[STATEMENT]
lemma discriminant_lemma:
  fixes a b c r::"real"
  assumes aneq: "a \<noteq> 0"
  assumes beq: "b = 2 * a * r"
  assumes root: " a * r^2 - 2 * a * r*r + c = 0"
  shows "\<forall>x. a * x\<^sup>2 + b * x + c = 0 \<longleftrightarrow> x = -r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - r)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - r)
[PROOF STEP]
have "c = a*r^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c = a * r\<^sup>2
[PROOF STEP]
using root
[PROOF STATE]
proof (prove)
using this:
a * r\<^sup>2 - 2 * a * r * r + c = 0

goal (1 subgoal):
 1. c = a * r\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
c = a * r\<^sup>2

goal (1 subgoal):
 1. \<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c = a * r\<^sup>2
[PROOF STEP]
have same: "b^2 - 4*a*c = (2 * a * r)^2 - 4*a*(a*r^2)"
[PROOF STATE]
proof (prove)
using this:
c = a * r\<^sup>2

goal (1 subgoal):
 1. b\<^sup>2 - 4 * a * c = (2 * a * r)\<^sup>2 - 4 * a * (a * r\<^sup>2)
[PROOF STEP]
using beq
[PROOF STATE]
proof (prove)
using this:
c = a * r\<^sup>2
b = 2 * a * r

goal (1 subgoal):
 1. b\<^sup>2 - 4 * a * c = (2 * a * r)\<^sup>2 - 4 * a * (a * r\<^sup>2)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b\<^sup>2 - 4 * a * c = (2 * a * r)\<^sup>2 - 4 * a * (a * r\<^sup>2)

goal (1 subgoal):
 1. \<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - r)
[PROOF STEP]
have "(2 * a * r)^2 = 4*a^2*r^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 * a * r)\<^sup>2 = 4 * a\<^sup>2 * r\<^sup>2
[PROOF STEP]
by (simp add: mult.commute power2_eq_square)
[PROOF STATE]
proof (state)
this:
(2 * a * r)\<^sup>2 = 4 * a\<^sup>2 * r\<^sup>2

goal (1 subgoal):
 1. \<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(2 * a * r)\<^sup>2 = 4 * a\<^sup>2 * r\<^sup>2
[PROOF STEP]
have "(2 * a * r)^2 - 4*a*(a*(r)^2) = 0"
[PROOF STATE]
proof (prove)
using this:
(2 * a * r)\<^sup>2 = 4 * a\<^sup>2 * r\<^sup>2

goal (1 subgoal):
 1. (2 * a * r)\<^sup>2 - 4 * a * (a * r\<^sup>2) = 0
[PROOF STEP]
using power2_eq_square
[PROOF STATE]
proof (prove)
using this:
(2 * a * r)\<^sup>2 = 4 * a\<^sup>2 * r\<^sup>2
?a\<^sup>2 = ?a * ?a

goal (1 subgoal):
 1. (2 * a * r)\<^sup>2 - 4 * a * (a * r\<^sup>2) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(2 * a * r)\<^sup>2 - 4 * a * (a * r\<^sup>2) = 0

goal (1 subgoal):
 1. \<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(2 * a * r)\<^sup>2 - 4 * a * (a * r\<^sup>2) = 0
[PROOF STEP]
have "b^2 - 4*a*c = 0"
[PROOF STATE]
proof (prove)
using this:
(2 * a * r)\<^sup>2 - 4 * a * (a * r\<^sup>2) = 0

goal (1 subgoal):
 1. b\<^sup>2 - 4 * a * c = 0
[PROOF STEP]
using same
[PROOF STATE]
proof (prove)
using this:
(2 * a * r)\<^sup>2 - 4 * a * (a * r\<^sup>2) = 0
b\<^sup>2 - 4 * a * c = (2 * a * r)\<^sup>2 - 4 * a * (a * r\<^sup>2)

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

goal (1 subgoal):
 1. \<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b\<^sup>2 - 4 * a * c = 0
[PROOF STEP]
have "\<forall>x. a * x\<^sup>2 + b * x + c = 0 \<longleftrightarrow> x = -b / (2 * a)"
[PROOF STATE]
proof (prove)
using this:
b\<^sup>2 - 4 * a * c = 0

goal (1 subgoal):
 1. \<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - b / (2 * a))
[PROOF STEP]
using discriminant_zero aneq
[PROOF STATE]
proof (prove)
using this:
b\<^sup>2 - 4 * a * c = 0
\<lbrakk>?a \<noteq> 0; discrim ?a ?b ?c = 0\<rbrakk> \<Longrightarrow> (?a * ?x\<^sup>2 + ?b * ?x + ?c = 0) = (?x = - ?b / (2 * ?a))
a \<noteq> 0

goal (1 subgoal):
 1. \<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - b / (2 * a))
[PROOF STEP]
unfolding discrim_def
[PROOF STATE]
proof (prove)
using this:
b\<^sup>2 - 4 * a * c = 0
\<lbrakk>?a \<noteq> 0; ?b\<^sup>2 - 4 * ?a * ?c = 0\<rbrakk> \<Longrightarrow> (?a * ?x\<^sup>2 + ?b * ?x + ?c = 0) = (?x = - ?b / (2 * ?a))
a \<noteq> 0

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

goal (1 subgoal):
 1. \<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - b / (2 * a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - b / (2 * a))

goal (1 subgoal):
 1. \<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - r)
[PROOF STEP]
using beq
[PROOF STATE]
proof (prove)
using this:
\<forall>x. (a * x\<^sup>2 + b * x + c = 0) = (x = - b / (2 * a))
b = 2 * a * r

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_all2_reorder_right_invariance:
  assumes rel: "list_all2 R xs ys" and ms_y: "mset ys' = mset ys"
  shows "\<exists>xs'. list_all2 R xs' ys' \<and> mset xs' = mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xs'. list_all2 R xs' ys' \<and> mset xs' = mset xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>xs'. list_all2 R xs' ys' \<and> mset xs' = mset xs
[PROOF STEP]
have len: "length xs = length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys
[PROOF STEP]
using rel list_all2_conv_all_nth
[PROOF STATE]
proof (prove)
using this:
list_all2 R xs ys
list_all2 ?P ?xs ?ys = (length ?xs = length ?ys \<and> (\<forall>i<length ?xs. ?P (?xs ! i) (?ys ! i)))

goal (1 subgoal):
 1. length xs = length ys
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length xs = length ys

goal (1 subgoal):
 1. \<exists>xs'. list_all2 R xs' ys' \<and> mset xs' = mset xs
[PROOF STEP]
obtain xs' where
    len': "length xs' = length ys'" and ms_xy: "mset (zip xs' ys') = mset (zip xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>xs'. \<lbrakk>length xs' = length ys'; mset (zip xs' ys') = mset (zip xs ys)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using len ms_y
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
mset ys' = mset ys

goal (1 subgoal):
 1. (\<And>xs'. \<lbrakk>length xs' = length ys'; mset (zip xs' ys') = mset (zip xs ys)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis ex_mset_zip_right)
[PROOF STATE]
proof (state)
this:
length xs' = length ys'
mset (zip xs' ys') = mset (zip xs ys)

goal (1 subgoal):
 1. \<exists>xs'. list_all2 R xs' ys' \<and> mset xs' = mset xs
[PROOF STEP]
have "list_all2 R xs' ys'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 R xs' ys'
[PROOF STEP]
using assms(1) len' ms_xy
[PROOF STATE]
proof (prove)
using this:
list_all2 R xs ys
length xs' = length ys'
mset (zip xs' ys') = mset (zip xs ys)

goal (1 subgoal):
 1. list_all2 R xs' ys'
[PROOF STEP]
unfolding list_all2_iff
[PROOF STATE]
proof (prove)
using this:
length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). R x y)
length xs' = length ys'
mset (zip xs' ys') = mset (zip xs ys)

goal (1 subgoal):
 1. length xs' = length ys' \<and> (\<forall>(x, y)\<in>set (zip xs' ys'). R x y)
[PROOF STEP]
by (blast dest: mset_eq_setD)
[PROOF STATE]
proof (state)
this:
list_all2 R xs' ys'

goal (1 subgoal):
 1. \<exists>xs'. list_all2 R xs' ys' \<and> mset xs' = mset xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
list_all2 R xs' ys'

goal (1 subgoal):
 1. \<exists>xs'. list_all2 R xs' ys' \<and> mset xs' = mset xs
[PROOF STEP]
have "mset xs' = mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset xs' = mset xs
[PROOF STEP]
using len len' ms_xy map_fst_zip mset_map
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
length xs' = length ys'
mset (zip xs' ys') = mset (zip xs ys)
length ?xs = length ?ys \<Longrightarrow> map fst (zip ?xs ?ys) = ?xs
mset (map ?f ?xs) = image_mset ?f (mset ?xs)

goal (1 subgoal):
 1. mset xs' = mset xs
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
mset xs' = mset xs

goal (1 subgoal):
 1. \<exists>xs'. list_all2 R xs' ys' \<and> mset xs' = mset xs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
list_all2 R xs' ys'
mset xs' = mset xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
list_all2 R xs' ys'
mset xs' = mset xs

goal (1 subgoal):
 1. \<exists>xs'. list_all2 R xs' ys' \<and> mset xs' = mset xs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>xs'. list_all2 R xs' ys' \<and> mset xs' = mset xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lim_in_closed_set:
  assumes "closed S" "eventually (\<lambda>x. f(x) \<in> S) F" "F \<noteq> bot" "(f \<longlongrightarrow> l) F"
  shows "l \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l \<in> S
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
assume "l \<notin> S"
[PROOF STATE]
proof (state)
this:
l \<notin> S

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with \<open>closed S\<close>
[PROOF STATE]
proof (chain)
picking this:
closed S
l \<notin> S
[PROOF STEP]
have "open (- S)" "l \<in> - S"
[PROOF STATE]
proof (prove)
using this:
closed S
l \<notin> S

goal (1 subgoal):
 1. open (- S) &&& l \<in> - S
[PROOF STEP]
by (simp_all add: open_Compl)
[PROOF STATE]
proof (state)
this:
open (- S)
l \<in> - S

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with assms(4)
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> l) F
open (- S)
l \<in> - S
[PROOF STEP]
have "eventually (\<lambda>x. f x \<in> - S) F"
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> l) F
open (- S)
l \<in> - S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<in> - S
[PROOF STEP]
by (rule topological_tendstoD)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. f x \<in> - S

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with assms(2)
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. f x \<in> S
\<forall>\<^sub>F x in F. f x \<in> - S
[PROOF STEP]
have "eventually (\<lambda>x. False) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x \<in> S
\<forall>\<^sub>F x in F. f x \<in> - S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. False
[PROOF STEP]
by (rule eventually_elim2) simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. False

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with assms(3)
[PROOF STATE]
proof (chain)
picking this:
F \<noteq> bot
\<forall>\<^sub>F x in F. False
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
F \<noteq> bot
\<forall>\<^sub>F x in F. False

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma row_copy_first_matrix:
assumes "i < nr"
shows "row (copy_first_matrix nr nc) i = unit_vec nc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (copy_first_matrix nr nc) i = unit_vec nc 0
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>ia. ia < dim_vec (unit_vec nc 0) \<Longrightarrow> row (copy_first_matrix nr nc) i $ ia = unit_vec nc 0 $ ia
 2. dim_vec (row (copy_first_matrix nr nc) i) = dim_vec (unit_vec nc 0)
