[STATEMENT]
lemma desargues_config_3D_non_coplanar :
  assumes "desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma>"
  shows "rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>} \<ge> 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 4 \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}
[PROOF STEP]
have "rk {A, B, C, A', B', C'} \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B, C, A', B', C'} \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}
[PROOF STEP]
using matroid_ax_2
[PROOF STATE]
proof (prove)
using this:
?X \<subseteq> ?Y \<longrightarrow> rk ?X \<le> rk ?Y

goal (1 subgoal):
 1. rk {A, B, C, A', B', C'} \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rk {A, B, C, A', B', C'} \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}

goal (1 subgoal):
 1. 4 \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}
[PROOF STEP]
thus "4 \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}"
[PROOF STATE]
proof (prove)
using this:
rk {A, B, C, A', B', C'} \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}

goal (1 subgoal):
 1. 4 \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}
[PROOF STEP]
using matroid_ax_2 assms desargues_config_3D_def[of A B C A' B' C' P \<alpha> \<beta> \<gamma>]
[PROOF STATE]
proof (prove)
using this:
rk {A, B, C, A', B', C'} \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}
?X \<subseteq> ?Y \<longrightarrow> rk ?X \<le> rk ?Y
desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma>
desargues_config_3D A B C A' B' C' P \<alpha> \<beta> \<gamma> \<equiv> rk {A, B, C} = 3 \<and> rk {A', B', C'} = 3 \<and> rk {A, A', P} = 2 \<and> rk {B, B', P} = 2 \<and> rk {C, C', P} = 2 \<and> 4 \<le> rk {A, B, C, A', B', C'} \<and> rk {B, C, \<alpha>} = 2 \<and> rk {B', C', \<alpha>} = 2 \<and> rk {A, C, \<beta>} = 2 \<and> rk {A', C', \<beta>} = 2 \<and> rk {A, B, \<gamma>} = 2 \<and> rk {A', B', \<gamma>} = 2

goal (1 subgoal):
 1. 4 \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
4 \<le> rk {A, B, C, A', B', C', \<alpha>, \<beta>, \<gamma>}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sq_norm_poly_le_linf_norm:
  fixes p :: "'a :: {conjugatable_ring_1_abs_real_line} poly"
  shows "\<parallel>p\<parallel>\<^sup>2 \<le> of_nat (degree p + 1) * \<parallel>p\<parallel>\<^sub>\<infinity>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>p\<parallel>\<^sup>2 \<le> of_nat (degree p + 1) * \<parallel>p\<parallel>\<^sub>\<infinity>\<^sup>2
[PROOF STEP]
using sq_norm_vec_le_linf_norm[of "vec_of_poly p" "degree p + 1"]
[PROOF STATE]
proof (prove)
using this:
vec_of_poly p \<in> carrier_vec (degree p + 1) \<Longrightarrow> \<parallel>vec_of_poly p\<parallel>\<^sup>2 \<le> of_nat (degree p + 1) * \<parallel>vec_of_poly p\<parallel>\<^sub>\<infinity>\<^sup>2

goal (1 subgoal):
 1. \<parallel>p\<parallel>\<^sup>2 \<le> of_nat (degree p + 1) * \<parallel>p\<parallel>\<^sub>\<infinity>\<^sup>2
[PROOF STEP]
by (auto simp: carrier_dim_vec)


[STATEMENT]
theorem sums_eval_fps:
  fixes f :: "'a :: {banach, real_normed_div_algebra} fps"
  assumes "norm z < fps_conv_radius f"
  shows   "(\<lambda>n. fps_nth f n * z ^ n) sums eval_fps f z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. fps_nth f n * z ^ n) sums eval_fps f z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ereal (norm z) < fps_conv_radius f

goal (1 subgoal):
 1. (\<lambda>n. fps_nth f n * z ^ n) sums eval_fps f z
[PROOF STEP]
unfolding eval_fps_def fps_conv_radius_def
[PROOF STATE]
proof (prove)
using this:
ereal (norm z) < conv_radius (fps_nth f)

goal (1 subgoal):
 1. (\<lambda>n. fps_nth f n * z ^ n) sums (\<Sum>n. fps_nth f n * z ^ n)
[PROOF STEP]
by (intro summable_sums summable_in_conv_radius) simp_all


[STATEMENT]
lemma greatest_plus_one_eq_0:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}" and k::nat
  assumes "Suc (to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A)) = nrows A"
  shows "(GREATEST n. \<not> is_zero_row_upt_k n k A) + 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows) = (0::'rows)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows) = (0::'rows)
[PROOF STEP]
have "to_nat (GREATEST R. \<not> is_zero_row_upt_k R k A) + 1 = card (UNIV::'rows set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (GREATEST R. \<not> is_zero_row_upt_k R k A) + 1 = CARD('rows)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Suc (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A)) = nrows A

goal (1 subgoal):
 1. mod_type_class.to_nat (GREATEST R. \<not> is_zero_row_upt_k R k A) + 1 = CARD('rows)
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
using this:
Suc (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A)) = CARD('rows)

goal (1 subgoal):
 1. mod_type_class.to_nat (GREATEST R. \<not> is_zero_row_upt_k R k A) + 1 = CARD('rows)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (GREATEST R. \<not> is_zero_row_upt_k R k A) + 1 = CARD('rows)

goal (1 subgoal):
 1. (GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows) = (0::'rows)
[PROOF STEP]
thus "(GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows) = (0::'rows)"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat (GREATEST R. \<not> is_zero_row_upt_k R k A) + 1 = CARD('rows)

goal (1 subgoal):
 1. (GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows) = (0::'rows)
[PROOF STEP]
using to_nat_plus_one_less_card
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat (GREATEST R. \<not> is_zero_row_upt_k R k A) + 1 = CARD('rows)
\<forall>a. a + (1::?'a) \<noteq> (0::?'a) \<longrightarrow> mod_type_class.to_nat a + 1 < CARD(?'a)

goal (1 subgoal):
 1. (GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows) = (0::'rows)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows) = (0::'rows)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem sigma_algebra_Inter:
  "(\<And>i::nat. a i \<in> \<sigma>_algebra A) \<Longrightarrow> (\<Inter>i. a i) \<in> \<sigma>_algebra A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. a i \<in> \<sigma>_algebra A) \<Longrightarrow> \<Inter> (range a) \<in> \<sigma>_algebra A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>i. a i \<in> \<sigma>_algebra A) \<Longrightarrow> \<Inter> (range a) \<in> \<sigma>_algebra A
[PROOF STEP]
assume "\<And>i::nat. a i \<in> \<sigma>_algebra A"
[PROOF STATE]
proof (state)
this:
a ?i \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. (\<And>i. a i \<in> \<sigma>_algebra A) \<Longrightarrow> \<Inter> (range a) \<in> \<sigma>_algebra A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a ?i \<in> \<sigma>_algebra A
[PROOF STEP]
have "\<And>i::nat. -(a i) \<in> \<sigma>_algebra A"
[PROOF STATE]
proof (prove)
using this:
a ?i \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. \<And>i. - a i \<in> \<sigma>_algebra A
[PROOF STEP]
by (rule \<sigma>_algebra.complement)
[PROOF STATE]
proof (state)
this:
- a ?i \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. (\<And>i. a i \<in> \<sigma>_algebra A) \<Longrightarrow> \<Inter> (range a) \<in> \<sigma>_algebra A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- a ?i \<in> \<sigma>_algebra A
[PROOF STEP]
have "(\<Union>i. -(a i)) \<in> \<sigma>_algebra A"
[PROOF STATE]
proof (prove)
using this:
- a ?i \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. (\<Union>i. - a i) \<in> \<sigma>_algebra A
[PROOF STEP]
by (rule \<sigma>_algebra.Union)
[PROOF STATE]
proof (state)
this:
(\<Union>i. - a i) \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. (\<And>i. a i \<in> \<sigma>_algebra A) \<Longrightarrow> \<Inter> (range a) \<in> \<sigma>_algebra A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Union>i. - a i) \<in> \<sigma>_algebra A
[PROOF STEP]
have "-(\<Union>i. -(a i)) \<in> \<sigma>_algebra A"
[PROOF STATE]
proof (prove)
using this:
(\<Union>i. - a i) \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. - (\<Union>i. - a i) \<in> \<sigma>_algebra A
[PROOF STEP]
by (rule \<sigma>_algebra.complement)
[PROOF STATE]
proof (state)
this:
- (\<Union>i. - a i) \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. (\<And>i. a i \<in> \<sigma>_algebra A) \<Longrightarrow> \<Inter> (range a) \<in> \<sigma>_algebra A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- (\<Union>i. - a i) \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. (\<And>i. a i \<in> \<sigma>_algebra A) \<Longrightarrow> \<Inter> (range a) \<in> \<sigma>_algebra A
[PROOF STEP]
have "-(\<Union>i. -(a i)) = (\<Inter>i. a i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (\<Union>i. - a i) = \<Inter> (range a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- (\<Union>i. - a i) = \<Inter> (range a)

goal (1 subgoal):
 1. (\<And>i. a i \<in> \<sigma>_algebra A) \<Longrightarrow> \<Inter> (range a) \<in> \<sigma>_algebra A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Inter> (range a) \<in> \<sigma>_algebra A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Inter> (range a) \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. \<Inter> (range a) \<in> \<sigma>_algebra A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Inter> (range a) \<in> \<sigma>_algebra A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_integral_diff [simp, intro]:
  assumes "set_integrable M A f" "set_integrable M A g"
  shows "set_integrable M A (\<lambda>x. f x - g x)" and "LINT x:A|M. f x - g x =
    (LINT x:A|M. f x) - (LINT x:A|M. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable M A (\<lambda>x. f x - g x) &&& LINT x:A|M. f x - g x = set_lebesgue_integral M A f - set_lebesgue_integral M A g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set_integrable M A f
set_integrable M A g

goal (1 subgoal):
 1. set_integrable M A (\<lambda>x. f x - g x) &&& LINT x:A|M. f x - g x = set_lebesgue_integral M A f - set_lebesgue_integral M A g
[PROOF STEP]
unfolding set_integrable_def set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)
integrable M (\<lambda>x. indicat_real A x *\<^sub>R g x)

goal (1 subgoal):
 1. integrable M (\<lambda>x. indicat_real A x *\<^sub>R (f x - g x)) &&& LINT x|M. indicat_real A x *\<^sub>R (f x - g x) = (LINT x|M. indicat_real A x *\<^sub>R f x) - (LINT x|M. indicat_real A x *\<^sub>R g x)
[PROOF STEP]
by (simp_all add: scaleR_diff_right)


[STATEMENT]
theorem integer_compositions_card:
  "card (integer_compositions n) = 2^(n-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (integer_compositions n) = 2 ^ (n - 1)
[PROOF STEP]
using integer_composition_enum_correct integer_composition_enum_length
    integer_composition_enum_distinct distinct_card
[PROOF STATE]
proof (prove)
using this:
set (integer_composition_enum ?n) = integer_compositions ?n
length (integer_composition_enum ?n) = 2 ^ (?n - 1)
distinct (integer_composition_enum ?n)
distinct ?xs \<Longrightarrow> card (set ?xs) = length ?xs

goal (1 subgoal):
 1. card (integer_compositions n) = 2 ^ (n - 1)
[PROOF STEP]
by metis


[STATEMENT]
lemma div_less_imp_less_mult: "\<lbrakk> 0 < (m::nat); n div m < k \<rbrakk> \<Longrightarrow> n < k * m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; n div m < k\<rbrakk> \<Longrightarrow> n < k * m
[PROOF STEP]
apply (rule ccontr, simp only: linorder_not_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; n div m < k; k * m \<le> n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (drule div_le_mono[of _ _ m])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; n div m < k; k * m div m \<le> n div m\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem time_vebt_succ:
  fixes t defines "u \<equiv> 2^n"
  shows "invar_vebt t n \<Longrightarrow>   T\<^sub>s\<^sub>u\<^sub>c\<^sub>c t x \<le> 54 + 27 * lb (lb u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> real (T\<^sub>s\<^sub>u\<^sub>c\<^sub>c t x) \<le> 54 + 27 * log 2 (log 2 u)
[PROOF STEP]
using succ_bound_size_univ
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>invar_vebt ?t ?n; ?u = 2 ^ ?n\<rbrakk> \<Longrightarrow> real (T\<^sub>s\<^sub>u\<^sub>c\<^sub>c ?t ?x) \<le> 54 + 27 * log 2 (log 2 ?u)

goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> real (T\<^sub>s\<^sub>u\<^sub>c\<^sub>c t x) \<le> 54 + 27 * log 2 (log 2 u)
[PROOF STEP]
unfolding u_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>invar_vebt ?t ?n; ?u = 2 ^ ?n\<rbrakk> \<Longrightarrow> real (T\<^sub>s\<^sub>u\<^sub>c\<^sub>c ?t ?x) \<le> 54 + 27 * log 2 (log 2 ?u)

goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> real (T\<^sub>s\<^sub>u\<^sub>c\<^sub>c t x) \<le> 54 + 27 * log 2 (log 2 (2 ^ n))
[PROOF STEP]
by presburger


[STATEMENT]
lemma convergent_prod_inverse:
  assumes "convergent_prod f"
  shows "convergent_prod (\<lambda>n. inverse (f n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_prod (\<lambda>n. inverse (f n))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
convergent_prod f

goal (1 subgoal):
 1. convergent_prod (\<lambda>n. inverse (f n))
[PROOF STEP]
unfolding convergent_prod_def
[PROOF STATE]
proof (prove)
using this:
\<exists>M p. raw_has_prod f M p

goal (1 subgoal):
 1. \<exists>M p. raw_has_prod (\<lambda>n. inverse (f n)) M p
[PROOF STEP]
by (blast intro: raw_has_prod_inverse elim: )


[STATEMENT]
lemma Ivl4:
  "{0..<4::nat} = {0, 1, 2, 3}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<4} = {0, 1, 2, 3}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {0..<4} = {0, 1, 2, 3}
[PROOF STEP]
have "{0..<4::nat} = {0..<Suc (Suc (Suc (Suc 0)))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<4} = {0..<Suc (Suc (Suc (Suc 0)))}
[PROOF STEP]
by (simp add: eval_nat_numeral)
[PROOF STATE]
proof (state)
this:
{0..<4} = {0..<Suc (Suc (Suc (Suc 0)))}

goal (1 subgoal):
 1. {0..<4} = {0, 1, 2, 3}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{0..<4} = {0..<Suc (Suc (Suc (Suc 0)))}

goal (1 subgoal):
 1. {0..<4} = {0, 1, 2, 3}
[PROOF STEP]
have "... = {0, 1, 2, 3}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<Suc (Suc (Suc (Suc 0)))} = {0, 1, 2, 3}
[PROOF STEP]
by (simp add: atLeastLessThanSuc eval_nat_numeral insert_commute)
[PROOF STATE]
proof (state)
this:
{0..<Suc (Suc (Suc (Suc 0)))} = {0, 1, 2, 3}

goal (1 subgoal):
 1. {0..<4} = {0, 1, 2, 3}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
{0..<4} = {0, 1, 2, 3}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{0..<4} = {0, 1, 2, 3}

goal (1 subgoal):
 1. {0..<4} = {0, 1, 2, 3}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
{0..<4} = {0, 1, 2, 3}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card1:
  assumes "card A = 1"
  shows "\<exists>a. A = {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a. A = {a}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a. A = {a}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
card A = 1
[PROOF STEP]
obtain a where a: "a \<in> A"
[PROOF STATE]
proof (prove)
using this:
card A = 1

goal (1 subgoal):
 1. (\<And>a. a \<in> A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
a \<in> A

goal (1 subgoal):
 1. \<exists>a. A = {a}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
card A = 1
a \<in> A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card A = 1
a \<in> A

goal (1 subgoal):
 1. \<exists>a. A = {a}
[PROOF STEP]
using card_ge_0_finite[of A] card_subset_eq[of A "{a}"]
[PROOF STATE]
proof (prove)
using this:
card A = 1
a \<in> A
0 < card A \<Longrightarrow> finite A
\<lbrakk>finite A; {a} \<subseteq> A; card {a} = card A\<rbrakk> \<Longrightarrow> {a} = A

goal (1 subgoal):
 1. \<exists>a. A = {a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>a. A = {a}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma insert_into_member_list_equivalence:
  fixes new_el::'a
    and Sets::"'a set list"
    and S::"'a set"
  assumes "distinct Sets"
  shows "set (insert_into_member_list new_el Sets S) = insert_into_member new_el (set Sets) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (insert_into_member_list new_el Sets S) = insert_into_member new_el (set Sets) S
[PROOF STEP]
unfolding insert_into_member_list_def insert_into_member_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set ((S \<union> {new_el}) # remove1 S Sets) = insert (S \<union> {new_el}) (set Sets - {S})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct Sets

goal (1 subgoal):
 1. set ((S \<union> {new_el}) # remove1 S Sets) = insert (S \<union> {new_el}) (set Sets - {S})
[PROOF STEP]
by simp


[STATEMENT]
lemma  avl_height_upperbound:
  defines "\<phi> \<equiv> (1 + sqrt 5) / 2"
  assumes "avl t"
  shows   "height t \<le> (1/log 2 \<phi>) * log 2 (size1 t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))
[PROOF STEP]
have "\<phi> > 0" "\<phi> > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<phi> &&& 1 < \<phi>
[PROOF STEP]
by(auto simp: \<phi>_def pos_add_strict)
[PROOF STATE]
proof (state)
this:
0 < \<phi>
1 < \<phi>

goal (1 subgoal):
 1. real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))
[PROOF STEP]
hence "height t = log \<phi> (\<phi> ^ height t)"
[PROOF STATE]
proof (prove)
using this:
0 < \<phi>
1 < \<phi>

goal (1 subgoal):
 1. real (height t) = log \<phi> (\<phi> ^ height t)
[PROOF STEP]
by(simp add: log_nat_power)
[PROOF STATE]
proof (state)
this:
real (height t) = log \<phi> (\<phi> ^ height t)

goal (1 subgoal):
 1. real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (height t) = log \<phi> (\<phi> ^ height t)

goal (1 subgoal):
 1. real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))
[PROOF STEP]
have "\<dots> \<le> log \<phi> (size1 t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log \<phi> (\<phi> ^ height t) \<le> log \<phi> (real (size1 t))
[PROOF STEP]
using avl_size_lowerbound[OF assms(2), folded \<phi>_def] \<open>1 < \<phi>\<close>
[PROOF STATE]
proof (prove)
using this:
\<phi> ^ height t \<le> real (size1 t)
1 < \<phi>

goal (1 subgoal):
 1. log \<phi> (\<phi> ^ height t) \<le> log \<phi> (real (size1 t))
[PROOF STEP]
by (simp add: le_log_of_power)
[PROOF STATE]
proof (state)
this:
log \<phi> (\<phi> ^ height t) \<le> log \<phi> (real (size1 t))

goal (1 subgoal):
 1. real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
log \<phi> (\<phi> ^ height t) \<le> log \<phi> (real (size1 t))

goal (1 subgoal):
 1. real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))
[PROOF STEP]
have "\<dots> = (1/log 2 \<phi>) * log 2 (size1 t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log \<phi> (real (size1 t)) = 1 / log 2 \<phi> * log 2 (real (size1 t))
[PROOF STEP]
by(simp add: log_base_change[of 2 \<phi>])
[PROOF STATE]
proof (state)
this:
log \<phi> (real (size1 t)) = 1 / log 2 \<phi> * log 2 (real (size1 t))

goal (1 subgoal):
 1. real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))

goal (1 subgoal):
 1. real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (height t) \<le> 1 / log 2 \<phi> * log 2 (real (size1 t))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_all_bi_edges:
  assumes "finite X" "finite Y"
  assumes "X \<inter> Y = {}"
  shows "card (all_bi_edges X Y) = card X * card Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_bi_edges X Y) = card X * card Y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (all_bi_edges X Y) = card X * card Y
[PROOF STEP]
have "card (all_bi_edges X Y) = card (X \<times> Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_bi_edges X Y) = card (X \<times> Y)
[PROOF STEP]
unfolding all_bi_edges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (mk_edge ` (X \<times> Y)) = card (X \<times> Y)
[PROOF STEP]
using inj_on_mk_edge assms card_image
[PROOF STATE]
proof (prove)
using this:
?X \<inter> ?Y = {} \<Longrightarrow> inj_on mk_edge (?X \<times> ?Y)
finite X
finite Y
X \<inter> Y = {}
inj_on ?f ?A \<Longrightarrow> card (?f ` ?A) = card ?A

goal (1 subgoal):
 1. card (mk_edge ` (X \<times> Y)) = card (X \<times> Y)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (all_bi_edges X Y) = card (X \<times> Y)

goal (1 subgoal):
 1. card (all_bi_edges X Y) = card X * card Y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
card (all_bi_edges X Y) = card (X \<times> Y)

goal (1 subgoal):
 1. card (all_bi_edges X Y) = card X * card Y
[PROOF STEP]
using card_cartesian_product
[PROOF STATE]
proof (prove)
using this:
card (all_bi_edges X Y) = card (X \<times> Y)
card (?A \<times> ?B) = card ?A * card ?B

goal (1 subgoal):
 1. card (all_bi_edges X Y) = card X * card Y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (all_bi_edges X Y) = card X * card Y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ennreal_suminf_SUP_eq:
  fixes f :: "nat \<Rightarrow> nat \<Rightarrow> ennreal"
  shows "(\<And>i. incseq (\<lambda>n. f n i)) \<Longrightarrow> (\<Sum>i. SUP n. f n i) = (SUP n. \<Sum>i. f n i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. incseq (\<lambda>n. f n i)) \<Longrightarrow> (\<Sum>i. SUP n. f n i) = (SUP n. \<Sum>i. f n i)
[PROOF STEP]
apply (rule ennreal_suminf_SUP_eq_directed)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N n j. \<lbrakk>\<And>i. incseq (\<lambda>n. f n i); n \<in> UNIV; j \<in> UNIV; finite N\<rbrakk> \<Longrightarrow> \<exists>k\<in>UNIV. \<forall>i\<in>N. f n i \<le> f k i \<and> f j i \<le> f k i
[PROOF STEP]
subgoal for N n j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>i. incseq (\<lambda>n. f n i); n \<in> UNIV; j \<in> UNIV; finite N\<rbrakk> \<Longrightarrow> \<exists>k\<in>UNIV. \<forall>i\<in>N. f n i \<le> f k i \<and> f j i \<le> f k i
[PROOF STEP]
by (auto simp: incseq_def intro!:exI[of _ "max n j"])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_list_take_eq:
  fixes xs :: "nat list"
  shows "k < i \<Longrightarrow> i < length xs \<Longrightarrow> sum_list (take i xs) =
    sum_list (take k xs) + xs ! k + sum_list (take (i - Suc k) (drop (Suc k) xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k < i; i < length xs\<rbrakk> \<Longrightarrow> sum_list (take i xs) = sum_list (take k xs) + xs ! k + sum_list (take (i - Suc k) (drop (Suc k) xs))
[PROOF STEP]
by (subst id_take_nth_drop [of k]) (auto simp: min_def drop_take)


[STATEMENT]
lemma size_multiset_int_count:
  assumes "of_nat (card (set_mset A)) = (ca :: int)"
  assumes "\<And>p. p \<in># A \<Longrightarrow> of_nat (count A p) = (ca2 :: int)"
  shows "of_nat (size A) =  ((ca :: int) * ca2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (size A) = ca * ca2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (size A) = ca * ca2
[PROOF STEP]
have "size A = (\<Sum> p \<in> (set_mset A) . count A p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size A = sum (count A) (set_mset A)
[PROOF STEP]
using size_multiset_overloaded_eq
[PROOF STATE]
proof (prove)
using this:
size ?x = sum (count ?x) (set_mset ?x)

goal (1 subgoal):
 1. size A = sum (count A) (set_mset A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
size A = sum (count A) (set_mset A)

goal (1 subgoal):
 1. int (size A) = ca * ca2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
size A = sum (count A) (set_mset A)
[PROOF STEP]
have "of_nat (size A) = (\<Sum> p \<in> (set_mset A) . ca2)"
[PROOF STATE]
proof (prove)
using this:
size A = sum (count A) (set_mset A)

goal (1 subgoal):
 1. int (size A) = (\<Sum>p\<in>set_mset A. ca2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
size A = sum (count A) (set_mset A)
int (card (set_mset A)) = ca
?p \<in># A \<Longrightarrow> int (count A ?p) = ca2

goal (1 subgoal):
 1. int (size A) = (\<Sum>p\<in>set_mset A. ca2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (size A) = (\<Sum>p\<in>set_mset A. ca2)

goal (1 subgoal):
 1. int (size A) = ca * ca2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
int (size A) = (\<Sum>p\<in>set_mset A. ca2)

goal (1 subgoal):
 1. int (size A) = ca * ca2
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
int (size A) = (\<Sum>p\<in>set_mset A. ca2)
int (card (set_mset A)) = ca

goal (1 subgoal):
 1. int (size A) = ca * ca2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (size A) = ca * ca2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conjugate_transpose_rank:
  fixes A::"'a::{conjugatable_ordered_field} mat"
  shows "vec_space.rank (dim_row A) A = vec_space.rank (dim_col A) (A\<^sup>H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_space.rank (dim_row A) A = vec_space.rank (dim_col A) A\<^sup>H
[PROOF STEP]
using  conjugatable_vec_space.conjugate_transpose_rank_le
[PROOF STATE]
proof (prove)
using this:
?A \<in> carrier_mat ?n ?nc \<Longrightarrow> vec_space.rank ?nc ?A\<^sup>H \<le> vec_space.rank ?n ?A

goal (1 subgoal):
 1. vec_space.rank (dim_row A) A = vec_space.rank (dim_col A) A\<^sup>H
[PROOF STEP]
by (metis (no_types, lifting) Matrix.transpose_transpose carrier_matI conjugate_id dim_col_conjugate dual_order.antisym index_transpose_mat(2) transpose_conjugate)


[STATEMENT]
lemma scalar_prod_split_head: assumes
  "A \<in> carrier_mat n n" "B \<in> carrier_mat n n" "n > 0"
  shows "row A 0 \<bullet> col B 0 = A $$ (0,0) * B $$ (0,0) + (\<Sum>i = 1..<n. A $$ (0, i) * B $$ (i, 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row A 0 \<bullet> col B 0 = A $$ (0, 0) * B $$ (0, 0) + (\<Sum>i = 1..<n. A $$ (0, i) * B $$ (i, 0))
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (col B 0). row A 0 $ i * col B 0 $ i) = A $$ (0, 0) * B $$ (0, 0) + (\<Sum>i = 1..<n. A $$ (0, i) * B $$ (i, 0))
[PROOF STEP]
using assms sum.atLeast_Suc_lessThan
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
0 < n
?m < ?n \<Longrightarrow> sum ?g {?m..<?n} = ?g ?m + sum ?g {Suc ?m..<?n}

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (col B 0). row A 0 $ i * col B 0 $ i) = A $$ (0, 0) * B $$ (0, 0) + (\<Sum>i = 1..<n. A $$ (0, i) * B $$ (i, 0))
[PROOF STEP]
by auto


[STATEMENT]
lemma (in prob_space) variance_eq:
  fixes X :: "'a \<Rightarrow> real"
  assumes [simp]: "integrable M X"
  assumes [simp]: "integrable M (\<lambda>x. (X x)\<^sup>2)"
  shows "variance X = expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2
[PROOF STEP]
by (simp add: field_simps prob_space power2_diff power2_eq_square[symmetric])