[STATEMENT]
lemma path_image_circlepath_nonneg:
  assumes "0 \<le> r" shows "path_image (circlepath z r) = sphere z r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (circlepath z r) = sphere z r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path_image (circlepath z r) = sphere z r
[PROOF STEP]
have *: "x \<in> (\<lambda>u. z + (cmod (x - z)) * exp (\<i> * (of_real u * (of_real pi * 2)))) ` {0..1}" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
proof (cases "x = z")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = z \<Longrightarrow> x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
 2. x \<noteq> z \<Longrightarrow> x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = z

goal (2 subgoals):
 1. x = z \<Longrightarrow> x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
 2. x \<noteq> z \<Longrightarrow> x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = z

goal (1 subgoal):
 1. x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> z

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
define w where "w = x - z"
[PROOF STATE]
proof (state)
this:
w = x - z

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
w = x - z
[PROOF STEP]
have "w \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
w = x - z

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

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
have **: "\<And>t. \<lbrakk>Re w = cos t * cmod w; Im w = sin t * cmod w\<rbrakk> \<Longrightarrow> w = of_real (cmod w) * exp (\<i> * t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t. \<lbrakk>Re w = cos t * cmod w; Im w = sin t * cmod w\<rbrakk> \<Longrightarrow> w = complex_of_real (cmod w) * exp (\<i> * complex_of_real t)
[PROOF STEP]
using cis_conv_exp complex_eq_iff
[PROOF STATE]
proof (prove)
using this:
cis ?b = exp (\<i> * complex_of_real ?b)
(?x = ?y) = (Re ?x = Re ?y \<and> Im ?x = Im ?y)

goal (1 subgoal):
 1. \<And>t. \<lbrakk>Re w = cos t * cmod w; Im w = sin t * cmod w\<rbrakk> \<Longrightarrow> w = complex_of_real (cmod w) * exp (\<i> * complex_of_real t)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re w = cos ?t * cmod w; Im w = sin ?t * cmod w\<rbrakk> \<Longrightarrow> w = complex_of_real (cmod w) * exp (\<i> * complex_of_real ?t)

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
obtain t where "0 \<le> t" "t < 2*pi" "Re(w/norm w) = cos t" "Im(w/norm w) = sin t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t. \<lbrakk>0 \<le> t; t < 2 * pi; Re (w / complex_of_real (cmod w)) = cos t; Im (w / complex_of_real (cmod w)) = sin t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
apply (rule sincos_total_2pi [of "Re(w/(norm w))" "Im(w/(norm w))"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>t. \<lbrakk>0 \<le> t; t < 2 * pi; Re (w / complex_of_real (cmod w)) = cos t; Im (w / complex_of_real (cmod w)) = sin t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (Re (w / complex_of_real (cmod w)))\<^sup>2 + (Im (w / complex_of_real (cmod w)))\<^sup>2 = 1
 2. \<And>t. \<lbrakk>\<And>t. \<lbrakk>0 \<le> t; t < 2 * pi; Re (w / complex_of_real (cmod w)) = cos t; Im (w / complex_of_real (cmod w)) = sin t\<rbrakk> \<Longrightarrow> thesis; 0 \<le> t; t < 2 * pi; Re (w / complex_of_real (cmod w)) = cos t; Im (w / complex_of_real (cmod w)) = sin t\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: divide_simps \<open>w \<noteq> 0\<close> cmod_power2 [symmetric])
[PROOF STATE]
proof (state)
this:
0 \<le> t
t < 2 * pi
Re (w / complex_of_real (cmod w)) = cos t
Im (w / complex_of_real (cmod w)) = sin t

goal (1 subgoal):
 1. x \<noteq> z \<Longrightarrow> x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> t
t < 2 * pi
Re (w / complex_of_real (cmod w)) = cos t
Im (w / complex_of_real (cmod w)) = sin t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> t
t < 2 * pi
Re (w / complex_of_real (cmod w)) = cos t
Im (w / complex_of_real (cmod w)) = sin t

goal (1 subgoal):
 1. x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
using False ** w_def \<open>w \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> t
t < 2 * pi
Re (w / complex_of_real (cmod w)) = cos t
Im (w / complex_of_real (cmod w)) = sin t
x \<noteq> z
\<lbrakk>Re w = cos ?t * cmod w; Im w = sin ?t * cmod w\<rbrakk> \<Longrightarrow> w = complex_of_real (cmod w) * exp (\<i> * complex_of_real ?t)
w = x - z
w \<noteq> 0

goal (1 subgoal):
 1. x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}