[PROOF STEP]
apply (auto simp add: copy_first_matrix_def assms)[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (row (copy_first_matrix nr nc) i) = dim_vec (unit_vec nc 0)
[PROOF STEP]
by (simp add: copy_first_matrix_def)


[STATEMENT]
lemma bilinear_rzero:
  assumes "bilinear h"
  shows "h x 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h x (0::'b) = (0::'c)
[PROOF STEP]
using bilinear_radd [OF assms, of x 0 0 ]
[PROOF STATE]
proof (prove)
using this:
h x ((0::'b) + (0::'b)) = h x (0::'b) + h x (0::'b)

goal (1 subgoal):
 1. h x (0::'b) = (0::'c)
[PROOF STEP]
by (simp add: eq_add_iff field_simps)


[STATEMENT]
lemma "\<bar>(-4::int) + 2 * 1\<bar> = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>- 4 + 2 * 1\<bar> = 2
[PROOF STEP]
by normalization


[STATEMENT]
lemma ctendsto_componentwise:
  fixes a::"'a::ceuclidean_space \<Rightarrow>\<^sub>C\<^sub>L 'b::ceuclidean_space"
    and b::"'c \<Rightarrow> 'a \<Rightarrow>\<^sub>C\<^sub>L 'b"
  shows "(\<And>i j. i \<in> CBasis \<Longrightarrow> j \<in> CBasis \<Longrightarrow> ((\<lambda>n. b n j \<bullet>\<^sub>C i) \<longlongrightarrow> a j \<bullet>\<^sub>C i) F) \<Longrightarrow> (b \<longlongrightarrow> a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>i \<in> CBasis; j \<in> CBasis\<rbrakk> \<Longrightarrow> ((\<lambda>n. cblinfun_apply (b n) j \<bullet>\<^sub>C i) \<longlongrightarrow> cblinfun_apply a j \<bullet>\<^sub>C i) F) \<Longrightarrow> (b \<longlongrightarrow> a) F
[PROOF STEP]
apply (subst cblinfun_of_matrix_works[of a, symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>i \<in> CBasis; j \<in> CBasis\<rbrakk> \<Longrightarrow> ((\<lambda>n. cblinfun_apply (b n) j \<bullet>\<^sub>C i) \<longlongrightarrow> cblinfun_apply a j \<bullet>\<^sub>C i) F) \<Longrightarrow> (b \<longlongrightarrow> cblinfun_of_matrix (\<lambda>i j. i \<bullet>\<^sub>C cblinfun_apply a j)) F
[PROOF STEP]
apply (subst cblinfun_of_matrix_works[of "b x" for x, symmetric, abs_def])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>i \<in> CBasis; j \<in> CBasis\<rbrakk> \<Longrightarrow> ((\<lambda>n. cblinfun_apply (b n) j \<bullet>\<^sub>C i) \<longlongrightarrow> cblinfun_apply a j \<bullet>\<^sub>C i) F) \<Longrightarrow> ((\<lambda>x. cblinfun_of_matrix (\<lambda>i j. i \<bullet>\<^sub>C cblinfun_apply (b x) j)) \<longlongrightarrow> cblinfun_of_matrix (\<lambda>i j. i \<bullet>\<^sub>C cblinfun_apply a j)) F
[PROOF STEP]
apply (rule tendsto_cblinfun_of_matrix)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>\<And>i j. \<lbrakk>i \<in> CBasis; j \<in> CBasis\<rbrakk> \<Longrightarrow> ((\<lambda>n. cblinfun_apply (b n) j \<bullet>\<^sub>C i) \<longlongrightarrow> cblinfun_apply a j \<bullet>\<^sub>C i) F; i \<in> CBasis; j \<in> CBasis\<rbrakk> \<Longrightarrow> ((\<lambda>x. i \<bullet>\<^sub>C cblinfun_apply (b x) j) \<longlongrightarrow> i \<bullet>\<^sub>C cblinfun_apply a j) F
[PROOF STEP]
apply (subst (1) cinner_commute, subst (2) cinner_commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>\<And>i j. \<lbrakk>i \<in> CBasis; j \<in> CBasis\<rbrakk> \<Longrightarrow> ((\<lambda>n. cblinfun_apply (b n) j \<bullet>\<^sub>C i) \<longlongrightarrow> cblinfun_apply a j \<bullet>\<^sub>C i) F; i \<in> CBasis; j \<in> CBasis\<rbrakk> \<Longrightarrow> ((\<lambda>x. cnj (cblinfun_apply (b x) j \<bullet>\<^sub>C i)) \<longlongrightarrow> cnj (cblinfun_apply a j \<bullet>\<^sub>C i)) F
[PROOF STEP]
by (metis lim_cnj)


[STATEMENT]
lemma valofn_eq:
  fixes x y :: "('e, 'f) float"
  assumes "valofn x = valofn y"
  shows "exponent x = exponent y" "fraction x = fraction y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IEEE.exponent x = IEEE.exponent y &&& fraction x = fraction y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. IEEE.exponent x = IEEE.exponent y
 2. fraction x = fraction y
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
valofn x = valofn y
[PROOF STEP]
show "exponent x = exponent y"
[PROOF STATE]
proof (prove)
using this:
valofn x = valofn y

goal (1 subgoal):
 1. IEEE.exponent x = IEEE.exponent y
[PROOF STEP]
by (auto intro!: antisym valofn_le_imp_exponent_le)
[PROOF STATE]
proof (state)
this:
IEEE.exponent x = IEEE.exponent y

goal (1 subgoal):
 1. fraction x = fraction y
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
valofn x = valofn y
IEEE.exponent x = IEEE.exponent y
[PROOF STEP]
show "fraction x = fraction y"
[PROOF STATE]
proof (prove)
using this:
valofn x = valofn y
IEEE.exponent x = IEEE.exponent y

goal (1 subgoal):
 1. fraction x = fraction y
[PROOF STEP]
unfolding valofn_def
[PROOF STATE]
proof (prove)
using this:
2 ^ IEEE.exponent x / 2 ^ bias TYPE(('e, 'f) IEEE.float) * (1 + real (fraction x) / 2 ^ LENGTH('f)) = 2 ^ IEEE.exponent y / 2 ^ bias TYPE(('e, 'f) IEEE.float) * (1 + real (fraction y) / 2 ^ LENGTH('f))
IEEE.exponent x = IEEE.exponent y

goal (1 subgoal):
 1. fraction x = fraction y
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
fraction x = fraction y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Elem_Elem_Fun: "Elem F (Fun U V) \<Longrightarrow> Elem p F \<Longrightarrow> isOpair p & Elem (Fst p) U & Elem (Snd p) V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Elem F (Fun U V); Elem p F\<rbrakk> \<Longrightarrow> isOpair p \<and> Elem (Fst p) U \<and> Elem (Snd p) V
[PROOF STEP]
by (auto simp add: Elem_Elem_PFun dest: Fun_implies_PFun)


[STATEMENT]
lemma ldrop_enat [code]: "ldrop (enat n) xs = ldropn n xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldrop (enat n) xs = ldropn n xs
[PROOF STEP]
proof(induct n arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. ldrop (enat 0) xs = ldropn 0 xs
 2. \<And>n xs. (\<And>xs. ldrop (enat n) xs = ldropn n xs) \<Longrightarrow> ldrop (enat (Suc n)) xs = ldropn (Suc n) xs
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
ldrop (enat n_) ?xs = ldropn n_ ?xs

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

goal (1 subgoal):
 1. ldrop (enat (Suc n_)) xs = ldropn (Suc n_) xs
[PROOF STEP]
by(cases xs)(simp_all add: eSuc_enat[symmetric])
[PROOF STATE]
proof (state)
this:
ldrop (enat (Suc n_)) xs = ldropn (Suc n_) xs

goal (1 subgoal):
 1. \<And>xs. ldrop (enat 0) xs = ldropn 0 xs
[PROOF STEP]
qed(simp add: zero_enat_def[symmetric])


[STATEMENT]
lemma prefixes_prefix_subset :
  assumes "xs \<in> set (prefixes ys)"
  shows "set (prefixes xs) \<subseteq> set (prefixes ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (prefixes xs) \<subseteq> set (prefixes ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
xs \<in> set (prefixes ys)

goal (1 subgoal):
 1. set (prefixes xs) \<subseteq> set (prefixes ys)
[PROOF STEP]
unfolding prefixes_set
[PROOF STATE]
proof (prove)
using this:
xs \<in> {xs'. \<exists>xs''. xs' @ xs'' = ys}

goal (1 subgoal):
 1. {xs'. \<exists>xs''. xs' @ xs'' = xs} \<subseteq> {xs'. \<exists>xs''. xs' @ xs'' = ys}
[PROOF STEP]
by auto


[STATEMENT]
lemma int_of_rat_0[simp]: "(int_of_rat x = 0) = (x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int_of_rat x = 0) = (x = 0)
[PROOF STEP]
unfolding int_of_rat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fst (quotient_of x) = 0) = (x = 0)
[PROOF STEP]
using quotient_of_div[of x]
[PROOF STATE]
proof (prove)
using this:
quotient_of x = (?n, ?d) \<Longrightarrow> x = rat_of_int ?n / rat_of_int ?d

goal (1 subgoal):
 1. (fst (quotient_of x) = 0) = (x = 0)
[PROOF STEP]
by (cases "quotient_of x", auto)


[STATEMENT]
lemma vec_to_iarray_columns: "vec_to_iarray` (columns A) = columns_iarray (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray ` columns A = columns_iarray (matrix_to_iarray A)
[PROOF STEP]
unfolding columns_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray ` {column i A |i. i \<in> UNIV} = columns_iarray (matrix_to_iarray A)
[PROOF STEP]
unfolding columns_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray ` {column i A |i. i \<in> UNIV} = {column_iarray i (matrix_to_iarray A) |i. i \<in> {..<ncols_iarray (matrix_to_iarray A)}}
[PROOF STEP]
apply(auto simp add: ncols_eq_card_columns to_nat_less_card vec_to_iarray_column)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < CARD('c) \<Longrightarrow> column_iarray i (matrix_to_iarray A) \<in> vec_to_iarray ` {uu_. \<exists>i. uu_ = column i A}
[PROOF STEP]
by (unfold image_def, auto, metis from_nat_not_eq vec_to_iarray_column)


[STATEMENT]
lemma finite_ipoly_roots: assumes "p \<noteq> 0"
  shows "finite {x :: real. ipoly p x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x. poly (real_of_int_poly p) x = 0}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {x. poly (real_of_int_poly p) x = 0}
[PROOF STEP]
let ?p = "real_of_int_poly p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {x. poly (real_of_int_poly p) x = 0}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
[PROOF STEP]
have "?p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

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

goal (1 subgoal):
 1. finite {x. poly (real_of_int_poly p) x = 0}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int_poly p \<noteq> 0

goal (1 subgoal):
 1. finite {x. poly (real_of_int_poly p) x = 0}
[PROOF STEP]
by (rule poly_roots_finite)
[PROOF STATE]
proof (state)
this:
finite {x. poly (real_of_int_poly p) x = 0}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_degree_app_iso_eq:
  assumes "digraph_isomorphism hom" and "u \<in> verts G"
  shows "in_degree (app_iso hom G) (iso_verts hom u) = in_degree G u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. in_degree (app_iso hom G) (iso_verts hom u) = in_degree G u
[PROOF STEP]
unfolding in_degree_def in_arcs_app_iso_eq[OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (iso_arcs hom ` in_arcs G u) = card (in_arcs G u)
[PROOF STEP]
proof (rule card_image)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on (iso_arcs hom) (in_arcs G u)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
digraph_isomorphism hom
u \<in> verts G
[PROOF STEP]
show "inj_on (iso_arcs hom) (in_arcs G u)"
[PROOF STATE]
proof (prove)
using this:
digraph_isomorphism hom
u \<in> verts G

goal (1 subgoal):
 1. inj_on (iso_arcs hom) (in_arcs G u)
[PROOF STEP]
unfolding digraph_isomorphism_def
[PROOF STATE]
proof (prove)
using this:
wf_digraph G \<and> inj_on (iso_verts hom) (verts G) \<and> inj_on (iso_arcs hom) (arcs G) \<and> (\<forall>a\<in>arcs G. iso_verts hom (tail G a) = iso_tail hom (iso_arcs hom a) \<and> iso_verts hom (head G a) = iso_head hom (iso_arcs hom a))
u \<in> verts G

goal (1 subgoal):
 1. inj_on (iso_arcs hom) (in_arcs G u)
[PROOF STEP]
by - (rule subset_inj_on, auto)
[PROOF STATE]
proof (state)
this:
inj_on (iso_arcs hom) (in_arcs G u)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fls_inverse_delta_nonzero:
  fixes   b :: "'a::{comm_monoid_add,inverse,mult_zero,uminus}"
  assumes "b \<noteq> 0"
  shows   "inverse (Abs_fls (\<lambda>n. if n=a then b else 0)) =
            Abs_fls (\<lambda>n. if n=-a then inverse b else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (Abs_fls (\<lambda>n. if n = a then b else (0::'a))) = Abs_fls (\<lambda>n. if n = - a then inverse b else (0::'a))
[PROOF STEP]
using   assms fls_nonzeroI[of "Abs_fls (\<lambda>n. if n=a then b else 0)" a]
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)
Abs_fls (\<lambda>n. if n = a then b else (0::'a)) $$ a \<noteq> (0::'a) \<Longrightarrow> Abs_fls (\<lambda>n. if n = a then b else (0::'a)) \<noteq> 0

goal (1 subgoal):
 1. inverse (Abs_fls (\<lambda>n. if n = a then b else (0::'a))) = Abs_fls (\<lambda>n. if n = - a then inverse b else (0::'a))
[PROOF STEP]
by      (simp add: fls_inverse_def' fls_right_inverse_delta[symmetric])


[STATEMENT]
lemma filtermap_at_shift: "filtermap (\<lambda>x. x - d) (at a) = at (a - d)"
  for a d :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap (\<lambda>x. x - d) (at a) = at (a - d)
[PROOF STEP]
by (simp add: filter_eq_iff eventually_filtermap eventually_at_filter filtermap_nhds_shift[symmetric])


[STATEMENT]
lemma summable_zero_power [simp]: "summable (\<lambda>n. 0 ^ n :: 'a::{comm_ring_1,topological_space})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable ((^) (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable ((^) (0::'a))
[PROOF STEP]
have "(\<lambda>n. 0 ^ n :: 'a) = (\<lambda>n. if n = 0 then 0^0 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (^) (0::'a) = (\<lambda>n. if n = 0 then (0::'a) ^ 0 else (0::'a))
[PROOF STEP]
by (intro ext) (simp add: zero_power)
[PROOF STATE]
proof (state)
this:
(^) (0::'a) = (\<lambda>n. if n = 0 then (0::'a) ^ 0 else (0::'a))

goal (1 subgoal):
 1. summable ((^) (0::'a))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(^) (0::'a) = (\<lambda>n. if n = 0 then (0::'a) ^ 0 else (0::'a))

goal (1 subgoal):
 1. summable ((^) (0::'a))
[PROOF STEP]
have "summable \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. if n = 0 then (0::'a) ^ 0 else (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. if n = 0 then (0::'a) ^ 0 else (0::'a))

goal (1 subgoal):
 1. summable ((^) (0::'a))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(^) (0::'a) = (\<lambda>n. if n = 0 then (0::'a) ^ 0 else (0::'a))
summable (\<lambda>n. if n = 0 then (0::'a) ^ 0 else (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(^) (0::'a) = (\<lambda>n. if n = 0 then (0::'a) ^ 0 else (0::'a))
summable (\<lambda>n. if n = 0 then (0::'a) ^ 0 else (0::'a))

goal (1 subgoal):
 1. summable ((^) (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
summable ((^) (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scalar_prod_inc_vec_const_inter:
  assumes "j1 < \<b>" "j2 < \<b>" "j1 \<noteq> j2"
  shows "(col N j1) \<bullet> (col N j2) = \<m>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col N j1 \<bullet> col N j2 = int \<m>
[PROOF STEP]
using scalar_prod_inc_vec_inter_num indexed_const_intersect assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?j1.0 < \<b>; ?j2.0 < \<b>\<rbrakk> \<Longrightarrow> col N ?j1.0 \<bullet> col N ?j2.0 = int (\<B>s ! ?j1.0 |\<inter>| \<B>s ! ?j2.0)
\<lbrakk>?j1.0 < \<b>; ?j2.0 < \<b>; ?j1.0 \<noteq> ?j2.0\<rbrakk> \<Longrightarrow> \<B>s ! ?j1.0 |\<inter>| \<B>s ! ?j2.0 = \<m>
j1 < \<b>
j2 < \<b>
j1 \<noteq> j2

goal (1 subgoal):
 1. col N j1 \<bullet> col N j2 = int \<m>
[PROOF STEP]
by simp


[STATEMENT]
lemma coeff_pcompose_linear:
  fixes p :: "'a :: comm_semiring_1 poly"
  shows "coeff (pcompose p [:0, c:]) i = c ^ i * coeff p i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p \<circ>\<^sub>p [:0::'a, c:]) i = c ^ i * coeff p i
[PROOF STEP]
by (induction p arbitrary: i) (auto simp: pcompose_pCons coeff_pCons mult_ac split: nat.splits)


[STATEMENT]
lemma nonneg_cexprD:
    "nonneg_cexpr V \<Gamma> e \<Longrightarrow> \<sigma> \<in> space (state_measure V \<Gamma>) \<Longrightarrow> extract_real (cexpr_sem \<sigma> e) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>nonneg_cexpr V \<Gamma> e; \<sigma> \<in> space (state_measure V \<Gamma>)\<rbrakk> \<Longrightarrow> 0 \<le> extract_real (cexpr_sem \<sigma> e)
[PROOF STEP]
unfolding nonneg_cexpr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<sigma>\<in>space (state_measure V \<Gamma>). 0 \<le> extract_real (cexpr_sem \<sigma> e); \<sigma> \<in> space (state_measure V \<Gamma>)\<rbrakk> \<Longrightarrow> 0 \<le> extract_real (cexpr_sem \<sigma> e)
[PROOF STEP]
by simp


[STATEMENT]
lemma DERIV_chain': "(f has_field_derivative D) (at x within s) \<Longrightarrow> DERIV g (f x) :> E \<Longrightarrow>
  ((\<lambda>x. g (f x)) has_field_derivative E * D) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative D) (at x within s); (g has_field_derivative E) (at (f x))\<rbrakk> \<Longrightarrow> ((\<lambda>x. g (f x)) has_field_derivative E * D) (at x within s)
[PROOF STEP]
using has_derivative_compose[of f "(*) D" x s g "(*) E"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(f has_derivative (*) D) (at x within s); (g has_derivative (*) E) (at (f x))\<rbrakk> \<Longrightarrow> ((\<lambda>x. g (f x)) has_derivative (\<lambda>x. E * (D * x))) (at x within s)

goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative D) (at x within s); (g has_field_derivative E) (at (f x))\<rbrakk> \<Longrightarrow> ((\<lambda>x. g (f x)) has_field_derivative E * D) (at x within s)
[PROOF STEP]
by (simp only: has_field_derivative_def mult_commute_abs ac_simps)


[STATEMENT]
theorem LPO_S_ctxt: "(s,t) \<in> LPO_S \<Longrightarrow> (Fun f (bef @ s # aft), Fun f (bef @ t # aft)) \<in> LPO_S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s, t) \<in> LPO_S \<Longrightarrow> (Fun f (bef @ s # aft), Fun f (bef @ t # aft)) \<in> LPO_S
[PROOF STEP]
using WPO_S_ctxt
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>f k. set (\<sigma> (f, k)) = {0..<k}; (?s, ?t) \<in> WPO_S\<rbrakk> \<Longrightarrow> (Fun ?f (?bef @ ?s # ?aft), Fun ?f (?bef @ ?t # ?aft)) \<in> WPO_S

goal (1 subgoal):
 1. (s, t) \<in> LPO_S \<Longrightarrow> (Fun f (bef @ s # aft), Fun f (bef @ t # aft)) \<in> LPO_S
[PROOF STEP]
unfolding lpo_eq_wpo
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>f k. set (\<sigma> (f, k)) = {0..<k}; (?s, ?t) \<in> WPO_S\<rbrakk> \<Longrightarrow> (Fun ?f (?bef @ ?s # ?aft), Fun ?f (?bef @ ?t # ?aft)) \<in> WPO_S

goal (1 subgoal):
 1. (s, t) \<in> WPO_S \<Longrightarrow> (Fun f (bef @ s # aft), Fun f (bef @ t # aft)) \<in> WPO_S
[PROOF STEP]
by auto


[STATEMENT]
lemma ncols_mult: "ncols ((A::('a::semiring_0) matrix) * B) <= ncols B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ncols (A * B) \<le> ncols B
[PROOF STEP]
by (simp add: times_matrix_def mult_ncols)


[STATEMENT]
lemma even_le_div2_imp_le_times_2: "m     div 2 < (Suc n) \<and> ((m::nat) mod 2 = 0) \<Longrightarrow> m \<le> 2*n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m div 2 < Suc n \<and> m mod 2 = 0 \<Longrightarrow> m \<le> 2 * n
[PROOF STEP]
by arith


[STATEMENT]
lemma convex_hull_union_two:
  fixes S T :: "'m::euclidean_space set"
  assumes "convex S"
    and "S \<noteq> {}"
    and "convex T"
    and "T \<noteq> {}"
  shows "convex hull (S \<union> T) =
    {u *\<^sub>R s + v *\<^sub>R t | u v s t. u \<ge> 0 \<and> v \<ge> 0 \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull (S \<union> T) = {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
 2. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
define I :: "nat set" where "I = {1, 2}"
[PROOF STATE]
proof (state)
this:
I = {1, 2}

goal (2 subgoals):
 1. convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
 2. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
define s where "s i = (if i = (1::nat) then S else T)" for i
[PROOF STATE]
proof (state)
this:
s ?i = (if ?i = 1 then S else T)

goal (2 subgoals):
 1. convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
 2. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
have "\<Union>(s ` I) = S \<union> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (s ` I) = S \<union> T
[PROOF STEP]
using s_def I_def
[PROOF STATE]
proof (prove)
using this:
s ?i = (if ?i = 1 then S else T)
I = {1, 2}

goal (1 subgoal):
 1. \<Union> (s ` I) = S \<union> T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> (s ` I) = S \<union> T

goal (2 subgoals):
 1. convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
 2. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<Union> (s ` I) = S \<union> T
[PROOF STEP]
have "convex hull (\<Union>(s ` I)) = convex hull (S \<union> T)"
[PROOF STATE]
proof (prove)
using this:
\<Union> (s ` I) = S \<union> T

goal (1 subgoal):
 1. convex hull \<Union> (s ` I) = convex hull (S \<union> T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex hull \<Union> (s ` I) = convex hull (S \<union> T)

goal (2 subgoals):
 1. convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
 2. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
convex hull \<Union> (s ` I) = convex hull (S \<union> T)

goal (2 subgoals):
 1. convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
 2. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
have "convex hull \<Union>(s ` I) =
    {\<Sum> i\<in>I. c i *\<^sub>R sa i | c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull \<Union> (s ` I) = {\<Sum>i\<in>I. c i *\<^sub>R sa i |c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)}
[PROOF STEP]
using assms s_def I_def
[PROOF STATE]
proof (prove)
using this:
convex S
S \<noteq> {}
convex T
T \<noteq> {}
s ?i = (if ?i = 1 then S else T)
I = {1, 2}

goal (1 subgoal):
 1. convex hull \<Union> (s ` I) = {\<Sum>i\<in>I. c i *\<^sub>R sa i |c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)}
[PROOF STEP]
by (subst convex_hull_finite_union) auto
[PROOF STATE]
proof (state)
this:
convex hull \<Union> (s ` I) = {\<Sum>i\<in>I. c i *\<^sub>R sa i |c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)}

goal (2 subgoals):
 1. convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
 2. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
convex hull \<Union> (s ` I) = {\<Sum>i\<in>I. c i *\<^sub>R sa i |c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)}

goal (2 subgoals):
 1. convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
 2. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
have
    "{\<Sum>i\<in>I. c i *\<^sub>R sa i | c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)} \<le> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<Sum>i\<in>I. c i *\<^sub>R sa i |c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)} \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
[PROOF STEP]
using s_def I_def
[PROOF STATE]
proof (prove)
using this:
s ?i = (if ?i = 1 then S else T)
I = {1, 2}

goal (1 subgoal):
 1. {\<Sum>i\<in>I. c i *\<^sub>R sa i |c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)} \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{\<Sum>i\<in>I. c i *\<^sub>R sa i |c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)} \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}

goal (2 subgoals):
 1. convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
 2. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
convex hull \<Union> (s ` I) = convex hull (S \<union> T)
convex hull \<Union> (s ` I) = {\<Sum>i\<in>I. c i *\<^sub>R sa i |c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)}
{\<Sum>i\<in>I. c i *\<^sub>R sa i |c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)} \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
[PROOF STEP]
show "?lhs \<subseteq> ?rhs"
[PROOF STATE]
proof (prove)
using this:
convex hull \<Union> (s ` I) = convex hull (S \<union> T)
convex hull \<Union> (s ` I) = {\<Sum>i\<in>I. c i *\<^sub>R sa i |c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)}
{\<Sum>i\<in>I. c i *\<^sub>R sa i |c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> sum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)} \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}

