[STATEMENT]
theorem discriminant_iff:
  fixes a b c x :: real
  assumes "a \<noteq> 0"
  shows "a * x\<^sup>2 + b * x + c = 0 \<longleftrightarrow>
    discrim a b c \<ge> 0 \<and>
    (x = (-b + sqrt (discrim a b c)) / (2 * a) \<or>
     x = (-b - sqrt (discrim a b c)) / (2 * a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * x\<^sup>2 + b * x + c = 0) = (0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a * x\<^sup>2 + b * x + c = 0 \<Longrightarrow> 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a))
 2. 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)) \<Longrightarrow> a * x\<^sup>2 + b * x + c = 0
[PROOF STEP]
assume "a * x\<^sup>2 + b * x + c = 0"
[PROOF STATE]
proof (state)
this:
a * x\<^sup>2 + b * x + c = 0

goal (2 subgoals):
 1. a * x\<^sup>2 + b * x + c = 0 \<Longrightarrow> 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a))
 2. 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)) \<Longrightarrow> a * x\<^sup>2 + b * x + c = 0
[PROOF STEP]
with discriminant_negative and \<open>a \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?a \<noteq> 0; discrim ?a ?b ?c < 0\<rbrakk> \<Longrightarrow> ?a * ?x\<^sup>2 + ?b * ?x + ?c \<noteq> 0
a \<noteq> 0
a * x\<^sup>2 + b * x + c = 0
[PROOF STEP]
have "\<not>(discrim a b c < 0)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<noteq> 0; discrim ?a ?b ?c < 0\<rbrakk> \<Longrightarrow> ?a * ?x\<^sup>2 + ?b * ?x + ?c \<noteq> 0
a \<noteq> 0
a * x\<^sup>2 + b * x + c = 0

goal (1 subgoal):
 1. \<not> discrim a b c < 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> discrim a b c < 0

goal (2 subgoals):
 1. a * x\<^sup>2 + b * x + c = 0 \<Longrightarrow> 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a))
 2. 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)) \<Longrightarrow> a * x\<^sup>2 + b * x + c = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> discrim a b c < 0
[PROOF STEP]
have "discrim a b c \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> discrim a b c < 0

goal (1 subgoal):
 1. 0 \<le> discrim a b c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> discrim a b c

goal (2 subgoals):
 1. a * x\<^sup>2 + b * x + c = 0 \<Longrightarrow> 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a))
 2. 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)) \<Longrightarrow> a * x\<^sup>2 + b * x + c = 0
[PROOF STEP]
with discriminant_nonneg and \<open>a * x\<^sup>2 + b * x + c = 0\<close> and \<open>a \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?a \<noteq> 0; 0 \<le> discrim ?a ?b ?c\<rbrakk> \<Longrightarrow> (?a * ?x\<^sup>2 + ?b * ?x + ?c = 0) = (?x = (- ?b + sqrt (discrim ?a ?b ?c)) / (2 * ?a) \<or> ?x = (- ?b - sqrt (discrim ?a ?b ?c)) / (2 * ?a))
a * x\<^sup>2 + b * x + c = 0
a \<noteq> 0
0 \<le> discrim a b c
[PROOF STEP]
have "x = (-b + sqrt (discrim a b c)) / (2 * a) \<or>
      x = (-b - sqrt (discrim a b c)) / (2 * a)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<noteq> 0; 0 \<le> discrim ?a ?b ?c\<rbrakk> \<Longrightarrow> (?a * ?x\<^sup>2 + ?b * ?x + ?c = 0) = (?x = (- ?b + sqrt (discrim ?a ?b ?c)) / (2 * ?a) \<or> ?x = (- ?b - sqrt (discrim ?a ?b ?c)) / (2 * ?a))
a * x\<^sup>2 + b * x + c = 0
a \<noteq> 0
0 \<le> discrim a b c

goal (1 subgoal):
 1. x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)

goal (2 subgoals):
 1. a * x\<^sup>2 + b * x + c = 0 \<Longrightarrow> 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a))
 2. 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)) \<Longrightarrow> a * x\<^sup>2 + b * x + c = 0
[PROOF STEP]
with \<open>discrim a b c \<ge> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 \<le> discrim a b c
x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)
[PROOF STEP]
show "discrim a b c \<ge> 0 \<and>
    (x = (-b + sqrt (discrim a b c)) / (2 * a) \<or>
     x = (-b - sqrt (discrim a b c)) / (2 * a))"
[PROOF STATE]
proof (prove)
using this:
0 \<le> discrim a b c
x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)

goal (1 subgoal):
 1. 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a))

goal (1 subgoal):
 1. 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)) \<Longrightarrow> a * x\<^sup>2 + b * x + c = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)) \<Longrightarrow> a * x\<^sup>2 + b * x + c = 0
[PROOF STEP]
assume "discrim a b c \<ge> 0 \<and>
    (x = (-b + sqrt (discrim a b c)) / (2 * a) \<or>
     x = (-b - sqrt (discrim a b c)) / (2 * a))"
[PROOF STATE]
proof (state)
this:
0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a))

goal (1 subgoal):
 1. 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)) \<Longrightarrow> a * x\<^sup>2 + b * x + c = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a))
[PROOF STEP]
have "discrim a b c \<ge> 0" and
    "x = (-b + sqrt (discrim a b c)) / (2 * a) \<or>
     x = (-b - sqrt (discrim a b c)) / (2 * a)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a))

goal (1 subgoal):
 1. 0 \<le> discrim a b c &&& x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 \<le> discrim a b c
x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)

goal (1 subgoal):
 1. 0 \<le> discrim a b c \<and> (x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)) \<Longrightarrow> a * x\<^sup>2 + b * x + c = 0
[PROOF STEP]
with discriminant_nonneg and \<open>a \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?a \<noteq> 0; 0 \<le> discrim ?a ?b ?c\<rbrakk> \<Longrightarrow> (?a * ?x\<^sup>2 + ?b * ?x + ?c = 0) = (?x = (- ?b + sqrt (discrim ?a ?b ?c)) / (2 * ?a) \<or> ?x = (- ?b - sqrt (discrim ?a ?b ?c)) / (2 * ?a))
a \<noteq> 0
0 \<le> discrim a b c
x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)
[PROOF STEP]
show "a * x\<^sup>2 + b * x + c = 0"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<noteq> 0; 0 \<le> discrim ?a ?b ?c\<rbrakk> \<Longrightarrow> (?a * ?x\<^sup>2 + ?b * ?x + ?c = 0) = (?x = (- ?b + sqrt (discrim ?a ?b ?c)) / (2 * ?a) \<or> ?x = (- ?b - sqrt (discrim ?a ?b ?c)) / (2 * ?a))
a \<noteq> 0
0 \<le> discrim a b c
x = (- b + sqrt (discrim a b c)) / (2 * a) \<or> x = (- b - sqrt (discrim a b c)) / (2 * a)

goal (1 subgoal):
 1. a * x\<^sup>2 + b * x + c = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a * x\<^sup>2 + b * x + c = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Gromov_product_commute:
  "Gromov_product_at e x y = Gromov_product_at e y x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_product_at e x y = Gromov_product_at e y x
[PROOF STEP]
unfolding Gromov_product_at_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist e x + dist e y - dist x y) / 2 = (dist e y + dist e x - dist y x) / 2
[PROOF STEP]
by (auto simp add: dist_commute)


[STATEMENT]
lemma X_minus_sub_deg:
  assumes "a \<in> carrier R"
  assumes "f \<in> carrier P"
  shows "degree (f of (X_minus a)) = degree f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg R (Cring_Poly.compose R f (X_poly_minus R a)) = deg R f
