[STATEMENT]
lemma matrix_right_invertible_span_columns:
  "(\<exists>(B::'a::field ^'n^'m). (A::'a ^'m^'n) ** B = mat 1) \<longleftrightarrow>
    vec.span (columns A) = UNIV" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
let ?U = "UNIV :: 'm set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
have fU: "finite ?U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite UNIV

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
have lhseq: "?lhs \<longleftrightarrow> (\<forall>y. \<exists>(x::'a^'m). sum (\<lambda>i. (x$i) *s column i A) ?U = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (\<forall>y. \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y)
[PROOF STEP]
unfolding matrix_right_invertible_surjective matrix_mult_sum surj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>y. \<exists>x. y = (\<Sum>i\<in>UNIV. x $ i *s column i A)) = (\<forall>y. \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y)
[PROOF STEP]
by (simp add: eq_commute)
[PROOF STATE]
proof (state)
this:
(\<exists>B. A ** B = mat (1::'a)) = (\<forall>y. \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y)

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
have rhseq: "?rhs \<longleftrightarrow> (\<forall>x. x \<in> vec.span (columns A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vec.span (columns A) = UNIV) = (\<forall>x. x \<in> vec.span (columns A))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(vec.span (columns A) = UNIV) = (\<forall>x. x \<in> vec.span (columns A))

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(vec.span (columns A) = UNIV) = (\<forall>x. x \<in> vec.span (columns A))

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
assume h: ?lhs
[PROOF STATE]
proof (state)
this:
\<exists>B. A ** B = mat (1::'a)

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<exists>B. A ** B = mat (1::'a)

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
fix x:: "'a ^'n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
from h[unfolded lhseq, rule_format, of x]
[PROOF STATE]
proof (chain)
picking this:
\<exists>xa. (\<Sum>i\<in>UNIV. xa $ i *s column i A) = x
[PROOF STEP]
obtain y :: "'a ^'m"
        where y: "sum (\<lambda>i. (y$i) *s column i A) ?U = x"
[PROOF STATE]
proof (prove)
using this:
\<exists>xa. (\<Sum>i\<in>UNIV. xa $ i *s column i A) = x

goal (1 subgoal):
 1. (\<And>y. (\<Sum>i\<in>UNIV. y $ i *s column i A) = x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. y $ i *s column i A) = x

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
have "x \<in> vec.span (columns A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> vec.span (columns A)
[PROOF STEP]
unfolding y[symmetric] scalar_mult_eq_scaleR
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. y $ i *s column i A) \<in> vec.span (columns A)
[PROOF STEP]
proof (rule vec.span_sum [OF vec.span_scale])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> column i A \<in> vec.span (columns A)
[PROOF STEP]
show "column i A \<in> vec.span (columns A)" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i A \<in> vec.span (columns A)
[PROOF STEP]
using columns_def vec.span_superset
[PROOF STATE]
proof (prove)
using this:
columns ?A = {column i ?A |i. i \<in> UNIV}
?S \<subseteq> vec.span ?S

goal (1 subgoal):
 1. column i A \<in> vec.span (columns A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column ?i A \<in> vec.span (columns A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<in> vec.span (columns A)

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x2 \<in> vec.span (columns A)

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x2 \<in> vec.span (columns A)
[PROOF STEP]
have ?rhs
[PROOF STATE]
proof (prove)
using this:
?x2 \<in> vec.span (columns A)

goal (1 subgoal):
 1. vec.span (columns A) = UNIV
[PROOF STEP]
unfolding rhseq
[PROOF STATE]
proof (prove)
using this:
?x2 \<in> vec.span (columns A)

goal (1 subgoal):
 1. \<forall>x. x \<in> vec.span (columns A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
vec.span (columns A) = UNIV

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<exists>B. A ** B = mat (1::'a) \<Longrightarrow> vec.span (columns A) = UNIV

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>B. A ** B = mat (1::'a) \<Longrightarrow> vec.span (columns A) = UNIV

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<exists>B. A ** B = mat (1::'a) \<Longrightarrow> vec.span (columns A) = UNIV

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
assume h:?rhs
[PROOF STATE]
proof (state)
this:
vec.span (columns A) = UNIV

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
let ?P = "\<lambda>(y::'a ^'n). \<exists>(x::'a^'m). sum (\<lambda>i. (x$i) *s column i A) ?U = y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
have "y \<in> vec.span (columns A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> vec.span (columns A)
[PROOF STEP]
unfolding h
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> UNIV
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<in> vec.span (columns A)

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> vec.span (columns A)
[PROOF STEP]
have "?P y"
[PROOF STATE]
proof (prove)
using this:
y \<in> vec.span (columns A)

goal (1 subgoal):
 1. \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y
[PROOF STEP]
proof (induction rule: vec.span_induct_alt)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = 0
 2. \<And>c x y. \<lbrakk>x \<in> columns A; \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y\<rbrakk> \<Longrightarrow> \<exists>xa. (\<Sum>i\<in>UNIV. xa $ i *s column i A) = c *s x + y
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = 0
 2. \<And>c x y. \<lbrakk>x \<in> columns A; \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y\<rbrakk> \<Longrightarrow> \<exists>xa. (\<Sum>i\<in>UNIV. xa $ i *s column i A) = c *s x + y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = 0
[PROOF STEP]
by (metis (full_types) matrix_mult_sum matrix_vector_mult_0_right)
[PROOF STATE]
proof (state)
this:
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = 0

goal (1 subgoal):
 1. \<And>c x y. \<lbrakk>x \<in> columns A; \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y\<rbrakk> \<Longrightarrow> \<exists>xa. (\<Sum>i\<in>UNIV. xa $ i *s column i A) = c *s x + y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c x y. \<lbrakk>x \<in> columns A; \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y\<rbrakk> \<Longrightarrow> \<exists>xa. (\<Sum>i\<in>UNIV. xa $ i *s column i A) = c *s x + y
[PROOF STEP]
case (step c y1 y2)
[PROOF STATE]
proof (state)
this:
y1 \<in> columns A
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y2

goal (1 subgoal):
 1. \<And>c x y. \<lbrakk>x \<in> columns A; \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y\<rbrakk> \<Longrightarrow> \<exists>xa. (\<Sum>i\<in>UNIV. xa $ i *s column i A) = c *s x + y
[PROOF STEP]
from step
[PROOF STATE]
proof (chain)
picking this:
y1 \<in> columns A
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y2
[PROOF STEP]
obtain i where i: "i \<in> ?U" "y1 = column i A"
[PROOF STATE]
proof (prove)
using this:
y1 \<in> columns A
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y2

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i \<in> UNIV; y1 = column i A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding columns_def
[PROOF STATE]
proof (prove)
using this:
y1 \<in> {column i A |i. i \<in> UNIV}
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y2

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i \<in> UNIV; y1 = column i A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i \<in> UNIV
y1 = column i A

goal (1 subgoal):
 1. \<And>c x y. \<lbrakk>x \<in> columns A; \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y\<rbrakk> \<Longrightarrow> \<exists>xa. (\<Sum>i\<in>UNIV. xa $ i *s column i A) = c *s x + y
[PROOF STEP]
obtain x:: "'a ^'m" where x: "sum (\<lambda>i. (x$i) *s column i A) ?U = y2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using step
[PROOF STATE]
proof (prove)
using this:
y1 \<in> columns A
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y2

goal (1 subgoal):
 1. (\<And>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. x $ i *s column i A) = y2

goal (1 subgoal):
 1. \<And>c x y. \<lbrakk>x \<in> columns A; \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y\<rbrakk> \<Longrightarrow> \<exists>xa. (\<Sum>i\<in>UNIV. xa $ i *s column i A) = c *s x + y
[PROOF STEP]
let ?x = "(\<chi> j. if j = i then c + (x$i) else (x$j))::'a^'m"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>c x y. \<lbrakk>x \<in> columns A; \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y\<rbrakk> \<Longrightarrow> \<exists>xa. (\<Sum>i\<in>UNIV. xa $ i *s column i A) = c *s x + y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = c *s y1 + y2
[PROOF STEP]
proof (rule exI[where x= "?x"], vector, auto simp add: i x[symmetric] if_distrib distrib_left if_distribR cong del: if_weak_cong)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia. (\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ ia else x $ xa * column xa A $ ia) = c * column i A $ ia + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ ia)
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia. (\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ ia else x $ xa * column xa A $ ia) = c * column i A $ ia + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ ia)
[PROOF STEP]
have th: "\<forall>xa \<in> ?U. (if xa = i then (c + (x$i)) * ((column xa A)$j)
              else (x$xa) * ((column xa A$j))) = (if xa = i then c * ((column i A)$j) else 0) + ((x$xa) * ((column xa A)$j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xa\<in>UNIV. (if xa = i then (c + x $ i) * column xa A $ j else x $ xa * column xa A $ j) = (if xa = i then c * column i A $ j else (0::'a)) + x $ xa * column xa A $ j
[PROOF STEP]
using i(1)
[PROOF STATE]
proof (prove)
using this:
i \<in> UNIV

goal (1 subgoal):
 1. \<forall>xa\<in>UNIV. (if xa = i then (c + x $ i) * column xa A $ j else x $ xa * column xa A $ j) = (if xa = i then c * column i A $ j else (0::'a)) + x $ xa * column xa A $ j
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
\<forall>xa\<in>UNIV. (if xa = i then (c + x $ i) * column xa A $ j else x $ xa * column xa A $ j) = (if xa = i then c * column i A $ j else (0::'a)) + x $ xa * column xa A $ j

goal (1 subgoal):
 1. \<And>ia. (\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ ia else x $ xa * column xa A $ ia) = c * column i A $ ia + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ ia)
[PROOF STEP]
have "sum (\<lambda>xa. if xa = i then (c + (x$i)) * ((column xa A)$j)
              else (x$xa) * ((column xa A$j))) ?U = sum (\<lambda>xa. (if xa = i then c * ((column i A)$j) else 0) + ((x$xa) * ((column xa A)$j))) ?U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ j else x $ xa * column xa A $ j) = (\<Sum>xa\<in>UNIV. (if xa = i then c * column i A $ j else (0::'a)) + x $ xa * column xa A $ j)
[PROOF STEP]
by (rule sum.cong[OF refl]) (use th in blast)
[PROOF STATE]
proof (state)
this:
(\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ j else x $ xa * column xa A $ j) = (\<Sum>xa\<in>UNIV. (if xa = i then c * column i A $ j else (0::'a)) + x $ xa * column xa A $ j)

goal (1 subgoal):
 1. \<And>ia. (\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ ia else x $ xa * column xa A $ ia) = c * column i A $ ia + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ ia)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ j else x $ xa * column xa A $ j) = (\<Sum>xa\<in>UNIV. (if xa = i then c * column i A $ j else (0::'a)) + x $ xa * column xa A $ j)

goal (1 subgoal):
 1. \<And>ia. (\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ ia else x $ xa * column xa A $ ia) = c * column i A $ ia + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ ia)
[PROOF STEP]
have "\<dots> = sum (\<lambda>xa. if xa = i then c * ((column i A)$j) else 0) ?U + sum (\<lambda>xa. ((x$xa) * ((column xa A)$j))) ?U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>xa\<in>UNIV. (if xa = i then c * column i A $ j else (0::'a)) + x $ xa * column xa A $ j) = (\<Sum>xa\<in>UNIV. if xa = i then c * column i A $ j else (0::'a)) + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j)
[PROOF STEP]
by (simp add: sum.distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>xa\<in>UNIV. (if xa = i then c * column i A $ j else (0::'a)) + x $ xa * column xa A $ j) = (\<Sum>xa\<in>UNIV. if xa = i then c * column i A $ j else (0::'a)) + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j)

goal (1 subgoal):
 1. \<And>ia. (\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ ia else x $ xa * column xa A $ ia) = c * column i A $ ia + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ ia)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>xa\<in>UNIV. (if xa = i then c * column i A $ j else (0::'a)) + x $ xa * column xa A $ j) = (\<Sum>xa\<in>UNIV. if xa = i then c * column i A $ j else (0::'a)) + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j)

goal (1 subgoal):
 1. \<And>ia. (\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ ia else x $ xa * column xa A $ ia) = c * column i A $ ia + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ ia)
[PROOF STEP]
have "\<dots> = c * ((column i A)$j) + sum (\<lambda>xa. ((x$xa) * ((column xa A)$j))) ?U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>xa\<in>UNIV. if xa = i then c * column i A $ j else (0::'a)) + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j) = c * column i A $ j + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j)
[PROOF STEP]
unfolding sum.delta[OF fU]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i \<in> UNIV then c * column i A $ j else (0::'a)) + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j) = c * column i A $ j + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j)
[PROOF STEP]
using i(1)
[PROOF STATE]
proof (prove)
using this:
i \<in> UNIV

goal (1 subgoal):
 1. (if i \<in> UNIV then c * column i A $ j else (0::'a)) + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j) = c * column i A $ j + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>xa\<in>UNIV. if xa = i then c * column i A $ j else (0::'a)) + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j) = c * column i A $ j + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j)

goal (1 subgoal):
 1. \<And>ia. (\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ ia else x $ xa * column xa A $ ia) = c * column i A $ ia + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ ia)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ j else x $ xa * column xa A $ j) = c * column i A $ j + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j)
[PROOF STEP]
show "sum (\<lambda>xa. if xa = i then (c + (x$i)) * ((column xa A)$j)
            else (x$xa) * ((column xa A$j))) ?U = c * ((column i A)$j) + sum (\<lambda>xa. ((x$xa) * ((column xa A)$j))) ?U"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ j else x $ xa * column xa A $ j) = c * column i A $ j + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j)

goal (1 subgoal):
 1. (\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ j else x $ xa * column xa A $ j) = c * column i A $ j + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>xa\<in>UNIV. if xa = i then (c + x $ i) * column xa A $ j else x $ xa * column xa A $ j) = c * column i A $ j + (\<Sum>xa\<in>UNIV. x $ xa * column xa A $ j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = c *s y1 + y2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = ?y2

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = ?y2
[PROOF STEP]
have ?lhs
[PROOF STATE]
proof (prove)
using this:
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = ?y2

goal (1 subgoal):
 1. \<exists>B. A ** B = mat (1::'a)
[PROOF STEP]
unfolding lhseq
[PROOF STATE]
proof (prove)
using this:
\<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = ?y2

goal (1 subgoal):
 1. \<forall>y. \<exists>x. (\<Sum>i\<in>UNIV. x $ i *s column i A) = y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>B. A ** B = mat (1::'a)

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
vec.span (columns A) = UNIV \<Longrightarrow> \<exists>B. A ** B = mat (1::'a)

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<exists>B. A ** B = mat (1::'a) \<Longrightarrow> vec.span (columns A) = UNIV
vec.span (columns A) = UNIV \<Longrightarrow> \<exists>B. A ** B = mat (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>B. A ** B = mat (1::'a) \<Longrightarrow> vec.span (columns A) = UNIV
vec.span (columns A) = UNIV \<Longrightarrow> \<exists>B. A ** B = mat (1::'a)

goal (1 subgoal):
 1. (\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<exists>B. A ** B = mat (1::'a)) = (vec.span (columns A) = UNIV)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_mean_cons [rule_format]:
  fixes xs::"real list"
  shows "xs \<noteq> [] \<longrightarrow> mean ((mean xs)#xs) = mean xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
assume lne: "xs \<noteq> []"
[PROOF STATE]
proof (state)
this:
xs \<noteq> []

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
obtain len where ld: "len = real (length xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>len. len = real (length xs) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
len = real (length xs)

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
with lne
[PROOF STATE]
proof (chain)
picking this:
xs \<noteq> []
len = real (length xs)
[PROOF STEP]
have lgt0: "len > 0"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
len = real (length xs)

goal (1 subgoal):
 1. 0 < len
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < len

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
hence lnez: "len \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < len

goal (1 subgoal):
 1. len \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
len \<noteq> 0

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
from lgt0
[PROOF STATE]
proof (chain)
picking this:
0 < len
[PROOF STEP]
have l1nez: "len + 1 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < len

goal (1 subgoal):
 1. len + 1 \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
len + 1 \<noteq> 0

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
from ld
[PROOF STATE]
proof (chain)
picking this:
len = real (length xs)
[PROOF STEP]
have mean: "mean xs = \<Sum>:xs / len"
[PROOF STATE]
proof (prove)
using this:
len = real (length xs)

goal (1 subgoal):
 1. mean xs = sum_list xs / len
[PROOF STEP]
unfolding mean_def
[PROOF STATE]
proof (prove)
using this:
len = real (length xs)

goal (1 subgoal):
 1. sum_list xs / real (length xs) = sum_list xs / len
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mean xs = sum_list xs / len

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
with ld of_nat_add of_int_1 mean_def
[PROOF STATE]
proof (chain)
picking this:
len = real (length xs)
of_nat (?m + ?n) = of_nat ?m + of_nat ?n
of_int 1 = (1::?'a)
mean ?s = sum_list ?s / real (length ?s)
mean xs = sum_list xs / len
[PROOF STEP]
have "mean ((mean xs)#xs) = (\<Sum>:xs/len + \<Sum>:xs) / (1+len)"
[PROOF STATE]
proof (prove)
using this:
len = real (length xs)
of_nat (?m + ?n) = of_nat ?m + of_nat ?n
of_int 1 = (1::?'a)
mean ?s = sum_list ?s / real (length ?s)
mean xs = sum_list xs / len

goal (1 subgoal):
 1. mean (mean xs # xs) = (sum_list xs / len + sum_list xs) / (1 + len)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mean (mean xs # xs) = (sum_list xs / len + sum_list xs) / (1 + len)

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mean (mean xs # xs) = (sum_list xs / len + sum_list xs) / (1 + len)

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
from list_sum_distrib_aux[of xs]
[PROOF STATE]
proof (chain)
picking this:
sum_list xs / ?n + sum_list xs = (1 + 1 / ?n) * sum_list xs
[PROOF STEP]
have
    "\<dots> = (1 + (1/len))*\<Sum>:xs / (1+len)"
[PROOF STATE]
proof (prove)
using this:
sum_list xs / ?n + sum_list xs = (1 + 1 / ?n) * sum_list xs

goal (1 subgoal):
 1. (sum_list xs / len + sum_list xs) / (1 + len) = (1 + 1 / len) * sum_list xs / (1 + len)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(sum_list xs / len + sum_list xs) / (1 + len) = (1 + 1 / len) * sum_list xs / (1 + len)

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(sum_list xs / len + sum_list xs) / (1 + len) = (1 + 1 / len) * sum_list xs / (1 + len)

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
with lnez
[PROOF STATE]
proof (chain)
picking this:
len \<noteq> 0
(sum_list xs / len + sum_list xs) / (1 + len) = (1 + 1 / len) * sum_list xs / (1 + len)
[PROOF STEP]
have
    "\<dots> = (len + 1)*\<Sum>:xs / (len * (1+len))"
[PROOF STATE]
proof (prove)
using this:
len \<noteq> 0
(sum_list xs / len + sum_list xs) / (1 + len) = (1 + 1 / len) * sum_list xs / (1 + len)

goal (1 subgoal):
 1. (1 + 1 / len) * sum_list xs / (1 + len) = (len + 1) * sum_list xs / (len * (1 + len))
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>len \<noteq> 0; (sum_list xs / len + sum_list xs) / (1 + len) = (1 + 1 / len) * sum_list xs / (1 + len)\<rbrakk> \<Longrightarrow> (1 + 1 / len) * sum_list xs / (1 + len) = (len + 1) * sum_list xs / (len * (1 + len))
[PROOF STEP]
apply (drule mult_divide_mult_cancel_left
      [symmetric, where c="len" and a="(1 + 1 / len) * \<Sum>:xs" and b="1+len"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(sum_list xs / len + sum_list xs) / (1 + len) = (1 + 1 / len) * sum_list xs / (1 + len); (1 + 1 / len) * sum_list xs / (1 + len) = len * ((1 + 1 / len) * sum_list xs) / (len * (1 + len))\<rbrakk> \<Longrightarrow> (1 + 1 / len) * sum_list xs / (1 + len) = (len + 1) * sum_list xs / (len * (1 + len))
[PROOF STEP]
apply (clarsimp simp:field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(1 + 1 / len) * sum_list xs / (1 + len) = (len + 1) * sum_list xs / (len * (1 + len))

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 + 1 / len) * sum_list xs / (1 + len) = (len + 1) * sum_list xs / (len * (1 + len))

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
from l1nez
[PROOF STATE]
proof (chain)
picking this:
len + 1 \<noteq> 0
[PROOF STEP]
have "\<dots> = \<Sum>:xs / len"
[PROOF STATE]
proof (prove)
using this:
len + 1 \<noteq> 0

goal (1 subgoal):
 1. (len + 1) * sum_list xs / (len * (1 + len)) = sum_list xs / len
[PROOF STEP]
apply (subst mult.commute [where a="len"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. len + 1 \<noteq> 0 \<Longrightarrow> (len + 1) * sum_list xs / ((1 + len) * len) = sum_list xs / len
[PROOF STEP]
apply (drule mult_divide_mult_cancel_left
      [where c="len+1" and a="\<Sum>:xs" and b="len"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (len + 1) * sum_list xs / ((len + 1) * len) = sum_list xs / len \<Longrightarrow> (len + 1) * sum_list xs / ((1 + len) * len) = sum_list xs / len
[PROOF STEP]
by (simp add: ac_simps ac_simps)
[PROOF STATE]
proof (state)
this:
(len + 1) * sum_list xs / (len * (1 + len)) = sum_list xs / len

goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> mean (mean xs # xs) = mean xs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mean (mean xs # xs) = sum_list xs / len
[PROOF STEP]
show "mean ((mean xs)#xs) = mean xs"
[PROOF STATE]
proof (prove)
using this:
mean (mean xs # xs) = sum_list xs / len

goal (1 subgoal):
 1. mean (mean xs # xs) = mean xs
[PROOF STEP]
by (simp add: mean)
[PROOF STATE]
proof (state)
this:
mean (mean xs # xs) = mean xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in order) order_zmset_exists_foundation_neg:
  fixes   t :: 'a
  assumes "zcount M t < 0"
  shows   "\<exists>s. s \<le> t \<and> zcount M s < 0 \<and> (\<forall>u. zcount M u < 0 \<longrightarrow> \<not> u < s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>s\<le>t. zcount M s < 0 \<and> (\<forall>u. zcount M u < 0 \<longrightarrow> \<not> u < s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
zcount M t < 0

goal (1 subgoal):
 1. \<exists>s\<le>t. zcount M s < 0 \<and> (\<forall>u. zcount M u < 0 \<longrightarrow> \<not> u < s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. zcount M t < 0 \<Longrightarrow> \<exists>s\<le>t. zcount M s < 0 \<and> (\<forall>u. zcount M u < 0 \<longrightarrow> \<not> u < s)
[PROOF STEP]
let ?M = "{t. zcount M t < 0}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. zcount M t < 0 \<Longrightarrow> \<exists>s\<le>t. zcount M s < 0 \<and> (\<forall>u. zcount M u < 0 \<longrightarrow> \<not> u < s)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
zcount M t < 0
[PROOF STEP]
have "t \<in> ?M"
[PROOF STATE]
proof (prove)
using this:
zcount M t < 0

goal (1 subgoal):
 1. t \<in> {t. zcount M t < 0}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t \<in> {t. zcount M t < 0}

goal (1 subgoal):
 1. zcount M t < 0 \<Longrightarrow> \<exists>s\<le>t. zcount M s < 0 \<and> (\<forall>u. zcount M u < 0 \<longrightarrow> \<not> u < s)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<in> {t. zcount M t < 0}
[PROOF STEP]
have "\<exists>s\<in>?M. s \<le> t \<and> (\<forall>u\<in>?M. \<not> u < s)"
[PROOF STATE]
proof (prove)
using this:
t \<in> {t. zcount M t < 0}

goal (1 subgoal):
 1. \<exists>s\<in>{t. zcount M t < 0}. s \<le> t \<and> (\<forall>u\<in>{t. zcount M t < 0}. \<not> u < s)
[PROOF STEP]
by - (drule order_finite_set_exists_foundation[rotated 1], auto)
[PROOF STATE]
proof (state)
this:
\<exists>s\<in>{t. zcount M t < 0}. s \<le> t \<and> (\<forall>u\<in>{t. zcount M t < 0}. \<not> u < s)

goal (1 subgoal):
 1. zcount M t < 0 \<Longrightarrow> \<exists>s\<le>t. zcount M s < 0 \<and> (\<forall>u. zcount M u < 0 \<longrightarrow> \<not> u < s)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>s\<in>{t. zcount M t < 0}. s \<le> t \<and> (\<forall>u\<in>{t. zcount M t < 0}. \<not> u < s)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>s\<in>{t. zcount M t < 0}. s \<le> t \<and> (\<forall>u\<in>{t. zcount M t < 0}. \<not> u < s)

goal (1 subgoal):
 1. \<exists>s\<le>t. zcount M s < 0 \<and> (\<forall>u. zcount M u < 0 \<longrightarrow> \<not> u < s)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>s\<le>t. zcount M s < 0 \<and> (\<forall>u. zcount M u < 0 \<longrightarrow> \<not> u < s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_inv_chart_image[simp, intro]: "open (inv_chart c ` X)"
  if "open X" "X \<subseteq> codomain c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (inv_chart c ` X)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. open (inv_chart c ` X)
[PROOF STEP]
have "inv_chart c ` X = c -` X \<inter> domain c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_chart c ` X = apply_chart c -` X \<inter> domain c
[PROOF STEP]
using that(2)
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> codomain c

goal (1 subgoal):
 1. inv_chart c ` X = apply_chart c -` X \<inter> domain c
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>X \<subseteq> codomain c; x \<in> domain c; apply_chart c x \<in> X\<rbrakk> \<Longrightarrow> x \<in> inv_chart c ` X
[PROOF STEP]
using image_iff
[PROOF STATE]
proof (prove)
using this:
(?z \<in> ?f ` ?A) = (\<exists>x\<in>?A. ?z = ?f x)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>X \<subseteq> codomain c; x \<in> domain c; apply_chart c x \<in> X\<rbrakk> \<Longrightarrow> x \<in> inv_chart c ` X
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
inv_chart c ` X = apply_chart c -` X \<inter> domain c

goal (1 subgoal):
 1. open (inv_chart c ` X)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inv_chart c ` X = apply_chart c -` X \<inter> domain c

goal (1 subgoal):
 1. open (inv_chart c ` X)
[PROOF STEP]
have "open \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (apply_chart c -` X \<inter> domain c)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
open X
X \<subseteq> codomain c

goal (1 subgoal):
 1. open (apply_chart c -` X \<inter> domain c)
[PROOF STEP]
by (metis continuous_on_domain continuous_on_open_vimage open_domain)
[PROOF STATE]
proof (state)
this:
open (apply_chart c -` X \<inter> domain c)

goal (1 subgoal):
 1. open (inv_chart c ` X)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
open (inv_chart c ` X)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
open (inv_chart c ` X)

goal (1 subgoal):
 1. open (inv_chart c ` X)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
open (inv_chart c ` X)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_col_permutation_1:
  assumes "\<not> Col A B C"
  shows "\<not> Col B C A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> Col B C A
[PROOF STEP]
using assms col_permutation_2
[PROOF STATE]
proof (prove)
using this:
\<not> Col A B C
Col ?A ?B ?C \<Longrightarrow> Col ?C ?A ?B

goal (1 subgoal):
 1. \<not> Col B C A
[PROOF STEP]
by blast


[STATEMENT]
lemma floor_numeral [simp]: "\<lfloor>numeral v\<rfloor> = numeral v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>numeral v\<rfloor> = numeral v
[PROOF STEP]
using floor_of_int [of "numeral v"]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>of_int (numeral v)\<rfloor> = numeral v

goal (1 subgoal):
 1. \<lfloor>numeral v\<rfloor> = numeral v
[PROOF STEP]
by simp


[STATEMENT]
lemma column_gr_k_Gram_Schmidt_upt:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes "i>k"
  and i: "i<ncols A"
  shows "column (from_nat i) (Gram_Schmidt_upt_k A k) = column (from_nat i) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
k < i

goal (1 subgoal):
 1. column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A 0) = column (mod_type_class.from_nat i) A
 2. \<And>k. \<lbrakk>k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A; Suc k < i\<rbrakk> \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
assume "0 < i"
[PROOF STATE]
proof (state)
this:
0 < i

goal (2 subgoals):
 1. 0 < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A 0) = column (mod_type_class.from_nat i) A
 2. \<And>k. \<lbrakk>k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A; Suc k < i\<rbrakk> \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
hence "(from_nat i::'n) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < i

goal (1 subgoal):
 1. mod_type_class.from_nat i \<noteq> (0::'n)
[PROOF STEP]
unfolding from_nat_0[symmetric]
[PROOF STATE]
proof (prove)
using this:
0 < i

goal (1 subgoal):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat 0
[PROOF STEP]
using bij_from_nat[where ?'a='n]
[PROOF STATE]
proof (prove)
using this:
0 < i
bij_betw mod_type_class.from_nat {0..<CARD('n)} UNIV

goal (1 subgoal):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat 0
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
0 < i
inj_on mod_type_class.from_nat {0..<CARD('n)} \<and> mod_type_class.from_nat ` {0..<CARD('n)} = UNIV

goal (1 subgoal):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat 0
[PROOF STEP]
by (metis from_nat_eq_imp_eq gr_implies_not0 i ncols_def neq0_conv)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i \<noteq> (0::'n)

goal (2 subgoals):
 1. 0 < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A 0) = column (mod_type_class.from_nat i) A
 2. \<And>k. \<lbrakk>k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A; Suc k < i\<rbrakk> \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
thus "column (from_nat i) (Gram_Schmidt_upt_k A 0) = column (from_nat i) A"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.from_nat i \<noteq> (0::'n)

goal (1 subgoal):
 1. column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A 0) = column (mod_type_class.from_nat i) A
[PROOF STEP]
unfolding Gram_Schmidt_upt_k_def
[PROOF STATE]
proof (prove)
using this:
mod_type_class.from_nat i \<noteq> (0::'n)

goal (1 subgoal):
 1. column (mod_type_class.from_nat i) (foldl Gram_Schmidt_column_k A [0..<Suc 0]) = column (mod_type_class.from_nat i) A
[PROOF STEP]
by (simp add: Gram_Schmidt_column_k_def from_nat_0 column_def)
[PROOF STATE]
proof (state)
this:
column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A 0) = column (mod_type_class.from_nat i) A

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A; Suc k < i\<rbrakk> \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A; Suc k < i\<rbrakk> \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A
Suc k < i

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A; Suc k < i\<rbrakk> \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
have hyp: "column (from_nat i) (Gram_Schmidt_upt_k A k) = column (from_nat i) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A
[PROOF STEP]
using Suc.hyps Suc.prems
[PROOF STATE]
proof (prove)
using this:
k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A
Suc k < i

goal (1 subgoal):
 1. column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A; Suc k < i\<rbrakk> \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
have to_nat_from_nat_suc_k: "(to_nat (from_nat (Suc k)::'n)) = Suc k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (mod_type_class.from_nat (Suc k)) = Suc k
[PROOF STEP]
by (metis Suc.prems dual_order.strict_trans from_nat_not_eq i ncols_def)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (mod_type_class.from_nat (Suc k)) = Suc k

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A; Suc k < i\<rbrakk> \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
have "column (from_nat i) (Gram_Schmidt_upt_k A (Suc k))
    = column (from_nat i) (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
unfolding Gram_Schmidt_upt_k_suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column (mod_type_class.from_nat i) (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column (mod_type_class.from_nat i) (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A; Suc k < i\<rbrakk> \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A; Suc k < i\<rbrakk> \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
have "... =  column (from_nat i) (Gram_Schmidt_upt_k A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column (mod_type_class.from_nat i) (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
proof (rule column_Gram_Schmidt_column_k'
      [of "from_nat i" "from_nat (Suc k)" " (Gram_Schmidt_upt_k A k)", unfolded to_nat_from_nat_suc_k])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat (Suc k)
[PROOF STEP]
show "from_nat i \<noteq> (from_nat (Suc k)::'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat (Suc k)
[PROOF STEP]
by (metis Suc.prems not_less_iff_gr_or_eq
        from_nat_not_eq i ncols_def to_nat_from_nat_suc_k)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i \<noteq> mod_type_class.from_nat (Suc k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
column (mod_type_class.from_nat i) (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < i \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) A; Suc k < i\<rbrakk> \<Longrightarrow> column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)

goal (1 subgoal):
 1. column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
unfolding hyp
[PROOF STATE]
proof (prove)
using this:
column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A

goal (1 subgoal):
 1. column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A (Suc k)) = column (mod_type_class.from_nat i) A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sets_PiM_cong[measurable_cong]:
  assumes "I = J" "\<And>i. i \<in> J \<Longrightarrow> sets (M i) = sets (N i)" shows "sets (PiM I M) = sets (PiM J N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (Pi\<^sub>M I M) = sets (Pi\<^sub>M J N)
[PROOF STEP]
using assms sets_eq_imp_space_eq[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
I = J
?i \<in> J \<Longrightarrow> sets (M ?i) = sets (N ?i)
?i1 \<in> J \<Longrightarrow> space (M ?i1) = space (N ?i1)

goal (1 subgoal):
 1. sets (Pi\<^sub>M I M) = sets (Pi\<^sub>M J N)
[PROOF STEP]
by (simp add: sets_PiM_single cong: PiE_cong conj_cong)


[STATEMENT]
lemma hnz_prop: "has_no_zeros l \<longleftrightarrow> \<not>(\<exists>k < length l. l ! k = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_no_zeros l = (\<not> (\<exists>k<length l. l ! k = 0))
[PROOF STEP]
unfolding has_no_zeros_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<notin> set l) = (\<not> (\<exists>k<length l. l ! k = 0))
[PROOF STEP]
by (simp add: in_set_conv_nth)


[STATEMENT]
lemma (in algebra) lambda_system_eq:
  "lambda_system \<Omega> M f = {l \<in> M. \<forall>x \<in> M. f (x \<inter> l) + f (x - l) = f x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lambda_system \<Omega> M f = {l \<in> M. \<forall>x\<in>M. f (x \<inter> l) + f (x - l) = f x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lambda_system \<Omega> M f = {l \<in> M. \<forall>x\<in>M. f (x \<inter> l) + f (x - l) = f x}
[PROOF STEP]
have [simp]: "\<And>l x. l \<in> M \<Longrightarrow> x \<in> M \<Longrightarrow> (\<Omega> - l) \<inter> x = x - l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l x. \<lbrakk>l \<in> M; x \<in> M\<rbrakk> \<Longrightarrow> (\<Omega> - l) \<inter> x = x - l
[PROOF STEP]
by (metis Int_Diff Int_absorb1 Int_commute sets_into_space)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?l \<in> M; ?x \<in> M\<rbrakk> \<Longrightarrow> (\<Omega> - ?l) \<inter> ?x = ?x - ?l

goal (1 subgoal):
 1. lambda_system \<Omega> M f = {l \<in> M. \<forall>x\<in>M. f (x \<inter> l) + f (x - l) = f x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lambda_system \<Omega> M f = {l \<in> M. \<forall>x\<in>M. f (x \<inter> l) + f (x - l) = f x}
[PROOF STEP]
by (auto simp add: lambda_system_def) (metis Int_commute)+
[PROOF STATE]
proof (state)
this:
lambda_system \<Omega> M f = {l \<in> M. \<forall>x\<in>M. f (x \<inter> l) + f (x - l) = f x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lcm_coprime':
  "card A \<noteq> 0 \<Longrightarrow>
    (\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<noteq> b \<Longrightarrow> coprime a b) \<Longrightarrow>
    Lcm A = normalize (\<Prod>A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>card A \<noteq> 0; \<And>a b. \<lbrakk>a \<in> A; b \<in> A; a \<noteq> b\<rbrakk> \<Longrightarrow> coprime a b\<rbrakk> \<Longrightarrow> Lcm A = normalize (\<Prod>A)
[PROOF STEP]
by (rule Lcm_coprime) (simp_all add: card_eq_0_iff)


[STATEMENT]
lemma convergent_prod_altdef:
  fixes f :: "nat \<Rightarrow> 'a :: {t2_space,comm_semiring_1}"
  shows "convergent_prod f \<longleftrightarrow> (\<exists>M L. (\<forall>n\<ge>M. f n \<noteq> 0) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> L \<and> L \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_prod f = (\<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. convergent_prod f \<Longrightarrow> \<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a)
 2. \<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a) \<Longrightarrow> convergent_prod f
[PROOF STEP]
assume "convergent_prod f"
[PROOF STATE]
proof (state)
this:
convergent_prod f

goal (2 subgoals):
 1. convergent_prod f \<Longrightarrow> \<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a)
 2. \<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a) \<Longrightarrow> convergent_prod f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
convergent_prod f
[PROOF STEP]
obtain M L where *: "(\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> L" "L \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
convergent_prod f

goal (1 subgoal):
 1. (\<And>M L. \<lbrakk>(\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L; L \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: prod_defs)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L
L \<noteq> (0::'a)

goal (2 subgoals):
 1. convergent_prod f \<Longrightarrow> \<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a)
 2. \<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a) \<Longrightarrow> convergent_prod f
[PROOF STEP]
have "f i \<noteq> 0" if "i \<ge> M" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i \<noteq> (0::'a)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f i = (0::'a) \<Longrightarrow> False
[PROOF STEP]
assume "f i = 0"
[PROOF STATE]
proof (state)
this:
f i = (0::'a)

goal (1 subgoal):
 1. f i = (0::'a) \<Longrightarrow> False
[PROOF STEP]
have **: "eventually (\<lambda>n. (\<Prod>i\<le>n. f (i+M)) = 0) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (\<Prod>i\<le>n. f (i + M)) = (0::'a)
[PROOF STEP]
using eventually_ge_at_top[of "i - M"]
[PROOF STATE]
proof (prove)
using this:
eventually ((\<le>) (i - M)) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (\<Prod>i\<le>n. f (i + M)) = (0::'a)
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. i - M \<le> n \<Longrightarrow> (\<Prod>i\<le>n. f (i + M)) = (0::'a)
[PROOF STEP]
case (elim n)
[PROOF STATE]
proof (state)
this:
i - M \<le> n

goal (1 subgoal):
 1. \<And>n. i - M \<le> n \<Longrightarrow> (\<Prod>i\<le>n. f (i + M)) = (0::'a)
[PROOF STEP]
with \<open>f i = 0\<close> and \<open>i \<ge> M\<close>
[PROOF STATE]
proof (chain)
picking this:
f i = (0::'a)
M \<le> i
i - M \<le> n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
f i = (0::'a)
M \<le> i
i - M \<le> n

goal (1 subgoal):
 1. (\<Prod>i\<le>n. f (i + M)) = (0::'a)
[PROOF STEP]
by (auto intro!: bexI[of _ "i - M"] prod_zero)
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<le>n. f (i + M)) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. (\<Prod>i\<le>n. f (i + M)) = (0::'a)

goal (1 subgoal):
 1. f i = (0::'a) \<Longrightarrow> False
[PROOF STEP]
have "(\<lambda>n. (\<Prod>i\<le>n. f (i+M))) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
unfolding filterlim_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>P. eventually P (nhds (0::'a)) \<longrightarrow> (\<forall>\<^sub>F x in sequentially. P (\<Prod>i\<le>x. f (i + M)))
[PROOF STEP]
by (auto dest!: eventually_nhds_x_imp_x intro!: eventually_mono[OF **])
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> (0::'a)

goal (1 subgoal):
 1. f i = (0::'a) \<Longrightarrow> False
[PROOF STEP]
from tendsto_unique[OF _ this *(1)] and *(2)
[PROOF STATE]
proof (chain)
picking this:
sequentially \<noteq> bot \<Longrightarrow> (0::'a) = L
L \<noteq> (0::'a)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
sequentially \<noteq> bot \<Longrightarrow> (0::'a) = L
L \<noteq> (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
M \<le> ?i \<Longrightarrow> f ?i \<noteq> (0::'a)

goal (2 subgoals):
 1. convergent_prod f \<Longrightarrow> \<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a)
 2. \<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a) \<Longrightarrow> convergent_prod f
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L
L \<noteq> (0::'a)
M \<le> ?i \<Longrightarrow> f ?i \<noteq> (0::'a)
[PROOF STEP]
show "(\<exists>M L. (\<forall>n\<ge>M. f n \<noteq> 0) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i+M)) \<longlonglongrightarrow> L \<and> L \<noteq> 0)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L
L \<noteq> (0::'a)
M \<le> ?i \<Longrightarrow> f ?i \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>M L. (\<forall>n\<ge>M. f n \<noteq> (0::'a)) \<and> (\<lambda>n. \<Prod>i\<le>n. f (i + M)) \<longlonglongrightarrow> L \<and> L \<noteq> (0::'a) \<Longrightarrow> convergent_prod f
[PROOF STEP]
qed (auto simp: prod_defs)


[STATEMENT]
lemma nonzero_Reals_divide: "a \<in> \<real> \<Longrightarrow> b \<in> \<real> \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> a / b \<in> \<real>"
  for a b :: "'a::real_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> \<real>; b \<in> \<real>; b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> a / b \<in> \<real>
[PROOF STEP]
by (simp add: divide_inverse)


[STATEMENT]
lemma induced_is_subgraph:
  "V \<subseteq> uverts G \<Longrightarrow> subgraph (induced_subgraph V G) G"
  "V \<subseteq> uverts G \<Longrightarrow> subgraph (induced_subgraph V G) (complete V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (V \<subseteq> uverts G \<Longrightarrow> subgraph (induced_subgraph V G) G) &&& (V \<subseteq> uverts G \<Longrightarrow> subgraph (induced_subgraph V G) (Ugraph_Lemmas.complete V))
[PROOF STEP]
unfolding subgraph_def induced_subgraph_def complete_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (V \<subseteq> uverts G \<Longrightarrow> uverts (V, uedges G \<inter> all_edges V) \<subseteq> uverts G \<and> uedges (V, uedges G \<inter> all_edges V) \<subseteq> uedges G) &&& (V \<subseteq> uverts G \<Longrightarrow> uverts (V, uedges G \<inter> all_edges V) \<subseteq> uverts (V, all_edges V) \<and> uedges (V, uedges G \<inter> all_edges V) \<subseteq> uedges (V, all_edges V))
[PROOF STEP]
by simp+


[STATEMENT]
lemma adds_deg_pm_antisym: "s adds t \<Longrightarrow> deg_pm t \<le> deg_pm (s::_ \<Rightarrow>\<^sub>0 _::add_linorder_min) \<Longrightarrow> s = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>s adds t; deg_pm t \<le> deg_pm s\<rbrakk> \<Longrightarrow> s = t
[PROOF STEP]
by (metis (no_types, lifting) add.right_neutral add.right_neutral add_left_cancel addsE
      deg_pm_eq_0_iff deg_pm_mono deg_pm_plus dual_order.antisym)


[STATEMENT]
lemma inversion_inversion_id [simp]:
  shows "inversion \<circ> inversion = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inversion \<circ> inversion = id
[PROOF STEP]
by (rule ext, simp)


[STATEMENT]
lemma (in ring_hom_ring) img_is_add_subgroup:
  assumes "subgroup H (add_monoid R)"
  shows "subgroup (h ` H) (add_monoid S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup (h ` H) (add_monoid S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subgroup (h ` H) (add_monoid S)
[PROOF STEP]
have "group ((add_monoid R) \<lparr> carrier := H \<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group (add_monoid R\<lparr>carrier := H\<rparr>)
[PROOF STEP]
using assms R.add.subgroup_imp_group
[PROOF STATE]
proof (prove)
using this:
subgroup H (add_monoid R)
subgroup ?H (add_monoid R) \<Longrightarrow> Group.group (add_monoid R\<lparr>carrier := ?H\<rparr>)

goal (1 subgoal):
 1. Group.group (add_monoid R\<lparr>carrier := H\<rparr>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Group.group (add_monoid R\<lparr>carrier := H\<rparr>)

goal (1 subgoal):
 1. subgroup (h ` H) (add_monoid S)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Group.group (add_monoid R\<lparr>carrier := H\<rparr>)

goal (1 subgoal):
 1. subgroup (h ` H) (add_monoid S)
[PROOF STEP]
have "H \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H \<subseteq> carrier R
[PROOF STEP]
by (simp add: R.add.subgroupE(1) assms)
[PROOF STATE]
proof (state)
this:
H \<subseteq> carrier R

goal (1 subgoal):
 1. subgroup (h ` H) (add_monoid S)
[PROOF STEP]
hence "h \<in> hom ((add_monoid R) \<lparr> carrier := H \<rparr>) (add_monoid S)"
[PROOF STATE]
proof (prove)
using this:
H \<subseteq> carrier R

goal (1 subgoal):
 1. h \<in> hom (add_monoid R\<lparr>carrier := H\<rparr>) (add_monoid S)
[PROOF STEP]
unfolding hom_def
[PROOF STATE]
proof (prove)
using this:
H \<subseteq> carrier R

goal (1 subgoal):
 1. h \<in> {h \<in> carrier (add_monoid R\<lparr>carrier := H\<rparr>) \<rightarrow> carrier (add_monoid S). \<forall>x\<in>carrier (add_monoid R\<lparr>carrier := H\<rparr>). \<forall>y\<in>carrier (add_monoid R\<lparr>carrier := H\<rparr>). h (x \<otimes>\<^bsub>add_monoid R\<lparr>carrier := H\<rparr>\<^esub> y) = h x \<otimes>\<^bsub>add_monoid S\<^esub> h y}
[PROOF STEP]
by (auto simp add: subsetD)
[PROOF STATE]
proof (state)
this:
h \<in> hom (add_monoid R\<lparr>carrier := H\<rparr>) (add_monoid S)

goal (1 subgoal):
 1. subgroup (h ` H) (add_monoid S)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Group.group (add_monoid R\<lparr>carrier := H\<rparr>)
h \<in> hom (add_monoid R\<lparr>carrier := H\<rparr>) (add_monoid S)
[PROOF STEP]
have "subgroup (h ` carrier ((add_monoid R) \<lparr> carrier := H \<rparr>)) (add_monoid S)"
[PROOF STATE]
proof (prove)
using this:
Group.group (add_monoid R\<lparr>carrier := H\<rparr>)
h \<in> hom (add_monoid R\<lparr>carrier := H\<rparr>) (add_monoid S)

goal (1 subgoal):
 1. subgroup (h ` carrier (add_monoid R\<lparr>carrier := H\<rparr>)) (add_monoid S)
[PROOF STEP]
using group_hom.img_is_subgroup[of "(add_monoid R) \<lparr> carrier := H \<rparr>" "add_monoid S" h]
[PROOF STATE]
proof (prove)
using this:
Group.group (add_monoid R\<lparr>carrier := H\<rparr>)
h \<in> hom (add_monoid R\<lparr>carrier := H\<rparr>) (add_monoid S)
group_hom (add_monoid R\<lparr>carrier := H\<rparr>) (add_monoid S) h \<Longrightarrow> subgroup (h ` carrier (add_monoid R\<lparr>carrier := H\<rparr>)) (add_monoid S)

goal (1 subgoal):
 1. subgroup (h ` carrier (add_monoid R\<lparr>carrier := H\<rparr>)) (add_monoid S)
[PROOF STEP]
using a_group_hom group_hom_axioms.intro group_hom_def
[PROOF STATE]
proof (prove)
using this:
Group.group (add_monoid R\<lparr>carrier := H\<rparr>)
h \<in> hom (add_monoid R\<lparr>carrier := H\<rparr>) (add_monoid S)
group_hom (add_monoid R\<lparr>carrier := H\<rparr>) (add_monoid S) h \<Longrightarrow> subgroup (h ` carrier (add_monoid R\<lparr>carrier := H\<rparr>)) (add_monoid S)
group_hom (add_monoid R) (add_monoid S) h
?h \<in> hom ?G ?H \<Longrightarrow> group_hom_axioms ?G ?H ?h
group_hom ?G ?H ?h \<equiv> Group.group ?G \<and> Group.group ?H \<and> group_hom_axioms ?G ?H ?h

goal (1 subgoal):
 1. subgroup (h ` carrier (add_monoid R\<lparr>carrier := H\<rparr>)) (add_monoid S)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
subgroup (h ` carrier (add_monoid R\<lparr>carrier := H\<rparr>)) (add_monoid S)

goal (1 subgoal):
 1. subgroup (h ` H) (add_monoid S)
[PROOF STEP]
thus "subgroup (h ` H) (add_monoid S)"
[PROOF STATE]
proof (prove)
using this:
subgroup (h ` carrier (add_monoid R\<lparr>carrier := H\<rparr>)) (add_monoid S)

goal (1 subgoal):
 1. subgroup (h ` H) (add_monoid S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
subgroup (h ` H) (add_monoid S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma app_vrange_def: "\<R>\<^sub>\<circ> r = set {b. \<exists>a. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> r = set {b. \<exists>a. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r}
[PROOF STEP]
unfolding vrange_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>r\<in>\<^sub>\<circ>set {r}. set {b. \<exists>a. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r})\<lparr>r\<rparr> = set {b. \<exists>a. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r}
[PROOF STEP]
by simp


[STATEMENT]
lemma worecSL_isSucc:
assumes a: "adm_woL L" and i: "isSucc i"
shows "worecSL S L i = S (pred i) (worecSL S L (pred i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. worecSL S L i = S (pred i) (worecSL S L (pred i))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. worecSL S L i = S (pred i) (worecSL S L (pred i))
[PROOF STEP]
let ?H = "mergeSL S L"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. worecSL S L i = S (pred i) (worecSL S L (pred i))
[PROOF STEP]
have "worecSL S L i = ?H (worec ?H) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. worecSL S L i = mergeSL S L (local.worec (mergeSL S L)) i
[PROOF STEP]
unfolding worecSL_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.worec (mergeSL S L) i = mergeSL S L (local.worec (mergeSL S L)) i
[PROOF STEP]
using worec_fixpoint1[OF mergeSL[OF a]]
[PROOF STATE]
proof (prove)
using this:
local.worec (mergeSL ?S1 L) ?i = mergeSL ?S1 L (local.worec (mergeSL ?S1 L)) ?i

goal (1 subgoal):
 1. local.worec (mergeSL S L) i = mergeSL S L (local.worec (mergeSL S L)) i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
worecSL S L i = mergeSL S L (local.worec (mergeSL S L)) i

goal (1 subgoal):
 1. worecSL S L i = S (pred i) (worecSL S L (pred i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
worecSL S L i = mergeSL S L (local.worec (mergeSL S L)) i

goal (1 subgoal):
 1. worecSL S L i = S (pred i) (worecSL S L (pred i))
[PROOF STEP]
have "... = S (pred i) (worecSL S L (pred i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mergeSL S L (local.worec (mergeSL S L)) i = S (pred i) (worecSL S L (pred i))
[PROOF STEP]
unfolding worecSL_def mergeSL_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if isSucc i then S (pred i) (local.worec (\<lambda>f i. if isSucc i then S (pred i) (f (pred i)) else L f i) (pred i)) else L (local.worec (\<lambda>f i. if isSucc i then S (pred i) (f (pred i)) else L f i)) i) = S (pred i) (local.worec (\<lambda>f i. if isSucc i then S (pred i) (f (pred i)) else L f i) (pred i))
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
isSucc i

goal (1 subgoal):
 1. (if isSucc i then S (pred i) (local.worec (\<lambda>f i. if isSucc i then S (pred i) (f (pred i)) else L f i) (pred i)) else L (local.worec (\<lambda>f i. if isSucc i then S (pred i) (f (pred i)) else L f i)) i) = S (pred i) (local.worec (\<lambda>f i. if isSucc i then S (pred i) (f (pred i)) else L f i) (pred i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mergeSL S L (local.worec (mergeSL S L)) i = S (pred i) (worecSL S L (pred i))

goal (1 subgoal):
 1. worecSL S L i = S (pred i) (worecSL S L (pred i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
worecSL S L i = S (pred i) (worecSL S L (pred i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
worecSL S L i = S (pred i) (worecSL S L (pred i))

goal (1 subgoal):
 1. worecSL S L i = S (pred i) (worecSL S L (pred i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
worecSL S L i = S (pred i) (worecSL S L (pred i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma median_rat:
  assumes "n > 0"
  shows "real_of_rat (median n f) = median n (\<lambda>i. real_of_rat (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat (median n f) = median n (\<lambda>i. real_of_rat (f i))
[PROOF STEP]
apply (subst (2) comp_def[where g="f", symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat (median n f) = median n (real_of_rat \<circ> f)
[PROOF STEP]
apply (rule median_commute_mono[OF assms(1)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono real_of_rat
[PROOF STEP]
by (simp add: mono_def of_rat_less_eq)


[STATEMENT]
lemma conv_dist_sum:
  fixes f :: "'b::finite \<Rightarrow> 'a"
  shows "(\<Squnion>\<^sub>k (f k)\<^sup>T) = (\<Squnion>\<^sub>k f k)\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comm_monoid_add.sum (\<squnion>) bot (\<lambda>k. f k\<^sup>T) {k. True} = comm_monoid_add.sum (\<squnion>) bot f {k. True}\<^sup>T
[PROOF STEP]
proof (induct rule: one_sup_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. f i\<^sup>T = f i\<^sup>T
 2. \<And>j I. \<lbrakk>j \<notin> I; comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = comm_monoid_add.sum (\<squnion>) bot f I\<^sup>T\<rbrakk> \<Longrightarrow> f j\<^sup>T \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)\<^sup>T
[PROOF STEP]
case one
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>i. f i\<^sup>T = f i\<^sup>T
 2. \<And>j I. \<lbrakk>j \<notin> I; comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = comm_monoid_add.sum (\<squnion>) bot f I\<^sup>T\<rbrakk> \<Longrightarrow> f j\<^sup>T \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)\<^sup>T
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i_\<^sup>T = f i_\<^sup>T
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f i_\<^sup>T = f i_\<^sup>T

goal (1 subgoal):
 1. \<And>j I. \<lbrakk>j \<notin> I; comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = comm_monoid_add.sum (\<squnion>) bot f I\<^sup>T\<rbrakk> \<Longrightarrow> f j\<^sup>T \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)\<^sup>T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j I. \<lbrakk>j \<notin> I; comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = comm_monoid_add.sum (\<squnion>) bot f I\<^sup>T\<rbrakk> \<Longrightarrow> f j\<^sup>T \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)\<^sup>T
[PROOF STEP]
case (sup j I)
[PROOF STATE]
proof (state)
this:
j \<notin> I
comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = comm_monoid_add.sum (\<squnion>) bot f I\<^sup>T

goal (1 subgoal):
 1. \<And>j I. \<lbrakk>j \<notin> I; comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = comm_monoid_add.sum (\<squnion>) bot f I\<^sup>T\<rbrakk> \<Longrightarrow> f j\<^sup>T \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)\<^sup>T
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
j \<notin> I
comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = comm_monoid_add.sum (\<squnion>) bot f I\<^sup>T

goal (1 subgoal):
 1. f j\<^sup>T \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)\<^sup>T
[PROOF STEP]
by (simp add: conv_dist_sup)
[PROOF STATE]
proof (state)
this:
f j\<^sup>T \<squnion> comm_monoid_add.sum (\<squnion>) bot (\<lambda>i. f i\<^sup>T) I = (f j \<squnion> comm_monoid_add.sum (\<squnion>) bot f I)\<^sup>T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "check_eqv (Abs_idx (0, 2))
  (FEx SO (FAnd (FBase (Subset 1 0)) (FSuc_SO 0 2)))
  (FAll FO (FImp (FIn 0 0) (FEx FO (FAnd (FEq_Plus 1 0 1) (FIn 0 1)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. check_eqv (Abs_idx (0, 2)) (\<exists>\<^sub>2 FBase (Subset 1 0) \<and> X\<^sub>0 = X\<^sub>2 + 1) (\<forall>\<^sub>1 \<not> x\<^sub>0 \<in> X\<^bsub>0\<^esub> \<or> (\<exists>\<^sub>1 x\<^sub>1 = x\<^sub>0 + 1 \<and> x\<^sub>0 \<in> X\<^bsub>1\<^esub>))
[PROOF STEP]
by check_equiv


[STATEMENT]
lemma Sup_to_Inf_var: "\<Squnion>X = \<partial> (\<Sqinter>(\<partial> ` X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> X = \<partial> (\<Sqinter> (\<partial> ` X))
[PROOF STEP]
using Sup_to_Inf
[PROOF STATE]
proof (prove)
using this:
Sup = \<partial> \<circ> Inf \<circ> (`) \<partial>

goal (1 subgoal):
 1. \<Squnion> X = \<partial> (\<Sqinter> (\<partial> ` X))
[PROOF STEP]
by force


[STATEMENT]
lemma res_zero_eq: "\<zero> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<zero> = 0
[PROOF STEP]
by (auto simp: R_m_def residue_ring_def)


[STATEMENT]
lemma (in Tarski) f'z_in_int_rel: "[| z \<in> P; \<forall>y\<in>Y. (y, z) \<in> induced P r |]
      ==> ((\<lambda>x \<in> intY1. f x) z, z) \<in> induced intY1 r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>z \<in> P; \<forall>y\<in>Y. (y, z) \<in> induced P r\<rbrakk> \<Longrightarrow> (restrict f intY1 z, z) \<in> induced intY1 r
[PROOF STEP]
using P_def fix_imp_eq indI intY1_elem reflE z_in_interval
[PROOF STATE]
proof (prove)
using this:
P \<equiv> fix f A
?x \<in> fix ?f ?A \<Longrightarrow> ?f ?x = ?x
\<lbrakk>(?x, ?y) \<in> r; ?x \<in> ?S; ?y \<in> ?S\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> induced ?S r
?c \<in> intY1 \<Longrightarrow> ?c \<in> A
?x \<in> A \<Longrightarrow> (?x, ?x) \<in> r
\<lbrakk>?z \<in> P; \<forall>y\<in>Y. (y, ?z) \<in> induced P r\<rbrakk> \<Longrightarrow> ?z \<in> intY1

goal (1 subgoal):
 1. \<lbrakk>z \<in> P; \<forall>y\<in>Y. (y, z) \<in> induced P r\<rbrakk> \<Longrightarrow> (restrict f intY1 z, z) \<in> induced intY1 r
[PROOF STEP]
by fastforce


[STATEMENT]
lemma pp_point_linorder_matrix:
  fixes f :: "('a::finite,'b::non_trivial_linorder_stone_relation_algebra_expansion) square"
  shows "matrix_stone_relation_algebra.pp_point f \<longleftrightarrow> (\<exists>i . \<forall>j . f (i,j) \<noteq> bot \<and> (\<forall>k . f (i,j) = f (i,k)) \<and> (\<forall>k . i \<noteq> k \<longrightarrow> f (k,j) = bot))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_stone_relation_algebra.pp_point f = (\<exists>i. \<forall>j. f (i, j) \<noteq> bot \<and> (\<forall>k. f (i, j) = f (i, k)) \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot))
[PROOF STEP]
apply (unfold vector_linorder_matrix pp_bijective_linorder_matrix)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i j k. f (i, j) = f (i, k)) \<and> (\<forall>j. \<exists>i. f (i, j) \<noteq> bot \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot))) = (\<exists>i. \<forall>j. f (i, j) \<noteq> bot \<and> (\<forall>k. f (i, j) = f (i, k)) \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot))
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>i j k. f (i, j) = f (i, k)) \<and> (\<forall>j. \<exists>i. f (i, j) \<noteq> bot \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot)) \<Longrightarrow> \<exists>i. \<forall>j. f (i, j) \<noteq> bot \<and> (\<forall>k. f (i, j) = f (i, k)) \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot)
 2. \<exists>i. \<forall>j. f (i, j) \<noteq> bot \<and> (\<forall>k. f (i, j) = f (i, k)) \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot) \<Longrightarrow> (\<forall>i j k. f (i, j) = f (i, k)) \<and> (\<forall>j. \<exists>i. f (i, j) \<noteq> bot \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot))
[PROOF STEP]
apply metis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. \<forall>j. f (i, j) \<noteq> bot \<and> (\<forall>k. f (i, j) = f (i, k)) \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot) \<Longrightarrow> (\<forall>i j k. f (i, j) = f (i, k)) \<and> (\<forall>j. \<exists>i. f (i, j) \<noteq> bot \<and> (\<forall>k. i \<noteq> k \<longrightarrow> f (k, j) = bot))
[PROOF STEP]
by metis


[STATEMENT]
lemma ennreal_divide_zero[simp]: "x / (0::ennreal) = (if x = 0 then 0 else top)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x / 0 = (if x = 0 then 0 else top)
[PROOF STEP]
by (simp add: divide_ennreal_def ennreal_mult_top)


[STATEMENT]
lemma SEQ_Infinitesimal: "( *f* (\<lambda>n::nat. inverse(real(Suc n)))) whn \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*f* (\<lambda>n. inverse (real (Suc n)))) whn \<in> Infinitesimal
[PROOF STEP]
by (simp add: hypnat_omega_def starfun_star_n star_n_inverse Infinitesimal_FreeUltrafilterNat_iff
      FreeUltrafilterNat_inverse_real_of_posnat del: of_nat_Suc)


[STATEMENT]
lemma no_plus_overflow_unat_size: "x \<le> x + y \<longleftrightarrow> unat x + unat y < 2 ^ size x"
  for x y :: "'a::len word"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> x + y) = (unat x + unat y < 2 ^ size x)
[PROOF STEP]
unfolding word_size
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> x + y) = (unat x + unat y < 2 ^ LENGTH('a))
[PROOF STEP]
by unat_arith


[STATEMENT]
lemma infinite_arith_prog: "b > 0 \<Longrightarrow> infinite (arith_prog a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < b \<Longrightarrow> infinite (arith_prog a b)
[PROOF STEP]
using bij_betw_finite[OF bij_betw_arith_prog[of b]]
[PROOF STATE]
proof (prove)
using this:
0 < b \<Longrightarrow> finite UNIV = finite (arith_prog ?a1 b)

goal (1 subgoal):
 1. 0 < b \<Longrightarrow> infinite (arith_prog a b)
[PROOF STEP]
by simp


[STATEMENT]
lemma cblinfun_apply_ccspan_using_vec:
  "A *\<^sub>S ccspan (set S) = ccspan (basis_enum_of_vec ` set (map ((*\<^sub>v) (mat_of_cblinfun A)) (map vec_of_basis_enum S)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>S ccspan (set S) = ccspan (basis_enum_of_vec ` set (map ((*\<^sub>v) (mat_of_cblinfun A)) (map vec_of_basis_enum S)))
[PROOF STEP]
apply (auto simp: cblinfun_image_ccspan image_image)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccspan ((*\<^sub>V) A ` set S) = ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v vec_of_basis_enum x)) ` set S)
[PROOF STEP]
by (metis mat_of_cblinfun_cblinfun_apply vec_of_basis_enum_inverse)


[STATEMENT]
lemma rtos_hom3_1:"\<lbrakk>(0::nat) < r; (0::nat) < s; i \<le> (r * s - Suc 0) \<rbrakk> \<Longrightarrow>
  (rtos r s i mod  r) = i div s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0\<rbrakk> \<Longrightarrow> rtos r s i mod r = i div s
[PROOF STEP]
apply (simp add:rtos_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0\<rbrakk> \<Longrightarrow> i < r * s \<longrightarrow> i div s mod r = i div s
[PROOF STEP]
apply (simp add:rfn_tool11 [of "r * s" "i"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0\<rbrakk> \<Longrightarrow> i div s mod r = i div s
[PROOF STEP]
apply (frule rtos_hom0 [of "r" "s" "i"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i div s < r\<rbrakk> \<Longrightarrow> i div s mod r = i div s
[PROOF STEP]
apply (simp add:mem_of_Nset)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma start_of_Suc2:
  "\<lbrakk>ly = layout_of ap;
  abc_fetch as ap = Some (Dec n e)\<rbrakk> \<Longrightarrow>
        start_of ly (Suc as) =
            start_of ly as + 2 * n + 16"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ly = layout_of ap; abc_fetch as ap = Some (Dec n e)\<rbrakk> \<Longrightarrow> start_of ly (Suc as) = start_of ly as + 2 * n + 16
[PROOF STEP]
apply(auto simp: start_of.simps layout_of.simps
      length_of.simps abc_fetch.simps
      take_Suc_conv_app_nth split: if_splits)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nodes_root_height_upper_bound:
  assumes "root_order k t"
    and "bal t"
  shows "nodes t * (2*k) \<le> (2*k+1)^(height t) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
proof(cases t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
case (Node ts t)
[PROOF STATE]
proof (state)
this:
t = Node ts t

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
let ?sub_height = "((2 * k + 1) ^ height t - 1)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
have "sum_list (map nodes (subtrees ts)) * (2*k) =
        sum_list (map (\<lambda>t. nodes t * (2 * k)) (subtrees ts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map nodes (subtrees ts)) * (2 * k) = (\<Sum>t\<leftarrow>subtrees ts. nodes t * (2 * k))
[PROOF STEP]
using sum_list_mult_const
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<leftarrow>?xs. ?f x * ?c) = sum_list (map ?f ?xs) * ?c

goal (1 subgoal):
 1. sum_list (map nodes (subtrees ts)) * (2 * k) = (\<Sum>t\<leftarrow>subtrees ts. nodes t * (2 * k))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
sum_list (map nodes (subtrees ts)) * (2 * k) = (\<Sum>t\<leftarrow>subtrees ts. nodes t * (2 * k))

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map nodes (subtrees ts)) * (2 * k) = (\<Sum>t\<leftarrow>subtrees ts. nodes t * (2 * k))

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
have "\<dots> \<le> sum_list (map (\<lambda>x.?sub_height) (subtrees ts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>subtrees ts. nodes t * (2 * k)) \<le> (\<Sum>x\<leftarrow>subtrees ts. bound (2 * k) (height t))
[PROOF STEP]
using Node
      sum_list_mono[of "subtrees ts" "\<lambda>x. nodes x * (2*k)"  "\<lambda>x. (2*k+1)^(height t) - 1"]
      nodes_height_upper_bound assms
[PROOF STATE]
proof (prove)
using this:
t = Node ts t
(\<And>x. x \<in> set (subtrees ts) \<Longrightarrow> nodes x * (2 * k) \<le> bound (2 * k) (height t)) \<Longrightarrow> (\<Sum>x\<leftarrow>subtrees ts. nodes x * (2 * k)) \<le> (\<Sum>x\<leftarrow>subtrees ts. bound (2 * k) (height t))
\<lbrakk>order ?k ?t; bal ?t\<rbrakk> \<Longrightarrow> nodes ?t * (2 * ?k) \<le> bound (2 * ?k) (height ?t)
root_order k t
bal t

goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>subtrees ts. nodes t * (2 * k)) \<le> (\<Sum>x\<leftarrow>subtrees ts. bound (2 * k) (height t))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>subtrees ts. nodes t * (2 * k)) \<le> (\<Sum>x\<leftarrow>subtrees ts. bound (2 * k) (height t))

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>subtrees ts. nodes t * (2 * k)) \<le> (\<Sum>x\<leftarrow>subtrees ts. bound (2 * k) (height t))

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
have "\<dots> = sum_list (replicate (length ts) ?sub_height)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>subtrees ts. bound (2 * k) (height t)) = sum_list (replicate (length ts) (bound (2 * k) (height t)))
[PROOF STEP]
using map_replicate_const[of ?sub_height "subtrees ts"] length_map
[PROOF STATE]
proof (prove)
using this:
map (\<lambda>x. bound (2 * k) (height t)) (subtrees ts) = replicate (length (subtrees ts)) (bound (2 * k) (height t))
length (map ?f ?xs) = length ?xs

goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>subtrees ts. bound (2 * k) (height t)) = sum_list (replicate (length ts) (bound (2 * k) (height t)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>subtrees ts. bound (2 * k) (height t)) = sum_list (replicate (length ts) (bound (2 * k) (height t)))

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>subtrees ts. bound (2 * k) (height t)) = sum_list (replicate (length ts) (bound (2 * k) (height t)))

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
have "\<dots> = (length ts)*(?sub_height)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (replicate (length ts) (bound (2 * k) (height t))) = length ts * bound (2 * k) (height t)
[PROOF STEP]
using sum_list_replicate
[PROOF STATE]
proof (prove)
using this:
sum_list (replicate ?n ?c) = ?n * ?c

goal (1 subgoal):
 1. sum_list (replicate (length ts) (bound (2 * k) (height t))) = length ts * bound (2 * k) (height t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (replicate (length ts) (bound (2 * k) (height t))) = length ts * bound (2 * k) (height t)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (replicate (length ts) (bound (2 * k) (height t))) = length ts * bound (2 * k) (height t)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
have "\<dots> \<le> (2*k)*?sub_height"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ts * bound (2 * k) (height t) \<le> 2 * k * bound (2 * k) (height t)
[PROOF STEP]
using assms Node
[PROOF STATE]
proof (prove)
using this:
root_order k t
bal t
t = Node ts t

goal (1 subgoal):
 1. length ts * bound (2 * k) (height t) \<le> 2 * k * bound (2 * k) (height t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length ts * bound (2 * k) (height t) \<le> 2 * k * bound (2 * k) (height t)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_list (map nodes (subtrees ts)) * (2 * k) \<le> 2 * k * bound (2 * k) (height t)
[PROOF STEP]
have "sum_list (map nodes (subtrees ts))*(2*k) \<le> ?sub_height*(2*k)"
[PROOF STATE]
proof (prove)
using this:
sum_list (map nodes (subtrees ts)) * (2 * k) \<le> 2 * k * bound (2 * k) (height t)

goal (1 subgoal):
 1. sum_list (map nodes (subtrees ts)) * (2 * k) \<le> bound (2 * k) (height t) * (2 * k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (map nodes (subtrees ts)) * (2 * k) \<le> bound (2 * k) (height t) * (2 * k)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sum_list (map nodes (subtrees ts)) * (2 * k) \<le> bound (2 * k) (height t) * (2 * k)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
have "(nodes t)*(2*k) \<le> ?sub_height"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
using Node assms nodes_height_upper_bound
[PROOF STATE]
proof (prove)
using this:
t = Node ts t
root_order k t
bal t
\<lbrakk>order ?k ?t; bal ?t\<rbrakk> \<Longrightarrow> nodes ?t * (2 * ?k) \<le> bound (2 * ?k) (height ?t)

goal (1 subgoal):
 1. nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nodes t * (2 * k) \<le> bound (2 * k) (height t)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sum_list (map nodes (subtrees ts)) * (2 * k) \<le> bound (2 * k) (height t) * (2 * k)
nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
have "(nodes (Node ts t))*(2*k) \<le>
         2*k
        + ?sub_height * (2*k)
        + ?sub_height"
[PROOF STATE]
proof (prove)
using this:
sum_list (map nodes (subtrees ts)) * (2 * k) \<le> bound (2 * k) (height t) * (2 * k)
nodes t * (2 * k) \<le> bound (2 * k) (height t)

goal (1 subgoal):
 1. nodes (Node ts t) * (2 * k) \<le> 2 * k + bound (2 * k) (height t) * (2 * k) + bound (2 * k) (height t)
[PROOF STEP]
unfolding nodes.simps add_mult_distrib
[PROOF STATE]
proof (prove)
using this:
sum_list (map nodes (subtrees ts)) * (2 * k) \<le> bound (2 * k) (height t) * (2 * k)
nodes t * (2 * k) \<le> bound (2 * k) (height t)

goal (1 subgoal):
 1. 1 * (2 * k) + sum_list (map nodes (subtrees ts)) * (2 * k) + nodes t * (2 * k) \<le> 2 * k + bound (2 * k) (height t) * (2 * k) + bound (2 * k) (height t)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
nodes (Node ts t) * (2 * k) \<le> 2 * k + bound (2 * k) (height t) * (2 * k) + bound (2 * k) (height t)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nodes (Node ts t) * (2 * k) \<le> 2 * k + bound (2 * k) (height t) * (2 * k) + bound (2 * k) (height t)

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
have "\<dots> =  2*k + (2*k)*((2 * k + 1) ^ height t) - 2*k + (2 * k + 1) ^ height t - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * k + bound (2 * k) (height t) * (2 * k) + bound (2 * k) (height t) = 2 * k + 2 * k * (2 * k + 1) ^ height t - 2 * k + (2 * k + 1) ^ height t - 1
[PROOF STEP]
by (simp add: diff_mult_distrib2 mult.assoc mult.commute)
[PROOF STATE]
proof (state)
this:
2 * k + bound (2 * k) (height t) * (2 * k) + bound (2 * k) (height t) = 2 * k + 2 * k * (2 * k + 1) ^ height t - 2 * k + (2 * k + 1) ^ height t - 1

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * k + bound (2 * k) (height t) * (2 * k) + bound (2 * k) (height t) = 2 * k + 2 * k * (2 * k + 1) ^ height t - 2 * k + (2 * k + 1) ^ height t - 1

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
have "\<dots> = (2*k)*((2 * k + 1) ^ height t) + (2 * k + 1) ^ height t - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * k + 2 * k * (2 * k + 1) ^ height t - 2 * k + (2 * k + 1) ^ height t - 1 = 2 * k * (2 * k + 1) ^ height t + (2 * k + 1) ^ height t - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * k + 2 * k * (2 * k + 1) ^ height t - 2 * k + (2 * k + 1) ^ height t - 1 = 2 * k * (2 * k + 1) ^ height t + (2 * k + 1) ^ height t - 1

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * k + 2 * k * (2 * k + 1) ^ height t - 2 * k + (2 * k + 1) ^ height t - 1 = 2 * k * (2 * k + 1) ^ height t + (2 * k + 1) ^ height t - 1

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
have "\<dots> = (2*k+1)^(Suc(height t)) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * k * (2 * k + 1) ^ height t + (2 * k + 1) ^ height t - 1 = bound (2 * k) (Suc (height t))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * k * (2 * k + 1) ^ height t + (2 * k + 1) ^ height t - 1 = bound (2 * k) (Suc (height t))

goal (2 subgoals):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
 2. \<And>x21 x22. t = Node x21 x22 \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
nodes (Node ts t) * (2 * k) \<le> bound (2 * k) (Suc (height t))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nodes (Node ts t) * (2 * k) \<le> bound (2 * k) (Suc (height t))

goal (1 subgoal):
 1. nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
by (metis Node assms(2) height_bal_tree)
[PROOF STATE]
proof (state)
this:
nodes t * (2 * k) \<le> bound (2 * k) (height t)

goal (1 subgoal):
 1. t = Leaf \<Longrightarrow> nodes t * (2 * k) \<le> bound (2 * k) (height t)
[PROOF STEP]
qed simp