[PROOF STEP]
by (rule_tac x="t / (2*pi)" in image_eqI) (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
x \<in> (\<lambda>u. z + complex_of_real (cmod (x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> (\<lambda>u. z + complex_of_real (cmod (?x - z)) * exp (\<i> * (complex_of_real u * (complex_of_real pi * 2)))) ` {0..1}

goal (1 subgoal):
 1. path_image (circlepath z r) = sphere z r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (circlepath z r) = sphere z r
[PROOF STEP]
unfolding circlepath path_image_def sphere_def dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. z + complex_of_real r * exp (2 * complex_of_real pi * \<i> * complex_of_real x)) ` {0..1} = {y. cmod (z - y) = r}
[PROOF STEP]
by (force simp: assms algebra_simps norm_mult norm_minus_commute intro: *)
[PROOF STATE]
proof (state)
this:
path_image (circlepath z r) = sphere z r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma last_mirror1:
  assumes "knights_path (board n m) ps" "last ps = (i,j)"
  shows "last (mirror1 ps) = (int n+1-i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (mirror1 ps) = (int n + 1 - i, j)
[PROOF STEP]
unfolding mirror1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (mirror1_aux (max1 ps + min1 ps) ps) = (int n + 1 - i, j)
[PROOF STEP]
using assms last_mirror1_aux knights_path_non_nil
[PROOF STATE]
proof (prove)
using this:
knights_path (board n m) ps
last ps = (i, j)
\<lbrakk>?ps \<noteq> []; last ?ps = (?i, ?j)\<rbrakk> \<Longrightarrow> last (mirror1_aux ?n ?ps) = (?n - ?i, ?j)
knights_path ?b ?ps \<Longrightarrow> ?ps \<noteq> []

goal (1 subgoal):
 1. last (mirror1_aux (max1 ps + min1 ps) ps) = (int n + 1 - i, j)
[PROOF STEP]
by (simp add: knights_path_max1 knights_path_min1)


[STATEMENT]
lemma integrable_const_ivl[intro]:
  fixes a::"'a::ordered_euclidean_space"
  shows "(\<lambda>x. c) integrable_on {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c) integrable_on {a..b}
[PROOF STEP]
unfolding cbox_interval[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c) integrable_on cbox a b
[PROOF STEP]
by (rule integrable_const)


[STATEMENT]
lemma divide_gt:
  "\<lbrakk>c *R (a::'a) > b;(c::rat) > 0\<rbrakk> \<Longrightarrow> a > (1/c) *R b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b < c *R a; 0 < c\<rbrakk> \<Longrightarrow> (1 / c) *R b < a
[PROOF STEP]
using scaleRat_less1[of b "c *R a" "1/c"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b < c *R a; 0 < 1 / c\<rbrakk> \<Longrightarrow> (1 / c) *R b < (1 / c) *R c *R a

goal (1 subgoal):
 1. \<lbrakk>b < c *R a; 0 < c\<rbrakk> \<Longrightarrow> (1 / c) *R b < a
[PROOF STEP]
by (simp add: scaleRat_one scaleRat_scaleRat)


[STATEMENT]
lemma fv_simp_foldr_Disj: "\<forall>Q\<in>set Qs \<union> {Q}. simplified Q \<and> fv Q = A \<Longrightarrow>
  fv (simp (foldr Disj Qs Q)) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>Q\<in>set Qs \<union> {Q}. simplified Q \<and> fv Q = A \<Longrightarrow> fv (simp (foldr Disj Qs Q)) = A
[PROOF STEP]
by (induct Qs) (auto simp: Let_def is_Bool_def simplified_fv_simp fv_simp_Disj_same)


[STATEMENT]
lemma smult_content_normalize_primitive_part [simp]:
  fixes p :: "'a :: {normalization_semidom_multiplicative, semiring_gcd, idom_divide} poly"
  shows "smult (content p) (normalize (primitive_part p)) = normalize p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (content p) (normalize (primitive_part p)) = normalize p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. smult (content p) (normalize (primitive_part p)) = normalize p
[PROOF STEP]
have "smult (content p) (normalize (primitive_part p)) =
      normalize ([:content p:] * primitive_part p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (content p) (normalize (primitive_part p)) = normalize ([:content p:] * primitive_part p)
[PROOF STEP]
by (subst normalize_mult) (simp_all add: normalize_const_poly)
[PROOF STATE]
proof (state)
this:
smult (content p) (normalize (primitive_part p)) = normalize ([:content p:] * primitive_part p)

goal (1 subgoal):
 1. smult (content p) (normalize (primitive_part p)) = normalize p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
smult (content p) (normalize (primitive_part p)) = normalize ([:content p:] * primitive_part p)

goal (1 subgoal):
 1. smult (content p) (normalize (primitive_part p)) = normalize p
[PROOF STEP]
have "[:content p:] * primitive_part p = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:content p:] * primitive_part p = p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[:content p:] * primitive_part p = p

goal (1 subgoal):
 1. smult (content p) (normalize (primitive_part p)) = normalize p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
smult (content p) (normalize (primitive_part p)) = normalize p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
smult (content p) (normalize (primitive_part p)) = normalize p

goal (1 subgoal):
 1. smult (content p) (normalize (primitive_part p)) = normalize p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
smult (content p) (normalize (primitive_part p)) = normalize p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma familyUnionFiniteEverySetFinite:
  assumes "finite (\<Union> XX)"
  shows "\<forall>X \<in> XX. finite X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>X\<in>XX. finite X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> XX)

goal (1 subgoal):
 1. \<forall>X\<in>XX. finite X
[PROOF STEP]
by (metis Union_upper finite_subset)


[STATEMENT]
lemma measure_preservingI [intro]:
  assumes "f \<in> measurable M N"
          "\<And>A. A \<in> sets N \<Longrightarrow> emeasure M (f-`A \<inter> space M) = emeasure N A"
  shows "f \<in> measure_preserving M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> measure_preserving M N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> M \<rightarrow>\<^sub>M N
?A \<in> sets N \<Longrightarrow> emeasure M (f -` ?A \<inter> space M) = emeasure N ?A

goal (1 subgoal):
 1. f \<in> measure_preserving M N
[PROOF STEP]
unfolding measure_preserving_def
[PROOF STATE]
proof (prove)
using this:
f \<in> M \<rightarrow>\<^sub>M N
?A \<in> sets N \<Longrightarrow> emeasure M (f -` ?A \<inter> space M) = emeasure N ?A

goal (1 subgoal):
 1. f \<in> {f \<in> M \<rightarrow>\<^sub>M N. \<forall>A\<in>sets N. emeasure M (f -` A \<inter> space M) = emeasure N A}
[PROOF STEP]
by auto


[STATEMENT]
lemma supportE_Suc: "supportE (\<lambda>l s. Suc (e1 l s)) = supportE e1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supportE (\<lambda>l s. Suc (e1 l s)) = supportE e1
[PROOF STEP]
unfolding supportE_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. \<exists>l1 l2 s. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> Suc (e1 l1 s) \<noteq> Suc (e1 l2 s)} = {x. \<exists>l1 l2 s. (\<forall>y. y \<noteq> x \<longrightarrow> l1 y = l2 y) \<and> e1 l1 s \<noteq> e1 l2 s}
[PROOF STEP]
by (auto)


[STATEMENT]
lemma VUnion_upper:
  assumes "x \<in>\<^sub>\<circ> A"
  shows "x \<subseteq>\<^sub>\<circ> \<Union>\<^sub>\<circ>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<subseteq>\<^sub>\<circ> \<Union>\<^sub>\<circ> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> A

goal (1 subgoal):
 1. x \<subseteq>\<^sub>\<circ> \<Union>\<^sub>\<circ> A
[PROOF STEP]
by auto


[STATEMENT]
lemma convex_sum:
  fixes C :: "'a::real_vector set"
  assumes "finite S"
    and "convex C"
    and "(\<Sum> i \<in> S. a i) = 1"
  assumes "\<And>i. i \<in> S \<Longrightarrow> a i \<ge> 0"
    and "\<And>i. i \<in> S \<Longrightarrow> y i \<in> C"
  shows "(\<Sum> j \<in> S. a j *\<^sub>R y j) \<in> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
using assms(1,3,4,5)
[PROOF STATE]
proof (prove)
using this:
finite S
sum a S = 1
?i \<in> S \<Longrightarrow> 0 \<le> a ?i
?i \<in> S \<Longrightarrow> y ?i \<in> C

goal (1 subgoal):
 1. (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
proof (induct arbitrary: a set: finite)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>sum a {} = 1; \<And>i. i \<in> {} \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> {} \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>{}. a j *\<^sub>R y j) \<in> C
 2. \<And>x F a. \<lbrakk>finite F; x \<notin> F; \<And>a. \<lbrakk>sum a F = 1; \<And>i. i \<in> F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>F. a j *\<^sub>R y j) \<in> C; sum a (insert x F) = 1; \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> insert x F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>insert x F. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
sum a {} = 1
?i \<in> {} \<Longrightarrow> 0 \<le> a ?i
?i \<in> {} \<Longrightarrow> y ?i \<in> C

goal (2 subgoals):
 1. \<And>a. \<lbrakk>sum a {} = 1; \<And>i. i \<in> {} \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> {} \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>{}. a j *\<^sub>R y j) \<in> C
 2. \<And>x F a. \<lbrakk>finite F; x \<notin> F; \<And>a. \<lbrakk>sum a F = 1; \<And>i. i \<in> F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>F. a j *\<^sub>R y j) \<in> C; sum a (insert x F) = 1; \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> insert x F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>insert x F. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum a {} = 1
?i \<in> {} \<Longrightarrow> 0 \<le> a ?i
?i \<in> {} \<Longrightarrow> y ?i \<in> C
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sum a {} = 1
?i \<in> {} \<Longrightarrow> 0 \<le> a ?i
?i \<in> {} \<Longrightarrow> y ?i \<in> C

goal (1 subgoal):
 1. (\<Sum>j\<in>{}. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>{}. a j *\<^sub>R y j) \<in> C

goal (1 subgoal):
 1. \<And>x F a. \<lbrakk>finite F; x \<notin> F; \<And>a. \<lbrakk>sum a F = 1; \<And>i. i \<in> F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>F. a j *\<^sub>R y j) \<in> C; sum a (insert x F) = 1; \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> insert x F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>insert x F. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F a. \<lbrakk>finite F; x \<notin> F; \<And>a. \<lbrakk>sum a F = 1; \<And>i. i \<in> F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>F. a j *\<^sub>R y j) \<in> C; sum a (insert x F) = 1; \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> insert x F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>insert x F. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
case (insert i S)
[PROOF STATE]
proof (state)
this:
finite S
i \<notin> S
\<lbrakk>sum ?a S = 1; \<And>i. i \<in> S \<Longrightarrow> 0 \<le> ?a i; \<And>i. i \<in> S \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>S. ?a j *\<^sub>R y j) \<in> C
sum a (insert i S) = 1
?i \<in> insert i S \<Longrightarrow> 0 \<le> a ?i
?i \<in> insert i S \<Longrightarrow> y ?i \<in> C

goal (1 subgoal):
 1. \<And>x F a. \<lbrakk>finite F; x \<notin> F; \<And>a. \<lbrakk>sum a F = 1; \<And>i. i \<in> F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>F. a j *\<^sub>R y j) \<in> C; sum a (insert x F) = 1; \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> insert x F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>insert x F. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
note IH = this(3)
[PROOF STATE]
proof (state)
this:
\<lbrakk>sum ?a S = 1; \<And>i. i \<in> S \<Longrightarrow> 0 \<le> ?a i; \<And>i. i \<in> S \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>S. ?a j *\<^sub>R y j) \<in> C

goal (1 subgoal):
 1. \<And>x F a. \<lbrakk>finite F; x \<notin> F; \<And>a. \<lbrakk>sum a F = 1; \<And>i. i \<in> F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>F. a j *\<^sub>R y j) \<in> C; sum a (insert x F) = 1; \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> insert x F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>insert x F. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
have "a i + sum a S = 1"
    and "0 \<le> a i"
    and "\<forall>j\<in>S. 0 \<le> a j"
    and "y i \<in> C"
    and "\<forall>j\<in>S. y j \<in> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a i + sum a S = 1 &&& 0 \<le> a i) &&& \<forall>j\<in>S. 0 \<le> a j &&& y i \<in> C &&& \<forall>j\<in>S. y j \<in> C
[PROOF STEP]
using insert.hyps(1,2) insert.prems
[PROOF STATE]
proof (prove)
using this:
finite S
i \<notin> S
sum a (insert i S) = 1
?i \<in> insert i S \<Longrightarrow> 0 \<le> a ?i
?i \<in> insert i S \<Longrightarrow> y ?i \<in> C

goal (1 subgoal):
 1. (a i + sum a S = 1 &&& 0 \<le> a i) &&& \<forall>j\<in>S. 0 \<le> a j &&& y i \<in> C &&& \<forall>j\<in>S. y j \<in> C
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
a i + sum a S = 1
0 \<le> a i
\<forall>j\<in>S. 0 \<le> a j
y i \<in> C
\<forall>j\<in>S. y j \<in> C

goal (1 subgoal):
 1. \<And>x F a. \<lbrakk>finite F; x \<notin> F; \<And>a. \<lbrakk>sum a F = 1; \<And>i. i \<in> F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>F. a j *\<^sub>R y j) \<in> C; sum a (insert x F) = 1; \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> insert x F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>insert x F. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a i + sum a S = 1
0 \<le> a i
\<forall>j\<in>S. 0 \<le> a j
y i \<in> C
\<forall>j\<in>S. y j \<in> C
[PROOF STEP]
have "0 \<le> sum a S"
[PROOF STATE]
proof (prove)
using this:
a i + sum a S = 1
0 \<le> a i
\<forall>j\<in>S. 0 \<le> a j
y i \<in> C
\<forall>j\<in>S. y j \<in> C

goal (1 subgoal):
 1. 0 \<le> sum a S
[PROOF STEP]
by (simp add: sum_nonneg)
[PROOF STATE]
proof (state)
this:
0 \<le> sum a S

goal (1 subgoal):
 1. \<And>x F a. \<lbrakk>finite F; x \<notin> F; \<And>a. \<lbrakk>sum a F = 1; \<And>i. i \<in> F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>F. a j *\<^sub>R y j) \<in> C; sum a (insert x F) = 1; \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> insert x F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>insert x F. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
have "a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
proof (cases "sum a S = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum a S = 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
 2. sum a S \<noteq> 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
sum a S = 0

goal (2 subgoals):
 1. sum a S = 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
 2. sum a S \<noteq> 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
with \<open>a i + sum a S = 1\<close>
[PROOF STATE]
proof (chain)
picking this:
a i + sum a S = 1
sum a S = 0
[PROOF STEP]
have "a i = 1"
[PROOF STATE]
proof (prove)
using this:
a i + sum a S = 1
sum a S = 0

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

goal (2 subgoals):
 1. sum a S = 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
 2. sum a S \<noteq> 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
from sum_nonneg_0 [OF \<open>finite S\<close> _ True] \<open>\<forall>j\<in>S. 0 \<le> a j\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>i. i \<in> S \<Longrightarrow> 0 \<le> a i; ?i \<in> S\<rbrakk> \<Longrightarrow> a ?i = 0
\<forall>j\<in>S. 0 \<le> a j
[PROOF STEP]
have "\<forall>j\<in>S. a j = 0"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>i. i \<in> S \<Longrightarrow> 0 \<le> a i; ?i \<in> S\<rbrakk> \<Longrightarrow> a ?i = 0
\<forall>j\<in>S. 0 \<le> a j

goal (1 subgoal):
 1. \<forall>j\<in>S. a j = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>j\<in>S. a j = 0

goal (2 subgoals):
 1. sum a S = 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
 2. sum a S \<noteq> 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
using \<open>a i = 1\<close> and \<open>\<forall>j\<in>S. a j = 0\<close> and \<open>y i \<in> C\<close>
[PROOF STATE]
proof (prove)
using this:
a i = 1
\<forall>j\<in>S. a j = 0
y i \<in> C

goal (1 subgoal):
 1. a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C

goal (1 subgoal):
 1. sum a S \<noteq> 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum a S \<noteq> 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
sum a S \<noteq> 0

goal (1 subgoal):
 1. sum a S \<noteq> 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
with \<open>0 \<le> sum a S\<close>
[PROOF STATE]
proof (chain)
picking this:
0 \<le> sum a S
sum a S \<noteq> 0
[PROOF STEP]
have "0 < sum a S"
[PROOF STATE]
proof (prove)
using this:
0 \<le> sum a S
sum a S \<noteq> 0

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

goal (1 subgoal):
 1. sum a S \<noteq> 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < sum a S
[PROOF STEP]
have "(\<Sum>j\<in>S. (a j / sum a S) *\<^sub>R y j) \<in> C"
[PROOF STATE]
proof (prove)
using this:
0 < sum a S

goal (1 subgoal):
 1. (\<Sum>j\<in>S. (a j / sum a S) *\<^sub>R y j) \<in> C
[PROOF STEP]
using \<open>\<forall>j\<in>S. 0 \<le> a j\<close> and \<open>\<forall>j\<in>S. y j \<in> C\<close>
[PROOF STATE]
proof (prove)
using this:
0 < sum a S
\<forall>j\<in>S. 0 \<le> a j
\<forall>j\<in>S. y j \<in> C

goal (1 subgoal):
 1. (\<Sum>j\<in>S. (a j / sum a S) *\<^sub>R y j) \<in> C
[PROOF STEP]
by (simp add: IH sum_divide_distrib [symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>S. (a j / sum a S) *\<^sub>R y j) \<in> C

goal (1 subgoal):
 1. sum a S \<noteq> 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
from \<open>convex C\<close> and \<open>y i \<in> C\<close> and this and \<open>0 \<le> a i\<close>
      and \<open>0 \<le> sum a S\<close> and \<open>a i + sum a S = 1\<close>
[PROOF STATE]
proof (chain)
picking this:
convex C
y i \<in> C
(\<Sum>j\<in>S. (a j / sum a S) *\<^sub>R y j) \<in> C
0 \<le> a i
0 \<le> sum a S
a i + sum a S = 1
[PROOF STEP]
have "a i *\<^sub>R y i + sum a S *\<^sub>R (\<Sum>j\<in>S. (a j / sum a S) *\<^sub>R y j) \<in> C"
[PROOF STATE]
proof (prove)
using this:
convex C
y i \<in> C
(\<Sum>j\<in>S. (a j / sum a S) *\<^sub>R y j) \<in> C
0 \<le> a i
0 \<le> sum a S
a i + sum a S = 1

goal (1 subgoal):
 1. a i *\<^sub>R y i + sum a S *\<^sub>R (\<Sum>j\<in>S. (a j / sum a S) *\<^sub>R y j) \<in> C
[PROOF STEP]
by (rule convexD)
[PROOF STATE]
proof (state)
this:
a i *\<^sub>R y i + sum a S *\<^sub>R (\<Sum>j\<in>S. (a j / sum a S) *\<^sub>R y j) \<in> C

goal (1 subgoal):
 1. sum a S \<noteq> 0 \<Longrightarrow> a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a i *\<^sub>R y i + sum a S *\<^sub>R (\<Sum>j\<in>S. (a j / sum a S) *\<^sub>R y j) \<in> C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a i *\<^sub>R y i + sum a S *\<^sub>R (\<Sum>j\<in>S. (a j / sum a S) *\<^sub>R y j) \<in> C

goal (1 subgoal):
 1. a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
by (simp add: scaleR_sum_right False)
[PROOF STATE]
proof (state)
this:
a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C

goal (1 subgoal):
 1. \<And>x F a. \<lbrakk>finite F; x \<notin> F; \<And>a. \<lbrakk>sum a F = 1; \<And>i. i \<in> F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>F. a j *\<^sub>R y j) \<in> C; sum a (insert x F) = 1; \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> a i; \<And>i. i \<in> insert x F \<Longrightarrow> y i \<in> C\<rbrakk> \<Longrightarrow> (\<Sum>j\<in>insert x F. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C

goal (1 subgoal):
 1. (\<Sum>j\<in>insert i S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
using \<open>finite S\<close> and \<open>i \<notin> S\<close>
[PROOF STATE]
proof (prove)
using this:
a i *\<^sub>R y i + (\<Sum>j\<in>S. a j *\<^sub>R y j) \<in> C
finite S
i \<notin> S

goal (1 subgoal):
 1. (\<Sum>j\<in>insert i S. a j *\<^sub>R y j) \<in> C
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>insert i S. a j *\<^sub>R y j) \<in> C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<psi>_mono: "x \<le> y \<Longrightarrow> \<psi> x \<le> \<psi> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> \<psi> x \<le> \<psi> y
[PROOF STEP]
unfolding \<psi>_def sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> sum mangoldt {i. 0 < i \<and> real i \<le> x} \<le> sum mangoldt {i. 0 < i \<and> real i \<le> y}
[PROOF STEP]
by (intro sum_mono2 mangoldt_nonneg) auto


[STATEMENT]
lemma ENR_bounded:
  fixes S :: "'a::euclidean_space set"
  assumes "bounded S"
  shows "ENR S \<longleftrightarrow> (\<exists>U. open U \<and> bounded U \<and> S retract_of U)"
         (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ENR S = (\<exists>U. open U \<and> bounded U \<and> S retract_of U)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ENR S \<Longrightarrow> \<exists>U. open U \<and> bounded U \<and> S retract_of U
 2. \<exists>U. open U \<and> bounded U \<and> S retract_of U \<Longrightarrow> ENR S
[PROOF STEP]
obtain r where "0 < r" and r: "S \<subseteq> ball 0 r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. \<lbrakk>0 < r; S \<subseteq> ball (0::'a) r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using bounded_subset_ballD assms
[PROOF STATE]
proof (prove)
using this:
bounded ?S \<Longrightarrow> \<exists>r>0. ?S \<subseteq> ball ?x r
bounded S

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>0 < r; S \<subseteq> ball (0::'a) r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < r
S \<subseteq> ball (0::'a) r

goal (2 subgoals):
 1. ENR S \<Longrightarrow> \<exists>U. open U \<and> bounded U \<and> S retract_of U
 2. \<exists>U. open U \<and> bounded U \<and> S retract_of U \<Longrightarrow> ENR S
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
ENR S

goal (2 subgoals):
 1. ENR S \<Longrightarrow> \<exists>U. open U \<and> bounded U \<and> S retract_of U
 2. \<exists>U. open U \<and> bounded U \<and> S retract_of U \<Longrightarrow> ENR S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ENR S
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
ENR S

goal (1 subgoal):
 1. \<exists>U. open U \<and> bounded U \<and> S retract_of U
[PROOF STEP]
by (meson ENR_def Elementary_Metric_Spaces.open_ball bounded_Int bounded_ball inf_le2 le_inf_iff
              open_Int r retract_of_imp_subset retract_of_subset)
[PROOF STATE]
proof (state)
this:
\<exists>U. open U \<and> bounded U \<and> S retract_of U

goal (1 subgoal):
 1. \<exists>U. open U \<and> bounded U \<and> S retract_of U \<Longrightarrow> ENR S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>U. open U \<and> bounded U \<and> S retract_of U \<Longrightarrow> ENR S
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
\<exists>U. open U \<and> bounded U \<and> S retract_of U

goal (1 subgoal):
 1. \<exists>U. open U \<and> bounded U \<and> S retract_of U \<Longrightarrow> ENR S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>U. open U \<and> bounded U \<and> S retract_of U
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
\<exists>U. open U \<and> bounded U \<and> S retract_of U

goal (1 subgoal):
 1. ENR S
[PROOF STEP]
using ENR_def
[PROOF STATE]
proof (prove)
using this:
\<exists>U. open U \<and> bounded U \<and> S retract_of U
ENR ?S \<equiv> \<exists>U. open U \<and> ?S retract_of U

goal (1 subgoal):
 1. ENR S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
ENR S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma llast_ldropn: "enat n < llength xs \<Longrightarrow> llast (ldropn n xs) = llast xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enat n < llength xs \<Longrightarrow> llast (ldropn n xs) = llast xs
[PROOF STEP]
proof(induct n arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. enat 0 < llength xs \<Longrightarrow> llast (ldropn 0 xs) = llast xs
 2. \<And>n xs. \<lbrakk>\<And>xs. enat n < llength xs \<Longrightarrow> llast (ldropn n xs) = llast xs; enat (Suc n) < llength xs\<rbrakk> \<Longrightarrow> llast (ldropn (Suc n) xs) = llast xs
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
enat 0 < llength xs

goal (2 subgoals):
 1. \<And>xs. enat 0 < llength xs \<Longrightarrow> llast (ldropn 0 xs) = llast xs
 2. \<And>n xs. \<lbrakk>\<And>xs. enat n < llength xs \<Longrightarrow> llast (ldropn n xs) = llast xs; enat (Suc n) < llength xs\<rbrakk> \<Longrightarrow> llast (ldropn (Suc n) xs) = llast xs
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
enat 0 < llength xs

goal (1 subgoal):
 1. llast (ldropn 0 xs) = llast xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
llast (ldropn 0 xs) = llast xs

goal (1 subgoal):
 1. \<And>n xs. \<lbrakk>\<And>xs. enat n < llength xs \<Longrightarrow> llast (ldropn n xs) = llast xs; enat (Suc n) < llength xs\<rbrakk> \<Longrightarrow> llast (ldropn (Suc n) xs) = llast xs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n xs. \<lbrakk>\<And>xs. enat n < llength xs \<Longrightarrow> llast (ldropn n xs) = llast xs; enat (Suc n) < llength xs\<rbrakk> \<Longrightarrow> llast (ldropn (Suc n) xs) = llast xs
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
enat n < llength ?xs \<Longrightarrow> llast (ldropn n ?xs) = llast ?xs
enat (Suc n) < llength xs

goal (1 subgoal):
 1. \<And>n xs. \<lbrakk>\<And>xs. enat n < llength xs \<Longrightarrow> llast (ldropn n xs) = llast xs; enat (Suc n) < llength xs\<rbrakk> \<Longrightarrow> llast (ldropn (Suc n) xs) = llast xs
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
enat n < llength ?xs \<Longrightarrow> llast (ldropn n ?xs) = llast ?xs
enat (Suc n) < llength xs

goal (1 subgoal):
 1. llast (ldropn (Suc n) xs) = llast xs
[PROOF STEP]
by(cases xs)(auto simp add: Suc_ile_eq llast_LCons)
[PROOF STATE]
proof (state)
this:
llast (ldropn (Suc n) xs) = llast xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma f_nth_eq_map_f_nth: "\<lbrakk>as \<noteq> []; length as \<ge> n\<rbrakk> \<Longrightarrow> f (as ! (n - Suc 0)) = map f as ! (n - Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>as \<noteq> []; n \<le> length as\<rbrakk> \<Longrightarrow> f (as ! (n - Suc 0)) = map f as ! (n - Suc 0)
[PROOF STEP]
by (cases "n = length as") auto


[STATEMENT]
lemma NSLIMSEQ_le_const2: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S r \<Longrightarrow> \<forall>n. X n \<le> a \<Longrightarrow> r \<le> a"
  for a r :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<longlonglongrightarrow>\<^sub>N\<^sub>S r; \<forall>n. X n \<le> a\<rbrakk> \<Longrightarrow> r \<le> a
[PROOF STEP]
by (erule NSLIMSEQ_le [OF _ NSLIMSEQ_const]) auto


[STATEMENT]
lemma floor_less_neg_numeral [simp]: "\<lfloor>x\<rfloor> < - numeral v \<longleftrightarrow> x < - numeral v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> < - numeral v) = (x < - numeral v)
[PROOF STEP]
by (simp add: floor_less_iff)


[STATEMENT]
lemma is_bintree_list_merge:
  assumes "is_bintree l t1" "is_bintree l t2"
  shows "is_bintree (Suc l) (merge t1 t2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_bintree_list (Suc l) (children (merge t1 t2))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_bintree_list l (children t1)
is_bintree_list l (children t2)

goal (1 subgoal):
 1. is_bintree_list (Suc l) (children (merge t1 t2))
[PROOF STEP]
by (simp add: merge_def)


[STATEMENT]
lemma unit_factor_lcm: "unit_factor (lcm a b) = (if a = 0 \<or> b = 0 then 0 else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_factor (lcm a b) = (if a = (0::'a) \<or> b = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
using lcm_eq_0_iff[of a b]
[PROOF STATE]
proof (prove)
using this:
(lcm a b = (0::'a)) = (a = (0::'a) \<or> b = (0::'a))

goal (1 subgoal):
 1. unit_factor (lcm a b) = (if a = (0::'a) \<or> b = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
by (cases "lcm a b = 0") (auto simp: lcm_gcd)


[STATEMENT]
lemma rbt_lookup_rbt_baliR: "rbt_sorted l \<Longrightarrow> rbt_sorted r \<Longrightarrow> l |\<guillemotleft> a \<Longrightarrow> a \<guillemotleft>| r \<Longrightarrow>
  rbt_lookup (rbt_baliR l a b r) k =
  (if k < a then rbt_lookup l k else if k = a then Some b else rbt_lookup r k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>rbt_sorted l; rbt_sorted r; l |\<guillemotleft> a; a \<guillemotleft>| r\<rbrakk> \<Longrightarrow> rbt_lookup (rbt_baliR l a b r) k = (if k < a then rbt_lookup l k else if k = a then Some b else rbt_lookup r k)
[PROOF STEP]
by (cases "(l,a,b,r)" rule: rbt_baliR.cases) (auto split!: if_splits)


[STATEMENT]
lemma abs_mangoldt [simp]: "abs (mangoldt n :: real) = mangoldt n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>mangoldt n\<bar> = mangoldt n
[PROOF STEP]
using norm_mangoldt[of n, where ?'a = real, unfolded real_norm_def]
[PROOF STATE]
proof (prove)
using this:
\<bar>mangoldt n\<bar> = mangoldt n

goal (1 subgoal):
 1. \<bar>mangoldt n\<bar> = mangoldt n
[PROOF STEP]
.


[STATEMENT]
lemma connected_closed_set:
   "closed S
    \<Longrightarrow> connected S \<longleftrightarrow> (\<nexists>A B. closed A \<and> closed B \<and> A \<noteq> {} \<and> B \<noteq> {} \<and> A \<union> B = S \<and> A \<inter> B = {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed S \<Longrightarrow> connected S = (\<nexists>A B. closed A \<and> closed B \<and> A \<noteq> {} \<and> B \<noteq> {} \<and> A \<union> B = S \<and> A \<inter> B = {})
[PROOF STEP]
unfolding connected_closedin_eq closedin_closed_eq connected_closedin_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed S \<Longrightarrow> (\<nexists>E1 E2. (closed E1 \<and> E1 \<subseteq> S) \<and> (closed E2 \<and> E2 \<subseteq> S) \<and> E1 \<union> E2 = S \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {}) = (\<nexists>A B. closed A \<and> closed B \<and> A \<noteq> {} \<and> B \<noteq> {} \<and> A \<union> B = S \<and> A \<inter> B = {})
[PROOF STEP]
by blast


[STATEMENT]
lemma minus_p_mod_def: assumes x: "x \<in> {0 ..< p}" and y: "y \<in> {0 ..< p}"
  shows "minus_p p x y = ((x - y) mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. minus_p p x y = (x - y) mod p
[PROOF STEP]
proof (cases "x - y < 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x - y < 0 \<Longrightarrow> minus_p p x y = (x - y) mod p
 2. \<not> x - y < 0 \<Longrightarrow> minus_p p x y = (x - y) mod p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x - y < 0

goal (2 subgoals):
 1. x - y < 0 \<Longrightarrow> minus_p p x y = (x - y) mod p
 2. \<not> x - y < 0 \<Longrightarrow> minus_p p x y = (x - y) mod p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> x - y < 0

goal (1 subgoal):
 1. minus_p p x y = (x - y) mod p
[PROOF STEP]
using x y
[PROOF STATE]
proof (prove)
using this:
\<not> x - y < 0
x \<in> {0..<p}
y \<in> {0..<p}

goal (1 subgoal):
 1. minus_p p x y = (x - y) mod p
[PROOF STEP]
unfolding minus_p_def Let_def
[PROOF STATE]
proof (prove)
using this:
\<not> x - y < 0
x \<in> {0..<p}
y \<in> {0..<p}

goal (1 subgoal):
 1. (if y \<le> x then x - y else x + p - y) = (x - y) mod p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
minus_p p x y = (x - y) mod p

goal (1 subgoal):
 1. x - y < 0 \<Longrightarrow> minus_p p x y = (x - y) mod p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x - y < 0 \<Longrightarrow> minus_p p x y = (x - y) mod p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x - y < 0

goal (1 subgoal):
 1. x - y < 0 \<Longrightarrow> minus_p p x y = (x - y) mod p
[PROOF STEP]
from True x y
[PROOF STATE]
proof (chain)
picking this:
x - y < 0
x \<in> {0..<p}
y \<in> {0..<p}
[PROOF STEP]
have *: "p > 0" "0 \<le> x - y + p" "x - y + p < p"
[PROOF STATE]
proof (prove)
using this:
x - y < 0
x \<in> {0..<p}
y \<in> {0..<p}

goal (1 subgoal):
 1. 0 < p &&& 0 \<le> x - y + p &&& x - y + p < p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < p
0 \<le> x - y + p
x - y + p < p

goal (1 subgoal):
 1. x - y < 0 \<Longrightarrow> minus_p p x y = (x - y) mod p
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
x - y < 0
[PROOF STEP]
have id: "minus_p p x y = x - y + p"
[PROOF STATE]
proof (prove)
using this:
x - y < 0

goal (1 subgoal):
 1. minus_p p x y = x - y + p
[PROOF STEP]
unfolding minus_p_def
[PROOF STATE]
proof (prove)
using this:
x - y < 0

goal (1 subgoal):
 1. (if y \<le> x then x - y else x + p - y) = x - y + p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
minus_p p x y = x - y + p

goal (1 subgoal):
 1. x - y < 0 \<Longrightarrow> minus_p p x y = (x - y) mod p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. minus_p p x y = (x - y) mod p
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - y + p = (x - y) mod p
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
0 < p
0 \<le> x - y + p
x - y + p < p

goal (1 subgoal):
 1. x - y + p = (x - y) mod p
[PROOF STEP]
using mod_pos_pos_trivial
[PROOF STATE]
proof (prove)
using this:
0 < p
0 \<le> x - y + p
x - y + p < p
\<lbrakk>0 \<le> ?k; ?k < ?l\<rbrakk> \<Longrightarrow> ?k mod ?l = ?k

goal (1 subgoal):
 1. x - y + p = (x - y) mod p
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
minus_p p x y = (x - y) mod p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_eventually_sequentiallyD:
  assumes "\<not> eventually P sequentially"
  shows "\<exists>r::nat\<Rightarrow>nat. strict_mono r \<and> (\<forall>n. \<not> P (r n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. strict_mono r \<and> (\<forall>n. \<not> P (r n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>r. strict_mono r \<and> (\<forall>n. \<not> P (r n))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<not> eventually P sequentially
[PROOF STEP]
have "\<forall>n. \<exists>m\<ge>n. \<not> P m"
[PROOF STATE]
proof (prove)
using this:
\<not> eventually P sequentially

goal (1 subgoal):
 1. \<forall>n. \<exists>m\<ge>n. \<not> P m
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
\<nexists>N. \<forall>n\<ge>N. P n

goal (1 subgoal):
 1. \<forall>n. \<exists>m\<ge>n. \<not> P m
[PROOF STEP]
by (simp add: not_less)
[PROOF STATE]
proof (state)
this:
\<forall>n. \<exists>m\<ge>n. \<not> P m

goal (1 subgoal):
 1. \<exists>r. strict_mono r \<and> (\<forall>n. \<not> P (r n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n. \<exists>m\<ge>n. \<not> P m
[PROOF STEP]
obtain r where "\<And>n. r n \<ge> n" "\<And>n. \<not> P (r n)"
[PROOF STATE]
proof (prove)
using this:
\<forall>n. \<exists>m\<ge>n. \<not> P m

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>\<And>n. n \<le> r n; \<And>n. \<not> P (r n)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: choice_iff)
[PROOF STATE]
proof (state)
this:
?n \<le> r ?n
\<not> P (r ?n)

goal (1 subgoal):
 1. \<exists>r. strict_mono r \<and> (\<forall>n. \<not> P (r n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?n \<le> r ?n
\<not> P (r ?n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?n \<le> r ?n
\<not> P (r ?n)

goal (1 subgoal):
 1. \<exists>r. strict_mono r \<and> (\<forall>n. \<not> P (r n))
[PROOF STEP]
by (auto intro!: exI[of _ "\<lambda>n. r (((Suc \<circ> r) ^^ Suc n) 0)"]
             simp: less_eq_Suc_le strict_mono_Suc_iff)
[PROOF STATE]
proof (state)
this:
\<exists>r. strict_mono r \<and> (\<forall>n. \<not> P (r n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Abs_G_perm_diff:
  "g\<in>G \<Longrightarrow> h\<in>G \<Longrightarrow> \<pp> g - \<pp> h = \<pp> (binop g (\<ii> h))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g \<in> G; h \<in> G\<rbrakk> \<Longrightarrow> \<pp> g - \<pp> h = \<pp> (binop g (\<ii> h))
[PROOF STEP]
using Abs_G_perm_def minus_permutation_abs_eq[OF bij_G_perm bij_G_perm]
        the_inv_G_perm G_perm_comp the_inverseD(1)
[PROOF STATE]
proof (prove)
using this:
\<pp> ?g \<equiv> Abs_permutation (G_perm ?g)
\<lbrakk>?g2 \<in> G; ?g1 \<in> G\<rbrakk> \<Longrightarrow> Abs_permutation (G_perm ?g2) - Abs_permutation (G_perm ?g1) = Abs_permutation (G_perm ?g2 \<circ> the_inv (G_perm ?g1))
?g \<in> G \<Longrightarrow> the_inv (G_perm ?g) = G_perm (\<ii> ?g)
\<lbrakk>?g \<in> G; ?h \<in> G\<rbrakk> \<Longrightarrow> G_perm ?g \<circ> G_perm ?h = G_perm (binop ?g ?h)
?g \<in> G \<Longrightarrow> \<ii> ?g \<in> G

goal (1 subgoal):
 1. \<lbrakk>g \<in> G; h \<in> G\<rbrakk> \<Longrightarrow> \<pp> g - \<pp> h = \<pp> (binop g (\<ii> h))
[PROOF STEP]
by    simp


[STATEMENT]
lemma Int_stable_PiE: "Int_stable {Pi\<^sub>E J E | E. \<forall>i\<in>I. E i \<in> sets (M i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Int_stable {Pi\<^sub>E J E |E. \<forall>i\<in>I. E i \<in> sets (M i)}
[PROOF STEP]
proof (safe intro!: Int_stableI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b E Ea. \<lbrakk>\<forall>i\<in>I. E i \<in> sets (M i); \<forall>i\<in>I. Ea i \<in> sets (M i)\<rbrakk> \<Longrightarrow> \<exists>Eb. Pi\<^sub>E J E \<inter> Pi\<^sub>E J Ea = Pi\<^sub>E J Eb \<and> (\<forall>i\<in>I. Eb i \<in> sets (M i))
[PROOF STEP]
fix E F
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b E Ea. \<lbrakk>\<forall>i\<in>I. E i \<in> sets (M i); \<forall>i\<in>I. Ea i \<in> sets (M i)\<rbrakk> \<Longrightarrow> \<exists>Eb. Pi\<^sub>E J E \<inter> Pi\<^sub>E J Ea = Pi\<^sub>E J Eb \<and> (\<forall>i\<in>I. Eb i \<in> sets (M i))
[PROOF STEP]
assume "\<forall>i\<in>I. E i \<in> sets (M i)" "\<forall>i\<in>I. F i \<in> sets (M i)"
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>I. E i \<in> sets (M i)
\<forall>i\<in>I. F i \<in> sets (M i)

goal (1 subgoal):
 1. \<And>a b E Ea. \<lbrakk>\<forall>i\<in>I. E i \<in> sets (M i); \<forall>i\<in>I. Ea i \<in> sets (M i)\<rbrakk> \<Longrightarrow> \<exists>Eb. Pi\<^sub>E J E \<inter> Pi\<^sub>E J Ea = Pi\<^sub>E J Eb \<and> (\<forall>i\<in>I. Eb i \<in> sets (M i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i\<in>I. E i \<in> sets (M i)
\<forall>i\<in>I. F i \<in> sets (M i)
[PROOF STEP]
show "\<exists>G. Pi\<^sub>E J E \<inter> Pi\<^sub>E J F = Pi\<^sub>E J G \<and> (\<forall>i\<in>I. G i \<in> sets (M i))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>I. E i \<in> sets (M i)
\<forall>i\<in>I. F i \<in> sets (M i)

goal (1 subgoal):
 1. \<exists>G. Pi\<^sub>E J E \<inter> Pi\<^sub>E J F = Pi\<^sub>E J G \<and> (\<forall>i\<in>I. G i \<in> sets (M i))
[PROOF STEP]
by (auto intro!: exI[of _ "\<lambda>i. E i \<inter> F i"] simp: PiE_Int)
[PROOF STATE]
proof (state)
this:
\<exists>G. Pi\<^sub>E J E \<inter> Pi\<^sub>E J F = Pi\<^sub>E J G \<and> (\<forall>i\<in>I. G i \<in> sets (M i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_closed_graph_eq:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "compact T" and fim: "f ` S \<subseteq> T"
  shows "continuous_on S f \<longleftrightarrow>
         closedin (top_of_set (S \<times> T)) ((\<lambda>x. Pair x (f x)) ` S)"
         (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S f = closedin (top_of_set (S \<times> T)) ((\<lambda>x. (x, f x)) ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous_on S f = closedin (top_of_set (S \<times> T)) ((\<lambda>x. (x, f x)) ` S)
[PROOF STEP]
have "?lhs" if ?rhs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S f
[PROOF STEP]
proof (clarsimp simp add: continuous_on_closed_gen [OF fim])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>U. closedin (top_of_set T) U \<Longrightarrow> closedin (top_of_set S) (S \<inter> f -` U)
[PROOF STEP]
fix U
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>U. closedin (top_of_set T) U \<Longrightarrow> closedin (top_of_set S) (S \<inter> f -` U)
[PROOF STEP]
assume U: "closedin (top_of_set T) U"
[PROOF STATE]
proof (state)
this:
closedin (top_of_set T) U

goal (1 subgoal):
 1. \<And>U. closedin (top_of_set T) U \<Longrightarrow> closedin (top_of_set S) (S \<inter> f -` U)
[PROOF STEP]
have eq: "(S \<inter> f -` U) = fst ` (((\<lambda>x. Pair x (f x)) ` S) \<inter> (S \<times> U))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> f -` U = fst ` ((\<lambda>x. (x, f x)) ` S \<inter> S \<times> U)
[PROOF STEP]
by (force simp: image_iff)
[PROOF STATE]
proof (state)
this:
S \<inter> f -` U = fst ` ((\<lambda>x. (x, f x)) ` S \<inter> S \<times> U)

goal (1 subgoal):
 1. \<And>U. closedin (top_of_set T) U \<Longrightarrow> closedin (top_of_set S) (S \<inter> f -` U)
[PROOF STEP]
show "closedin (top_of_set S) (S \<inter> f -` U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (top_of_set S) (S \<inter> f -` U)
[PROOF STEP]
by (simp add: U closedin_Int closedin_Times closed_map_fst [OF \<open>compact T\<close>] that eq)
[PROOF STATE]
proof (state)
this:
closedin (top_of_set S) (S \<inter> f -` U)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
closedin (top_of_set (S \<times> T)) ((\<lambda>x. (x, f x)) ` S) \<Longrightarrow> continuous_on S f

goal (1 subgoal):
 1. continuous_on S f = closedin (top_of_set (S \<times> T)) ((\<lambda>x. (x, f x)) ` S)
[PROOF STEP]
with continuous_closed_graph_gen assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>continuous_on ?S ?f; ?f ` ?S \<subseteq> ?T\<rbrakk> \<Longrightarrow> closedin (top_of_set (?S \<times> ?T)) ((\<lambda>x. (x, ?f x)) ` ?S)
compact T
f ` S \<subseteq> T
closedin (top_of_set (S \<times> T)) ((\<lambda>x. (x, f x)) ` S) \<Longrightarrow> continuous_on S f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on ?S ?f; ?f ` ?S \<subseteq> ?T\<rbrakk> \<Longrightarrow> closedin (top_of_set (?S \<times> ?T)) ((\<lambda>x. (x, ?f x)) ` ?S)
compact T
f ` S \<subseteq> T
closedin (top_of_set (S \<times> T)) ((\<lambda>x. (x, f x)) ` S) \<Longrightarrow> continuous_on S f

goal (1 subgoal):
 1. continuous_on S f = closedin (top_of_set (S \<times> T)) ((\<lambda>x. (x, f x)) ` S)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on S f = closedin (top_of_set (S \<times> T)) ((\<lambda>x. (x, f x)) ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cf_Hom_ObjMap_app[cat_cs_simps]:
  assumes "[a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> (op_cat \<CC> \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>"
  shows "Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,-)\<lparr>ObjMap\<rparr>\<lparr>a, b\<rparr>\<^sub>\<bullet> = Hom \<CC> a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,-)\<^esub> b = Hom \<CC> a b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
[a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> (op_cat \<CC> \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,-)\<^esub> b = Hom \<CC> a b
[PROOF STEP]
unfolding cf_Hom_components
[PROOF STATE]
proof (prove)
using this:
[a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> (op_cat \<CC> \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. (\<lambda>a\<in>\<^sub>\<circ>(op_cat \<CC> \<times>\<^sub>C \<CC>)\<lparr>Obj\<rparr>. Hom \<CC> (a\<lparr>[]\<^sub>\<circ>\<rparr>) (a\<lparr>1\<^sub>\<nat>\<rparr>)) \<lparr>a, b\<rparr>\<^sub>\<bullet> = Hom \<CC> a b
[PROOF STEP]
by (simp add: nat_omega_simps)


[STATEMENT]
lemma cut_less_image: "
  \<lbrakk> strict_mono_on f A; I \<subseteq> A; n \<in> A \<rbrakk> \<Longrightarrow>
  (f ` I) \<down>< f n = f ` (I \<down>< n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>SetInterval2.strict_mono_on f A; I \<subseteq> A; n \<in> A\<rbrakk> \<Longrightarrow> (f ` I) \<down>< f n = f ` I \<down>< n
[PROOF STEP]
apply (rule set_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>SetInterval2.strict_mono_on f A; I \<subseteq> A; n \<in> A\<rbrakk> \<Longrightarrow> (x \<in> (f ` I) \<down>< f n) = (x \<in> f ` I \<down>< n)
[PROOF STEP]
apply (simp add: image_iff Bex_def cut_less_mem_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>SetInterval2.strict_mono_on f A; I \<subseteq> A; n \<in> A\<rbrakk> \<Longrightarrow> ((\<exists>xa. xa \<in> I \<and> x = f xa) \<and> x < f n) = (\<exists>xa. xa \<in> I \<and> xa < n \<and> x = f xa)
[PROOF STEP]
apply (unfold strict_mono_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a < b \<longrightarrow> f a < f b; I \<subseteq> A; n \<in> A\<rbrakk> \<Longrightarrow> ((\<exists>xa. xa \<in> I \<and> x = f xa) \<and> x < f n) = (\<exists>xa. xa \<in> I \<and> xa < n \<and> x = f xa)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a < b \<longrightarrow> f a < f b; I \<subseteq> A; n \<in> A; (\<exists>xa. xa \<in> I \<and> x = f xa) \<and> x < f n\<rbrakk> \<Longrightarrow> \<exists>xa. xa \<in> I \<and> xa < n \<and> x = f xa
 2. \<And>x. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a < b \<longrightarrow> f a < f b; I \<subseteq> A; n \<in> A; \<exists>xa. xa \<in> I \<and> xa < n \<and> x = f xa\<rbrakk> \<Longrightarrow> (\<exists>xa. xa \<in> I \<and> x = f xa) \<and> x < f n
[PROOF STEP]
apply (metis not_less_iff_gr_or_eq rev_subsetD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a < b \<longrightarrow> f a < f b; I \<subseteq> A; n \<in> A; \<exists>xa. xa \<in> I \<and> xa < n \<and> x = f xa\<rbrakk> \<Longrightarrow> (\<exists>xa. xa \<in> I \<and> x = f xa) \<and> x < f n
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_apply_bfun:
  fixes f :: "nat \<Rightarrow> 'c \<Rightarrow>\<^sub>b real"
  shows "(\<Sum>i<n. f i) x = (\<Sum>i<n. apply_bfun (f i) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apply_bfun (sum f {..<n}) x = (\<Sum>i<n. apply_bfun (f i) x)
[PROOF STEP]
by (induction n) auto


[STATEMENT]
lemma mem_sphere [simp]: "y \<in> sphere x e \<longleftrightarrow> dist x y = e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<in> sphere x e) = (dist x y = e)
[PROOF STEP]
by (simp add: sphere_def)


[STATEMENT]
lemma integer_of_num [code]:
  "integer_of_num Num.One = 1"
  "integer_of_num (Num.Bit0 n) = (let k = integer_of_num n in k + k)"
  "integer_of_num (Num.Bit1 n) = (let k = integer_of_num n in k + k + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integer_of_num num.One = 1 &&& integer_of_num (num.Bit0 n) = (let k = integer_of_num n in k + k) &&& integer_of_num (num.Bit1 n) = (let k = integer_of_num n in k + k + 1)
[PROOF STEP]
by (simp_all only: integer_of_num_def numeral.simps Let_def)


[STATEMENT]
lemma fls_inverse_X_power':
  assumes "inverse 1 = (1::'a::{semiring_1,uminus,inverse})"
  shows   "inverse ((fls_X ^ n)::'a fls) = fls_X_inv ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (fls_X ^ n) = fls_X_inv ^ n
[PROOF STEP]
using   fls_lr_inverse_X_power'(2)[of n 1]
[PROOF STATE]
proof (prove)
using this:
fls_right_inverse (fls_X ^ n) (1::?'b1) = fls_const (1::?'b1) * fls_X_inv ^ n

goal (1 subgoal):
 1. inverse (fls_X ^ n) = fls_X_inv ^ n
[PROOF STEP]
by      (simp add: fls_inverse_def' assms )


[STATEMENT]
lemma subtract_mask:
  "p - (p AND mask n) = (p AND NOT (mask n))"
  "p - (p AND NOT (mask n)) = (p AND mask n)"
  for p :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p - (p AND mask n) = p AND NOT (mask n) &&& p - (p AND NOT (mask n)) = p AND mask n
[PROOF STEP]
by (simp add: field_simps word_plus_and_or_coroll2)+


[STATEMENT]
lemma samp_uni_minus_one_time_pad:
  shows "map_spmf(\<lambda> b. (y + (q - b)) mod q) (sample_uniform q) = (sample_uniform q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf (\<lambda>b. (y + (q - b)) mod q) (sample_uniform q) = sample_uniform q
[PROOF STEP]
using inj_on_minus surj_on_minus one_time_pad
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>b. (?y + (?q - b)) mod ?q) {..<?q}
inj_on (\<lambda>b. (?y + (?q - b)) mod ?q) {..<?q} \<Longrightarrow> (\<lambda>b. (?y + (?q - b)) mod ?q) ` {..<?q} = {..<?q}
\<lbrakk>inj_on ?f {..<?q}; ?f ` {..<?q} = {..<?q}\<rbrakk> \<Longrightarrow> map_spmf ?f (sample_uniform ?q) = sample_uniform ?q

goal (1 subgoal):
 1. map_spmf (\<lambda>b. (y + (q - b)) mod q) (sample_uniform q) = sample_uniform q
[PROOF STEP]
by simp


[STATEMENT]
lemma l2_11:
  assumes "Bet A B C" and
    "Bet A' B' C'" and
    "Cong A B A' B'" and
    "Cong B C B' C'"
  shows "Cong A C A' C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cong A C A' C'
[PROOF STEP]
by (smt assms(1) assms(2) assms(3) assms(4) cong_right_commutativity cong_symmetry cong_trivial_identity five_segment)


[STATEMENT]
lemma powerset_lift_iterate_UNION:
  "(\<Union>x\<in>S. (\<^ps>g)\<^bsup>i\<^esup>\<cdot>(A x)) = (\<^ps>g)\<^bsup>i\<^esup>\<cdot>(\<Union>x\<in>S. A x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>S. (\<^ps> g)\<^bsup>i\<^esup>\<cdot>(A x)) = (\<^ps> g)\<^bsup>i\<^esup>\<cdot>(\<Union> (A ` S))