goal (1 subgoal):
 1. convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}

goal (1 subgoal):
 1. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
convex hull (S \<union> T) \<subseteq> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}

goal (1 subgoal):
 1. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
assume "x \<in> ?rhs"
[PROOF STATE]
proof (state)
this:
x \<in> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}

goal (1 subgoal):
 1. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}
[PROOF STEP]
obtain u v s t where *: "x = u *\<^sub>R s + v *\<^sub>R t \<and> u \<ge> 0 \<and> v \<ge> 0 \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T"
[PROOF STATE]
proof (prove)
using this:
x \<in> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}

goal (1 subgoal):
 1. (\<And>u s v t. x = u *\<^sub>R s + v *\<^sub>R t \<and> 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = u *\<^sub>R s + v *\<^sub>R t \<and> 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T

goal (1 subgoal):
 1. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = u *\<^sub>R s + v *\<^sub>R t \<and> 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T
[PROOF STEP]
have "x \<in> convex hull {s, t}"
[PROOF STATE]
proof (prove)
using this:
x = u *\<^sub>R s + v *\<^sub>R t \<and> 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T

goal (1 subgoal):
 1. x \<in> convex hull {s, t}
[PROOF STEP]
using convex_hull_2[of s t]
[PROOF STATE]
proof (prove)
using this:
x = u *\<^sub>R s + v *\<^sub>R t \<and> 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T
convex hull {s, t} = {u *\<^sub>R s + v *\<^sub>R t |u v. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1}

goal (1 subgoal):
 1. x \<in> convex hull {s, t}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> convex hull {s, t}

goal (1 subgoal):
 1. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> convex hull {s, t}
[PROOF STEP]
have "x \<in> convex hull (S \<union> T)"
[PROOF STATE]
proof (prove)
using this:
x \<in> convex hull {s, t}

goal (1 subgoal):
 1. x \<in> convex hull (S \<union> T)
[PROOF STEP]
using * hull_mono[of "{s, t}" "S \<union> T"]
[PROOF STATE]
proof (prove)
using this:
x \<in> convex hull {s, t}
x = u *\<^sub>R s + v *\<^sub>R t \<and> 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T
{s, t} \<subseteq> S \<union> T \<Longrightarrow> ?S hull {s, t} \<subseteq> ?S hull (S \<union> T)

goal (1 subgoal):
 1. x \<in> convex hull (S \<union> T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> convex hull (S \<union> T)

goal (1 subgoal):
 1. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x2 \<in> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<Longrightarrow> ?x2 \<in> convex hull (S \<union> T)

goal (1 subgoal):
 1. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x2 \<in> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<Longrightarrow> ?x2 \<in> convex hull (S \<union> T)
[PROOF STEP]
show "?lhs \<supseteq> ?rhs"
[PROOF STATE]
proof (prove)
using this:
?x2 \<in> {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<Longrightarrow> ?x2 \<in> convex hull (S \<union> T)

goal (1 subgoal):
 1. {u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{u *\<^sub>R s + v *\<^sub>R t |u v s t. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T} \<subseteq> convex hull (S \<union> T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pmult_padd:
  "pmult a (padd (pmult b x) (pmult c y)) = padd (pmult (pmult a b) x) (pmult (pmult a c) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmult a (padd (pmult b x) (pmult c y)) = padd (pmult (pmult a b) x) (pmult (pmult a c) y)
[PROOF STEP]
by (metis Rep_prat_inject mult.assoc pmult.rep_eq pmult_distr)


[STATEMENT]
lemma output_complete_alt_def :
  "output_complete M = (\<forall> q x . (\<exists> y q' . (q,x,y,q') \<in> transitions M) \<longrightarrow> (\<forall> y \<in> (outputs M) . \<exists> q' . (q,x,y,q') \<in> transitions M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. output_complete M = (\<forall>q x. (\<exists>y q'. (q, x, y, q') \<in> FSM.transitions M) \<longrightarrow> (\<forall>y\<in>FSM.outputs M. \<exists>q'. (q, x, y, q') \<in> FSM.transitions M))
[PROOF STEP]
by force


[STATEMENT]
lemma frag_cmul_sum:
     "frag_cmul a (sum b I) = (\<Sum>i\<in>I. frag_cmul a (b i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frag_cmul a (sum b I) = (\<Sum>i\<in>I. frag_cmul a (b i))
[PROOF STEP]
proof (induction rule: infinite_finite_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> frag_cmul a (sum b A) = (\<Sum>i\<in>A. frag_cmul a (b i))
 2. frag_cmul a (sum b {}) = (\<Sum>i\<in>{}. frag_cmul a (b i))
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; frag_cmul a (sum b F) = (\<Sum>i\<in>F. frag_cmul a (b i))\<rbrakk> \<Longrightarrow> frag_cmul a (sum b (insert x F)) = (\<Sum>i\<in>insert x F. frag_cmul a (b i))
[PROOF STEP]
case (insert i I)
[PROOF STATE]
proof (state)
this:
finite I
i \<notin> I
frag_cmul a (sum b I) = (\<Sum>i\<in>I. frag_cmul a (b i))

goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> frag_cmul a (sum b A) = (\<Sum>i\<in>A. frag_cmul a (b i))
 2. frag_cmul a (sum b {}) = (\<Sum>i\<in>{}. frag_cmul a (b i))
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; frag_cmul a (sum b F) = (\<Sum>i\<in>F. frag_cmul a (b i))\<rbrakk> \<Longrightarrow> frag_cmul a (sum b (insert x F)) = (\<Sum>i\<in>insert x F. frag_cmul a (b i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite I
i \<notin> I
frag_cmul a (sum b I) = (\<Sum>i\<in>I. frag_cmul a (b i))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite I
i \<notin> I
frag_cmul a (sum b I) = (\<Sum>i\<in>I. frag_cmul a (b i))

goal (1 subgoal):
 1. frag_cmul a (sum b (insert i I)) = (\<Sum>i\<in>insert i I. frag_cmul a (b i))
[PROOF STEP]
by (auto simp: algebra_simps frag_cmul_distrib2)
[PROOF STATE]
proof (state)
this:
frag_cmul a (sum b (insert i I)) = (\<Sum>i\<in>insert i I. frag_cmul a (b i))

goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> frag_cmul a (sum b A) = (\<Sum>i\<in>A. frag_cmul a (b i))
 2. frag_cmul a (sum b {}) = (\<Sum>i\<in>{}. frag_cmul a (b i))
[PROOF STEP]
qed auto


[STATEMENT]
lemma of_int_div_field:
  assumes "d dvd n"
  shows "(of_int::_\<Rightarrow>'a::field_char_0) (n div d) = of_int n / of_int d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (n div d) = of_int n / of_int d
[PROOF STEP]
apply (subst (2) dvd_mult_div_cancel[OF assms,symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (n div d) = of_int (d * (n div d)) / of_int d
[PROOF STEP]
by (auto simp add:field_simps)


[STATEMENT]
lemma multiply_by_add2: "VARS M N P :: int
 {m=M \<and> n=N}
 IF M < 0 THEN M := -M; N := -N ELSE SKIP FI;
 P := 0;
 WHILE 0 < M
 INV {0 \<le> M \<and> (\<exists>p. p = (if m<0 then -m else m) & p*N = m*n & P = (p-M)*N)}
 DO P := P+N; M := M - 1 OD
 {P = m*n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {m = M \<and> n = N}
IF M < 0 THEN M := - M; N := - N  ELSE SKIP FI; P := 0; WHILE 0 < M INV {0 \<le> M \<and> (\<exists>p. p = (if m < 0 then - m else m) \<and> p * N = m * n \<and> P = (p - M) * N)}  VAR {0}
DO P := P + N; M := M - 1 OD
{P = m * n}
[PROOF STEP]
apply vcg_simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>M N. 0 \<le> M \<and> (if m < 0 then - m else m) * N = m * n \<and> 0 < M \<Longrightarrow> (m < 0 \<longrightarrow> (- m - M) * N + N = (- m - (M - 1)) * N) \<and> (\<not> m < 0 \<longrightarrow> (m - M) * N + N = (m - (M - 1)) * N)
 2. \<And>M N. 0 \<le> M \<and> (if m < 0 then - m else m) * N = m * n \<and> \<not> 0 < M \<Longrightarrow> (m < 0 \<longrightarrow> (- m - M) * N = m * n) \<and> (\<not> m < 0 \<longrightarrow> (m - M) * N = m * n)
[PROOF STEP]
apply (auto simp add:int_distrib)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma homotopy_eqv_inj_linear_image:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "linear f" "inj f"
    shows "(f ` S) homotopy_eqv S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` S homotopy_eqv S
[PROOF STEP]
by (metis assms homeomorphic_sym homeomorphic_imp_homotopy_eqv linear_homeomorphic_image)


[STATEMENT]
lemma span_span: "span (span A) = span A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (span A) = span A
[PROOF STEP]
unfolding span_def hull_hull
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subspace hull A = subspace hull A
[PROOF STEP]
..


[STATEMENT]
lemma log_floor_sound: assumes "b > 1" "x > 0" "log_floor b x = y"
  shows "b^y \<le> x" "x < b^(Suc y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b ^ y \<le> x &&& x < b ^ Suc y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b ^ y \<le> x
 2. x < b ^ Suc y
[PROOF STEP]
from assms(1,3)
[PROOF STATE]
proof (chain)
picking this:
1 < b
log_floor b x = y
[PROOF STEP]
have id: "get_base (into_base b) = b"
[PROOF STATE]
proof (prove)
using this:
1 < b
log_floor b x = y

goal (1 subgoal):
 1. get_base (into_base b) = b
[PROOF STEP]
by transfer auto
[PROOF STATE]
proof (state)
this:
get_base (into_base b) = b

goal (2 subgoals):
 1. b ^ y \<le> x
 2. x < b ^ Suc y
[PROOF STEP]
obtain yy bb where log: "log_main (into_base b) x = (yy,bb)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>yy bb. log_main (into_base b) x = (yy, bb) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "log_main (into_base b) x", auto)
[PROOF STATE]
proof (state)
this:
log_main (into_base b) x = (yy, bb)

goal (2 subgoals):
 1. b ^ y \<le> x
 2. x < b ^ Suc y
[PROOF STEP]
from log_main[OF assms(2) log] assms(3)[unfolded log_floor_def log] id
[PROOF STATE]
proof (chain)
picking this:
bb = get_base (into_base b) ^ yy \<and> get_base (into_base b) ^ yy \<le> x \<and> x < get_base (into_base b) ^ Suc yy
fst (yy, bb) = y
get_base (into_base b) = b
[PROOF STEP]
show "b^y \<le> x" "x < b^(Suc y)"
[PROOF STATE]
proof (prove)
using this:
bb = get_base (into_base b) ^ yy \<and> get_base (into_base b) ^ yy \<le> x \<and> x < get_base (into_base b) ^ Suc yy
fst (yy, bb) = y
get_base (into_base b) = b

goal (1 subgoal):
 1. b ^ y \<le> x &&& x < b ^ Suc y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b ^ y \<le> x
x < b ^ Suc y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma T_insort_length: "T_insort xs \<le> (length xs + 1) ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_insort xs \<le> (length xs + 1)\<^sup>2
[PROOF STEP]
proof(induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. T_insort [] \<le> (length [] + 1)\<^sup>2
 2. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. T_insort [] \<le> (length [] + 1)\<^sup>2
 2. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_insort [] \<le> (length [] + 1)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
T_insort [] \<le> (length [] + 1)\<^sup>2

goal (1 subgoal):
 1. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
T_insort xs \<le> (length xs + 1)\<^sup>2

goal (1 subgoal):
 1. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
have "T_insort (x#xs) = T_insort xs + T_insort1 x (insort xs) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_insort (x # xs) = T_insort xs + T_insort1 x (insort xs) + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
T_insort (x # xs) = T_insort xs + T_insort1 x (insort xs) + 1

goal (1 subgoal):
 1. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
T_insort (x # xs) = T_insort xs + T_insort1 x (insort xs) + 1

goal (1 subgoal):
 1. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
have "\<dots> \<le> (length xs + 1) ^ 2 + T_insort1 x (insort xs) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_insort xs + T_insort1 x (insort xs) + 1 \<le> (length xs + 1)\<^sup>2 + T_insort1 x (insort xs) + 1
[PROOF STEP]
using Cons.IH
[PROOF STATE]
proof (prove)
using this:
T_insort xs \<le> (length xs + 1)\<^sup>2

goal (1 subgoal):
 1. T_insort xs + T_insort1 x (insort xs) + 1 \<le> (length xs + 1)\<^sup>2 + T_insort1 x (insort xs) + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
T_insort xs + T_insort1 x (insort xs) + 1 \<le> (length xs + 1)\<^sup>2 + T_insort1 x (insort xs) + 1

goal (1 subgoal):
 1. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
T_insort xs + T_insort1 x (insort xs) + 1 \<le> (length xs + 1)\<^sup>2 + T_insort1 x (insort xs) + 1

goal (1 subgoal):
 1. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
have "\<dots> \<le> (length xs + 1) ^ 2 + length xs + 1 + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (length xs + 1)\<^sup>2 + T_insort1 x (insort xs) + 1 \<le> (length xs + 1)\<^sup>2 + length xs + 1 + 1
[PROOF STEP]
using T_insort1_length[of x "insort xs"]
[PROOF STATE]
proof (prove)
using this:
T_insort1 x (insort xs) \<le> length (insort xs) + 1

goal (1 subgoal):
 1. (length xs + 1)\<^sup>2 + T_insort1 x (insort xs) + 1 \<le> (length xs + 1)\<^sup>2 + length xs + 1 + 1
[PROOF STEP]
by (simp add: length_insort)
[PROOF STATE]
proof (state)
this:
(length xs + 1)\<^sup>2 + T_insort1 x (insort xs) + 1 \<le> (length xs + 1)\<^sup>2 + length xs + 1 + 1

goal (1 subgoal):
 1. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(length xs + 1)\<^sup>2 + T_insort1 x (insort xs) + 1 \<le> (length xs + 1)\<^sup>2 + length xs + 1 + 1

goal (1 subgoal):
 1. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
have "\<dots> \<le> (length(x#xs) + 1) ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (length xs + 1)\<^sup>2 + length xs + 1 + 1 \<le> (length (x # xs) + 1)\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
(length xs + 1)\<^sup>2 + length xs + 1 + 1 \<le> (length (x # xs) + 1)\<^sup>2

goal (1 subgoal):
 1. \<And>a xs. T_insort xs \<le> (length xs + 1)\<^sup>2 \<Longrightarrow> T_insort (a # xs) \<le> (length (a # xs) + 1)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
T_insort (x # xs) \<le> (length (x # xs) + 1)\<^sup>2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
T_insort (x # xs) \<le> (length (x # xs) + 1)\<^sup>2

goal (1 subgoal):
 1. T_insort (x # xs) \<le> (length (x # xs) + 1)\<^sup>2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
T_insort (x # xs) \<le> (length (x # xs) + 1)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma laplace_expansion_column:
  assumes A: "(A :: 'a :: comm_ring_1 mat) \<in> carrier_mat n n"
      and j: "j < n"
  shows "det A = (\<Sum>i<n. A $$ (i,j) * cofactor A i j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
define l where "l = n-1"
[PROOF STATE]
proof (state)
this:
l = n - 1

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have A: "A \<in> carrier_mat (Suc l) (Suc l)"
   and jl: "j < Suc l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat (Suc l) (Suc l) &&& j < Suc l
[PROOF STEP]
using A j
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
j < n

goal (1 subgoal):
 1. A \<in> carrier_mat (Suc l) (Suc l) &&& j < Suc l
[PROOF STEP]
unfolding l_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
j < n

goal (1 subgoal):
 1. A \<in> carrier_mat (Suc (n - 1)) (Suc (n - 1)) &&& j < Suc (n - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat (Suc l) (Suc l)
j < Suc l

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
let ?N = "{0 ..< Suc l}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
define f where "f = (\<lambda>p i. A $$ (i, p i))"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>p i. A $$ (i, p i))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
define g where "g = (\<lambda>p. prod (f p) ?N)"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>p. prod (f p) {0..<Suc l})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
define h where "h = (\<lambda>p. signof p * g p)"
[PROOF STATE]
proof (state)
this:
h = (\<lambda>p. of_int (sign p) * g p)

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
define Q where "Q = { q . q permutes {0..<l} }"
[PROOF STATE]
proof (state)
this:
Q = {q. q permutes {0..<l}}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have jN: "j \<in> ?N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j \<in> {0..<Suc l}
[PROOF STEP]
using jl
[PROOF STATE]
proof (prove)
using this:
j < Suc l

goal (1 subgoal):
 1. j \<in> {0..<Suc l}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j \<in> {0..<Suc l}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have disj: "\<forall>i \<in> ?N. \<forall>i' \<in> ?N. i \<noteq> i' \<longrightarrow>
    {p. p permutes ?N \<and> p i = j} \<inter> {p. p permutes ?N \<and> p i' = j} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{0..<Suc l}. \<forall>i'\<in>{0..<Suc l}. i \<noteq> i' \<longrightarrow> {p. p permutes {0..<Suc l} \<and> p i = j} \<inter> {p. p permutes {0..<Suc l} \<and> p i' = j} = {}
[PROOF STEP]
using permutation_disjoint_dom[OF _ _ jN]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i \<in> {0..<Suc l}; ?i' \<in> {0..<Suc l}; ?i \<noteq> ?i'\<rbrakk> \<Longrightarrow> {p. p permutes {0..<Suc l} \<and> p ?i = j} \<inter> {p. p permutes {0..<Suc l} \<and> p ?i' = j} = {}

goal (1 subgoal):
 1. \<forall>i\<in>{0..<Suc l}. \<forall>i'\<in>{0..<Suc l}. i \<noteq> i' \<longrightarrow> {p. p permutes {0..<Suc l} \<and> p i = j} \<inter> {p. p permutes {0..<Suc l} \<and> p i' = j} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{0..<Suc l}. \<forall>i'\<in>{0..<Suc l}. i \<noteq> i' \<longrightarrow> {p. p permutes {0..<Suc l} \<and> p i = j} \<inter> {p. p permutes {0..<Suc l} \<and> p i' = j} = {}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have fin: "\<forall>i\<in>?N. finite {p. p permutes ?N \<and> p i = j}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{0..<Suc l}. finite {p. p permutes {0..<Suc l} \<and> p i = j}
[PROOF STEP]
using finite_permutations[of ?N]
[PROOF STATE]
proof (prove)
using this:
finite {0..<Suc l} \<Longrightarrow> finite {p. p permutes {0..<Suc l}}

goal (1 subgoal):
 1. \<forall>i\<in>{0..<Suc l}. finite {p. p permutes {0..<Suc l} \<and> p i = j}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{0..<Suc l}. finite {p. p permutes {0..<Suc l} \<and> p i = j}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "det A = sum h { p. p permutes ?N }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = sum h {p. p permutes {0..<Suc l}}
[PROOF STEP]
using det_def'[OF A]
[PROOF STATE]
proof (prove)
using this:
det A = (\<Sum>p | p permutes {0..<Suc l}. of_int (sign p) * (\<Prod>i = 0..<Suc l. A $$ (i, p i)))

goal (1 subgoal):
 1. det A = sum h {p. p permutes {0..<Suc l}}
[PROOF STEP]
unfolding h_def g_def f_def
[PROOF STATE]
proof (prove)
using this:
det A = (\<Sum>p | p permutes {0..<Suc l}. of_int (sign p) * (\<Prod>i = 0..<Suc l. A $$ (i, p i)))

goal (1 subgoal):
 1. det A = (\<Sum>p | p permutes {0..<Suc l}. of_int (sign p) * (\<Prod>i = 0..<Suc l. A $$ (i, p i)))
[PROOF STEP]
using atLeast0LessThan
[PROOF STATE]
proof (prove)
using this:
det A = (\<Sum>p | p permutes {0..<Suc l}. of_int (sign p) * (\<Prod>i = 0..<Suc l. A $$ (i, p i)))
{0..<?n} = {..<?n}

goal (1 subgoal):
 1. det A = (\<Sum>p | p permutes {0..<Suc l}. of_int (sign p) * (\<Prod>i = 0..<Suc l. A $$ (i, p i)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
det A = sum h {p. p permutes {0..<Suc l}}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A = sum h {p. p permutes {0..<Suc l}}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = sum h (\<Union>i\<in>?N. {p. p permutes ?N \<and> p i = j})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum h {p. p permutes {0..<Suc l}} = sum h (\<Union>i\<in>{0..<Suc l}. {p. p permutes {0..<Suc l} \<and> p i = j})
[PROOF STEP]
unfolding permutation_split_ran[OF jN]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum h (\<Union>i\<in>{0..<Suc l}. {p. p permutes {0..<Suc l} \<and> p i = j}) = sum h (\<Union>i\<in>{0..<Suc l}. {p. p permutes {0..<Suc l} \<and> p i = j})
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
sum h {p. p permutes {0..<Suc l}} = sum h (\<Union>i\<in>{0..<Suc l}. {p. p permutes {0..<Suc l} \<and> p i = j})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum h {p. p permutes {0..<Suc l}} = sum h (\<Union>i\<in>{0..<Suc l}. {p. p permutes {0..<Suc l} \<and> p i = j})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = (\<Sum>i\<in>?N. sum h { p | p. p permutes ?N \<and> p i = j})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum h (\<Union>i\<in>{0..<Suc l}. {p. p permutes {0..<Suc l} \<and> p i = j}) = (\<Sum>i = 0..<Suc l. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j})
[PROOF STEP]
using sum.UNION_disjoint[OF _ fin disj]
[PROOF STATE]
proof (prove)
using this:
finite {0..<Suc l} \<Longrightarrow> sum ?g (\<Union>i\<in>{0..<Suc l}. {p. p permutes {0..<Suc l} \<and> p i = j}) = (\<Sum>x = 0..<Suc l. sum ?g {p. p permutes {0..<Suc l} \<and> p x = j})

goal (1 subgoal):
 1. sum h (\<Union>i\<in>{0..<Suc l}. {p. p permutes {0..<Suc l} \<and> p i = j}) = (\<Sum>i = 0..<Suc l. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum h (\<Union>i\<in>{0..<Suc l}. {p. p permutes {0..<Suc l} \<and> p i = j}) = (\<Sum>i = 0..<Suc l. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum h (\<Union>i\<in>{0..<Suc l}. {p. p permutes {0..<Suc l} \<and> p i = j}) = (\<Sum>i = 0..<Suc l. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
sum h (\<Union>i\<in>{0..<Suc l}. {p. p permutes {0..<Suc l} \<and> p i = j}) = (\<Sum>i = 0..<Suc l. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
assume "i \<in> ?N"
[PROOF STATE]
proof (state)
this:
i \<in> {0..<Suc l}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
hence i: "i < Suc l"
[PROOF STATE]
proof (prove)
using this:
i \<in> {0..<Suc l}

goal (1 subgoal):
 1. i < Suc l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < Suc l

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "sum h { p | p. p permutes ?N \<and> p i = j} = sum h (permutation_insert i j ` Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j} = sum h (permutation_insert i j ` Q)
[PROOF STEP]
using permutation_fix[OF i jl]
[PROOF STATE]
proof (prove)
using this:
{p. p permutes {0..<Suc l} \<and> p i = j} = permutation_insert i j ` {q. q permutes {0..<l}}

goal (1 subgoal):
 1. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j} = sum h (permutation_insert i j ` Q)
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
using this:
{p. p permutes {0..<Suc l} \<and> p i = j} = permutation_insert i j ` {q. q permutes {0..<l}}

goal (1 subgoal):
 1. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j} = sum h (permutation_insert i j ` {q. q permutes {0..<l}})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum h {p |p. p permutes {0..<Suc l} \<and> p i = j} = sum h (permutation_insert i j ` Q)

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum h {p |p. p permutes {0..<Suc l} \<and> p i = j} = sum h (permutation_insert i j ` Q)

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = sum (h \<circ> permutation_insert i j) Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum h (permutation_insert i j ` Q) = sum (h \<circ> permutation_insert i j) Q
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum h (permutation_insert i j ` {q. q permutes {0..<l}}) = sum (h \<circ> permutation_insert i j) {q. q permutes {0..<l}}
[PROOF STEP]
using sum.reindex[OF permutation_insert_inj_on[OF i jl]]
[PROOF STATE]
proof (prove)
using this:
sum ?g (permutation_insert i j ` {q. q permutes {0..<l}}) = sum (?g \<circ> permutation_insert i j) {q. q permutes {0..<l}}

goal (1 subgoal):
 1. sum h (permutation_insert i j ` {q. q permutes {0..<l}}) = sum (h \<circ> permutation_insert i j) {q. q permutes {0..<l}}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum h (permutation_insert i j ` Q) = sum (h \<circ> permutation_insert i j) Q

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum h (permutation_insert i j ` Q) = sum (h \<circ> permutation_insert i j) Q

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = (\<Sum> q \<in> Q.
      signof (permutation_insert i j q) * prod (f (permutation_insert i j q)) ?N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (h \<circ> permutation_insert i j) Q = (\<Sum>q\<in>Q. of_int (sign (permutation_insert i j q)) * prod (f (permutation_insert i j q)) {0..<Suc l})
[PROOF STEP]
unfolding h_def g_def Q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>p. of_int (sign p) * prod (f p) {0..<Suc l}) \<circ> permutation_insert i j) {q. q permutes {0..<l}} = (\<Sum>q | q permutes {0..<l}. of_int (sign (permutation_insert i j q)) * prod (f (permutation_insert i j q)) {0..<Suc l})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum (h \<circ> permutation_insert i j) Q = (\<Sum>q\<in>Q. of_int (sign (permutation_insert i j q)) * prod (f (permutation_insert i j q)) {0..<Suc l})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (h \<circ> permutation_insert i j) Q = (\<Sum>q\<in>Q. of_int (sign (permutation_insert i j q)) * prod (f (permutation_insert i j q)) {0..<Suc l})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
sum (h \<circ> permutation_insert i j) Q = (\<Sum>q\<in>Q. of_int (sign (permutation_insert i j q)) * prod (f (permutation_insert i j q)) {0..<Suc l})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
fix q
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
assume "q \<in> Q"
[PROOF STATE]
proof (state)
this:
q \<in> Q

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
hence q: "q permutes {0..<l}"
[PROOF STATE]
proof (prove)
using this:
q \<in> Q

goal (1 subgoal):
 1. q permutes {0..<l}
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
using this:
q \<in> {q. q permutes {0..<l}}

goal (1 subgoal):
 1. q permutes {0..<l}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q permutes {0..<l}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
let ?p = "permutation_insert i j q"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have fin: "finite (?N - {i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ({0..<Suc l} - {i})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite ({0..<Suc l} - {i})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have notin: "i \<notin> ?N - {i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<notin> {0..<Suc l} - {i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i \<notin> {0..<Suc l} - {i}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have close: "insert i (?N - {i}) = ?N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert i ({0..<Suc l} - {i}) = {0..<Suc l}
[PROOF STEP]
using notin i
[PROOF STATE]
proof (prove)
using this:
i \<notin> {0..<Suc l} - {i}
i < Suc l

goal (1 subgoal):
 1. insert i ({0..<Suc l} - {i}) = {0..<Suc l}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert i ({0..<Suc l} - {i}) = {0..<Suc l}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "prod (f ?p) ?N = f ?p i * prod (f ?p) (?N-{i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod (f (permutation_insert i j q)) {0..<Suc l} = f (permutation_insert i j q) i * prod (f (permutation_insert i j q)) ({0..<Suc l} - {i})
[PROOF STEP]
unfolding prod.insert[OF fin notin, unfolded close]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (permutation_insert i j q) i * prod (f (permutation_insert i j q)) ({0..<Suc l} - {i}) = f (permutation_insert i j q) i * prod (f (permutation_insert i j q)) ({0..<Suc l} - {i})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prod (f (permutation_insert i j q)) {0..<Suc l} = f (permutation_insert i j q) i * prod (f (permutation_insert i j q)) ({0..<Suc l} - {i})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod (f (permutation_insert i j q)) {0..<Suc l} = f (permutation_insert i j q) i * prod (f (permutation_insert i j q)) ({0..<Suc l} - {i})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = A $$ (i, j) * prod (f ?p) (?N-{i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (permutation_insert i j q) i * prod (f (permutation_insert i j q)) ({0..<Suc l} - {i}) = A $$ (i, j) * prod (f (permutation_insert i j q)) ({0..<Suc l} - {i})
[PROOF STEP]
unfolding f_def Q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (i, permutation_insert i j q i) * (\<Prod>ia\<in>{0..<Suc l} - {i}. A $$ (ia, permutation_insert i j q ia)) = A $$ (i, j) * (\<Prod>ia\<in>{0..<Suc l} - {i}. A $$ (ia, permutation_insert i j q ia))
[PROOF STEP]
using permutation_insert_inserted
[PROOF STATE]
proof (prove)
using this:
permutation_insert ?i ?j ?p ?i = ?j

goal (1 subgoal):
 1. A $$ (i, permutation_insert i j q i) * (\<Prod>ia\<in>{0..<Suc l} - {i}. A $$ (ia, permutation_insert i j q ia)) = A $$ (i, j) * (\<Prod>ia\<in>{0..<Suc l} - {i}. A $$ (ia, permutation_insert i j q ia))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f (permutation_insert i j q) i * prod (f (permutation_insert i j q)) ({0..<Suc l} - {i}) = A $$ (i, j) * prod (f (permutation_insert i j q)) ({0..<Suc l} - {i})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (permutation_insert i j q) i * prod (f (permutation_insert i j q)) ({0..<Suc l} - {i}) = A $$ (i, j) * prod (f (permutation_insert i j q)) ({0..<Suc l} - {i})

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "prod (f ?p) (?N-{i}) = prod (\<lambda>i'. A $$ (i', permutation_insert i j q i')) (?N-{i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod (f (permutation_insert i j q)) ({0..<Suc l} - {i}) = (\<Prod>i'\<in>{0..<Suc l} - {i}. A $$ (i', permutation_insert i j q i'))
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>ia\<in>{0..<Suc l} - {i}. A $$ (ia, permutation_insert i j q ia)) = (\<Prod>i'\<in>{0..<Suc l} - {i}. A $$ (i', permutation_insert i j q i'))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
prod (f (permutation_insert i j q)) ({0..<Suc l} - {i}) = (\<Prod>i'\<in>{0..<Suc l} - {i}. A $$ (i', permutation_insert i j q i'))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod (f (permutation_insert i j q)) ({0..<Suc l} - {i}) = (\<Prod>i'\<in>{0..<Suc l} - {i}. A $$ (i', permutation_insert i j q i'))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = prod (\<lambda>ij. A $$ ij) ((\<lambda>i'. (i', permutation_insert i j q i')) ` (?N-{i}))"
        (is "_ = prod _ ?part")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i'\<in>{0..<Suc l} - {i}. A $$ (i', permutation_insert i j q i')) = prod (($$) A) ((\<lambda>i'. (i', permutation_insert i j q i')) ` ({0..<Suc l} - {i}))
[PROOF STEP]
unfolding prod.reindex[OF inj_on_convol_ident] o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i'\<in>{0..<Suc l} - {i}. A $$ (i', permutation_insert i j q i')) = (\<Prod>x\<in>{0..<Suc l} - {i}. A $$ (x, permutation_insert i j q x))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Prod>i'\<in>{0..<Suc l} - {i}. A $$ (i', permutation_insert i j q i')) = prod (($$) A) ((\<lambda>i'. (i', permutation_insert i j q i')) ` ({0..<Suc l} - {i}))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i'\<in>{0..<Suc l} - {i}. A $$ (i', permutation_insert i j q i')) = prod (($$) A) ((\<lambda>i'. (i', permutation_insert i j q i')) ` ({0..<Suc l} - {i}))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "?part = {(i', permutation_insert i j q i') | i'. i' \<in> ?N-{i} }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i'. (i', permutation_insert i j q i')) ` ({0..<Suc l} - {i}) = {(i', permutation_insert i j q i') |i'. i' \<in> {0..<Suc l} - {i}}
[PROOF STEP]
unfolding image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..<Suc l} - {i}. y = (x, permutation_insert i j q x)} = {(i', permutation_insert i j q i') |i'. i' \<in> {0..<Suc l} - {i}}
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<lambda>i'. (i', permutation_insert i j q i')) ` ({0..<Suc l} - {i}) = {(i', permutation_insert i j q i') |i'. i' \<in> {0..<Suc l} - {i}}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>i'. (i', permutation_insert i j q i')) ` ({0..<Suc l} - {i}) = {(i', permutation_insert i j q i') |i'. i' \<in> {0..<Suc l} - {i}}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = {(insert_index i i'', insert_index j (q i'')) | i''. i'' < l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(i', permutation_insert i j q i') |i'. i' \<in> {0..<Suc l} - {i}} = {(insert_index i i'', insert_index j (q i'')) |i''. i'' < l}
[PROOF STEP]
unfolding foo[OF i jl q]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(insert_index i i'', insert_index j (q i'')) |i''. i'' < l} = {(insert_index i i'', insert_index j (q i'')) |i''. i'' < l}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
{(i', permutation_insert i j q i') |i'. i' \<in> {0..<Suc l} - {i}} = {(insert_index i i'', insert_index j (q i'')) |i''. i'' < l}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{(i', permutation_insert i j q i') |i'. i' \<in> {0..<Suc l} - {i}} = {(insert_index i i'', insert_index j (q i'')) |i''. i'' < l}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(insert_index i i'', insert_index j (q i'')) |i''. i'' < l} = (\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l}
[PROOF STEP]
unfolding image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(insert_index i i'', insert_index j (q i'')) |i''. i'' < l} = {y. \<exists>x\<in>{0..<l}. y = (insert_index i x, insert_index j (q x))}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{(insert_index i i'', insert_index j (q i'')) |i''. i'' < l} = (\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{(insert_index i i'', insert_index j (q i'')) |i''. i'' < l} = (\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "prod (\<lambda>ij. A $$ ij)... = prod ((\<lambda>ij. A $$ ij) \<circ> (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))) {0..<l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l}) = prod (($$) A \<circ> (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))) {0..<l}
[PROOF STEP]
proof(subst prod.reindex[symmetric])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on (\<lambda>i''. (insert_index i i'', insert_index j (q i''))) {0..<l}
 2. prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l}) = prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l})
[PROOF STEP]
have 1: "inj (\<lambda>i''. (i'', insert_index j (q i'')))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>i''. (i'', insert_index j (q i'')))
[PROOF STEP]
using inj_on_convol_ident
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>x. (x, ?f x)) ?X

goal (1 subgoal):
 1. inj (\<lambda>i''. (i'', insert_index j (q i'')))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
inj (\<lambda>i''. (i'', insert_index j (q i'')))

goal (2 subgoals):
 1. inj_on (\<lambda>i''. (insert_index i i'', insert_index j (q i''))) {0..<l}
 2. prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l}) = prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l})
[PROOF STEP]
have 2: "inj (\<lambda>(i'',j). (insert_index i i'', j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>(i'', j). (insert_index i i'', j))
[PROOF STEP]
apply (intro injI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. (case x of (i'', j) \<Rightarrow> (insert_index i i'', j)) = (case y of (i'', j) \<Rightarrow> (insert_index i i'', j)) \<Longrightarrow> x = y
[PROOF STEP]
using injD[OF insert_index_inj_on[of _ UNIV]]
[PROOF STATE]
proof (prove)
using this:
insert_index ?i1 ?x = insert_index ?i1 ?y \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. \<And>x y. (case x of (i'', j) \<Rightarrow> (insert_index i i'', j)) = (case y of (i'', j) \<Rightarrow> (insert_index i i'', j)) \<Longrightarrow> x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj (\<lambda>(i'', j). (insert_index i i'', j))

goal (2 subgoals):
 1. inj_on (\<lambda>i''. (insert_index i i'', insert_index j (q i''))) {0..<l}
 2. prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l}) = prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l})
[PROOF STEP]
have "inj (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))
[PROOF STEP]
using inj_compose[OF 2 1]
[PROOF STATE]
proof (prove)
using this:
inj ((\<lambda>(i'', j). (insert_index i i'', j)) \<circ> (\<lambda>i''. (i'', insert_index j (q i''))))

goal (1 subgoal):
 1. inj (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
using this:
inj (\<lambda>x. case (x, insert_index j (q x)) of (i'', x) \<Rightarrow> (insert_index i i'', x))

goal (1 subgoal):
 1. inj (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))

goal (2 subgoals):
 1. inj_on (\<lambda>i''. (insert_index i i'', insert_index j (q i''))) {0..<l}
 2. prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l}) = prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l})
[PROOF STEP]
thus "inj_on (\<lambda>i''. (insert_index i i'', insert_index j (q i''))) {0..<l}"
[PROOF STATE]
proof (prove)
using this:
inj (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))

goal (1 subgoal):
 1. inj_on (\<lambda>i''. (insert_index i i'', insert_index j (q i''))) {0..<l}
[PROOF STEP]
using subset_inj_on
[PROOF STATE]
proof (prove)
using this:
inj (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))
\<lbrakk>inj_on ?f ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> inj_on ?f ?A

goal (1 subgoal):
 1. inj_on (\<lambda>i''. (insert_index i i'', insert_index j (q i''))) {0..<l}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>i''. (insert_index i i'', insert_index j (q i''))) {0..<l}

goal (1 subgoal):
 1. prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l}) = prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l})
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l}) = prod (($$) A \<circ> (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))) {0..<l}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod (($$) A) ((\<lambda>i''. (insert_index i i'', insert_index j (q i''))) ` {0..<l}) = prod (($$) A \<circ> (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))) {0..<l}

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = prod (\<lambda>i''. A $$ (insert_index i i'', insert_index j (q i''))) {0..<l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod (($$) A \<circ> (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))) {0..<l} = (\<Prod>i'' = 0..<l. A $$ (insert_index i i'', insert_index j (q i'')))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prod (($$) A \<circ> (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))) {0..<l} = (\<Prod>i'' = 0..<l. A $$ (insert_index i i'', insert_index j (q i'')))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod (($$) A \<circ> (\<lambda>i''. (insert_index i i'', insert_index j (q i'')))) {0..<l} = (\<Prod>i'' = 0..<l. A $$ (insert_index i i'', insert_index j (q i'')))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = prod (\<lambda>i''. mat_delete A i j $$ (i'', q i'')) {0..<l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i'' = 0..<l. A $$ (insert_index i i'', insert_index j (q i''))) = (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))
[PROOF STEP]
proof (rule prod.cong[OF refl], unfold atLeastLessThan_iff, elim conjE)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 \<le> x; x < l\<rbrakk> \<Longrightarrow> A $$ (insert_index i x, insert_index j (q x)) = mat_delete A i j $$ (x, q x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 \<le> x; x < l\<rbrakk> \<Longrightarrow> A $$ (insert_index i x, insert_index j (q x)) = mat_delete A i j $$ (x, q x)
[PROOF STEP]
assume x: "x < l"
[PROOF STATE]
proof (state)
this:
x < l

goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 \<le> x; x < l\<rbrakk> \<Longrightarrow> A $$ (insert_index i x, insert_index j (q x)) = mat_delete A i j $$ (x, q x)
[PROOF STEP]
show "A $$ (insert_index i x, insert_index j (q x)) = mat_delete A i j $$ (x, q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (insert_index i x, insert_index j (q x)) = mat_delete A i j $$ (x, q x)
[PROOF STEP]
apply(rule mat_delete_index[OF A i jl])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x < l
 2. q x < l
[PROOF STEP]
using q x
[PROOF STATE]
proof (prove)
using this:
q permutes {0..<l}
x < l

goal (2 subgoals):
 1. x < l
 2. q x < l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A $$ (insert_index i x, insert_index j (q x)) = mat_delete A i j $$ (x, q x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Prod>i'' = 0..<l. A $$ (insert_index i i'', insert_index j (q i''))) = (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prod (f (permutation_insert i j q)) {0..<Suc l} = A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))
[PROOF STEP]
have "prod (f ?p) ?N =
        A $$ (i, j) * (\<Prod>i'' = 0..< l. mat_delete A i j $$ (i'', q i''))"
[PROOF STATE]
proof (prove)
using this:
prod (f (permutation_insert i j q)) {0..<Suc l} = A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))

goal (1 subgoal):
 1. prod (f (permutation_insert i j q)) {0..<Suc l} = A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prod (f (permutation_insert i j q)) {0..<Suc l} = A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
hence "signof ?p * prod (f ?p) ?N  = (-1::'a)^(i+j) * signof q * ..."
[PROOF STATE]
proof (prove)
using this:
prod (f (permutation_insert i j q)) {0..<Suc l} = A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j q)) * prod (f (permutation_insert i j q)) {0..<Suc l} = (- (1::'a)) ^ (i + j) * of_int (sign q) * (A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))
[PROOF STEP]
unfolding signof_permutation_insert[OF q i jl]
[PROOF STATE]
proof (prove)
using this:
prod (f (permutation_insert i j q)) {0..<Suc l} = A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))

goal (1 subgoal):
 1. (- (1::'a)) ^ (i + j) * of_int (sign q) * prod (f (permutation_insert i j q)) {0..<Suc l} = (- (1::'a)) ^ (i + j) * of_int (sign q) * (A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert i j q)) * prod (f (permutation_insert i j q)) {0..<Suc l} = (- (1::'a)) ^ (i + j) * of_int (sign q) * (A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?q2 \<in> Q \<Longrightarrow> of_int (sign (permutation_insert i j ?q2)) * prod (f (permutation_insert i j ?q2)) {0..<Suc l} = (- (1::'a)) ^ (i + j) * of_int (sign ?q2) * (A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', ?q2 i'')))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
hence "... = (\<Sum> q \<in> Q. (-1)^(i+j) * signof q *
      A $$ (i, j) * (\<Prod>i'' = 0 ..< l. mat_delete A i j $$ (i'', q i'')))"
[PROOF STATE]
proof (prove)
using this:
?q2 \<in> Q \<Longrightarrow> of_int (sign (permutation_insert i j ?q2)) * prod (f (permutation_insert i j ?q2)) {0..<Suc l} = (- (1::'a)) ^ (i + j) * of_int (sign ?q2) * (A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', ?q2 i'')))

goal (1 subgoal):
 1. (\<Sum>q\<in>Q. of_int (sign (permutation_insert i j q)) * prod (f (permutation_insert i j q)) {0..<Suc l}) = (\<Sum>q\<in>Q. (- (1::'a)) ^ (i + j) * of_int (sign q) * A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))
[PROOF STEP]
by(intro sum.cong[OF refl],auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>Q. of_int (sign (permutation_insert i j q)) * prod (f (permutation_insert i j q)) {0..<Suc l}) = (\<Sum>q\<in>Q. (- (1::'a)) ^ (i + j) * of_int (sign q) * A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>Q. of_int (sign (permutation_insert i j q)) * prod (f (permutation_insert i j q)) {0..<Suc l}) = (\<Sum>q\<in>Q. (- (1::'a)) ^ (i + j) * of_int (sign q) * A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = ( \<Sum> q \<in> Q. A $$ (i, j) * (-1)^(i+j) *
       ( signof q * (\<Prod>i'' = 0..< l. mat_delete A i j $$ (i'', q i'')) ) )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q\<in>Q. (- (1::'a)) ^ (i + j) * of_int (sign q) * A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))) = (\<Sum>q\<in>Q. A $$ (i, j) * (- (1::'a)) ^ (i + j) * (of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))))
[PROOF STEP]
by (intro sum.cong[OF refl],auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>Q. (- (1::'a)) ^ (i + j) * of_int (sign q) * A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))) = (\<Sum>q\<in>Q. A $$ (i, j) * (- (1::'a)) ^ (i + j) * (of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>Q. (- (1::'a)) ^ (i + j) * of_int (sign q) * A $$ (i, j) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))) = (\<Sum>q\<in>Q. A $$ (i, j) * (- (1::'a)) ^ (i + j) * (of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = A $$ (i, j) * (-1)^(i+j) *
      ( \<Sum> q \<in> Q. signof q * (\<Prod>i''= 0 ..< l. mat_delete A i j $$ (i'', q i'')) )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q\<in>Q. A $$ (i, j) * (- (1::'a)) ^ (i + j) * (of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))) = A $$ (i, j) * (- (1::'a)) ^ (i + j) * (\<Sum>q\<in>Q. of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))
[PROOF STEP]
unfolding sum_distrib_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q\<in>Q. A $$ (i, j) * (- (1::'a)) ^ (i + j) * (of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))) = (\<Sum>n\<in>Q. A $$ (i, j) * (- (1::'a)) ^ (i + j) * (of_int (sign n) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', n i''))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>Q. A $$ (i, j) * (- (1::'a)) ^ (i + j) * (of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))) = A $$ (i, j) * (- (1::'a)) ^ (i + j) * (\<Sum>q\<in>Q. of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>Q. A $$ (i, j) * (- (1::'a)) ^ (i + j) * (of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))) = A $$ (i, j) * (- (1::'a)) ^ (i + j) * (\<Sum>q\<in>Q. of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i'')))

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "... = (A $$ (i, j) * (-1)^(i+j) * det (mat_delete A i j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (i, j) * (- (1::'a)) ^ (i + j) * (\<Sum>q\<in>Q. of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))) = A $$ (i, j) * (- (1::'a)) ^ (i + j) * det (mat_delete A i j)
[PROOF STEP]
unfolding det_def'[OF mat_delete_carrier[OF A]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (i, j) * (- (1::'a)) ^ (i + j) * (\<Sum>q\<in>Q. of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))) = A $$ (i, j) * (- (1::'a)) ^ (i + j) * (\<Sum>p | p permutes {0..<Suc l - 1}. of_int (sign p) * (\<Prod>ia = 0..<Suc l - 1. mat_delete A i j $$ (ia, p ia)))
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $$ (i, j) * (- (1::'a)) ^ (i + j) * (\<Sum>q | q permutes {0..<l}. of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))) = A $$ (i, j) * (- (1::'a)) ^ (i + j) * (\<Sum>p | p permutes {0..<Suc l - 1}. of_int (sign p) * (\<Prod>ia = 0..<Suc l - 1. mat_delete A i j $$ (ia, p ia)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A $$ (i, j) * (- (1::'a)) ^ (i + j) * (\<Sum>q\<in>Q. of_int (sign q) * (\<Prod>i'' = 0..<l. mat_delete A i j $$ (i'', q i''))) = A $$ (i, j) * (- (1::'a)) ^ (i + j) * det (mat_delete A i j)

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum h {p |p. p permutes {0..<Suc l} \<and> p i = j} = A $$ (i, j) * (- (1::'a)) ^ (i + j) * det (mat_delete A i j)
[PROOF STEP]
have "sum h {p | p. p permutes ?N \<and> p i = j} = A $$ (i, j) * cofactor A i j"
[PROOF STATE]
proof (prove)
using this:
sum h {p |p. p permutes {0..<Suc l} \<and> p i = j} = A $$ (i, j) * (- (1::'a)) ^ (i + j) * det (mat_delete A i j)

goal (1 subgoal):
 1. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j} = A $$ (i, j) * cofactor A i j
[PROOF STEP]
unfolding cofactor_def
[PROOF STATE]
proof (prove)
using this:
sum h {p |p. p permutes {0..<Suc l} \<and> p i = j} = A $$ (i, j) * (- (1::'a)) ^ (i + j) * det (mat_delete A i j)

goal (1 subgoal):
 1. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j} = A $$ (i, j) * ((- (1::'a)) ^ (i + j) * det (mat_delete A i j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum h {p |p. p permutes {0..<Suc l} \<and> p i = j} = A $$ (i, j) * cofactor A i j

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i2 \<in> {0..<Suc l} \<Longrightarrow> sum h {p |p. p permutes {0..<Suc l} \<and> p ?i2 = j} = A $$ (?i2, j) * cofactor A ?i2 j

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
hence "... = (\<Sum>i\<in>?N. A $$ (i,j) * cofactor A i j)"
[PROOF STATE]
proof (prove)
using this:
?i2 \<in> {0..<Suc l} \<Longrightarrow> sum h {p |p. p permutes {0..<Suc l} \<and> p ?i2 = j} = A $$ (?i2, j) * cofactor A ?i2 j

goal (1 subgoal):
 1. (\<Sum>i = 0..<Suc l. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j}) = (\<Sum>i = 0..<Suc l. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<Suc l. sum h {p |p. p permutes {0..<Suc l} \<and> p i = j}) = (\<Sum>i = 0..<Suc l. A $$ (i, j) * cofactor A i j)

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det A = (\<Sum>i = 0..<Suc l. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det A = (\<Sum>i = 0..<Suc l. A $$ (i, j) * cofactor A i j)

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
unfolding atLeast0LessThan
[PROOF STATE]
proof (prove)
using this:
det A = (\<Sum>i<Suc l. A $$ (i, j) * cofactor A i j)

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
using A j
[PROOF STATE]
proof (prove)
using this:
det A = (\<Sum>i<Suc l. A $$ (i, j) * cofactor A i j)
A \<in> carrier_mat (Suc l) (Suc l)
j < n

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
unfolding l_def
[PROOF STATE]
proof (prove)
using this:
det A = (\<Sum>i<Suc (n - 1). A $$ (i, j) * cofactor A i j)
A \<in> carrier_mat (Suc (n - 1)) (Suc (n - 1))
j < n

goal (1 subgoal):
 1. det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
det A = (\<Sum>i<n. A $$ (i, j) * cofactor A i j)

goal:
No subgoals!
[PROOF STEP]
qed