[PROOF STEP]
using X_plus_sub_deg[of "\<ominus>a"] assms X_minus_plus[of a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<ominus> a \<in> carrier R; ?f \<in> carrier P\<rbrakk> \<Longrightarrow> deg R (Cring_Poly.compose R ?f (X_poly_plus R (\<ominus> a))) = deg R ?f
a \<in> carrier R
f \<in> carrier P
a \<in> carrier R \<Longrightarrow> X_poly_minus R a = X_poly_plus R (\<ominus> a)

goal (1 subgoal):
 1. deg R (Cring_Poly.compose R f (X_poly_minus R a)) = deg R f
[PROOF STEP]
by simp


[STATEMENT]
lemma ordinal_of_hmset_1[simp]: "ordinal_of_hmset 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinal_of_hmset 1 = 1
[PROOF STEP]
using ordinal_of_hmset_suc[of 0]
[PROOF STATE]
proof (prove)
using this:
ordinal_of_hmset (0 + 1) = ordinal_of_hmset 0 + 1

goal (1 subgoal):
 1. ordinal_of_hmset 1 = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma (in ring) subalgebra_inter:
  assumes "subalgebra K V R" and "subalgebra K V' R" shows "subalgebra K (V \<inter> V') R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subalgebra K (V \<inter> V') R
[PROOF STEP]
using add.subgroups_Inter_pair assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subgroup ?I (add_monoid R); subgroup ?J (add_monoid R)\<rbrakk> \<Longrightarrow> subgroup (?I \<inter> ?J) (add_monoid R)
subalgebra K V R
subalgebra K V' R

goal (1 subgoal):
 1. subalgebra K (V \<inter> V') R
[PROOF STEP]
unfolding subalgebra_def subalgebra_axioms_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subgroup ?I (add_monoid R); subgroup ?J (add_monoid R)\<rbrakk> \<Longrightarrow> subgroup (?I \<inter> ?J) (add_monoid R)
subgroup V (add_monoid R) \<and> (\<forall>k v. k \<in> K \<longrightarrow> v \<in> V \<longrightarrow> k \<otimes> v \<in> V)
subgroup V' (add_monoid R) \<and> (\<forall>k v. k \<in> K \<longrightarrow> v \<in> V' \<longrightarrow> k \<otimes> v \<in> V')

goal (1 subgoal):
 1. subgroup (V \<inter> V') (add_monoid R) \<and> (\<forall>k v. k \<in> K \<longrightarrow> v \<in> V \<inter> V' \<longrightarrow> k \<otimes> v \<in> V \<inter> V')
[PROOF STEP]
by auto


[STATEMENT]
lemma card_of_set_type[simp]: "|UNIV::'a set| <o |UNIV::'a set set|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |UNIV| <o |UNIV|
[PROOF STEP]
using card_of_Pow[of "UNIV::'a set"]
[PROOF STATE]
proof (prove)
using this:
|UNIV| <o |Pow UNIV|

goal (1 subgoal):
 1. |UNIV| <o |UNIV|
[PROOF STEP]
by simp


[STATEMENT]
lemma nset_Tr51:"\<lbrakk>j \<in> nset (Suc 0) (Suc (Suc n)); j \<noteq> Suc 0\<rbrakk>
       \<Longrightarrow> j - Suc 0 \<in> nset (Suc 0) (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j \<in> nset (Suc 0) (Suc (Suc n)); j \<noteq> Suc 0\<rbrakk> \<Longrightarrow> j - Suc 0 \<in> nset (Suc 0) (Suc n)
[PROOF STEP]
apply (simp add:nset_def, (erule conjE)+,
       frule_tac m = j and n = "Suc (Suc n)" and l = "Suc 0" in diff_le_mono,
       simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in group) setmult_lcos_assoc:
     "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G\<rbrakk>
      \<Longrightarrow> (x <# H) <#> K = x <# (H <#> K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G\<rbrakk> \<Longrightarrow> x <# H <#> K = x <# (H <#> K)
[PROOF STEP]
by (force simp add: l_coset_def set_mult_def m_assoc)


[STATEMENT]
lemma floor_log_nat_eq_if: fixes b n k :: nat
  assumes "b^n \<le> k" "k < b^(n+1)" "b \<ge> 2"
  shows "floor (log b (real k)) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log (real b) (real k)\<rfloor> = int n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lfloor>log (real b) (real k)\<rfloor> = int n
[PROOF STEP]
have "k \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> k
[PROOF STEP]
using assms(1,3) one_le_power[of b n]
[PROOF STATE]
proof (prove)
using this:
b ^ n \<le> k
2 \<le> b
1 \<le> b \<Longrightarrow> 1 \<le> b ^ n

goal (1 subgoal):
 1. 1 \<le> k
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
1 \<le> k

goal (1 subgoal):
 1. \<lfloor>log (real b) (real k)\<rfloor> = int n
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
b ^ n \<le> k
k < b ^ (n + 1)
2 \<le> b
1 \<le> k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b ^ n \<le> k
k < b ^ (n + 1)
2 \<le> b
1 \<le> k

goal (1 subgoal):
 1. \<lfloor>log (real b) (real k)\<rfloor> = int n
[PROOF STEP]
by(simp add: floor_log_nat_eq_powr_iff)
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real k)\<rfloor> = int n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma graphIntersection:
  "graph (X \<inter> Y) f \<subseteq> ((graph X f) || Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph (X \<inter> Y) f \<subseteq> graph X f || Y
[PROOF STEP]
unfolding graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, f x) |x. x \<in> X \<inter> Y} \<subseteq> {(x, f x) |x. x \<in> X} || Y
[PROOF STEP]
using Int_iff mem_Collect_eq RelationOperators.restrict_ext subrelI
[PROOF STATE]
proof (prove)
using this:
(?c \<in> ?A \<inter> ?B) = (?c \<in> ?A \<and> ?c \<in> ?B)
(?a \<in> Collect ?P) = ?P ?a
?R || ?X = {(x, y) |x y. x \<in> ?X \<and> (x, y) \<in> ?R}
(\<And>x y. (x, y) \<in> ?r \<Longrightarrow> (x, y) \<in> ?s) \<Longrightarrow> ?r \<subseteq> ?s

goal (1 subgoal):
 1. {(x, f x) |x. x \<in> X \<inter> Y} \<subseteq> {(x, f x) |x. x \<in> X} || Y
[PROOF STEP]
by auto


[STATEMENT]
lemma set_decode_Suc [simp]: "Suc n \<in> set_decode x \<longleftrightarrow> n \<in> set_decode (x div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Suc n \<in> set_decode x) = (n \<in> set_decode (x div 2))
[PROOF STEP]
by (simp add: set_decode_def div_mult2_eq)


[STATEMENT]
lemma suminf_diff: "summable f \<Longrightarrow> summable g \<Longrightarrow> suminf f - suminf g = (\<Sum>n. f n - g n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>summable f; summable g\<rbrakk> \<Longrightarrow> suminf f - suminf g = (\<Sum>n. f n - g n)
[PROOF STEP]
by (intro sums_unique sums_diff summable_sums)


[STATEMENT]
lemma times_ms_aux_MSLCons: "times_ms_aux (MSLCons x xs) (MSLCons y ys) =
  MSLCons (fst x * fst y, snd x + snd y) (plus_ms_aux (scale_shift_ms_aux x ys)
       (times_ms_aux xs (MSLCons y ys)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. times_ms_aux (MSLCons x xs) (MSLCons y ys) = MSLCons (fst x * fst y, snd x + snd y) (plus_ms_aux (scale_shift_ms_aux x ys) (times_ms_aux xs (MSLCons y ys)))
[PROOF STEP]
by (subst times_ms_aux_altdef) simp


[STATEMENT]
lemma list_prod_divmod_eq: "List.product [0..<M] [0..<N] = map (\<lambda>i. (i div N, i mod N)) [0..<N*M]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List.product [0..<M] [0..<N] = map (\<lambda>i. (i div N, i mod N)) [0..<N * M]
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. List.product [0..<M] [0..<N] = map (\<lambda>i. (i div N, i mod N)) [0..<N * M]
[PROOF STEP]
have [simp]: "i < m*n \<Longrightarrow> (i::nat) div n < m" for i m n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < m * n \<Longrightarrow> i div n < m
[PROOF STEP]
by (metis mult.commute div_eq_0_iff div_mult2_eq gr_implies_not_zero mult_not_zero)
[PROOF STATE]
proof (state)
this:
?i < ?m * ?n \<Longrightarrow> ?i div ?n < ?m

goal (1 subgoal):
 1. List.product [0..<M] [0..<N] = map (\<lambda>i. (i div N, i mod N)) [0..<N * M]
[PROOF STEP]
have [simp]: "i<N*M \<Longrightarrow> N>0 \<and> M>0" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < N * M \<Longrightarrow> 0 < N \<and> 0 < M
[PROOF STEP]
by (cases N; cases M; auto)
[PROOF STATE]
proof (state)
this:
?i < N * M \<Longrightarrow> 0 < N \<and> 0 < M

goal (1 subgoal):
 1. List.product [0..<M] [0..<N] = map (\<lambda>i. (i div N, i mod N)) [0..<N * M]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List.product [0..<M] [0..<N] = map (\<lambda>i. (i div N, i mod N)) [0..<N * M]
[PROOF STEP]
by (rule nth_equalityI) (auto simp add: product_nth algebra_simps)
[PROOF STATE]
proof (state)
this:
List.product [0..<M] [0..<N] = map (\<lambda>i. (i div N, i mod N)) [0..<N * M]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in cof_vec_space) gram_schmidt_sub0_result:
  assumes "gram_schmidt_sub0 n us ws = us'"
    and "set ws \<subseteq> carrier_vec n"
    and "set us \<subseteq> carrier_vec n"
    and "distinct us"
    and "~ lin_dep (set us)"
    and "corthogonal us"
  shows "set us' \<subseteq> carrier_vec n \<and>
         distinct us' \<and>
         corthogonal us' \<and>
         span (set (us @ ws)) = span (set us')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
gram_schmidt_sub0 n us ws = us'
set ws \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (1 subgoal):
 1. set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us')
[PROOF STEP]
proof (induct ws arbitrary: us us')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub0 n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct us; lin_indpt (set us); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us')
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub0 n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct us; lin_indpt (set us); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us'); gram_schmidt_sub0 n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct us; lin_indpt (set us); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us')
[PROOF STEP]
case (Cons w ws)
[PROOF STATE]
proof (state)
this:
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (2 subgoals):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub0 n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct us; lin_indpt (set us); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us')
 2. \<And>a ws us us'. \<lbrakk>\<And>us us'. \<lbrakk>gram_schmidt_sub0 n us ws = us'; set ws \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct us; lin_indpt (set us); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ ws)) = local.span (set us'); gram_schmidt_sub0 n us (a # ws) = us'; set (a # ws) \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct us; lin_indpt (set us); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ a # ws)) = local.span (set us')
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
proof (cases "w \<in> span (set us)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
w \<notin> local.span (set us)

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
let ?v = "adjuster n w us"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have wW[simp]: "set (w#ws) \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (w # ws) \<subseteq> carrier_vec n
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (1 subgoal):
 1. set (w # ws) \<subseteq> carrier_vec n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (w # ws) \<subseteq> carrier_vec n

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
hence W[simp]: "set ws \<subseteq> carrier_vec n"
      and w[simp]: "w : carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
set (w # ws) \<subseteq> carrier_vec n

goal (1 subgoal):
 1. set ws \<subseteq> carrier_vec n &&& w \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set ws \<subseteq> carrier_vec n
w \<in> carrier_vec n

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have U[simp]: "set us \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set us \<subseteq> carrier_vec n
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (1 subgoal):
 1. set us \<subseteq> carrier_vec n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set us \<subseteq> carrier_vec n

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have UW: "set (us@ws) \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (us @ ws) \<subseteq> carrier_vec n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (us @ ws) \<subseteq> carrier_vec n

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have wU: "set (w#us) \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (w # us) \<subseteq> carrier_vec n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (w # us) \<subseteq> carrier_vec n

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have dist_U: "distinct us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct us
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (1 subgoal):
 1. distinct us
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct us

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have w_U: "w \<notin> set us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<notin> set us
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
w \<notin> local.span (set us)

goal (1 subgoal):
 1. w \<notin> set us
[PROOF STEP]
using span_mem
[PROOF STATE]
proof (prove)
using this:
w \<notin> local.span (set us)
\<lbrakk>?E \<subseteq> carrier_vec n; ?u \<in> ?E\<rbrakk> \<Longrightarrow> ?u \<in> local.span ?E

goal (1 subgoal):
 1. w \<notin> set us
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<notin> set us

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have ind_U: "~ lin_dep (set us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt (set us)
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (1 subgoal):
 1. lin_indpt (set us)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lin_indpt (set us)

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have ind_wU: "~ lin_dep (insert w (set us))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt (insert w (set us))
[PROOF STEP]
apply (subst lin_dep_iff_in_span[simplified, symmetric])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. set us \<subseteq> carrier_vec n
 2. lin_indpt (set us)
 3. w \<in> carrier_vec n
 4. w \<notin> set us
 5. w \<notin> local.span (set us)
[PROOF STEP]
using w_U ind_U False
[PROOF STATE]
proof (prove)
using this:
w \<notin> set us
lin_indpt (set us)
w \<notin> local.span (set us)

goal (5 subgoals):
 1. set us \<subseteq> carrier_vec n
 2. lin_indpt (set us)
 3. w \<in> carrier_vec n
 4. w \<notin> set us
 5. w \<notin> local.span (set us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lin_indpt (insert w (set us))

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
thm lin_dep_iff_in_span[simplified, symmetric]
[PROOF STATE]
proof (state)
this:
lin_indpt (insert w (set us))

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have corth: "corthogonal us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. corthogonal us
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (1 subgoal):
 1. corthogonal us
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
corthogonal us

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have "?v + w \<noteq> 0\<^sub>v n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjuster n w us + w \<noteq> 0\<^sub>v n
[PROOF STEP]
by (simp add: False adjust_nonzero dist_U)
[PROOF STATE]
proof (state)
this:
adjuster n w us + w \<noteq> 0\<^sub>v n

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
hence "\<not> vec_is_zero n (?v + w)"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us + w \<noteq> 0\<^sub>v n

goal (1 subgoal):
 1. \<not> vec_is_zero n (adjuster n w us + w)
[PROOF STEP]
by (simp add: vec_is_zero)
[PROOF STATE]
proof (state)
this:
\<not> vec_is_zero n (adjuster n w us + w)

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
hence U'def: "gram_schmidt_sub0 n ((?v + w)#us) ws = us'"
[PROOF STATE]
proof (prove)
using this:
\<not> vec_is_zero n (adjuster n w us + w)

goal (1 subgoal):
 1. gram_schmidt_sub0 n ((adjuster n w us + w) # us) ws = us'
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<not> vec_is_zero n (adjuster n w us + w)
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (1 subgoal):
 1. gram_schmidt_sub0 n ((adjuster n w us + w) # us) ws = us'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gram_schmidt_sub0 n ((adjuster n w us + w) # us) ws = us'

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have v: "?v : carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjuster n w us \<in> carrier_vec n
[PROOF STEP]
using dist_U
[PROOF STATE]
proof (prove)
using this:
distinct us

goal (1 subgoal):
 1. adjuster n w us \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us \<in> carrier_vec n

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
hence vw: "?v + w : carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us \<in> carrier_vec n

goal (1 subgoal):
 1. adjuster n w us + w \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us + w \<in> carrier_vec n

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
hence vwU: "set ((?v + w) # us) \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us + w \<in> carrier_vec n

goal (1 subgoal):
 1. set ((adjuster n w us + w) # us) \<subseteq> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set ((adjuster n w us + w) # us) \<subseteq> carrier_vec n

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have vsU: "?v : span (set us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjuster n w us \<in> local.span (set us)
[PROOF STEP]
apply (rule adjuster_in_span[OF w])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. set us \<subseteq> carrier_vec n
 2. distinct us
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (2 subgoals):
 1. set us \<subseteq> carrier_vec n
 2. distinct us
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
adjuster n w us \<in> local.span (set us)

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
hence vsUW: "?v : span (set (us @ ws))"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us \<in> local.span (set us)

goal (1 subgoal):
 1. adjuster n w us \<in> local.span (set (us @ ws))
[PROOF STEP]
using span_is_monotone[of "set us" "set (us@ws)"]
[PROOF STATE]
proof (prove)
using this:
adjuster n w us \<in> local.span (set us)
set us \<subseteq> set (us @ ws) \<Longrightarrow> local.span (set us) \<subseteq> local.span (set (us @ ws))

goal (1 subgoal):
 1. adjuster n w us \<in> local.span (set (us @ ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us \<in> local.span (set (us @ ws))

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have wsU: "w \<notin> span (set us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<notin> local.span (set us)
[PROOF STEP]
using lin_dep_iff_in_span[OF U ind_U w w_U] ind_wU
[PROOF STATE]
proof (prove)
using this:
(w \<in> local.span (set us)) = lin_dep (set us \<union> {w})
lin_indpt (insert w (set us))

goal (1 subgoal):
 1. w \<notin> local.span (set us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<notin> local.span (set us)

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
hence vwU: "?v + w \<notin> span (set us)"
[PROOF STATE]
proof (prove)
using this:
w \<notin> local.span (set us)

goal (1 subgoal):
 1. adjuster n w us + w \<notin> local.span (set us)
[PROOF STEP]
using adjust_not_in_span[OF w U dist_U]
[PROOF STATE]
proof (prove)
using this:
w \<notin> local.span (set us)
w \<notin> local.span (set us) \<Longrightarrow> adjuster n w us + w \<notin> local.span (set us)

goal (1 subgoal):
 1. adjuster n w us + w \<notin> local.span (set us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us + w \<notin> local.span (set us)

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have span: "?v + w \<notin> span (set us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjuster n w us + w \<notin> local.span (set us)
[PROOF STEP]
apply (subst span_add[symmetric])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. set us \<subseteq> carrier_vec n
 2. adjuster n w us \<in> local.span (set us)
 3. w \<in> carrier_vec n
 4. w \<notin> local.span (set us)
[PROOF STEP]
by (simp_all add: False vsU)
[PROOF STATE]
proof (state)
this:
adjuster n w us + w \<notin> local.span (set us)

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
hence vwUS: "?v + w \<notin> set us"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us + w \<notin> local.span (set us)

goal (1 subgoal):
 1. adjuster n w us + w \<notin> set us
[PROOF STEP]
using span_mem
[PROOF STATE]
proof (prove)
using this:
adjuster n w us + w \<notin> local.span (set us)
\<lbrakk>?E \<subseteq> carrier_vec n; ?u \<in> ?E\<rbrakk> \<Longrightarrow> ?u \<in> local.span ?E

goal (1 subgoal):
 1. adjuster n w us + w \<notin> set us
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us + w \<notin> set us

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have vwU: "set ((?v + w) # us) \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set ((adjuster n w us + w) # us) \<subseteq> carrier_vec n
[PROOF STEP]
using U w vw
[PROOF STATE]
proof (prove)
using this:
set us \<subseteq> carrier_vec n
w \<in> carrier_vec n
adjuster n w us + w \<in> carrier_vec n

goal (1 subgoal):
 1. set ((adjuster n w us + w) # us) \<subseteq> carrier_vec n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set ((adjuster n w us + w) # us) \<subseteq> carrier_vec n

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have dist2: "distinct (((?v + w) # us))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct ((adjuster n w us + w) # us)
[PROOF STEP]
using vwUS
[PROOF STATE]
proof (prove)
using this:
adjuster n w us + w \<notin> set us

goal (1 subgoal):
 1. distinct ((adjuster n w us + w) # us)
[PROOF STEP]
by (simp add: dist_U)
[PROOF STATE]
proof (state)
this:
distinct ((adjuster n w us + w) # us)

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have orth2: "corthogonal ((adjuster n w us + w) # us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. corthogonal ((adjuster n w us + w) # us)
[PROOF STEP]
using adjust_orthogonal[OF U corth w wsU]
[PROOF STATE]
proof (prove)
using this:
corthogonal ((adjuster n w us + w) # us)

goal (1 subgoal):
 1. corthogonal ((adjuster n w us + w) # us)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
corthogonal ((adjuster n w us + w) # us)

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have ind_vwU: "~ lin_dep (set ((adjuster n w us + w) # us))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt (set ((adjuster n w us + w) # us))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt (insert (adjuster n w us + w) (set us))
[PROOF STEP]
apply (subst lin_dep_iff_in_span[simplified, symmetric])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. set us \<subseteq> carrier_vec n
 2. lin_indpt (set us)
 3. adjuster n w us + w \<in> carrier_vec n
 4. adjuster n w us + w \<notin> set us
 5. adjuster n w us + w \<notin> local.span (set us)
[PROOF STEP]
by (simp_all add: ind_U vw vwUS span)
[PROOF STATE]
proof (state)
this:
lin_indpt (set ((adjuster n w us + w) # us))

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have span_UwW_U': "span (set (us @ w # ws)) = span (set us')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
using Cons(1)[OF U'def W vwU dist2 ind_vwU orth2]
[PROOF STATE]
proof (prove)
using this:
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (((adjuster n w us + w) # us) @ ws)) = local.span (set us')

goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
using span_Un[OF vwU wU gram_schmidt_sub_span[OF w U dist_U] W W refl]
[PROOF STATE]
proof (prove)
using this:
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (((adjuster n w us + w) # us) @ ws)) = local.span (set us')
local.span (set ((adjuster n w us + w) # us) \<union> set ws) = local.span (set (w # us) \<union> set ws)

goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.span (set (us @ w # ws)) = local.span (set us')

goal (2 subgoals):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
 2. w \<notin> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
apply (intro conjI)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. set us' \<subseteq> carrier_vec n
 2. distinct us'
 3. corthogonal us'
 4. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
using Cons(1)[OF U'def W vwU dist2 ind_vwU orth2] span_UwW_U'
[PROOF STATE]
proof (prove)
using this:
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (((adjuster n w us + w) # us) @ ws)) = local.span (set us')
local.span (set (us @ w # ws)) = local.span (set us')

goal (4 subgoals):
 1. set us' \<subseteq> carrier_vec n
 2. distinct us'
 3. corthogonal us'
 4. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')

goal (1 subgoal):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
w \<in> local.span (set us)

goal (1 subgoal):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
let ?v = "adjuster n w us"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have "?v + w = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjuster n w us + w = 0\<^sub>v n
[PROOF STEP]
apply (rule adjuster_already_in_span)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. w \<in> carrier_vec n
 2. set us \<subseteq> carrier_vec n
 3. corthogonal us
 4. w \<in> local.span (set us)
[PROOF STEP]
using True Cons
[PROOF STATE]
proof (prove)
using this:
w \<in> local.span (set us)
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (4 subgoals):
 1. w \<in> carrier_vec n
 2. set us \<subseteq> carrier_vec n
 3. corthogonal us
 4. w \<in> local.span (set us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjuster n w us + w = 0\<^sub>v n

goal (1 subgoal):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
hence "vec_is_zero n (?v + w)"
[PROOF STATE]
proof (prove)
using this:
adjuster n w us + w = 0\<^sub>v n

goal (1 subgoal):
 1. vec_is_zero n (adjuster n w us + w)
[PROOF STEP]
by (simp add: vec_is_zero)
[PROOF STATE]
proof (state)
this:
vec_is_zero n (adjuster n w us + w)

goal (1 subgoal):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
hence U'_def: "us' = gram_schmidt_sub0 n us ws"
[PROOF STATE]
proof (prove)
using this:
vec_is_zero n (adjuster n w us + w)

goal (1 subgoal):
 1. us' = gram_schmidt_sub0 n us ws
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
vec_is_zero n (adjuster n w us + w)
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (1 subgoal):
 1. us' = gram_schmidt_sub0 n us ws
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
us' = gram_schmidt_sub0 n us ws

goal (1 subgoal):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have span: "span (set (us @ w # ws)) = span (set us')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have wU_U: "span (set (w # us)) = span (set us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (set (w # us)) = local.span (set us)
[PROOF STEP]
apply (subst already_in_span[OF _ True, simplified])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. set us \<subseteq> carrier_vec n
 2. local.span (set (w # us)) = local.span (insert w (set us))
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (2 subgoals):
 1. set us \<subseteq> carrier_vec n
 2. local.span (set (w # us)) = local.span (insert w (set us))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.span (set (w # us)) = local.span (set us)

goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have "span (set (us @ w # ws)) = span (set (w # us) \<union> set ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set (w # us) \<union> set ws)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.span (set (us @ w # ws)) = local.span (set (w # us) \<union> set ws)

goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.span (set (us @ w # ws)) = local.span (set (w # us) \<union> set ws)

goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have "\<dots> = span (set us \<union> set ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (set (w # us) \<union> set ws) = local.span (set us \<union> set ws)
[PROOF STEP]
apply (rule span_Un)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. set (w # us) \<subseteq> carrier_vec n
 2. set us \<subseteq> carrier_vec n
 3. local.span (set (w # us)) = local.span (set us)
 4. set ws \<subseteq> carrier_vec n
 5. set ws \<subseteq> carrier_vec n
 6. local.span (set ws) = local.span (set ws)
[PROOF STEP]
using wU_U Cons
[PROOF STATE]
proof (prove)
using this:
local.span (set (w # us)) = local.span (set us)
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (6 subgoals):
 1. set (w # us) \<subseteq> carrier_vec n
 2. set us \<subseteq> carrier_vec n
 3. local.span (set (w # us)) = local.span (set us)
 4. set ws \<subseteq> carrier_vec n
 5. set ws \<subseteq> carrier_vec n
 6. local.span (set ws) = local.span (set ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.span (set (w # us) \<union> set ws) = local.span (set us \<union> set ws)

goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.span (set (w # us) \<union> set ws) = local.span (set us \<union> set ws)

goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have "\<dots> = local.span (set us')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (set us \<union> set ws) = local.span (set us')
[PROOF STEP]
using Cons U'_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us
us' = gram_schmidt_sub0 n us ws

goal (1 subgoal):
 1. local.span (set us \<union> set ws) = local.span (set us')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.span (set us \<union> set ws) = local.span (set us')

goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.span (set (us @ w # ws)) = local.span (set us')

goal (1 subgoal):
 1. local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
by -
[PROOF STATE]
proof (state)
this:
local.span (set (us @ w # ws)) = local.span (set us')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
local.span (set (us @ w # ws)) = local.span (set us')

goal (1 subgoal):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
local.span (set (us @ w # ws)) = local.span (set us')

goal (1 subgoal):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
have "set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us'
[PROOF STEP]
unfolding U'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (gram_schmidt_sub0 n us ws) \<subseteq> carrier_vec n \<and> distinct (gram_schmidt_sub0 n us ws) \<and> corthogonal (gram_schmidt_sub0 n us ws)
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gram_schmidt_sub0 n ?us1 ws = ?us'1; set ws \<subseteq> carrier_vec n; set ?us1 \<subseteq> carrier_vec n; distinct ?us1; lin_indpt (set ?us1); corthogonal ?us1\<rbrakk> \<Longrightarrow> set ?us'1 \<subseteq> carrier_vec n \<and> distinct ?us'1 \<and> corthogonal ?us'1 \<and> local.span (set (?us1 @ ws)) = local.span (set ?us'1)
gram_schmidt_sub0 n us (w # ws) = us'
set (w # ws) \<subseteq> carrier_vec n
set us \<subseteq> carrier_vec n
distinct us
lin_indpt (set us)
corthogonal us

goal (1 subgoal):
 1. set (gram_schmidt_sub0 n us ws) \<subseteq> carrier_vec n \<and> distinct (gram_schmidt_sub0 n us ws) \<and> corthogonal (gram_schmidt_sub0 n us ws)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us'

goal (1 subgoal):
 1. w \<in> local.span (set us) \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
local.span (set (us @ w # ws)) = local.span (set us')
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.span (set (us @ w # ws)) = local.span (set us')
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us'

goal (1 subgoal):
 1. set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ w # ws)) = local.span (set us')

goal (1 subgoal):
 1. \<And>us us'. \<lbrakk>gram_schmidt_sub0 n us [] = us'; set [] \<subseteq> carrier_vec n; set us \<subseteq> carrier_vec n; distinct us; lin_indpt (set us); corthogonal us\<rbrakk> \<Longrightarrow> set us' \<subseteq> carrier_vec n \<and> distinct us' \<and> corthogonal us' \<and> local.span (set (us @ [])) = local.span (set us')
[PROOF STEP]
qed simp


[STATEMENT]
lemma binomial_code [code]:
  "n choose k =
      (if k > n then 0
       else if 2 * k > n then n choose (n - k)
       else (fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
assume "k \<le> n"
[PROOF STATE]
proof (state)
this:
k \<le> n

goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<le> n
[PROOF STEP]
have "{1..n} = {1..n-k} \<union> {n-k+1..n}"
[PROOF STATE]
proof (prove)
using this:
k \<le> n

goal (1 subgoal):
 1. {1..n} = {1..n - k} \<union> {n - k + 1..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{1..n} = {1..n - k} \<union> {n - k + 1..n}

goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{1..n} = {1..n - k} \<union> {n - k + 1..n}
[PROOF STEP]
have "(fact n :: nat) = fact (n-k) * \<Prod>{n-k+1..n}"
[PROOF STATE]
proof (prove)
using this:
{1..n} = {1..n - k} \<union> {n - k + 1..n}

goal (1 subgoal):
 1. fact n = fact (n - k) * \<Prod>{n - k + 1..n}
[PROOF STEP]
by (simp add: prod.union_disjoint fact_prod)
[PROOF STATE]
proof (state)
this:
fact n = fact (n - k) * \<Prod>{n - k + 1..n}

goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
k \<le> n \<Longrightarrow> fact n = fact (n - k) * \<Prod>{n - k + 1..n}

goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<le> n \<Longrightarrow> fact n = fact (n - k) * \<Prod>{n - k + 1..n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k \<le> n \<Longrightarrow> fact n = fact (n - k) * \<Prod>{n - k + 1..n}

goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
by (auto simp: binomial_altdef_nat mult_ac prod_atLeastAtMost_code)
[PROOF STATE]
proof (state)
this:
n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pairwise_disjnt_diff_2:
  "pairwise disjnt ((\<lambda> d. {(a, b) | a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d}) ` (differenceset A A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise disjnt ((\<lambda>d. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d}) ` differenceset A A)
[PROOF STEP]
unfolding disjnt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise (\<lambda>A B. A \<inter> B = {}) ((\<lambda>d. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d}) ` differenceset A A)
[PROOF STEP]
by (intro pairwiseI) (auto)


[STATEMENT]
lemma asymp_equivI'_inverse_const:
  assumes "((\<lambda>x. f x / g x) \<longlongrightarrow> inverse c) F" "c \<noteq> 0"
  shows   "(\<lambda>x. c * f x) \<sim>[F] g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c * f x) \<sim>[F] g
[PROOF STEP]
using tendsto_mult[OF assms(1) tendsto_const[of "c"]] assms(2)
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f x / g x * c) \<longlongrightarrow> inverse c * c) F
c \<noteq> (0::'b)

goal (1 subgoal):
 1. (\<lambda>x. c * f x) \<sim>[F] g
[PROOF STEP]
by (intro asymp_equivI') (simp add: field_simps)


[STATEMENT]
lemma matrix_scalar_vector_ac:
  fixes A :: "'a::{field}^'m^'n"
  shows "A *v (k *s v) = k *k A *v v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v (k *s v) = k *k A *v v
[PROOF STEP]
by (simp add: Miscellaneous.scalar_matrix_vector_assoc vec.scale)


[STATEMENT]
lemma I_minWeightBasisD:
  assumes
   "I_minWeightBasis (T,E)"
 shows"indep T" "\<And>e. e\<in>carrier-E-T \<Longrightarrow> ~indep (insert e T)"
    "E \<subseteq> carrier" "\<And>x y. x\<in>T \<Longrightarrow> y\<in>E \<Longrightarrow> weight x \<le> weight y"  "T \<subseteq> carrier"
    "no_smallest_element_skipped E T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (indep T &&& (\<And>e. e \<in> carrier - E - T \<Longrightarrow> \<not> indep (insert e T)) &&& E \<subseteq> carrier) &&& (\<And>x y. \<lbrakk>x \<in> T; y \<in> E\<rbrakk> \<Longrightarrow> weight x \<le> weight y) &&& T \<subseteq> carrier &&& no_smallest_element_skipped E T
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
I_minWeightBasis (T, E)

goal (1 subgoal):
 1. (indep T &&& (\<And>e. e \<in> carrier - E - T \<Longrightarrow> \<not> indep (insert e T)) &&& E \<subseteq> carrier) &&& (\<And>x y. \<lbrakk>x \<in> T; y \<in> E\<rbrakk> \<Longrightarrow> weight x \<le> weight y) &&& T \<subseteq> carrier &&& no_smallest_element_skipped E T
[PROOF STEP]
by(auto simp: no_smallest_element_skipped_def I_minWeightBasis_def)


[STATEMENT]
lemma test_comp_test_top:
  "y \<sqinter> (x \<sqinter> 1) * top * (z \<sqinter> 1) = (x \<sqinter> 1) * y * (z \<sqinter> 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<sqinter> (x \<sqinter> (1::'a)) * top * (z \<sqinter> (1::'a)) = (x \<sqinter> (1::'a)) * y * (z \<sqinter> (1::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<sqinter> (x \<sqinter> (1::'a)) * top * (z \<sqinter> (1::'a)) = (x \<sqinter> (1::'a)) * y * (z \<sqinter> (1::'a))
[PROOF STEP]
have "\<forall>u v . (v \<sqinter> u\<^sup>T)\<^sup>T = v\<^sup>T \<sqinter> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>u v. (v \<sqinter> u\<^sup>T)\<^sup>T = v\<^sup>T \<sqinter> u
[PROOF STEP]
using conv_dist_inf
[PROOF STATE]
proof (prove)
using this:
(?x \<sqinter> ?y)\<^sup>T = ?x\<^sup>T \<sqinter> ?y\<^sup>T

goal (1 subgoal):
 1. \<forall>u v. (v \<sqinter> u\<^sup>T)\<^sup>T = v\<^sup>T \<sqinter> u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>u v. (v \<sqinter> u\<^sup>T)\<^sup>T = v\<^sup>T \<sqinter> u

goal (1 subgoal):
 1. y \<sqinter> (x \<sqinter> (1::'a)) * top * (z \<sqinter> (1::'a)) = (x \<sqinter> (1::'a)) * y * (z \<sqinter> (1::'a))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>u v. (v \<sqinter> u\<^sup>T)\<^sup>T = v\<^sup>T \<sqinter> u

goal (1 subgoal):
 1. y \<sqinter> (x \<sqinter> (1::'a)) * top * (z \<sqinter> (1::'a)) = (x \<sqinter> (1::'a)) * y * (z \<sqinter> (1::'a))
[PROOF STEP]
by (smt conv_dist_comp conv_involutive coreflexive_comp_top_inf inf.cobounded2 inf.left_commute inf.sup_monoid.add_commute symmetric_one_closed mult_assoc symmetric_top_closed)
[PROOF STATE]
proof (state)
this:
y \<sqinter> (x \<sqinter> (1::'a)) * top * (z \<sqinter> (1::'a)) = (x \<sqinter> (1::'a)) * y * (z \<sqinter> (1::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma example1_divisor: shows "(2::nat) \<in> divisor_set (4::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<in> divisor_set 4
[PROOF STEP]
using  divisor_set divisor_def
[PROOF STATE]
proof (prove)
using this:
divisor_set ?m = {n. n divisor ?m}
?n divisor ?m \<equiv> 1 \<le> ?n \<and> ?n \<le> ?m \<and> ?n dvd ?m

goal (1 subgoal):
 1. 2 \<in> divisor_set 4
[PROOF STEP]
by force


[STATEMENT]
lemma sqrt_nat_ceiling_code[code]: "sqrt_nat_ceiling x = sqrt_int_ceiling_pos (int x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt_nat_ceiling x = sqrt_int_ceiling_pos (int x)
[PROOF STEP]
unfolding sqrt_nat_ceiling_def root_nat_ceiling_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root_int_ceiling_pos 2 (int x) = sqrt_int_ceiling_pos (int x)
[PROOF STEP]
by simp


[STATEMENT]
lemma inconsistent_imp_rank_less:
  fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
  assumes inc: "inconsistent A b"
  shows "rank A < (if (\<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0) then (to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0) + 1) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0 then to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0) + 1 else 0)"
[PROOF STATE]
proof (state)
this:
\<not> rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0)

goal (1 subgoal):
 1. \<not> rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<Longrightarrow> False
[PROOF STEP]
hence "(if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0 then to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0) + 1 else 0) \<le> rank A"
[PROOF STATE]
proof (prove)
using this:
\<not> rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0)

goal (1 subgoal):
 1. (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<le> rank A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<le> rank A

goal (1 subgoal):
 1. \<not> rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<Longrightarrow> False
[PROOF STEP]
hence "consistent A b"
[PROOF STATE]
proof (prove)
using this:
(if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<le> rank A

goal (1 subgoal):
 1. consistent A b
[PROOF STEP]
using rank_ge_imp_consistent
[PROOF STATE]
proof (prove)
using this:
(if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<le> rank A
(if \<exists>a. (P_Gauss_Jordan ?A *v ?b) $ a \<noteq> (0::?'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan ?A *v ?b) $ a \<noteq> (0::?'a)) + 1 else 0) \<le> rank ?A \<Longrightarrow> consistent ?A ?b

goal (1 subgoal):
 1. consistent A b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
consistent A b

goal (1 subgoal):
 1. \<not> rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
consistent A b

goal (1 subgoal):
 1. False
[PROOF STEP]
using inc
[PROOF STATE]
proof (prove)
using this:
consistent A b
inconsistent A b

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding inconsistent_def
[PROOF STATE]
proof (prove)
using this:
consistent A b
\<not> consistent A b

goal (1 subgoal):
 1. False
[PROOF STEP]
by contradiction
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fls_deriv_shift:
  "fls_deriv (fls_shift n f) = of_int (-n) * fls_shift (n+1) f + fls_shift n (fls_deriv f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_deriv (fls_shift n f) = of_int (- n) * fls_shift (n + 1) f + fls_shift n (fls_deriv f)
[PROOF STEP]
by (intro fls_eqI) (simp flip: fls_shift_fls_shift add: algebra_simps)


[STATEMENT]
lemma eval_inverse_monom:
  "eval_monom (inverse_monom monom) basis = (\<lambda>x. inverse (eval_monom monom basis x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_monom (inverse_monom monom) basis = (\<lambda>x. inverse (eval_monom monom basis x))
[PROOF STEP]
by (rule ext) (simp add: eval_monom_def inverse_monom_def zip_map2 o_def case_prod_unfold
                   inverse_prod_list powr_minus)


[STATEMENT]
lemma lhopital_left_at_top:
  "LIM x at_left x. g x :> at_top \<Longrightarrow>
    eventually (\<lambda>x. g' x \<noteq> 0) (at_left x) \<Longrightarrow>
    eventually (\<lambda>x. DERIV f x :> f' x) (at_left x) \<Longrightarrow>
    eventually (\<lambda>x. DERIV g x :> g' x) (at_left x) \<Longrightarrow>
    ((\<lambda> x. (f' x / g' x)) \<longlongrightarrow> y) (at_left x) \<Longrightarrow>
    ((\<lambda> x. f x / g x) \<longlongrightarrow> y) (at_left x)"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>filterlim g at_top (at_left x); \<forall>\<^sub>F x in at_left x. g' x \<noteq> 0; \<forall>\<^sub>F x in at_left x. (f has_real_derivative f' x) (at x); \<forall>\<^sub>F x in at_left x. (g has_real_derivative g' x) (at x); ((\<lambda>x. f' x / g' x) \<longlongrightarrow> y) (at_left x)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x / g x) \<longlongrightarrow> y) (at_left x)
[PROOF STEP]
unfolding eventually_at_left_to_right filterlim_at_left_to_right DERIV_mirror
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>LIM x at_right (- x). g (- x) :> at_top; \<forall>\<^sub>F x in at_right (- x). g' (- x) \<noteq> 0; \<forall>\<^sub>F x in at_right (- x). ((\<lambda>x. f (- x)) has_real_derivative - f' (- x)) (at x); \<forall>\<^sub>F x in at_right (- x). ((\<lambda>x. g (- x)) has_real_derivative - g' (- x)) (at x); ((\<lambda>x. f' (- x) / g' (- x)) \<longlongrightarrow> y) (at_right (- x))\<rbrakk> \<Longrightarrow> ((\<lambda>x. f (- x) / g (- x)) \<longlongrightarrow> y) (at_right (- x))
[PROOF STEP]
by (rule lhopital_right_at_top[where f'="\<lambda>x. - f' (- x)"]) (auto simp: DERIV_mirror)


[STATEMENT]
lemma Union_of_finite_supp_sets:
  fixes S::"('a::fs set)"
  assumes fin: "finite S"
  shows "finite (\<Union>x\<in>S. supp x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union> (supp ` S))
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. finite (\<Union> (supp ` S))
[PROOF STEP]
by (induct) (auto simp: finite_supp)


[STATEMENT]
lemma LIM_offset: "f \<midarrow>a\<rightarrow> L \<Longrightarrow> (\<lambda>x. f (x + k)) \<midarrow>(a - k)\<rightarrow> L"
  for a :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>a\<rightarrow> L \<Longrightarrow> (\<lambda>x. f (x + k)) \<midarrow>a - k\<rightarrow> L
[PROOF STEP]
by (simp add: filtermap_at_shift[symmetric, of a k] filterlim_def filtermap_filtermap)


[STATEMENT]
lemma ltakes_suc_iterates[simp]:
  "ltake (enat (Suc n)) (iterates f p) = LCons p (ltake (enat n) (iterates f (f p)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltake (enat (Suc n)) (iterates f p) = LCons p (ltake (enat n) (iterates f (f p)))
[PROOF STEP]
by (induct n,force simp:ltakes_one_iterates,metis eSuc_enat iterates.code ltake_eSuc_LCons)


[STATEMENT]
lemma lsortedD: "\<lbrakk> lsorted xs; \<not> lnull xs; y \<in> lset (ltl xs) \<rbrakk> \<Longrightarrow> lhd xs \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>lsorted xs; \<not> lnull xs; y \<in> lset (ltl xs)\<rbrakk> \<Longrightarrow> lhd xs \<le> y
[PROOF STEP]
by(clarsimp simp add: not_lnull_conv lsorted_LCons)


[STATEMENT]
lemma continuous_on_sgn[continuous_intros]:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
  assumes "continuous_on s f"
    and "\<forall>x\<in>s. f x \<noteq> 0"
  shows "continuous_on s (\<lambda>x. sgn (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s (\<lambda>x. sgn (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on s f
\<forall>x\<in>s. f x \<noteq> (0::'b)

goal (1 subgoal):
 1. continuous_on s (\<lambda>x. sgn (f x))
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s)
\<forall>x\<in>s. f x \<noteq> (0::'b)

goal (1 subgoal):
 1. \<forall>x\<in>s. ((\<lambda>x. sgn (f x)) \<longlongrightarrow> sgn (f x)) (at x within s)
[PROOF STEP]
by (blast intro: tendsto_sgn)


[STATEMENT]
lemma binomial_code [code]:
  "n choose k =
      (if k > n then 0
       else if 2 * k > n then n choose (n - k)
       else (fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
assume "k \<le> n"
[PROOF STATE]
proof (state)
this:
k \<le> n

goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<le> n
[PROOF STEP]
have "{1..n} = {1..n-k} \<union> {n-k+1..n}"
[PROOF STATE]
proof (prove)
using this:
k \<le> n

goal (1 subgoal):
 1. {1..n} = {1..n - k} \<union> {n - k + 1..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{1..n} = {1..n - k} \<union> {n - k + 1..n}

goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{1..n} = {1..n - k} \<union> {n - k + 1..n}
[PROOF STEP]
have "(fact n :: nat) = fact (n-k) * \<Prod>{n-k+1..n}"
[PROOF STATE]
proof (prove)
using this:
{1..n} = {1..n - k} \<union> {n - k + 1..n}

goal (1 subgoal):
 1. fact n = fact (n - k) * \<Prod>{n - k + 1..n}
[PROOF STEP]
by (simp add: prod.union_disjoint fact_prod)
[PROOF STATE]
proof (state)
this:
fact n = fact (n - k) * \<Prod>{n - k + 1..n}

goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
k \<le> n \<Longrightarrow> fact n = fact (n - k) * \<Prod>{n - k + 1..n}

goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<le> n \<Longrightarrow> fact n = fact (n - k) * \<Prod>{n - k + 1..n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k \<le> n \<Longrightarrow> fact n = fact (n - k) * \<Prod>{n - k + 1..n}

goal (1 subgoal):
 1. n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)
[PROOF STEP]
by (auto simp: binomial_altdef_nat mult_ac prod_atLeastAtMost_code)
[PROOF STATE]
proof (state)
this:
n choose k = (if n < k then 0 else if n < 2 * k then n choose (n - k) else fold_atLeastAtMost_nat (*) (n - k + 1) n 1 div fact k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_set_conv_ex_nth: "(\<exists>x\<in>set xs. P x) = (\<exists>i<length xs. P (xs ! i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x\<in>set xs. P x) = (\<exists>i<length xs. P (xs ! i))
[PROOF STEP]
using in_set_conv_nth[of _ xs]
[PROOF STATE]
proof (prove)
using this:
(?x \<in> set xs) = (\<exists>i<length xs. xs ! i = ?x)

goal (1 subgoal):
 1. (\<exists>x\<in>set xs. P x) = (\<exists>i<length xs. P (xs ! i))
[PROOF STEP]
by force


[STATEMENT]
lemma ennreal_approx_INF:
  fixes x::ennreal
  assumes f_bound: "\<And>i. i \<in> A \<Longrightarrow> x \<le> f i"
  assumes approx: "\<And>e. (e::real) > 0 \<Longrightarrow> \<exists>i \<in> A. f i \<le> x + e"
  shows "x = (INF i \<in> A. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = Inf (f ` A)
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<le> Inf (f ` A)
 2. Inf (f ` A) \<le> x
[PROOF STEP]
show "(INF i\<in>A. f i) \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (f ` A) \<le> x
[PROOF STEP]
proof (rule ennreal_le_epsilon)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>x < top; 0 < e\<rbrakk> \<Longrightarrow> Inf (f ` A) \<le> x + ennreal e
[PROOF STEP]
fix e :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>x < top; 0 < e\<rbrakk> \<Longrightarrow> Inf (f ` A) \<le> x + ennreal e
[PROOF STEP]
assume "0 < e"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>x < top; 0 < e\<rbrakk> \<Longrightarrow> Inf (f ` A) \<le> x + ennreal e
[PROOF STEP]
from approx[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>i\<in>A. f i \<le> x + ennreal e
[PROOF STEP]
obtain i where "i\<in>A" "f i \<le> x + ennreal e"
[PROOF STATE]
proof (prove)
using this:
\<exists>i\<in>A. f i \<le> x + ennreal e

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i \<in> A; f i \<le> x + ennreal e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i \<in> A
f i \<le> x + ennreal e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>x < top; 0 < e\<rbrakk> \<Longrightarrow> Inf (f ` A) \<le> x + ennreal e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> A
f i \<le> x + ennreal e
[PROOF STEP]
have "(INF i\<in>A. f i) \<le> f i"
[PROOF STATE]
proof (prove)
using this:
i \<in> A
f i \<le> x + ennreal e

goal (1 subgoal):
 1. Inf (f ` A) \<le> f i
[PROOF STEP]
by (intro INF_lower)
[PROOF STATE]
proof (state)
this:
Inf (f ` A) \<le> f i

goal (1 subgoal):
 1. \<And>e. \<lbrakk>x < top; 0 < e\<rbrakk> \<Longrightarrow> Inf (f ` A) \<le> x + ennreal e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Inf (f ` A) \<le> f i

goal (1 subgoal):
 1. \<And>e. \<lbrakk>x < top; 0 < e\<rbrakk> \<Longrightarrow> Inf (f ` A) \<le> x + ennreal e
[PROOF STEP]
have "\<dots> \<le> x + e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i \<le> x + ennreal e
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
f i \<le> x + ennreal e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>x < top; 0 < e\<rbrakk> \<Longrightarrow> Inf (f ` A) \<le> x + ennreal e
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Inf (f ` A) \<le> x + ennreal e
[PROOF STEP]
show "(INF i\<in>A. f i) \<le> x + e"
[PROOF STATE]
proof (prove)
using this:
Inf (f ` A) \<le> x + ennreal e

goal (1 subgoal):
 1. Inf (f ` A) \<le> x + ennreal e
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Inf (f ` A) \<le> x + ennreal e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Inf (f ` A) \<le> x

goal (1 subgoal):
 1. x \<le> Inf (f ` A)
[PROOF STEP]
qed (intro INF_greatest f_bound)


[STATEMENT]
lemma proj_set_dist_le:
  assumes "y \<in> A" "p \<in> proj_set x A"
  shows "dist x p \<le> dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x p \<le> dist x y
[PROOF STEP]
using assms infdist_le
[PROOF STATE]
proof (prove)
using this:
y \<in> A
p \<in> proj_set x A
?a \<in> ?A \<Longrightarrow> infdist ?x ?A \<le> dist ?x ?a

goal (1 subgoal):
 1. dist x p \<le> dist x y
[PROOF STEP]
unfolding proj_set_def
[PROOF STATE]
proof (prove)
using this:
y \<in> A
p \<in> {y \<in> A. dist x y = infdist x A}
?a \<in> ?A \<Longrightarrow> infdist ?x ?A \<le> dist ?x ?a

goal (1 subgoal):
 1. dist x p \<le> dist x y
[PROOF STEP]
by auto


[STATEMENT]
lemma all_union_of:
     "(\<forall>S. (P union_of Q) S \<longrightarrow> R S) \<longleftrightarrow> (\<forall>T. P T \<and> T \<subseteq> Collect Q \<longrightarrow> R(\<Union>T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>S. (P union_of Q) S \<longrightarrow> R S) = (\<forall>T. P T \<and> T \<subseteq> Collect Q \<longrightarrow> R (\<Union> T))
[PROOF STEP]
by (auto simp: union_of_def)


[STATEMENT]
lemma lm01: "card P = card (P^-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card P = card (P\<inverse>)
[PROOF STEP]
using card_image flip_conv injflip
[PROOF STATE]
proof (prove)
using this:
inj_on ?f ?A \<Longrightarrow> card (?f ` ?A) = card ?A
flip ` ?R = ?R\<inverse>
inj_on flip ?A

goal (1 subgoal):
 1. card P = card (P\<inverse>)
[PROOF STEP]
by metis


[STATEMENT]
lemma eval_fds_logderiv_zeta_real:
  assumes "x > (1 :: real)"
  shows  "(\<lambda>p. ln (real p) / (p powr x - 1)) abs_summable_on {p. prime p}" (is ?th1)
    and  "deriv zeta (of_real x) / zeta (of_real x) =
            -of_real (\<Sum>\<^sub>ap | prime p. ln (real p) / (p powr x - 1))" (is ?th2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. ln (real p) / (real p powr x - 1)) abs_summable_on {p. prime p} &&& deriv zeta (complex_of_real x) / zeta (complex_of_real x) = - complex_of_real (\<Sum>\<^sub>ap | prime p. ln (real p) / (real p powr x - 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>p. ln (real p) / (real p powr x - 1)) abs_summable_on {p. prime p}
 2. deriv zeta (complex_of_real x) / zeta (complex_of_real x) = - complex_of_real (\<Sum>\<^sub>ap | prime p. ln (real p) / (real p powr x - 1))
[PROOF STEP]
have "(\<lambda>p. Re (of_real (ln (real p)) / (of_nat p powr of_real x - 1)))
          abs_summable_on {p. prime p}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. Re (complex_of_real (ln (real p)) / (of_nat p powr complex_of_real x - 1))) abs_summable_on {p. prime p}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < x

goal (1 subgoal):
 1. (\<lambda>p. Re (complex_of_real (ln (real p)) / (of_nat p powr complex_of_real x - 1))) abs_summable_on {p. prime p}
[PROOF STEP]
by (intro abs_summable_Re eval_fds_logderiv_zeta) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>p. Re (complex_of_real (ln (real p)) / (of_nat p powr complex_of_real x - 1))) abs_summable_on {p. prime p}

goal (2 subgoals):
 1. (\<lambda>p. ln (real p) / (real p powr x - 1)) abs_summable_on {p. prime p}
 2. deriv zeta (complex_of_real x) / zeta (complex_of_real x) = - complex_of_real (\<Sum>\<^sub>ap | prime p. ln (real p) / (real p powr x - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>p. Re (complex_of_real (ln (real p)) / (of_nat p powr complex_of_real x - 1))) abs_summable_on {p. prime p}

goal (2 subgoals):
 1. (\<lambda>p. ln (real p) / (real p powr x - 1)) abs_summable_on {p. prime p}
 2. deriv zeta (complex_of_real x) / zeta (complex_of_real x) = - complex_of_real (\<Sum>\<^sub>ap | prime p. ln (real p) / (real p powr x - 1))
[PROOF STEP]
have "?this \<longleftrightarrow> ?th1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>p. Re (complex_of_real (ln (real p)) / (of_nat p powr complex_of_real x - 1))) abs_summable_on {p. prime p}) = ((\<lambda>p. ln (real p) / (real p powr x - 1)) abs_summable_on {p. prime p})
[PROOF STEP]
by (intro abs_summable_on_cong) (auto simp: powr_Reals_eq)
[PROOF STATE]
proof (state)
this:
((\<lambda>p. Re (complex_of_real (ln (real p)) / (of_nat p powr complex_of_real x - 1))) abs_summable_on {p. prime p}) = ((\<lambda>p. ln (real p) / (real p powr x - 1)) abs_summable_on {p. prime p})

goal (2 subgoals):
 1. (\<lambda>p. ln (real p) / (real p powr x - 1)) abs_summable_on {p. prime p}
 2. deriv zeta (complex_of_real x) / zeta (complex_of_real x) = - complex_of_real (\<Sum>\<^sub>ap | prime p. ln (real p) / (real p powr x - 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>p. ln (real p) / (real p powr x - 1)) abs_summable_on {p. prime p}
[PROOF STEP]
show ?th1
[PROOF STATE]
proof (prove)
using this:
(\<lambda>p. ln (real p) / (real p powr x - 1)) abs_summable_on {p. prime p}

goal (1 subgoal):
 1. (\<lambda>p. ln (real p) / (real p powr x - 1)) abs_summable_on {p. prime p}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>p. ln (real p) / (real p powr x - 1)) abs_summable_on {p. prime p}

goal (1 subgoal):
 1. deriv zeta (complex_of_real x) / zeta (complex_of_real x) = - complex_of_real (\<Sum>\<^sub>ap | prime p. ln (real p) / (real p powr x - 1))
[PROOF STEP]
show ?th2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv zeta (complex_of_real x) / zeta (complex_of_real x) = - complex_of_real (\<Sum>\<^sub>ap | prime p. ln (real p) / (real p powr x - 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < x

goal (1 subgoal):
 1. deriv zeta (complex_of_real x) / zeta (complex_of_real x) = - complex_of_real (\<Sum>\<^sub>ap | prime p. ln (real p) / (real p powr x - 1))
[PROOF STEP]
by (subst eval_fds_logderiv_zeta) (auto simp: infsetsum_of_real [symmetric] powr_Reals_eq)
[PROOF STATE]
proof (state)
this:
deriv zeta (complex_of_real x) / zeta (complex_of_real x) = - complex_of_real (\<Sum>\<^sub>ap | prime p. ln (real p) / (real p powr x - 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coprime_cong_mult_poly:
  assumes "[(a::'b::{field_gcd} poly) = b] (mod m)" and "[a = b] (mod n)" and "coprime m n"
  shows "[a = b] (mod m * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a = b] (mod m * n)
[PROOF STEP]
using divides_mult assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a dvd ?c; ?b dvd ?c; coprime ?a ?b\<rbrakk> \<Longrightarrow> ?a * ?b dvd ?c
[a = b] (mod m)
[a = b] (mod n)
coprime m n

goal (1 subgoal):
 1. [a = b] (mod m * n)
[PROOF STEP]
by (metis (no_types, opaque_lifting) cong_dvd_modulus_poly cong_iff_lin_poly dvd_mult2 dvd_refl minus_add_cancel mult.right_neutral)


[STATEMENT]
lemma (in Module) mker_inc_zero:
           "\<lbrakk>R module N; f \<in> mHom R M N \<rbrakk> \<Longrightarrow> \<zero> \<in> (ker\<^bsub>M,N\<^esub> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N\<rbrakk> \<Longrightarrow> \<zero> \<in> ker\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (simp add:ker_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N\<rbrakk> \<Longrightarrow> \<zero> \<in> carrier M \<and> f \<zero> = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (simp add:module_inc_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N\<rbrakk> \<Longrightarrow> f \<zero> = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (simp add:mHom_0)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lists_sing_map_concat_ident: "xs \<in> lists (sings B) \<Longrightarrow> xs = map (\<lambda> x. [x]) (concat xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> lists (sings B) \<Longrightarrow> xs = map (\<lambda>x. [x]) (concat xs)
[PROOF STEP]
by (induct xs, simp, auto)


[STATEMENT]
lemma inner_prod_csqrt [simp]:
  "csqrt \<langle>v|v\<rangle> = \<parallel>v\<parallel>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. csqrt \<langle>v|v\<rangle> = complex_of_real \<parallel>v\<parallel>
[PROOF STEP]
using inner_prod_with_itself_Re inner_prod_with_itself_Im csqrt_of_real_nonneg cpx_vec_length_def
[PROOF STATE]
proof (prove)
using this:
0 \<le> Re \<langle>?u|?u\<rangle>
Im \<langle>?u|?u\<rangle> = 0
\<lbrakk>Im ?x = 0; 0 \<le> Re ?x\<rbrakk> \<Longrightarrow> csqrt ?x = complex_of_real (sqrt (Re ?x))
\<parallel>?v\<parallel> \<equiv> sqrt (\<Sum>i<dim_vec ?v. (cmod (?v $ i))\<^sup>2)

goal (1 subgoal):
 1. csqrt \<langle>v|v\<rangle> = complex_of_real \<parallel>v\<parallel>
[PROOF STEP]
by (metis (no_types, lifting) Re_complex_of_real cpx_vec_length_inner_prod real_sqrt_ge_0_iff
      real_sqrt_unique sum_nonneg zero_le_power2)


[STATEMENT]
lemma at_map_Inf_pres: "at_map (\<Sqinter>X) = Abs_atoms (Collect atom \<sqinter> (\<Sqinter>x \<in> X. (Rep_atoms (at_map (x::'a::complete_boolean_algebra_alt)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at_map (\<Sqinter> X) = Abs_atoms (Collect atom \<inter> (\<Inter>x\<in>X. Rep_atoms (at_map x)))
[PROOF STEP]
unfolding at_map_def comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_atoms (atom_map (\<Sqinter> X)) = Abs_atoms (Collect atom \<inter> (\<Inter>x\<in>X. Rep_atoms (Abs_atoms (atom_map x))))
[PROOF STEP]
by (metis (no_types, lifting) Abs_atoms_inverse Sup.SUP_cong atom_map_Inf_pres rangeI)