[PROOF STEP]
by (induct i, auto simp add:powerset_lift_UNION)


[STATEMENT]
lemma fiter_qiter4: "mono f \<Longrightarrow> mono g \<Longrightarrow> mono h \<Longrightarrow> Rep_iso (qiter_fun (Abs_iso f) (Abs_iso g) (Abs_iso h)) = fiter_fun f g h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono f; mono g; mono h\<rbrakk> \<Longrightarrow> Rep_iso (qiter_fun (Abs_iso f) (Abs_iso g) (Abs_iso h)) = fiter_fun f g h
[PROOF STEP]
by (simp add: Abs_iso_inverse fiter_fun_exp qiter_fun_exp sup_iso.rep_eq times_iso.rep_eq)


[STATEMENT]
lemma store_sops_mono: "\<And>ys. set xs \<subseteq> set ys \<Longrightarrow> store_sops xs \<subseteq> store_sops ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ys. set xs \<subseteq> set ys \<Longrightarrow> store_sops xs \<subseteq> store_sops ys
[PROOF STEP]
by (fastforce simp add: in_store_sops_conv)


[STATEMENT]
lemma constrains_INT:
    "(!!i. i \<in> I ==> F \<in> (A i) co (A' i))
     ==> F \<in> (\<Inter>i \<in> I. A i) co (\<Inter>i \<in> I. A' i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> F \<in> A i co A' i) \<Longrightarrow> F \<in> \<Inter> (A ` I) co \<Inter> (A' ` I)
