[STATEMENT]
lemma delta0:
  assumes "qd1 \<le> qd2"
  shows "\<forall> \<epsilon>. \<epsilon> > 0 \<and> \<epsilon> \<le> (\<delta>0 qd1 qd2) \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<epsilon>. 0 < \<epsilon> \<and> \<epsilon> \<le> \<delta>0 qd1 qd2 \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<epsilon>. 0 < \<epsilon> \<and> \<epsilon> \<le> \<delta>0 qd1 qd2 \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>
[PROOF STEP]
have "\<And> e c1 c2 k1 k2 :: rat. \<lbrakk>e \<ge> 0; c1 < c2; k1 \<le> k2\<rbrakk> \<Longrightarrow> c1 + e*k1 \<le> c2 + e*k2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e c1 c2 k1 k2. \<lbrakk>0 \<le> e; c1 < c2; k1 \<le> k2\<rbrakk> \<Longrightarrow> c1 + e * k1 \<le> c2 + e * k2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e c1 c2 k1 k2. \<lbrakk>0 \<le> e; c1 < c2; k1 \<le> k2\<rbrakk> \<Longrightarrow> c1 + e * k1 \<le> c2 + e * k2
[PROOF STEP]
fix e c1 c2 k1 k2 :: rat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e c1 c2 k1 k2. \<lbrakk>0 \<le> e; c1 < c2; k1 \<le> k2\<rbrakk> \<Longrightarrow> c1 + e * k1 \<le> c2 + e * k2
[PROOF STEP]
show "\<lbrakk>e \<ge> 0; c1 < c2; k1 \<le> k2\<rbrakk> \<Longrightarrow> c1 + e*k1 \<le> c2 + e*k2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> e; c1 < c2; k1 \<le> k2\<rbrakk> \<Longrightarrow> c1 + e * k1 \<le> c2 + e * k2
[PROOF STEP]
using mult_left_mono[of "k1" "k2" "e"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k1 \<le> k2; 0 \<le> e\<rbrakk> \<Longrightarrow> e * k1 \<le> e * k2

goal (1 subgoal):
 1. \<lbrakk>0 \<le> e; c1 < c2; k1 \<le> k2\<rbrakk> \<Longrightarrow> c1 + e * k1 \<le> c2 + e * k2
[PROOF STEP]
using add_less_le_mono[of "c1" "c2" "e*k1" "e*k2"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k1 \<le> k2; 0 \<le> e\<rbrakk> \<Longrightarrow> e * k1 \<le> e * k2
\<lbrakk>c1 < c2; e * k1 \<le> e * k2\<rbrakk> \<Longrightarrow> c1 + e * k1 < c2 + e * k2

goal (1 subgoal):
 1. \<lbrakk>0 \<le> e; c1 < c2; k1 \<le> k2\<rbrakk> \<Longrightarrow> c1 + e * k1 \<le> c2 + e * k2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> e; c1 < c2; k1 \<le> k2\<rbrakk> \<Longrightarrow> c1 + e * k1 \<le> c2 + e * k2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> ?e; ?c1.0 < ?c2.0; ?k1.0 \<le> ?k2.0\<rbrakk> \<Longrightarrow> ?c1.0 + ?e * ?k1.0 \<le> ?c2.0 + ?e * ?k2.0

goal (1 subgoal):
 1. \<forall>\<epsilon>. 0 < \<epsilon> \<and> \<epsilon> \<le> \<delta>0 qd1 qd2 \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 \<le> ?e; ?c1.0 < ?c2.0; ?k1.0 \<le> ?k2.0\<rbrakk> \<Longrightarrow> ?c1.0 + ?e * ?k1.0 \<le> ?c2.0 + ?e * ?k2.0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?e; ?c1.0 < ?c2.0; ?k1.0 \<le> ?k2.0\<rbrakk> \<Longrightarrow> ?c1.0 + ?e * ?k1.0 \<le> ?c2.0 + ?e * ?k2.0

goal (1 subgoal):
 1. \<forall>\<epsilon>. 0 < \<epsilon> \<and> \<epsilon> \<le> \<delta>0 qd1 qd2 \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?e; ?c1.0 < ?c2.0; ?k1.0 \<le> ?k2.0\<rbrakk> \<Longrightarrow> ?c1.0 + ?e * ?k1.0 \<le> ?c2.0 + ?e * ?k2.0
qd1 \<le> qd2

goal (1 subgoal):
 1. \<forall>\<epsilon>. 0 < \<epsilon> \<and> \<epsilon> \<le> \<delta>0 qd1 qd2 \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>
[PROOF STEP]
by (auto simp add: \<delta>0_def val_def less_eq_QDelta_def Let_def field_simps mult_left_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<epsilon>. 0 < \<epsilon> \<and> \<epsilon> \<le> \<delta>0 qd1 qd2 \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coord_matrix':
  fixes X::"'a::{field}^'n^'n" and Y::"'a^'m^'m"
  assumes basis_X: "is_basis (set_of_vector X)" and basis_Y: "is_basis (set_of_vector Y)"
  and linear_f: "linear ((*s)) ((*s)) f"
  shows "coord Y (f v) = (matrix' X Y f) *v (coord X v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coord Y (f v) = matrix' X Y f *v coord X v
[PROOF STEP]
proof (unfold matrix_mult_sum matrix'_def column_def coord_def, vector, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
interpret Vector_Spaces.linear "(*s)" "(*s)" f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear (*s) (*s) f
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
obtain g where g: "(\<Sum>x\<in>UNIV. g x *s Y $ x) = f v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. (\<Sum>x\<in>UNIV. g x *s Y $ x) = f v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using basis_UNIV[OF basis_Y]
[PROOF STATE]
proof (prove)
using this:
UNIV = {x. \<exists>g. (\<Sum>i\<in>UNIV. g i *s Y $ i) = x}

goal (1 subgoal):
 1. (\<And>g. (\<Sum>x\<in>UNIV. g x *s Y $ x) = f v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. g x *s Y $ x) = f v

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
obtain s where s: "(\<Sum>x\<in>UNIV. s x *s X $ x) = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s. (\<Sum>x\<in>UNIV. s x *s X $ x) = v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using basis_UNIV[OF basis_X]
[PROOF STATE]
proof (prove)
using this:
UNIV = {x. \<exists>g. (\<Sum>i\<in>UNIV. g i *s X $ i) = x}

goal (1 subgoal):
 1. (\<And>s. (\<Sum>x\<in>UNIV. s x *s X $ x) = v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. s x *s X $ x) = v

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have the_g: "(THE fa. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a)) = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (THE fa. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a)) = g
[PROOF STEP]
proof (rule the_equality)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. g x * Y $ x $ a)
 2. \<And>fa. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a) \<Longrightarrow> fa = g
[PROOF STEP]
have "\<forall>a. f v $ a = (\<Sum>x\<in>UNIV. g x  *s Y $ x) $ a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. g x *s Y $ x) $ a
[PROOF STEP]
using g
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>UNIV. g x *s Y $ x) = f v

goal (1 subgoal):
 1. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. g x *s Y $ x) $ a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>a. f v $ a = (\<Sum>x\<in>UNIV. g x *s Y $ x) $ a

goal (2 subgoals):
 1. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. g x * Y $ x $ a)
 2. \<And>fa. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a) \<Longrightarrow> fa = g
[PROOF STEP]
thus " \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. g x * Y $ x $ a)"
[PROOF STATE]
proof (prove)
using this:
\<forall>a. f v $ a = (\<Sum>x\<in>UNIV. g x *s Y $ x) $ a

goal (1 subgoal):
 1. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. g x * Y $ x $ a)
[PROOF STEP]
unfolding sum_component
[PROOF STATE]
proof (prove)
using this:
\<forall>a. f v $ a = (\<Sum>x\<in>UNIV. (g x *s Y $ x) $ a)

goal (1 subgoal):
 1. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. g x * Y $ x $ a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>a. f v $ a = (\<Sum>x\<in>UNIV. g x * Y $ x $ a)

goal (1 subgoal):
 1. \<And>fa. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a) \<Longrightarrow> fa = g
[PROOF STEP]
fix fa
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>fa. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a) \<Longrightarrow> fa = g
[PROOF STEP]
assume " \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a)"
[PROOF STATE]
proof (state)
this:
\<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a)

goal (1 subgoal):
 1. \<And>fa. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a) \<Longrightarrow> fa = g
[PROOF STEP]
hence  fa: "f v = (\<Sum>x\<in>UNIV. fa x *s Y $ x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a)

goal (1 subgoal):
 1. f v = (\<Sum>x\<in>UNIV. fa x *s Y $ x)
[PROOF STEP]
by (vector, auto)
[PROOF STATE]
proof (state)
this:
f v = (\<Sum>x\<in>UNIV. fa x *s Y $ x)

goal (1 subgoal):
 1. \<And>fa. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a) \<Longrightarrow> fa = g
[PROOF STEP]
show "fa=g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fa = g
[PROOF STEP]
by (rule basis_combination_unique[OF basis_Y], simp add: fa g)
[PROOF STATE]
proof (state)
this:
fa = g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(THE fa. \<forall>a. f v $ a = (\<Sum>x\<in>UNIV. fa x * Y $ x $ a)) = g

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have the_s: "(THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i))=s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) = s
[PROOF STEP]
proof (rule the_equality)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. s x * X $ x $ i)
 2. \<And>f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i) \<Longrightarrow> f = s
[PROOF STEP]
have " \<forall>i. v $ i = (\<Sum>x\<in>UNIV. s x *s X $ x) $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. s x *s X $ x) $ i
[PROOF STEP]
using s
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>UNIV. s x *s X $ x) = v

goal (1 subgoal):
 1. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. s x *s X $ x) $ i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>i. v $ i = (\<Sum>x\<in>UNIV. s x *s X $ x) $ i