[PROOF STEP]
by (unfold constrains_def, blast)


[STATEMENT]
lemma span_diff: "x \<in> span S \<Longrightarrow> y \<in> span S \<Longrightarrow> x - y \<in> span S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> span S; y \<in> span S\<rbrakk> \<Longrightarrow> x - y \<in> span S
[PROOF STEP]
by (metis subspace_span subspace_diff)


[STATEMENT]
lemma permute_poly_args_mult:
  assumes "\<sigma> permutes {..<n}"
  assumes "p \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  assumes "q \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  shows "permute_poly_args n \<sigma> (p \<otimes>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> q) = (permute_poly_args n \<sigma> p) \<otimes>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> (permute_poly_args n \<sigma> q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permute_poly_args n \<sigma> (p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> q) = permute_poly_args n \<sigma> p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> permute_poly_args n \<sigma> q
[PROOF STEP]
using permute_poly_args_characterization(1)[of  \<sigma>] assms
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes {..<?n} \<Longrightarrow> ring_hom_ring (R [\<X>\<^bsub>?n\<^esub>]) (R [\<X>\<^bsub>?n\<^esub>]) (permute_poly_args ?n \<sigma>)
\<sigma> permutes {..<n}
p \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
q \<in> carrier (R [\<X>\<^bsub>n\<^esub>])

goal (1 subgoal):
 1. permute_poly_args n \<sigma> (p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> q) = permute_poly_args n \<sigma> p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> permute_poly_args n \<sigma> q
[PROOF STEP]
unfolding ring_hom_ring_def ring_hom_ring_axioms_def
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes {..<?n} \<Longrightarrow> ring (R [\<X>\<^bsub>?n\<^esub>]) \<and> ring (R [\<X>\<^bsub>?n\<^esub>]) \<and> permute_poly_args ?n \<sigma> \<in> ring_hom (R [\<X>\<^bsub>?n\<^esub>]) (R [\<X>\<^bsub>?n\<^esub>])
\<sigma> permutes {..<n}
p \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
q \<in> carrier (R [\<X>\<^bsub>n\<^esub>])

goal (1 subgoal):
 1. permute_poly_args n \<sigma> (p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> q) = permute_poly_args n \<sigma> p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> permute_poly_args n \<sigma> q
[PROOF STEP]
using ring_hom_mult
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes {..<?n} \<Longrightarrow> ring (R [\<X>\<^bsub>?n\<^esub>]) \<and> ring (R [\<X>\<^bsub>?n\<^esub>]) \<and> permute_poly_args ?n \<sigma> \<in> ring_hom (R [\<X>\<^bsub>?n\<^esub>]) (R [\<X>\<^bsub>?n\<^esub>])
\<sigma> permutes {..<n}
p \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
q \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
\<lbrakk>?h \<in> ring_hom ?R ?S; ?x \<in> carrier ?R; ?y \<in> carrier ?R\<rbrakk> \<Longrightarrow> ?h (?x \<otimes>\<^bsub>?R\<^esub> ?y) = ?h ?x \<otimes>\<^bsub>?S\<^esub> ?h ?y