goal (2 subgoals):
 1. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. s x * X $ x $ i)
 2. \<And>f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i) \<Longrightarrow> f = s
[PROOF STEP]
thus " \<forall>i. v $ i = (\<Sum>x\<in>UNIV. s x * X $ x $ i)"
[PROOF STATE]
proof (prove)
using this:
\<forall>i. v $ i = (\<Sum>x\<in>UNIV. s x *s X $ x) $ i

goal (1 subgoal):
 1. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. s x * X $ x $ i)
[PROOF STEP]
unfolding sum_component
[PROOF STATE]
proof (prove)
using this:
\<forall>i. v $ i = (\<Sum>x\<in>UNIV. (s x *s X $ x) $ i)

goal (1 subgoal):
 1. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. s x * X $ x $ i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>i. v $ i = (\<Sum>x\<in>UNIV. s x * X $ x $ i)

goal (1 subgoal):
 1. \<And>f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i) \<Longrightarrow> f = s
[PROOF STEP]
fix fa
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i) \<Longrightarrow> f = s
[PROOF STEP]
assume "\<forall>i. v $ i = (\<Sum>x\<in>UNIV. fa x * X $ x $ i)"
[PROOF STATE]
proof (state)
this:
\<forall>i. v $ i = (\<Sum>x\<in>UNIV. fa x * X $ x $ i)

goal (1 subgoal):
 1. \<And>f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i) \<Longrightarrow> f = s
[PROOF STEP]
hence fa: "v=(\<Sum>x\<in>UNIV. fa x *s X $ x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>i. v $ i = (\<Sum>x\<in>UNIV. fa x * X $ x $ i)

goal (1 subgoal):
 1. v = (\<Sum>x\<in>UNIV. fa x *s X $ x)
[PROOF STEP]
by (vector, auto)
[PROOF STATE]
proof (state)
this:
v = (\<Sum>x\<in>UNIV. fa x *s X $ x)

goal (1 subgoal):
 1. \<And>f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i) \<Longrightarrow> f = s
[PROOF STEP]
show "fa=s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fa = s
[PROOF STEP]
by (rule basis_combination_unique[OF basis_X], simp add: fa s)
[PROOF STATE]
proof (state)
this:
fa = s

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) = s

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
define t where "t x = (\<Sum>i\<in>UNIV. (s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x))" for x
[PROOF STATE]
proof (state)
this:
t ?x = (\<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) ?x)

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have "(\<Sum>x\<in>UNIV. g x *s Y $ x) = f v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. g x *s Y $ x) = f v
[PROOF STEP]
using g
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>UNIV. g x *s Y $ x) = f v

goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. g x *s Y $ x) = f v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. g x *s Y $ x) = f v

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. g x *s Y $ x) = f v

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have "... = f (\<Sum>x\<in>UNIV. s x *s X $ x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f v = f (\<Sum>x\<in>UNIV. s x *s X $ x)
[PROOF STEP]
using s
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>UNIV. s x *s X $ x) = v

goal (1 subgoal):
 1. f v = f (\<Sum>x\<in>UNIV. s x *s X $ x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f v = f (\<Sum>x\<in>UNIV. s x *s X $ x)

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f v = f (\<Sum>x\<in>UNIV. s x *s X $ x)

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have "... = (\<Sum>x\<in>UNIV. s x *s f (X $ x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (\<Sum>x\<in>UNIV. s x *s X $ x) = (\<Sum>x\<in>UNIV. s x *s f (X $ x))
[PROOF STEP]
by (simp add: sum scale)
[PROOF STATE]
proof (state)
this:
f (\<Sum>x\<in>UNIV. s x *s X $ x) = (\<Sum>x\<in>UNIV. s x *s f (X $ x))

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (\<Sum>x\<in>UNIV. s x *s X $ x) = (\<Sum>x\<in>UNIV. s x *s f (X $ x))

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have "... = (\<Sum>i\<in>UNIV. s i *s sum (\<lambda>j. (matrix' X Y f)$j$i *s (Y$j)) UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. s x *s f (X $ x)) = (\<Sum>i\<in>UNIV. s i *s (\<Sum>j\<in>UNIV. matrix' X Y f $ j $ i *s Y $ j))
[PROOF STEP]
using matrix'[OF basis_X basis_Y]
[PROOF STATE]
proof (prove)
using this:
?f (X $ ?i) = (\<Sum>j\<in>UNIV. matrix' X Y ?f $ j $ ?i *s Y $ j)

goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. s x *s f (X $ x)) = (\<Sum>i\<in>UNIV. s i *s (\<Sum>j\<in>UNIV. matrix' X Y f $ j $ i *s Y $ j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. s x *s f (X $ x)) = (\<Sum>i\<in>UNIV. s i *s (\<Sum>j\<in>UNIV. matrix' X Y f $ j $ i *s Y $ j))

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. s x *s f (X $ x)) = (\<Sum>i\<in>UNIV. s i *s (\<Sum>j\<in>UNIV. matrix' X Y f $ j $ i *s Y $ j))

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have "... =  (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i *s (matrix' X Y f $ x $ i *s Y $ x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. s i *s (\<Sum>j\<in>UNIV. matrix' X Y f $ j $ i *s Y $ j)) = (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i *s (matrix' X Y f $ x $ i *s Y $ x))
[PROOF STEP]
unfolding vec.scale_sum_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i *s (matrix' X Y f $ x $ i *s Y $ x)) = (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i *s (matrix' X Y f $ x $ i *s Y $ x))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. s i *s (\<Sum>j\<in>UNIV. matrix' X Y f $ j $ i *s Y $ j)) = (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i *s (matrix' X Y f $ x $ i *s Y $ x))

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. s i *s (\<Sum>j\<in>UNIV. matrix' X Y f $ j $ i *s Y $ j)) = (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i *s (matrix' X Y f $ x $ i *s Y $ x))

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have "... = (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. (s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x) *s Y $ x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i *s (matrix' X Y f $ x $ i *s Y $ x)) = (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x)
[PROOF STEP]
unfolding matrix'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i *s ((\<chi>i j. coord Y (f (X $ j)) $ i) $ x $ i *s Y $ x)) = (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x)
[PROOF STEP]
unfolding coord_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i *s ((\<chi>i j. vec_lambda (THE fa. f (X $ j) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) $ i) $ x $ i *s Y $ x)) = (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i *s (matrix' X Y f $ x $ i *s Y $ x)) = (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x)

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i *s (matrix' X Y f $ x $ i *s Y $ x)) = (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x)

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have "... = (\<Sum>x\<in>UNIV. (\<Sum>i\<in>UNIV. (s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x) *s Y $ x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x) = (\<Sum>x\<in>UNIV. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x)
[PROOF STEP]
by (rule sum.swap)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x) = (\<Sum>x\<in>UNIV. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x)

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. \<Sum>x\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x) = (\<Sum>x\<in>UNIV. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x)

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have "... =  (\<Sum>x\<in>UNIV. (\<Sum>i\<in>UNIV. (s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x)) *s Y $ x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x) = (\<Sum>x\<in>UNIV. (\<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x) *s Y $ x)
[PROOF STEP]
unfolding vec.scale_sum_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x) = (\<Sum>x\<in>UNIV. \<Sum>a\<in>UNIV. s a * (THE fa. f (X $ a) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x) = (\<Sum>x\<in>UNIV. (\<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x) *s Y $ x)

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x *s Y $ x) = (\<Sum>x\<in>UNIV. (\<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x) *s Y $ x)

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have "... =  (\<Sum>x\<in>UNIV. t x *s Y $ x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. (\<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x) *s Y $ x) = (\<Sum>x\<in>UNIV. t x *s Y $ x)
[PROOF STEP]
unfolding t_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. (\<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x) *s Y $ x) = (\<Sum>x\<in>UNIV. (\<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x) *s Y $ x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. (\<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x) *s Y $ x) = (\<Sum>x\<in>UNIV. t x *s Y $ x)

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x\<in>UNIV. g x *s Y $ x) = (\<Sum>x\<in>UNIV. t x *s Y $ x)
[PROOF STEP]
have "(\<Sum>x\<in>UNIV. g x *s Y $ x) = (\<Sum>x\<in>UNIV. t x *s Y $ x)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>UNIV. g x *s Y $ x) = (\<Sum>x\<in>UNIV. t x *s Y $ x)

goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. g x *s Y $ x) = (\<Sum>x\<in>UNIV. t x *s Y $ x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. g x *s Y $ x) = (\<Sum>x\<in>UNIV. t x *s Y $ x)

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
hence "g=t"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>UNIV. g x *s Y $ x) = (\<Sum>x\<in>UNIV. t x *s Y $ x)

goal (1 subgoal):
 1. g = t
[PROOF STEP]
using basis_combination_unique[OF basis_Y]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>UNIV. g x *s Y $ x) = (\<Sum>x\<in>UNIV. t x *s Y $ x)
(\<Sum>i\<in>UNIV. ?g i *s Y $ i) = (\<Sum>i\<in>UNIV. ?f i *s Y $ i) \<Longrightarrow> ?f = ?g

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

goal (1 subgoal):
 1. \<And>i. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
thus "(THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i =
    (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)"
[PROOF STATE]
proof (prove)
using this:
g = t

goal (1 subgoal):
 1. (THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
proof (unfold  the_g the_s t_def, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>t = (\<lambda>x. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x); g = (\<lambda>x. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x)\<rbrakk> \<Longrightarrow> (\<Sum>ia\<in>UNIV. s ia * (THE fa. f (X $ ia) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have " (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i) =
      (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x  *s Y $ x) $ i) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x *s Y $ x) $ i) i)
[PROOF STEP]
unfolding sum_component
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. (fa x *s Y $ x) $ i)) i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x *s Y $ x) $ i) i)