goal (1 subgoal):
 1. permute_poly_args n \<sigma> (p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> q) = permute_poly_args n \<sigma> p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> permute_poly_args n \<sigma> q
[PROOF STEP]
by (metis (mono_tags, lifting))


[STATEMENT]
theorem app_eq2: "app xs ys zs \<Longrightarrow> zs = xs @ ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. app xs ys zs \<Longrightarrow> zs = xs @ ys
[PROOF STEP]
by (erule app.induct) simp_all


[STATEMENT]
lemma (in monoid_add) sum_list_triv:
  "(\<Sum>x\<leftarrow>xs. r) = of_nat (length xs) * r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>xs. r) = of_nat (length xs) * r
[PROOF STEP]
by (induct xs) (simp_all add: distrib_right)


[STATEMENT]
theorem fib_gcd: "fib (gcd m n) = gcd (fib m) (fib n)"
  (is "?P m n")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
proof (induct m n rule: gcd_nat_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m. fib (gcd m 0) = gcd (fib m) (fib 0)
 2. \<And>m n. \<lbrakk>0 < n; fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))\<rbrakk> \<Longrightarrow> fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
fix m n :: nat
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m. fib (gcd m 0) = gcd (fib m) (fib 0)
 2. \<And>m n. \<lbrakk>0 < n; fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))\<rbrakk> \<Longrightarrow> fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