goal (1 subgoal):
 1. \<lbrakk>t = (\<lambda>x. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x); g = (\<lambda>x. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x)\<rbrakk> \<Longrightarrow> (\<Sum>ia\<in>UNIV. s ia * (THE fa. f (X $ ia) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x *s Y $ x) $ i) i)

goal (1 subgoal):
 1. \<lbrakk>t = (\<lambda>x. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x); g = (\<lambda>x. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x)\<rbrakk> \<Longrightarrow> (\<Sum>ia\<in>UNIV. s ia * (THE fa. f (X $ ia) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
have "... = (\<Sum>x\<in>UNIV. s x * (THE fa. f (X $ x) = (\<Sum>x\<in>UNIV. fa x  *s Y $ x)) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x *s Y $ x) $ i) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. f (X $ x) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) i)
[PROOF STEP]
by (rule sum.cong, auto simp add: vec_eq_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x *s Y $ x) $ i) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. f (X $ x) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) i)

goal (1 subgoal):
 1. \<lbrakk>t = (\<lambda>x. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x); g = (\<lambda>x. \<Sum>i\<in>UNIV. s i * (THE fa. f (X $ i) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) x)\<rbrakk> \<Longrightarrow> (\<Sum>ia\<in>UNIV. s ia * (THE fa. f (X $ ia) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. f (X $ x) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) i)
[PROOF STEP]
show " (\<Sum>ia\<in>UNIV. s ia * (THE fa. f (X $ ia) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. f (X $ x) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) i)

goal (1 subgoal):
 1. (\<Sum>ia\<in>UNIV. s ia * (THE fa. f (X $ ia) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>ia\<in>UNIV. s ia * (THE fa. f (X $ ia) = (\<Sum>x\<in>UNIV. fa x *s Y $ x)) i) = (\<Sum>x\<in>UNIV. s x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(THE fa. \<forall>i. f v $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i = (\<Sum>x\<in>UNIV. (THE f. \<forall>i. v $ i = (\<Sum>x\<in>UNIV. f x * X $ x $ i)) x * (THE fa. \<forall>i. f (X $ x) $ i = (\<Sum>x\<in>UNIV. fa x * Y $ x $ i)) i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma insertion_mpoly_to_mpoly_poly: assumes "\<And> y. y \<noteq> x \<Longrightarrow> \<beta> y = \<alpha> y"
  shows "poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p)) (\<alpha> x) = insertion \<alpha> p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p)) (\<alpha> x) = insertion \<alpha> p
[PROOF STEP]
proof (induct p rule: mpoly_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m a. poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (MPoly_Type.monom m a))) (\<alpha> x) = insertion \<alpha> (MPoly_Type.monom m a)
 2. \<And>p1 p2 m a. \<lbrakk>poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p1)) (\<alpha> x) = insertion \<alpha> p1; poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p2)) (\<alpha> x) = insertion \<alpha> p2; p2 = MPoly_Type.monom m a; m \<notin> keys (mapping_of p1)\<rbrakk> \<Longrightarrow> poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (p1 + p2))) (\<alpha> x) = insertion \<alpha> (p1 + p2)
[PROOF STEP]
case (monom m a)
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>m a. poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (MPoly_Type.monom m a))) (\<alpha> x) = insertion \<alpha> (MPoly_Type.monom m a)
 2. \<And>p1 p2 m a. \<lbrakk>poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p1)) (\<alpha> x) = insertion \<alpha> p1; poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p2)) (\<alpha> x) = insertion \<alpha> p2; p2 = MPoly_Type.monom m a; m \<notin> keys (mapping_of p1)\<rbrakk> \<Longrightarrow> poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (p1 + p2))) (\<alpha> x) = insertion \<alpha> (p1 + p2)
[PROOF STEP]
let ?rkm = "remove_key x m"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m a. poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (MPoly_Type.monom m a))) (\<alpha> x) = insertion \<alpha> (MPoly_Type.monom m a)
 2. \<And>p1 p2 m a. \<lbrakk>poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p1)) (\<alpha> x) = insertion \<alpha> p1; poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p2)) (\<alpha> x) = insertion \<alpha> p2; p2 = MPoly_Type.monom m a; m \<notin> keys (mapping_of p1)\<rbrakk> \<Longrightarrow> poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (p1 + p2))) (\<alpha> x) = insertion \<alpha> (p1 + p2)
[PROOF STEP]
have to_alpha: "insertion \<beta> (MPoly_Type.monom ?rkm a) = insertion \<alpha> (MPoly_Type.monom ?rkm a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion \<beta> (MPoly_Type.monom (remove_key x m) a) = insertion \<alpha> (MPoly_Type.monom (remove_key x m) a)
[PROOF STEP]
by (rule insertion_irrelevant_vars, rule assms, insert vars_monom_subset[of ?rkm a], auto simp: remove_key_keys[symmetric])
[PROOF STATE]
proof (state)
this:
insertion \<beta> (MPoly_Type.monom (remove_key x m) a) = insertion \<alpha> (MPoly_Type.monom (remove_key x m) a)

goal (2 subgoals):
 1. \<And>m a. poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (MPoly_Type.monom m a))) (\<alpha> x) = insertion \<alpha> (MPoly_Type.monom m a)
 2. \<And>p1 p2 m a. \<lbrakk>poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p1)) (\<alpha> x) = insertion \<alpha> p1; poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p2)) (\<alpha> x) = insertion \<alpha> p2; p2 = MPoly_Type.monom m a; m \<notin> keys (mapping_of p1)\<rbrakk> \<Longrightarrow> poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (p1 + p2))) (\<alpha> x) = insertion \<alpha> (p1 + p2)
[PROOF STEP]
have main: "insertion \<alpha> (MPoly_Type.monom ?rkm a) * \<alpha> x ^ lookup m x = insertion \<alpha> (MPoly_Type.monom m a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion \<alpha> (MPoly_Type.monom (remove_key x m) a) * \<alpha> x ^ lookup m x = insertion \<alpha> (MPoly_Type.monom m a)
[PROOF STEP]
unfolding monom_remove_key[of m a x] insertion_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion \<alpha> (MPoly_Type.monom (remove_key x m) a) * \<alpha> x ^ lookup m x = insertion \<alpha> (MPoly_Type.monom (remove_key x m) a) * insertion \<alpha> (MPoly_Type.monom (monomial (lookup m x) x) (1::'a))
[PROOF STEP]
by (metis insertion_single mult.left_neutral)
[PROOF STATE]
proof (state)
this:
insertion \<alpha> (MPoly_Type.monom (remove_key x m) a) * \<alpha> x ^ lookup m x = insertion \<alpha> (MPoly_Type.monom m a)

goal (2 subgoals):
 1. \<And>m a. poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (MPoly_Type.monom m a))) (\<alpha> x) = insertion \<alpha> (MPoly_Type.monom m a)
 2. \<And>p1 p2 m a. \<lbrakk>poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p1)) (\<alpha> x) = insertion \<alpha> p1; poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p2)) (\<alpha> x) = insertion \<alpha> p2; p2 = MPoly_Type.monom m a; m \<notin> keys (mapping_of p1)\<rbrakk> \<Longrightarrow> poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (p1 + p2))) (\<alpha> x) = insertion \<alpha> (p1 + p2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (MPoly_Type.monom m a))) (\<alpha> x) = insertion \<alpha> (MPoly_Type.monom m a)
[PROOF STEP]
using main to_alpha
[PROOF STATE]
proof (prove)
using this:
insertion \<alpha> (MPoly_Type.monom (remove_key x m) a) * \<alpha> x ^ lookup m x = insertion \<alpha> (MPoly_Type.monom m a)
insertion \<beta> (MPoly_Type.monom (remove_key x m) a) = insertion \<alpha> (MPoly_Type.monom (remove_key x m) a)

goal (1 subgoal):
 1. poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (MPoly_Type.monom m a))) (\<alpha> x) = insertion \<alpha> (MPoly_Type.monom m a)
[PROOF STEP]
by (simp add: mpoly_to_mpoly_poly_monom map_poly_monom poly_monom)
[PROOF STATE]
proof (state)
this:
poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (MPoly_Type.monom m a))) (\<alpha> x) = insertion \<alpha> (MPoly_Type.monom m a)

goal (1 subgoal):
 1. \<And>p1 p2 m a. \<lbrakk>poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p1)) (\<alpha> x) = insertion \<alpha> p1; poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p2)) (\<alpha> x) = insertion \<alpha> p2; p2 = MPoly_Type.monom m a; m \<notin> keys (mapping_of p1)\<rbrakk> \<Longrightarrow> poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (p1 + p2))) (\<alpha> x) = insertion \<alpha> (p1 + p2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p1 p2 m a. \<lbrakk>poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p1)) (\<alpha> x) = insertion \<alpha> p1; poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p2)) (\<alpha> x) = insertion \<alpha> p2; p2 = MPoly_Type.monom m a; m \<notin> keys (mapping_of p1)\<rbrakk> \<Longrightarrow> poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (p1 + p2))) (\<alpha> x) = insertion \<alpha> (p1 + p2)
[PROOF STEP]
case (sum p1 p2 m a)
[PROOF STATE]
proof (state)
this:
poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p1)) (\<alpha> x) = insertion \<alpha> p1
poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p2)) (\<alpha> x) = insertion \<alpha> p2
p2 = MPoly_Type.monom m a
m \<notin> keys (mapping_of p1)

goal (1 subgoal):
 1. \<And>p1 p2 m a. \<lbrakk>poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p1)) (\<alpha> x) = insertion \<alpha> p1; poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p2)) (\<alpha> x) = insertion \<alpha> p2; p2 = MPoly_Type.monom m a; m \<notin> keys (mapping_of p1)\<rbrakk> \<Longrightarrow> poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (p1 + p2))) (\<alpha> x) = insertion \<alpha> (p1 + p2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p1)) (\<alpha> x) = insertion \<alpha> p1
poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p2)) (\<alpha> x) = insertion \<alpha> p2
p2 = MPoly_Type.monom m a
m \<notin> keys (mapping_of p1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p1)) (\<alpha> x) = insertion \<alpha> p1
poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x p2)) (\<alpha> x) = insertion \<alpha> p2
p2 = MPoly_Type.monom m a
m \<notin> keys (mapping_of p1)

goal (1 subgoal):
 1. poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (p1 + p2))) (\<alpha> x) = insertion \<alpha> (p1 + p2)
[PROOF STEP]
by (simp add: mpoly_to_mpoly_poly_add insertion_add map_poly_add)
[PROOF STATE]
proof (state)
this:
poly (map_poly (insertion \<beta>) (mpoly_to_mpoly_poly x (p1 + p2))) (\<alpha> x) = insertion \<alpha> (p1 + p2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_hd_tl: "distinct xs \<Longrightarrow> hd xs \<notin> set (tl xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs \<Longrightarrow> hd xs \<notin> set (tl xs)
[PROOF STEP]
by (metis distinct.simps(2) hd_Cons_tl in_set_member list.sel(2) member_rec(2))


[STATEMENT]
lemma (in complex_normed_algebra_1) scaleC_power [simp]: "(scaleC x y) ^ n = scaleC (x^n) (y^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x *\<^sub>C y) ^ n = x ^ n *\<^sub>C y ^ n
[PROOF STEP]
by (induct n) (simp_all add: mult_ac)


[STATEMENT]
lemma Max_wrt_preorder:
  "Max_wrt le = {x\<in>carrier. \<forall>y\<in>carrier. le x y \<longrightarrow> le y x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max_wrt le = {x \<in> carrier. \<forall>y\<in>carrier. le x y \<longrightarrow> le y x}
[PROOF STEP]
unfolding Max_wrt_altdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. le x x \<and> (\<forall>y. le x y \<longrightarrow> le y x)} = {x \<in> carrier. \<forall>y\<in>carrier. le x y \<longrightarrow> le y x}
[PROOF STEP]
using not_outside refl
[PROOF STATE]
proof (prove)
using this:
le ?x ?y \<Longrightarrow> ?x \<in> carrier
le ?x ?y \<Longrightarrow> ?y \<in> carrier
?x \<in> carrier \<Longrightarrow> le ?x ?x

goal (1 subgoal):
 1. {x. le x x \<and> (\<forall>y. le x y \<longrightarrow> le y x)} = {x \<in> carrier. \<forall>y\<in>carrier. le x y \<longrightarrow> le y x}
[PROOF STEP]
by blast


[STATEMENT]
lemma fvi_iff_fv: "x \<in> fvi b \<phi> \<longleftrightarrow> x + b \<in> fv \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> fvi b \<phi>) = (x + b \<in> fv \<phi>)
[PROOF STEP]
using fvi_plus[where b=0 and c=b]
[PROOF STATE]
proof (prove)
using this:
(?x \<in> fvi (0 + b) ?\<phi>) = (?x + b \<in> fv ?\<phi>)

goal (1 subgoal):
 1. (x \<in> fvi b \<phi>) = (x + b \<in> fv \<phi>)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma foldr_conv_foldl: "foldr f xs a = foldl (\<lambda>a b. f b a) a xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr f xs a = foldl (\<lambda>a b. f b a) a xs
[PROOF STEP]
by(induct xs arbitrary: a)(simp_all add: foldl_f_commute)


[STATEMENT]
lemma disjE5:
  "\<lbrakk> A \<or> B \<or> C \<or> D \<or> E ; A \<Longrightarrow> P ; B \<Longrightarrow> P ; C \<Longrightarrow> P ; D \<Longrightarrow> P ; E \<Longrightarrow> P \<rbrakk> \<Longrightarrow> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<or> B \<or> C \<or> D \<or> E; A \<Longrightarrow> P; B \<Longrightarrow> P; C \<Longrightarrow> P; D \<Longrightarrow> P; E \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by auto


[STATEMENT]
lemma Arg2pi_diff:
  assumes "w \<noteq> 0" "z \<noteq> 0"
    shows "Arg2pi w - Arg2pi z = (if Arg2pi z \<le> Arg2pi w then Arg2pi(w / z) else Arg2pi(w/z) - 2*pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg2pi w - Arg2pi z = (if Arg2pi z \<le> Arg2pi w then Arg2pi (w / z) else Arg2pi (w / z) - 2 * pi)
[PROOF STEP]
using assms Arg2pi_divide Arg2pi_inverse [of "w/z"] Arg2pi_eq_0_pi
[PROOF STATE]
proof (prove)
using this:
w \<noteq> 0
z \<noteq> 0
\<lbrakk>?w \<noteq> 0; ?z \<noteq> 0; Arg2pi ?w \<le> Arg2pi ?z\<rbrakk> \<Longrightarrow> Arg2pi (?z / ?w) = Arg2pi ?z - Arg2pi ?w
Arg2pi (inverse (w / z)) = (if w / z \<in> \<real> then Arg2pi (w / z) else 2 * pi - Arg2pi (w / z))
(Arg2pi ?z = 0 \<or> Arg2pi ?z = pi) = (?z \<in> \<real>)

goal (1 subgoal):
 1. Arg2pi w - Arg2pi z = (if Arg2pi z \<le> Arg2pi w then Arg2pi (w / z) else Arg2pi (w / z) - 2 * pi)
[PROOF STEP]
by (force simp add: Arg2pi_ge_0 Arg2pi_divide not_le split: if_split_asm)


[STATEMENT]
lemma bij_swap_comp:
  assumes "bij p"
  shows "Fun.swap a b id \<circ> p = Fun.swap (inv p a) (inv p b) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. id \<circ> Transposition.transpose a b \<circ> p = p \<circ> Transposition.transpose (inv p a) (inv p b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bij p

goal (1 subgoal):
 1. id \<circ> Transposition.transpose a b \<circ> p = p \<circ> Transposition.transpose (inv p a) (inv p b)
[PROOF STEP]
by (simp add: transpose_comp_eq)


[STATEMENT]
lemma filter_mset_image_mset:
  "filter_mset P (image_mset f A) = image_mset f (filter_mset (\<lambda>x. P (f x)) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset P (image_mset f A) = image_mset f {#x \<in># A. P (f x)#}
[PROOF STEP]
by (induction A) auto


[STATEMENT]
lemma floor_uminus_of_int [simp]: "\<lfloor>- (of_int z)\<rfloor> = - z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>- of_int z\<rfloor> = - z
[PROOF STEP]
by (metis floor_diff_of_int [of 0] diff_0 floor_zero)


[STATEMENT]
lemma regular_implies_mono: "regular f \<Longrightarrow> mono f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. regular f \<Longrightarrow> mono f
[PROOF STEP]
by (simp add: continuous_imp_mono regular_def)


[STATEMENT]
lemma subst_clause'_append[simp]:
  "subst_clause' (A @ B) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' B m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subst_clause' (A @ B) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' B m