show "fib (gcd m 0) = gcd (fib m) (fib 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (gcd m 0) = gcd (fib m) (fib 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fib (gcd m 0) = gcd (fib m) (fib 0)

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>0 < n; fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))\<rbrakk> \<Longrightarrow> fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
assume n: "0 < n"
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>0 < n; fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))\<rbrakk> \<Longrightarrow> fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "gcd m n = gcd n (m mod n)"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. gcd m n = gcd n (m mod n)
[PROOF STEP]
by (simp add: gcd_non_0_nat)
[PROOF STATE]
proof (state)
this:
gcd m n = gcd n (m mod n)

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>0 < n; fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))\<rbrakk> \<Longrightarrow> fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd m n = gcd n (m mod n)

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>0 < n; fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))\<rbrakk> \<Longrightarrow> fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
assume hyp: "fib \<dots> = gcd (fib n) (fib (m mod n))"
[PROOF STATE]
proof (state)
this:
fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>0 < n; fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))\<rbrakk> \<Longrightarrow> fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>0 < n; fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))\<rbrakk> \<Longrightarrow> fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "\<dots> = gcd (fib n) (fib m)"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. gcd (fib n) (fib (m mod n)) = gcd (fib n) (fib m)
[PROOF STEP]
by (rule gcd_fib_mod)
[PROOF STATE]
proof (state)
this:
gcd (fib n) (fib (m mod n)) = gcd (fib n) (fib m)

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>0 < n; fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))\<rbrakk> \<Longrightarrow> fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd (fib n) (fib (m mod n)) = gcd (fib n) (fib m)

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>0 < n; fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))\<rbrakk> \<Longrightarrow> fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
have "\<dots> = gcd (fib m) (fib n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (fib n) (fib m) = gcd (fib m) (fib n)
[PROOF STEP]
by (rule gcd.commute)
[PROOF STATE]
proof (state)
this:
gcd (fib n) (fib m) = gcd (fib m) (fib n)

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>0 < n; fib (gcd n (m mod n)) = gcd (fib n) (fib (m mod n))\<rbrakk> \<Longrightarrow> fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
show "fib (gcd m n) = gcd (fib m) (fib n)"
[PROOF STATE]
proof (prove)
using this:
fib (gcd m n) = gcd (fib m) (fib n)

goal (1 subgoal):
 1. fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fib (gcd m n) = gcd (fib m) (fib n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma det_mul_finsum_alt:
  assumes A: "A \<in> carrier_mat n m"
    and B: "B \<in> carrier_mat m n"
  shows "det (A*B) = det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a::comm_ring_1) n
  (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v Matrix.col A k) {0..<m}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
have AT: "A\<^sup>T \<in> carrier_mat m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A\<^sup>T \<in> carrier_mat m n
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n m

goal (1 subgoal):
 1. A\<^sup>T \<in> carrier_mat m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A\<^sup>T \<in> carrier_mat m n

goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
have BT: "B\<^sup>T \<in> carrier_mat n m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B\<^sup>T \<in> carrier_mat n m
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat m n

goal (1 subgoal):
 1. B\<^sup>T \<in> carrier_mat n m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B\<^sup>T \<in> carrier_mat n m

goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
let ?f = "(\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
let ?g = "(\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v Matrix.col A k) {0..<m})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
let ?lhs = "mat\<^sub>r n n ?f"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
let ?rhs = "mat\<^sub>r n n ?g"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
have lhs_rhs: "?lhs = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})
[PROOF STEP]
proof (rule eq_matI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
 2. dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m})) = dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
 3. dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m})) = dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
show "dim_row ?lhs = dim_row ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m})) = dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m})) = dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
 2. dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m})) = dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
show "dim_col ?lhs = dim_col ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m})) = dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m})) = dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
assume i: "i < dim_row ?rhs" and j: "j < dim_col ?rhs"
[PROOF STATE]
proof (state)
this:
i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
have j_n: "j<n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < n
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))

goal (1 subgoal):
 1. j < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j < n

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
have "?lhs $$ (i, j) = ?f i $v j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m} $v j
[PROOF STEP]
by (rule index_mat, insert i j, auto)
[PROOF STATE]
proof (state)
this:
mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m} $v j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m} $v j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
have "... = (\<Sum>k\<in>{0..<m}. (B\<^sup>T $$ (i, k) \<cdot>\<^sub>v row A\<^sup>T k) $ j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m} $v j = (\<Sum>k = 0..<m. (B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) $v j)
[PROOF STEP]
by (rule index_finsum_vec[OF _ j_n], auto simp add: A)
[PROOF STATE]
proof (state)
this:
finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m} $v j = (\<Sum>k = 0..<m. (B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) $v j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m} $v j = (\<Sum>k = 0..<m. (B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) $v j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
have "... = (\<Sum>k\<in>{0..<m}. (B $$ (k, i) \<cdot>\<^sub>v col A k) $ j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<m. (B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) $v j) = (\<Sum>k = 0..<m. (B $$ (k, i) \<cdot>\<^sub>v col A k) $v j)
[PROOF STEP]
proof (rule sum.cong, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x < m \<Longrightarrow> (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x < m \<Longrightarrow> (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
assume x: "x<m"
[PROOF STATE]
proof (state)
this:
x < m

goal (1 subgoal):
 1. \<And>x. x < m \<Longrightarrow> (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
have row_rw: "Matrix.row A\<^sup>T x = col A x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row A\<^sup>T x = col A x
[PROOF STEP]
by (rule row_transpose, insert A x, auto)
[PROOF STATE]
proof (state)
this:
Matrix.row A\<^sup>T x = col A x

goal (1 subgoal):
 1. \<And>x. x < m \<Longrightarrow> (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
have B_rw: "B\<^sup>T $$ (i,x) = B $$ (x, i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B\<^sup>T $$ (i, x) = B $$ (x, i)
[PROOF STEP]
by (rule index_transpose_mat, insert x i B, auto)
[PROOF STATE]
proof (state)
this:
B\<^sup>T $$ (i, x) = B $$ (x, i)

goal (1 subgoal):
 1. \<And>x. x < m \<Longrightarrow> (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
have "(B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = B\<^sup>T $$ (i, x) * Matrix.row A\<^sup>T x $v j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = B\<^sup>T $$ (i, x) * Matrix.row A\<^sup>T x $v j
[PROOF STEP]
by (rule index_smult_vec, insert A j_n, auto)
[PROOF STATE]
proof (state)
this:
(B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = B\<^sup>T $$ (i, x) * Matrix.row A\<^sup>T x $v j

goal (1 subgoal):
 1. \<And>x. x < m \<Longrightarrow> (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = B\<^sup>T $$ (i, x) * Matrix.row A\<^sup>T x $v j

goal (1 subgoal):
 1. \<And>x. x < m \<Longrightarrow> (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
have "... = B $$ (x, i) * col A x $v j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B\<^sup>T $$ (i, x) * Matrix.row A\<^sup>T x $v j = B $$ (x, i) * col A x $v j
[PROOF STEP]
unfolding row_rw B_rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B $$ (x, i) * col A x $v j = B $$ (x, i) * col A x $v j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B\<^sup>T $$ (i, x) * Matrix.row A\<^sup>T x $v j = B $$ (x, i) * col A x $v j

goal (1 subgoal):
 1. \<And>x. x < m \<Longrightarrow> (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B\<^sup>T $$ (i, x) * Matrix.row A\<^sup>T x $v j = B $$ (x, i) * col A x $v j

goal (1 subgoal):
 1. \<And>x. x < m \<Longrightarrow> (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
have "... = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B $$ (x, i) * col A x $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
by (rule index_smult_vec[symmetric], insert A j_n, auto)
[PROOF STATE]
proof (state)
this:
B $$ (x, i) * col A x $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j

goal (1 subgoal):
 1. \<And>x. x < m \<Longrightarrow> (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
show " (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j"
[PROOF STATE]
proof (prove)
using this:
(B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j

goal (1 subgoal):
 1. (B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(B\<^sup>T $$ (i, x) \<cdot>\<^sub>v Matrix.row A\<^sup>T x) $v j = (B $$ (x, i) \<cdot>\<^sub>v col A x) $v j

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<m. (B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) $v j) = (\<Sum>k = 0..<m. (B $$ (k, i) \<cdot>\<^sub>v col A k) $v j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<m. (B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) $v j) = (\<Sum>k = 0..<m. (B $$ (k, i) \<cdot>\<^sub>v col A k) $v j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
have "... = ?g i $v j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<m. (B $$ (k, i) \<cdot>\<^sub>v col A k) $v j) = finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m} $v j
[PROOF STEP]
by (rule index_finsum_vec[symmetric, OF _ j_n], auto simp add: A)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<m. (B $$ (k, i) \<cdot>\<^sub>v col A k) $v j) = finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m} $v j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<m. (B $$ (k, i) \<cdot>\<^sub>v col A k) $v j) = finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m} $v j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
have "... = ?rhs $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m} $v j = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
by (rule index_mat[symmetric], insert i j, auto)
[PROOF STATE]
proof (state)
this:
finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m} $v j = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})); j < dim_col (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))\<rbrakk> \<Longrightarrow> mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
show "?lhs $$ (i, j) = ?rhs $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)

goal (1 subgoal):
 1. mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) $$ (i, j) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}) = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m})

goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
have "det (A*B) = det (B\<^sup>T*A\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (B\<^sup>T * A\<^sup>T)
[PROOF STEP]
using det_transpose
[PROOF STATE]
proof (prove)
using this:
?A \<in> carrier_mat ?n ?n \<Longrightarrow> Determinant.det ?A\<^sup>T = Determinant.det ?A

goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (B\<^sup>T * A\<^sup>T)
[PROOF STEP]
by (metis A B Matrix.transpose_mult mult_carrier_mat)
[PROOF STATE]
proof (state)
this:
Determinant.det (A * B) = Determinant.det (B\<^sup>T * A\<^sup>T)

goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Determinant.det (A * B) = Determinant.det (B\<^sup>T * A\<^sup>T)

goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
have "... =  det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (B\<^sup>T * A\<^sup>T) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}))
[PROOF STEP]
using mat_mul_finsum_alt[OF BT AT]
[PROOF STATE]
proof (prove)
using this:
B\<^sup>T * A\<^sup>T = mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m})

goal (1 subgoal):
 1. Determinant.det (B\<^sup>T * A\<^sup>T) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Determinant.det (B\<^sup>T * A\<^sup>T) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}))

goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Determinant.det (B\<^sup>T * A\<^sup>T) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m}))

goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
have "... = det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v Matrix.col A k) {0..<m}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m})) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
by (rule arg_cong[of _ _ det], rule lhs_rhs)
[PROOF STATE]
proof (state)
this:
Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B\<^sup>T $$ (i, k) \<cdot>\<^sub>v Matrix.row A\<^sup>T k) {0..<m})) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))

goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))

goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Determinant.det (A * B) = Determinant.det (mat\<^sub>r n n (\<lambda>i. finsum_vec TYPE('a) n (\<lambda>k. B $$ (k, i) \<cdot>\<^sub>v col A k) {0..<m}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_div_2_less: "a \<noteq> 0 \<Longrightarrow> a \<noteq> -1 \<Longrightarrow> \<bar>(a::int) div 2\<bar> < \<bar>a\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<noteq> 0; a \<noteq> - 1\<rbrakk> \<Longrightarrow> \<bar>a div 2\<bar> < \<bar>a\<bar>
[PROOF STEP]
by arith


[STATEMENT]
lemma mtx_invertible_inv[simp]: "mtx_invertible A \<Longrightarrow> mtx_invertible (A\<^sup>-\<^sup>1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mtx_invertible A \<Longrightarrow> mtx_invertible A\<^sup>-\<^sup>1
[PROOF STEP]
using mtx_invertibleD mtx_invertibleI
[PROOF STATE]
proof (prove)
using this:
mtx_invertible ?A \<Longrightarrow> ?A\<^sup>-\<^sup>1 * ?A = 1
mtx_invertible ?A \<Longrightarrow> ?A * ?A\<^sup>-\<^sup>1 = 1
\<lbrakk>?A * ?B = 1; ?B * ?A = 1\<rbrakk> \<Longrightarrow> mtx_invertible ?A

goal (1 subgoal):
 1. mtx_invertible A \<Longrightarrow> mtx_invertible A\<^sup>-\<^sup>1
[PROOF STEP]
by blast