[PROOF STEP]
proof (induction B rule: rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. subst_clause' (A @ []) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' [] m
 2. \<And>x xs. subst_clause' (A @ xs) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' xs m \<Longrightarrow> subst_clause' (A @ xs @ [x]) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' (xs @ [x]) m
[PROOF STEP]
case (snoc x xs)
[PROOF STATE]
proof (state)
this:
subst_clause' (A @ xs) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' xs m

goal (2 subgoals):
 1. subst_clause' (A @ []) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' [] m
 2. \<And>x xs. subst_clause' (A @ xs) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' xs m \<Longrightarrow> subst_clause' (A @ xs @ [x]) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' (xs @ [x]) m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subst_clause' (A @ xs) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' xs m
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
subst_clause' (A @ xs) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' xs m

goal (1 subgoal):
 1. subst_clause' (A @ xs @ [x]) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' (xs @ [x]) m
[PROOF STEP]
by simp (metis append_assoc subst_clause'_cons)
[PROOF STATE]
proof (state)
this:
subst_clause' (A @ xs @ [x]) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' (xs @ [x]) m

goal (1 subgoal):
 1. subst_clause' (A @ []) m = subst_clause' A m \<otimes>\<^sub>l subst_clause' [] m
[PROOF STEP]
qed(simp add: list_product_def)


[STATEMENT]
lemma all_roots_real_mult[simp]:
  "all_roots_real (p*q) \<longleftrightarrow> all_roots_real p \<and> all_roots_real q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_roots_real (p * q) = (all_roots_real p \<and> all_roots_real q)
[PROOF STEP]
unfolding all_roots_real_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>r\<in>proots (map_poly complex_of_real (p * q)). Im r = 0) = ((\<forall>r\<in>proots (map_poly complex_of_real p). Im r = 0) \<and> (\<forall>r\<in>proots (map_poly complex_of_real q). Im r = 0))
[PROOF STEP]
by auto


[STATEMENT]
lemma signed_measure_sums:
  assumes "signed_measure M \<mu>"
    and "range A \<subseteq> M"
    and "disjoint_family A"
    and "\<Union> (range A) \<in> sets M"
  shows "(\<lambda>i. \<mu> (A i)) sums \<mu> (\<Union> (range A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. \<mu> (A i)) sums \<mu> (\<Union> (range A))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
signed_measure M \<mu>
range A \<subseteq> sets M
disjoint_family A
\<Union> (range A) \<in> sets M

goal (1 subgoal):
 1. (\<lambda>i. \<mu> (A i)) sums \<mu> (\<Union> (range A))
[PROOF STEP]
unfolding signed_measure_def
[PROOF STATE]
proof (prove)
using this:
\<mu> {} = 0 \<and> (- \<infinity> \<notin> range \<mu> \<or> \<infinity> \<notin> range \<mu>) \<and> (\<forall>A. range A \<subseteq> sets M \<longrightarrow> disjoint_family A \<longrightarrow> \<Union> (range A) \<in> sets M \<longrightarrow> (\<lambda>i. \<mu> (A i)) sums \<mu> (\<Union> (range A))) \<and> (\<forall>A. range A \<subseteq> sets M \<longrightarrow> disjoint_family A \<longrightarrow> \<Union> (range A) \<in> sets M \<longrightarrow> \<bar>\<mu> (\<Union> (range A))\<bar> < \<infinity> \<longrightarrow> summable (\<lambda>i. real_of_ereal \<bar>\<mu> (A i)\<bar>))
range A \<subseteq> sets M
disjoint_family A
\<Union> (range A) \<in> sets M

goal (1 subgoal):
 1. (\<lambda>i. \<mu> (A i)) sums \<mu> (\<Union> (range A))
[PROOF STEP]
by simp


[STATEMENT]
lemma (in cpx_sq_mat) similar_eigenvectors:
  assumes "A\<in> fc_mats"
  and "B\<in> fc_mats"
  and "P\<in> fc_mats"
  and "similar_mat_wit A B P (Complex_Matrix.adjoint P)"
  and "diagonal_mat B"
  and "i < n"
shows "A *\<^sub>v (P *\<^sub>v (unit_vec dimR i)) = B $$ (i,i) \<cdot>\<^sub>v (P *\<^sub>v (unit_vec dimR i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
have "A *\<^sub>v (P *\<^sub>v (unit_vec dimR i)) =
    (P * B * (Complex_Matrix.adjoint P)) *\<^sub>v (P *\<^sub>v (unit_vec dimR i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = P * B * Complex_Matrix.adjoint P *\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
P \<in> fc_mats
similar_mat_wit A B P (Complex_Matrix.adjoint P)
diagonal_mat B
i < n

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = P * B * Complex_Matrix.adjoint P *\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
unfolding similar_mat_wit_def
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
P \<in> fc_mats
let n = dim_row A in {A, B, P, Complex_Matrix.adjoint P} \<subseteq> carrier_mat n n \<and> P * Complex_Matrix.adjoint P = 1\<^sub>m n \<and> Complex_Matrix.adjoint P * P = 1\<^sub>m n \<and> A = P * B * Complex_Matrix.adjoint P
diagonal_mat B
i < n

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = P * B * Complex_Matrix.adjoint P *\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = P * B * Complex_Matrix.adjoint P *\<^sub>v (P *\<^sub>v unit_vec dimR i)

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = P * B * Complex_Matrix.adjoint P *\<^sub>v (P *\<^sub>v unit_vec dimR i)

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
have "... = P * B * (Complex_Matrix.adjoint P) * P *\<^sub>v (unit_vec dimR i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P * B * Complex_Matrix.adjoint P *\<^sub>v (P *\<^sub>v unit_vec dimR i) = P * B * Complex_Matrix.adjoint P * P *\<^sub>v unit_vec dimR i
[PROOF STEP]
proof (rule mat_vec_mult_assoc[of _ dimR dimR], (auto simp add: assms fc_mats_carrier))
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P * B * Complex_Matrix.adjoint P \<in> carrier_mat dimR dimR
 2. P \<in> carrier_mat dimR dimR
[PROOF STEP]
show "P \<in> carrier_mat dimR dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<in> carrier_mat dimR dimR
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
P \<in> fc_mats
similar_mat_wit A B P (Complex_Matrix.adjoint P)
diagonal_mat B
i < n
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. P \<in> carrier_mat dimR dimR
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P \<in> carrier_mat dimR dimR

goal (1 subgoal):
 1. P * B * Complex_Matrix.adjoint P \<in> carrier_mat dimR dimR
[PROOF STEP]
show "P * B * Complex_Matrix.adjoint P \<in> carrier_mat dimR dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P * B * Complex_Matrix.adjoint P \<in> carrier_mat dimR dimR
[PROOF STEP]
using assms fc_mats_carrier
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
P \<in> fc_mats
similar_mat_wit A B P (Complex_Matrix.adjoint P)
diagonal_mat B
i < n
fc_mats = carrier_mat dimR dimC

goal (1 subgoal):
 1. P * B * Complex_Matrix.adjoint P \<in> carrier_mat dimR dimR
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P * B * Complex_Matrix.adjoint P \<in> carrier_mat dimR dimR

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P * B * Complex_Matrix.adjoint P *\<^sub>v (P *\<^sub>v unit_vec dimR i) = P * B * Complex_Matrix.adjoint P * P *\<^sub>v unit_vec dimR i

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P * B * Complex_Matrix.adjoint P *\<^sub>v (P *\<^sub>v unit_vec dimR i) = P * B * Complex_Matrix.adjoint P * P *\<^sub>v unit_vec dimR i

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
have "... = P * B * ((Complex_Matrix.adjoint P) * P) *\<^sub>v (unit_vec dimR i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P * B * Complex_Matrix.adjoint P * P *\<^sub>v unit_vec dimR i = P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i
[PROOF STEP]
using assms dim_eq
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
P \<in> fc_mats
similar_mat_wit A B P (Complex_Matrix.adjoint P)
diagonal_mat B
i < n
dimR = dimC

goal (1 subgoal):
 1. P * B * Complex_Matrix.adjoint P * P *\<^sub>v unit_vec dimR i = P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i
[PROOF STEP]
by (smt fc_mats_carrier mat_assoc_test(1) similar_mat_witD2(6) similar_mat_wit_sym)
[PROOF STATE]
proof (state)
this:
P * B * Complex_Matrix.adjoint P * P *\<^sub>v unit_vec dimR i = P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P * B * Complex_Matrix.adjoint P * P *\<^sub>v unit_vec dimR i = P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
have "... = P * B *\<^sub>v (unit_vec dimR i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i = P * B *\<^sub>v unit_vec dimR i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i = P * B *\<^sub>v unit_vec dimR i
[PROOF STEP]
have "(Complex_Matrix.adjoint P) * P = 1\<^sub>m dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint P * P = 1\<^sub>m dimR
[PROOF STEP]
using assms dim_eq
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
P \<in> fc_mats
similar_mat_wit A B P (Complex_Matrix.adjoint P)
diagonal_mat B
i < n
dimR = dimC

goal (1 subgoal):
 1. Complex_Matrix.adjoint P * P = 1\<^sub>m dimR
[PROOF STEP]
unfolding similar_mat_wit_def
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
P \<in> fc_mats
let n = dim_row A in {A, B, P, Complex_Matrix.adjoint P} \<subseteq> carrier_mat n n \<and> P * Complex_Matrix.adjoint P = 1\<^sub>m n \<and> Complex_Matrix.adjoint P * P = 1\<^sub>m n \<and> A = P * B * Complex_Matrix.adjoint P
diagonal_mat B
i < n
dimR = dimC

goal (1 subgoal):
 1. Complex_Matrix.adjoint P * P = 1\<^sub>m dimR
[PROOF STEP]
by (simp add: fc_mats_carrier)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint P * P = 1\<^sub>m dimR

goal (1 subgoal):
 1. P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i = P * B *\<^sub>v unit_vec dimR i
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint P * P = 1\<^sub>m dimR

goal (1 subgoal):
 1. P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i = P * B *\<^sub>v unit_vec dimR i
[PROOF STEP]
using assms(2) local.fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint P * P = 1\<^sub>m dimR
B \<in> fc_mats
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i = P * B *\<^sub>v unit_vec dimR i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i = P * B *\<^sub>v unit_vec dimR i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i = P * B *\<^sub>v unit_vec dimR i

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P * B * (Complex_Matrix.adjoint P * P) *\<^sub>v unit_vec dimR i = P * B *\<^sub>v unit_vec dimR i

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
have "... = P *\<^sub>v (B *\<^sub>v (unit_vec dimR i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P * B *\<^sub>v unit_vec dimR i = P *\<^sub>v (B *\<^sub>v unit_vec dimR i)
[PROOF STEP]
using mat_vec_mult_assoc assms fc_mats_carrier
      dim_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n ?p; ?B \<in> carrier_mat ?p ?q; dim_vec ?v = ?q\<rbrakk> \<Longrightarrow> ?A *\<^sub>v (?B *\<^sub>v ?v) = ?A * ?B *\<^sub>v ?v
A \<in> fc_mats
B \<in> fc_mats
P \<in> fc_mats
similar_mat_wit A B P (Complex_Matrix.adjoint P)
diagonal_mat B
i < n
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. P * B *\<^sub>v unit_vec dimR i = P *\<^sub>v (B *\<^sub>v unit_vec dimR i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P * B *\<^sub>v unit_vec dimR i = P *\<^sub>v (B *\<^sub>v unit_vec dimR i)

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P * B *\<^sub>v unit_vec dimR i = P *\<^sub>v (B *\<^sub>v unit_vec dimR i)

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
have "... = P *\<^sub>v (B $$ (i,i) \<cdot>\<^sub>v (unit_vec dimR i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P *\<^sub>v (B *\<^sub>v unit_vec dimR i) = P *\<^sub>v (B $$ (i, i) \<cdot>\<^sub>v unit_vec dimR i)
[PROOF STEP]
using assms diagonal_unit_vec
      fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
P \<in> fc_mats
similar_mat_wit A B P (Complex_Matrix.adjoint P)
diagonal_mat B
i < n
\<lbrakk>?B \<in> carrier_mat ?n ?n; diagonal_mat ?B\<rbrakk> \<Longrightarrow> ?B *\<^sub>v unit_vec ?n ?i = ?B $$ (?i, ?i) \<cdot>\<^sub>v unit_vec ?n ?i
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. P *\<^sub>v (B *\<^sub>v unit_vec dimR i) = P *\<^sub>v (B $$ (i, i) \<cdot>\<^sub>v unit_vec dimR i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P *\<^sub>v (B *\<^sub>v unit_vec dimR i) = P *\<^sub>v (B $$ (i, i) \<cdot>\<^sub>v unit_vec dimR i)

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P *\<^sub>v (B *\<^sub>v unit_vec dimR i) = P *\<^sub>v (B $$ (i, i) \<cdot>\<^sub>v unit_vec dimR i)

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
have "... = B $$ (i,i) \<cdot>\<^sub>v (P *\<^sub>v (unit_vec dimR i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P *\<^sub>v (B $$ (i, i) \<cdot>\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
proof (rule mult_mat_vec)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P \<in> carrier_mat ?nr ?nc
 2. unit_vec dimR i \<in> carrier_vec ?nc
[PROOF STEP]
show "P \<in> carrier_mat dimR dimC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<in> carrier_mat dimR dimC
[PROOF STEP]
using assms fc_mats_carrier
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
P \<in> fc_mats
similar_mat_wit A B P (Complex_Matrix.adjoint P)
diagonal_mat B
i < n
fc_mats = carrier_mat dimR dimC

goal (1 subgoal):
 1. P \<in> carrier_mat dimR dimC
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P \<in> carrier_mat dimR dimC

goal (1 subgoal):
 1. unit_vec dimR i \<in> carrier_vec dimC
[PROOF STEP]
show "unit_vec dimR i \<in> carrier_vec dimC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_vec dimR i \<in> carrier_vec dimC
[PROOF STEP]
using dim_eq
[PROOF STATE]
proof (prove)
using this:
dimR = dimC

goal (1 subgoal):
 1. unit_vec dimR i \<in> carrier_vec dimC
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
unit_vec dimR i \<in> carrier_vec dimC

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P *\<^sub>v (B $$ (i, i) \<cdot>\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)

goal (1 subgoal):
 1. A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
A *\<^sub>v (P *\<^sub>v unit_vec dimR i) = B $$ (i, i) \<cdot>\<^sub>v (P *\<^sub>v unit_vec dimR i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem pre_gauss_lemma: "[a ^ nat((int p - 1) div 2) = (-1) ^ (card E)] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
have "[prod id A = prod id F * prod id D](mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [prod id A = prod id F * prod id D] (mod int p)
[PROOF STEP]
by (auto simp: prod_D_F_eq_prod_A mult.commute cong del: prod.cong_simp)
[PROOF STATE]
proof (state)
this:
[prod id A = prod id F * prod id D] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[prod id A = prod id F * prod id D] (mod int p)
[PROOF STEP]
have "[prod id A = ((-1)^(card E) * prod id E) * prod id D] (mod p)"
[PROOF STATE]
proof (prove)
using this:
[prod id A = prod id F * prod id D] (mod int p)

goal (1 subgoal):
 1. [prod id A = (- 1) ^ card E * prod id E * prod id D] (mod int p)
[PROOF STEP]
by (rule cong_trans) (metis cong_scalar_right prod_F_zcong)
[PROOF STATE]
proof (state)
this:
[prod id A = (- 1) ^ card E * prod id E * prod id D] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[prod id A = (- 1) ^ card E * prod id E * prod id D] (mod int p)
[PROOF STEP]
have "[prod id A = ((-1)^(card E) * prod id C)] (mod p)"
[PROOF STATE]
proof (prove)
using this:
[prod id A = (- 1) ^ card E * prod id E * prod id D] (mod int p)

goal (1 subgoal):
 1. [prod id A = (- 1) ^ card E * prod id C] (mod int p)
[PROOF STEP]
using finite_D finite_E
[PROOF STATE]
proof (prove)
using this:
[prod id A = (- 1) ^ card E * prod id E * prod id D] (mod int p)
finite D
finite E

goal (1 subgoal):
 1. [prod id A = (- 1) ^ card E * prod id C] (mod int p)
[PROOF STEP]
by (auto simp add: ac_simps C_prod_eq_D_times_E C_eq D_E_disj prod.union_disjoint)
[PROOF STATE]
proof (state)
this:
[prod id A = (- 1) ^ card E * prod id C] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[prod id A = (- 1) ^ card E * prod id C] (mod int p)
[PROOF STEP]
have "[prod id A = ((-1)^(card E) * prod id B)] (mod p)"
[PROOF STATE]
proof (prove)
using this:
[prod id A = (- 1) ^ card E * prod id C] (mod int p)

goal (1 subgoal):
 1. [prod id A = (- 1) ^ card E * prod id B] (mod int p)
[PROOF STEP]
by (rule cong_trans) (metis C_B_zcong_prod cong_scalar_left)
[PROOF STATE]
proof (state)
this:
[prod id A = (- 1) ^ card E * prod id B] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[prod id A = (- 1) ^ card E * prod id B] (mod int p)
[PROOF STEP]
have "[prod id A = ((-1)^(card E) * prod id ((\<lambda>x. x * a) ` A))] (mod p)"
[PROOF STATE]
proof (prove)
using this:
[prod id A = (- 1) ^ card E * prod id B] (mod int p)

goal (1 subgoal):
 1. [prod id A = (- 1) ^ card E * prod id ((\<lambda>x. x * a) ` A)] (mod int p)
[PROOF STEP]
by (simp add: B_def)
[PROOF STATE]
proof (state)
this:
[prod id A = (- 1) ^ card E * prod id ((\<lambda>x. x * a) ` A)] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[prod id A = (- 1) ^ card E * prod id ((\<lambda>x. x * a) ` A)] (mod int p)
[PROOF STEP]
have "[prod id A = ((-1)^(card E) * prod (\<lambda>x. x * a) A)] (mod p)"
[PROOF STATE]
proof (prove)
using this:
[prod id A = (- 1) ^ card E * prod id ((\<lambda>x. x * a) ` A)] (mod int p)

goal (1 subgoal):
 1. [prod id A = (- 1) ^ card E * (\<Prod>x\<in>A. x * a)] (mod int p)
[PROOF STEP]
by (simp add: inj_on_xa_A prod.reindex)
[PROOF STATE]
proof (state)
this:
[prod id A = (- 1) ^ card E * (\<Prod>x\<in>A. x * a)] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[prod id A = (- 1) ^ card E * (\<Prod>x\<in>A. x * a)] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
have "prod (\<lambda>x. x * a) A = prod (\<lambda>x. a) A * prod id A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>A. x * a) = (\<Prod>x\<in>A. a) * prod id A
[PROOF STEP]
using finite_A
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (\<Prod>x\<in>A. x * a) = (\<Prod>x\<in>A. a) * prod id A
[PROOF STEP]
by (induct set: finite) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>A. x * a) = (\<Prod>x\<in>A. a) * prod id A

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
[prod id A = (- 1) ^ card E * (\<Prod>x\<in>A. x * a)] (mod int p)
(\<Prod>x\<in>A. x * a) = (\<Prod>x\<in>A. a) * prod id A
[PROOF STEP]
have "[prod id A = ((-1)^(card E) * (prod (\<lambda>x. a) A * prod id A))] (mod p)"
[PROOF STATE]
proof (prove)
using this:
[prod id A = (- 1) ^ card E * (\<Prod>x\<in>A. x * a)] (mod int p)
(\<Prod>x\<in>A. x * a) = (\<Prod>x\<in>A. a) * prod id A

goal (1 subgoal):
 1. [prod id A = (- 1) ^ card E * ((\<Prod>x\<in>A. a) * prod id A)] (mod int p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[prod id A = (- 1) ^ card E * ((\<Prod>x\<in>A. a) * prod id A)] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[prod id A = (- 1) ^ card E * ((\<Prod>x\<in>A. a) * prod id A)] (mod int p)
[PROOF STEP]
have "[prod id A = ((-1)^(card E) * a^(card A) * prod id A)](mod p)"
[PROOF STATE]
proof (prove)
using this:
[prod id A = (- 1) ^ card E * ((\<Prod>x\<in>A. a) * prod id A)] (mod int p)

goal (1 subgoal):
 1. [prod id A = (- 1) ^ card E * a ^ card A * prod id A] (mod int p)
[PROOF STEP]
by (rule cong_trans)
      (simp add: cong_scalar_left cong_scalar_right finite_A prod_constant ac_simps)
[PROOF STATE]
proof (state)
this:
[prod id A = (- 1) ^ card E * a ^ card A * prod id A] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[prod id A = (- 1) ^ card E * a ^ card A * prod id A] (mod int p)
[PROOF STEP]
have a: "[prod id A * (-1)^(card E) =
      ((-1)^(card E) * a^(card A) * prod id A * (-1)^(card E))](mod p)"
[PROOF STATE]
proof (prove)
using this:
[prod id A = (- 1) ^ card E * a ^ card A * prod id A] (mod int p)

goal (1 subgoal):
 1. [prod id A * (- 1) ^ card E = (- 1) ^ card E * a ^ card A * prod id A * (- 1) ^ card E] (mod int p)
[PROOF STEP]
by (rule cong_scalar_right)
[PROOF STATE]
proof (state)
this:
[prod id A * (- 1) ^ card E = (- 1) ^ card E * a ^ card A * prod id A * (- 1) ^ card E] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[prod id A * (- 1) ^ card E = (- 1) ^ card E * a ^ card A * prod id A * (- 1) ^ card E] (mod int p)
[PROOF STEP]
have "[prod id A * (-1)^(card E) = prod id A *
      (-1)^(card E) * a^(card A) * (-1)^(card E)](mod p)"
[PROOF STATE]
proof (prove)
using this:
[prod id A * (- 1) ^ card E = (- 1) ^ card E * a ^ card A * prod id A * (- 1) ^ card E] (mod int p)

goal (1 subgoal):
 1. [prod id A * (- 1) ^ card E = prod id A * (- 1) ^ card E * a ^ card A * (- 1) ^ card E] (mod int p)
[PROOF STEP]
by (rule cong_trans) (simp add: a ac_simps)
[PROOF STATE]
proof (state)
this:
[prod id A * (- 1) ^ card E = prod id A * (- 1) ^ card E * a ^ card A * (- 1) ^ card E] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[prod id A * (- 1) ^ card E = prod id A * (- 1) ^ card E * a ^ card A * (- 1) ^ card E] (mod int p)
[PROOF STEP]
have "[prod id A * (-1)^(card E) = prod id A * a^(card A)](mod p)"
[PROOF STATE]
proof (prove)
using this:
[prod id A * (- 1) ^ card E = prod id A * (- 1) ^ card E * a ^ card A * (- 1) ^ card E] (mod int p)

goal (1 subgoal):
 1. [prod id A * (- 1) ^ card E = prod id A * a ^ card A] (mod int p)
[PROOF STEP]
by (rule cong_trans) (simp add: aux cong del: prod.cong_simp)
[PROOF STATE]
proof (state)
this:
[prod id A * (- 1) ^ card E = prod id A * a ^ card A] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
with A_prod_relprime
[PROOF STATE]
proof (chain)
picking this:
coprime (prod id A) (int p)
[prod id A * (- 1) ^ card E = prod id A * a ^ card A] (mod int p)
[PROOF STEP]
have "[(- 1) ^ card E = a ^ card A](mod p)"
[PROOF STATE]
proof (prove)
using this:
coprime (prod id A) (int p)
[prod id A * (- 1) ^ card E = prod id A * a ^ card A] (mod int p)

goal (1 subgoal):
 1. [(- 1) ^ card E = a ^ card A] (mod int p)
[PROOF STEP]
by (metis cong_mult_lcancel)
[PROOF STATE]
proof (state)
this:
[(- 1) ^ card E = a ^ card A] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[(- 1) ^ card E = a ^ card A] (mod int p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[(- 1) ^ card E = a ^ card A] (mod int p)

goal (1 subgoal):
 1. [a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)
[PROOF STEP]
by (simp add: A_card_eq cong_sym)
[PROOF STATE]
proof (state)
this:
[a ^ nat ((int p - 1) div 2) = (- 1) ^ card E] (mod int p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uncurry_split_asm: "P (uncurry f a) \<longleftrightarrow> \<not>(\<exists>x y. a = (x,y) \<and> \<not>P (f x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (uncurry f a) = (\<nexists>x y. a = (x, y) \<and> \<not> P (f x y))
[PROOF STEP]
by(simp split: uncurry_split)


[STATEMENT]
lemma smooth_on_Pair:
  "k-smooth_on S (\<lambda>x. (f x, g x))"
  if "open S" "k-smooth_on S f" "k-smooth_on S g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k-smooth_on S (\<lambda>x. (f x, g x))
[PROOF STEP]
proof (auto simp: smooth_on_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. enat n \<le> k \<Longrightarrow> higher_differentiable_on S (\<lambda>x. (f x, g x)) n
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. enat n \<le> k \<Longrightarrow> higher_differentiable_on S (\<lambda>x. (f x, g x)) n
[PROOF STEP]
assume n: "enat n \<le> k"
[PROOF STATE]
proof (state)
this:
enat n \<le> k

goal (1 subgoal):
 1. \<And>n. enat n \<le> k \<Longrightarrow> higher_differentiable_on S (\<lambda>x. (f x, g x)) n
[PROOF STEP]
have 1: "higher_differentiable_on S f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. higher_differentiable_on S f n
[PROOF STEP]
using that(2) n
[PROOF STATE]
proof (prove)
using this:
k-smooth_on S f
enat n \<le> k

goal (1 subgoal):
 1. higher_differentiable_on S f n
[PROOF STEP]
unfolding smooth_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. enat n \<le> k \<longrightarrow> higher_differentiable_on S f n
enat n \<le> k

goal (1 subgoal):
 1. higher_differentiable_on S f n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
higher_differentiable_on S f n

goal (1 subgoal):
 1. \<And>n. enat n \<le> k \<Longrightarrow> higher_differentiable_on S (\<lambda>x. (f x, g x)) n
[PROOF STEP]
have 2: "higher_differentiable_on S g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. higher_differentiable_on S g n
[PROOF STEP]
using that(3) n
[PROOF STATE]
proof (prove)
using this:
k-smooth_on S g
enat n \<le> k

goal (1 subgoal):
 1. higher_differentiable_on S g n
[PROOF STEP]
unfolding smooth_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. enat n \<le> k \<longrightarrow> higher_differentiable_on S g n
enat n \<le> k

goal (1 subgoal):
 1. higher_differentiable_on S g n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
higher_differentiable_on S g n

goal (1 subgoal):
 1. \<And>n. enat n \<le> k \<Longrightarrow> higher_differentiable_on S (\<lambda>x. (f x, g x)) n
[PROOF STEP]
show "higher_differentiable_on S (\<lambda>x. (f x, g x)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. higher_differentiable_on S (\<lambda>x. (f x, g x)) n
[PROOF STEP]
by (rule higher_differentiable_on_Pair [OF that(1) 1 2])
[PROOF STATE]
proof (state)
this:
higher_differentiable_on S (\<lambda>x. (f x, g x)) n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mset_ran_combine2: "\<lbrakk>finite r; i\<notin>r\<rbrakk> \<Longrightarrow> add_mset (a i) (mset_ran a r) = mset_ran a (insert i r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite r; i \<notin> r\<rbrakk> \<Longrightarrow> add_mset (a i) (mset_ran a r) = mset_ran a (insert i r)
[PROOF STEP]
using mset_ran_combine1[of "{i}" r a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {i}; finite r; {i} \<inter> r = {}\<rbrakk> \<Longrightarrow> mset_ran a {i} + mset_ran a r = mset_ran a ({i} \<union> r)

goal (1 subgoal):
 1. \<lbrakk>finite r; i \<notin> r\<rbrakk> \<Longrightarrow> add_mset (a i) (mset_ran a r) = mset_ran a (insert i r)
[PROOF STEP]
by auto


[STATEMENT]
lemma substexp_substmem:
"ExprEval e'<Var x\\e> m = ExprEval e' (m(x := ExprEval e m))
  \<and> ExprEvalL (SubstL elist (Var x) e) m
  = ExprEvalL elist (m(x := ExprEval e m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ExprEval e'<Var x\e> m = ExprEval e' (m(x := ExprEval e m)) \<and> ExprEvalL (SubstL elist (Var x) e) m = ExprEvalL elist (m(x := ExprEval e m))
[PROOF STEP]
by (induct_tac e' and elist rule: ExprEval.induct ExprEvalL.induct, simp_all)

\<comment> \<open>another auxiliary lemma for locale interpretation (lemma 8 in original paper)\<close>


[STATEMENT]
lemma east_west_tangents_far_north:
  "proj2_intersection (polar east) (polar west) = far_north"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj2_intersection (polar east) (polar west) = far_north
[PROOF STEP]
using east_west_tangents_distinct and east_west_tangents_incident_far_north
[PROOF STATE]
proof (prove)
using this:
polar east \<noteq> polar west
proj2_incident far_north (polar east)
proj2_incident far_north (polar west)

goal (1 subgoal):
 1. proj2_intersection (polar east) (polar west) = far_north
[PROOF STEP]
by (rule proj2_intersection_unique [symmetric])


[STATEMENT]
lemma sumlist_as_finsum:
  assumes "set xs \<subseteq> carrier G" and "distinct xs" shows "sumlist xs = (\<Oplus>x\<in>set xs. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumlist xs = (\<Oplus>x\<in>set xs. x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> carrier G
distinct xs

goal (1 subgoal):
 1. sumlist xs = (\<Oplus>x\<in>set xs. x)
[PROOF STEP]
by (induct xs, auto intro:finsum_insert[symmetric])


[STATEMENT]
lemma one_disjoint:
  assumes "disjoint ks ls"
    shows "ks\<langle>(mone::('a,'b::idempotent_semiring) square)\<rangle>ls = mbot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ks \<langle>mone\<rangle> ls = mbot
[PROOF STEP]
proof (rule ext, rule prod_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x a b. (ks \<langle>mone\<rangle> ls) (a, b) = mbot (a, b)
[PROOF STEP]
let ?o = "mone::('a,'b) square"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x a b. (ks \<langle>mone\<rangle> ls) (a, b) = mbot (a, b)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x a b. (ks \<langle>mone\<rangle> ls) (a, b) = mbot (a, b)
[PROOF STEP]
have "(ks\<langle>?o\<rangle>ls) (i,j) = (if List.member ks i \<and> List.member ls j then if i = j then 1 else bot else bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ks \<langle>mone\<rangle> ls) (i, j) = (if List.member ks i \<and> List.member ls j then if i = j then 1::'b else bot else bot)
[PROOF STEP]
by (simp add: restrict_matrix_def one_matrix_def)
[PROOF STATE]
proof (state)
this:
(ks \<langle>mone\<rangle> ls) (i, j) = (if List.member ks i \<and> List.member ls j then if i = j then 1::'b else bot else bot)

goal (1 subgoal):
 1. \<And>x a b. (ks \<langle>mone\<rangle> ls) (a, b) = mbot (a, b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(ks \<langle>mone\<rangle> ls) (i, j) = (if List.member ks i \<and> List.member ls j then if i = j then 1::'b else bot else bot)

goal (1 subgoal):
 1. \<And>x a b. (ks \<langle>mone\<rangle> ls) (a, b) = mbot (a, b)
[PROOF STEP]
have "... = bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bot_homomorphism (If (List.member ks i \<and> List.member ls j) (if i = j then 1::'b else bot))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
disjoint ks ls

goal (1 subgoal):
 1. bot_homomorphism (If (List.member ks i \<and> List.member ls j) (if i = j then 1::'b else bot))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bot_homomorphism (If (List.member ks i \<and> List.member ls j) (if i = j then 1::'b else bot))

goal (1 subgoal):
 1. \<And>x a b. (ks \<langle>mone\<rangle> ls) (a, b) = mbot (a, b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bot_homomorphism (If (List.member ks i \<and> List.member ls j) (if i = j then 1::'b else bot))

goal (1 subgoal):
 1. \<And>x a b. (ks \<langle>mone\<rangle> ls) (a, b) = mbot (a, b)
[PROOF STEP]
have "... = mbot (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bot = mbot (i, j)
[PROOF STEP]
by (simp add: bot_matrix_def)
[PROOF STATE]
proof (state)
this:
bot = mbot (i, j)

goal (1 subgoal):
 1. \<And>x a b. (ks \<langle>mone\<rangle> ls) (a, b) = mbot (a, b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(ks \<langle>mone\<rangle> ls) (i, j) = mbot (i, j)
[PROOF STEP]
show "(ks\<langle>?o\<rangle>ls) (i,j) = mbot (i,j)"
[PROOF STATE]
proof (prove)
using this:
(ks \<langle>mone\<rangle> ls) (i, j) = mbot (i, j)

goal (1 subgoal):
 1. (ks \<langle>mone\<rangle> ls) (i, j) = mbot (i, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(ks \<langle>mone\<rangle> ls) (i, j) = mbot (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ev_blocks_partI:
  assumes "\<And> i j k. i < j \<Longrightarrow> j < k \<Longrightarrow> k < m \<Longrightarrow> A $$ (k,k) = A $$ (i,i) \<Longrightarrow> A $$ (j,j) = A $$ (i,i)"
  shows "ev_blocks_part m A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.ev_blocks_part m A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < ?j; ?j < ?k; ?k < m; A $$ (?k, ?k) = A $$ (?i, ?i)\<rbrakk> \<Longrightarrow> A $$ (?j, ?j) = A $$ (?i, ?i)

goal (1 subgoal):
 1. local.ev_blocks_part m A
[PROOF STEP]
unfolding ev_blocks_part_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < ?j; ?j < ?k; ?k < m; A $$ (?k, ?k) = A $$ (?i, ?i)\<rbrakk> \<Longrightarrow> A $$ (?j, ?j) = A $$ (?i, ?i)

goal (1 subgoal):
 1. \<forall>i j k. i < j \<longrightarrow> j < k \<longrightarrow> k < m \<longrightarrow> A $$ (k, k) = A $$ (i, i) \<longrightarrow> A $$ (j, j) = A $$ (i, i)
[PROOF STEP]
by blast


[STATEMENT]
lemma bound_aux:
assumes
  hby: "\<forall> l\<in>C. \<forall> m\<in>C. \<bar>f l - f m\<bar> <= x" and
  hpC: "p\<in>C" and
  hqC: "q\<in>C"
shows
  "\<bar>fiX f p r - f q\<bar> <= x + \<Delta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
proof (cases "\<bar> f p - f r \<bar> <= \<Delta>")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
 2. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<bar>f p - f r\<bar> \<le> \<Delta>

goal (2 subgoals):
 1. \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
 2. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>f p - f r\<bar> \<le> \<Delta>
[PROOF STEP]
have "\<bar>fiX f p r - f q\<bar> = \<bar> f r - f q \<bar>"
[PROOF STATE]
proof (prove)
using this:
\<bar>f p - f r\<bar> \<le> \<Delta>

goal (1 subgoal):
 1. \<bar>fiX f p r - f q\<bar> = \<bar>f r - f q\<bar>
[PROOF STEP]
by (simp add: fiX_def)
[PROOF STATE]
proof (state)
this:
\<bar>fiX f p r - f q\<bar> = \<bar>f r - f q\<bar>

goal (2 subgoals):
 1. \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
 2. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>fiX f p r - f q\<bar> = \<bar>f r - f q\<bar>

goal (2 subgoals):
 1. \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
 2. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
have "... = \<bar> (f r - f p) + (f p - f q) \<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f r - f q\<bar> = \<bar>f r - f p + (f p - f q)\<bar>
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<bar>f r - f q\<bar> = \<bar>f r - f p + (f p - f q)\<bar>

goal (2 subgoals):
 1. \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
 2. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>f r - f q\<bar> = \<bar>f r - f p + (f p - f q)\<bar>

goal (2 subgoals):
 1. \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
 2. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
have "... <= \<bar> f p - f r \<bar> + \<bar> f p - f q \<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f r - f p + (f p - f q)\<bar> \<le> \<bar>f p - f r\<bar> + \<bar>f p - f q\<bar>
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<bar>f r - f p + (f p - f q)\<bar> \<le> \<bar>f p - f r\<bar> + \<bar>f p - f q\<bar>

goal (2 subgoals):
 1. \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
 2. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>f r - f p + (f p - f q)\<bar> \<le> \<bar>f p - f r\<bar> + \<bar>f p - f q\<bar>

goal (2 subgoals):
 1. \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
 2. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
\<bar>f p - f r\<bar> \<le> \<Delta>
[PROOF STEP]
have "... <= \<Delta> + \<bar> f p - f q \<bar>"
[PROOF STATE]
proof (prove)
using this:
\<bar>f p - f r\<bar> \<le> \<Delta>

goal (1 subgoal):
 1. \<bar>f p - f r\<bar> + \<bar>f p - f q\<bar> \<le> \<Delta> + \<bar>f p - f q\<bar>
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<bar>f p - f r\<bar> + \<bar>f p - f q\<bar> \<le> \<Delta> + \<bar>f p - f q\<bar>

goal (2 subgoals):
 1. \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
 2. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>f p - f r\<bar> + \<bar>f p - f q\<bar> \<le> \<Delta> + \<bar>f p - f q\<bar>

goal (2 subgoals):
 1. \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
 2. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
from hby hpC hqC
[PROOF STATE]
proof (chain)
picking this:
\<forall>l\<in>C. \<forall>m\<in>C. \<bar>f l - f m\<bar> \<le> x
p \<in> C
q \<in> C
[PROOF STEP]
have "... <= \<Delta> + x"
[PROOF STATE]
proof (prove)
using this:
\<forall>l\<in>C. \<forall>m\<in>C. \<bar>f l - f m\<bar> \<le> x
p \<in> C
q \<in> C

goal (1 subgoal):
 1. \<Delta> + \<bar>f p - f q\<bar> \<le> \<Delta> + x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Delta> + \<bar>f p - f q\<bar> \<le> \<Delta> + x

goal (2 subgoals):
 1. \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
 2. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>fiX f p r - f q\<bar> \<le> \<Delta> + x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>fiX f p r - f q\<bar> \<le> \<Delta> + x

goal (1 subgoal):
 1. \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>

goal (1 subgoal):
 1. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> \<bar>f p - f r\<bar> \<le> \<Delta>

goal (1 subgoal):
 1. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> \<bar>f p - f r\<bar> \<le> \<Delta>
[PROOF STEP]
have "\<bar>fiX f p r - f q\<bar> = \<bar> f p - f q \<bar>"
[PROOF STATE]
proof (prove)
using this:
\<not> \<bar>f p - f r\<bar> \<le> \<Delta>

goal (1 subgoal):
 1. \<bar>fiX f p r - f q\<bar> = \<bar>f p - f q\<bar>
[PROOF STEP]
by (simp add: fiX_def)
[PROOF STATE]
proof (state)
this:
\<bar>fiX f p r - f q\<bar> = \<bar>f p - f q\<bar>

goal (1 subgoal):
 1. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>fiX f p r - f q\<bar> = \<bar>f p - f q\<bar>

goal (1 subgoal):
 1. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
from hby hpC hqC
[PROOF STATE]
proof (chain)
picking this:
\<forall>l\<in>C. \<forall>m\<in>C. \<bar>f l - f m\<bar> \<le> x
p \<in> C
q \<in> C
[PROOF STEP]
have "... <= x"
[PROOF STATE]
proof (prove)
using this:
\<forall>l\<in>C. \<forall>m\<in>C. \<bar>f l - f m\<bar> \<le> x
p \<in> C
q \<in> C

goal (1 subgoal):
 1. \<bar>f p - f q\<bar> \<le> x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<bar>f p - f q\<bar> \<le> x

goal (1 subgoal):
 1. \<not> \<bar>f p - f r\<bar> \<le> \<Delta> \<Longrightarrow> \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>fiX f p r - f q\<bar> \<le> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>fiX f p r - f q\<bar> \<le> x

goal (1 subgoal):
 1. \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
using constants_ax
[PROOF STATE]
proof (prove)
using this:
\<bar>fiX f p r - f q\<bar> \<le> x
0 \<le> \<Delta> \<and> 0 < np

goal (1 subgoal):
 1. \<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<bar>fiX f p r - f q\<bar> \<le> x + \<Delta>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma split_scaleR_pos_le: "(0 \<le> a \<and> 0 \<le> b) \<or> (a \<le> 0 \<and> b \<le> 0) \<Longrightarrow> 0 \<le> a *\<^sub>R b"
  for b :: "'a::ordered_real_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> a \<and> (0::'a) \<le> b \<or> a \<le> 0 \<and> b \<le> (0::'a) \<Longrightarrow> (0::'a) \<le> a *\<^sub>R b
[PROOF STEP]
by (auto simp: scaleR_nonneg_nonneg scaleR_nonpos_nonpos)


[STATEMENT]
lemma imp_imp_compat_eqvR:
assumes "\<phi> \<in> fmla" and "\<chi>1 \<in> fmla" and "\<chi>2 \<in> fmla"
shows "prv (imp (eqv \<chi>1 \<chi>2) (eqv (imp \<phi> \<chi>1) (imp \<phi> \<chi>2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp (eqv \<chi>1 \<chi>2) (eqv (imp \<phi> \<chi>1) (imp \<phi> \<chi>2)))
[PROOF STEP]
by (simp add: assms prv_cnj_mono prv_imp_trans1 eqv_def)