[STATEMENT]
lemma zip_append:"(length zs = length ws)\<and>(length xs = length ys)
                       \<Longrightarrow> (zip (xs@zs) (ys@ws)) = (zip xs ys)@(zip zs ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<Longrightarrow> zip (xs @ zs) (ys @ ws) = zip xs ys @ zip zs ws
[PROOF STEP]
using zip_append1 zip_append2
[PROOF STATE]
proof (prove)
using this:
zip (?xs @ ?ys) ?zs = zip ?xs (take (length ?xs) ?zs) @ zip ?ys (drop (length ?xs) ?zs)
zip ?xs (?ys @ ?zs) = zip (take (length ?ys) ?xs) ?ys @ zip (drop (length ?ys) ?xs) ?zs

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<Longrightarrow> zip (xs @ zs) (ys @ ws) = zip xs ys @ zip zs ws
[PROOF STEP]
by auto


[STATEMENT]
lemma image_TimesB:
    "(\<lambda>(x, y, z). (f x, g y, h z)) ` (A \<times> B \<times> C) = (f ` A) \<times> (g ` B) \<times> (h ` C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y, z). (f x, g y, h z)) ` (A \<times> B \<times> C) = f ` A \<times> g ` B \<times> h ` C
[PROOF STEP]
by force


[STATEMENT]
lemma isNSCont_inverse: "isNSCont f x \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow> isNSCont (\<lambda>x. inverse (f x)) x"
  for f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_div_algebra"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>isNSCont f x; f x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> isNSCont (\<lambda>x. inverse (f x)) x
[PROOF STEP]
using NSLIM_inverse NSLIM_isNSCont isNSCont_NSLIM
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f \<midarrow>?a\<rightarrow>\<^sub>N\<^sub>S ?L; ?L \<noteq> (0::?'a)\<rbrakk> \<Longrightarrow> (\<lambda>x. inverse (?f x)) \<midarrow>?a\<rightarrow>\<^sub>N\<^sub>S inverse ?L
?f \<midarrow>?a\<rightarrow>\<^sub>N\<^sub>S ?f ?a \<Longrightarrow> isNSCont ?f ?a
isNSCont ?f ?a \<Longrightarrow> ?f \<midarrow>?a\<rightarrow>\<^sub>N\<^sub>S ?f ?a

goal (1 subgoal):
 1. \<lbrakk>isNSCont f x; f x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> isNSCont (\<lambda>x. inverse (f x)) x
[PROOF STEP]
by blast


[STATEMENT]
lemma mod_dvd_simp: "(x mod y = (0::nat)) = (y dvd x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x mod y = 0) = (y dvd x)
[PROOF STEP]
by(simp add: dvd_def, auto)


[STATEMENT]
lemma frontier_interiors: "frontier s = - interior(s) - interior(-s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier s = - interior s - interior (- s)
[PROOF STEP]
by (simp add: Int_commute frontier_def interior_closure)


[STATEMENT]
lemma gcd_mult_distrib_nat: "k * gcd m n = gcd (k * m) (k * n)"
  for k m n :: nat
  \<comment> \<open>@{cite \<open>page 27\<close> davenport92}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * gcd m n = gcd (k * m) (k * n)
[PROOF STEP]
by (simp add: gcd_mult_left)


[STATEMENT]
lemma piecewise_differentiable_compose:
    "\<lbrakk>f piecewise_differentiable_on S; g piecewise_differentiable_on (f ` S);
      \<And>x. finite (S \<inter> f-`{x})\<rbrakk>
      \<Longrightarrow> (g \<circ> f) piecewise_differentiable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f piecewise_differentiable_on S; g piecewise_differentiable_on f ` S; \<And>x. finite (S \<inter> f -` {x})\<rbrakk> \<Longrightarrow> g \<circ> f piecewise_differentiable_on S
[PROOF STEP]
apply (simp add: piecewise_differentiable_on_def, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>Sa Saa. \<lbrakk>\<And>x. finite (S \<inter> f -` {x}); continuous_on S f; continuous_on (f ` S) g; finite Sa; \<forall>x\<in>S - Sa. f differentiable at x within S; finite Saa; \<forall>x\<in>f ` S - Saa. g differentiable at x within f ` S\<rbrakk> \<Longrightarrow> continuous_on S (\<lambda>x. g (f x))
 2. \<And>Sa Saa. \<lbrakk>\<And>x. finite (S \<inter> f -` {x}); continuous_on S f; continuous_on (f ` S) g; finite Sa; \<forall>x\<in>S - Sa. f differentiable at x within S; finite Saa; \<forall>x\<in>f ` S - Saa. g differentiable at x within f ` S\<rbrakk> \<Longrightarrow> \<exists>Sa. finite Sa \<and> (\<forall>x\<in>S - Sa. g \<circ> f differentiable at x within S)
[PROOF STEP]
apply (blast intro: continuous_on_compose2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Sa Saa. \<lbrakk>\<And>x. finite (S \<inter> f -` {x}); continuous_on S f; continuous_on (f ` S) g; finite Sa; \<forall>x\<in>S - Sa. f differentiable at x within S; finite Saa; \<forall>x\<in>f ` S - Saa. g differentiable at x within f ` S\<rbrakk> \<Longrightarrow> \<exists>Sa. finite Sa \<and> (\<forall>x\<in>S - Sa. g \<circ> f differentiable at x within S)
[PROOF STEP]
apply (rename_tac A B)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B. \<lbrakk>\<And>x. finite (S \<inter> f -` {x}); continuous_on S f; continuous_on (f ` S) g; finite A; \<forall>x\<in>S - A. f differentiable at x within S; finite B; \<forall>x\<in>f ` S - B. g differentiable at x within f ` S\<rbrakk> \<Longrightarrow> \<exists>Sa. finite Sa \<and> (\<forall>x\<in>S - Sa. g \<circ> f differentiable at x within S)
[PROOF STEP]
apply (rule_tac x="A \<union> (\<Union>x\<in>B. S \<inter> f-`{x})" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B. \<lbrakk>\<And>x. finite (S \<inter> f -` {x}); continuous_on S f; continuous_on (f ` S) g; finite A; \<forall>x\<in>S - A. f differentiable at x within S; finite B; \<forall>x\<in>f ` S - B. g differentiable at x within f ` S\<rbrakk> \<Longrightarrow> finite (A \<union> (\<Union>x\<in>B. S \<inter> f -` {x})) \<and> (\<forall>x\<in>S - (A \<union> (\<Union>x\<in>B. S \<inter> f -` {x})). g \<circ> f differentiable at x within S)
[PROOF STEP]
apply (blast intro!: differentiable_chain_within)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma de_morgan2: "-(\<Sqinter>X) = (\<Squnion>x \<in> X. -x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<Sqinter> X = \<Squnion> (uminus ` X)
[PROOF STEP]
by (metis de_morgan1 ba_dual.dual_iff ba_dual.image_dual pointfree_idE)


[STATEMENT]
lemma USUP_Suc_shift: "(\<Squnion> i \<in> {Suc 0..<Suc n} \<bullet> P(i)) = (\<Squnion> i \<in> {0..<n} \<bullet> P(Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion> i \<in> {Suc 0..<Suc n} \<bullet> P i) = (\<Squnion> i \<in> {0..<n} \<bullet> P (Suc i))
[PROOF STEP]
apply (rel_simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<Squnion>{uu_. \<exists>x. uu_ = \<lbrakk>P x\<rbrakk>\<^sub>e b \<and> Suc 0 \<le> x \<and> x < Suc n} = \<Squnion>{uu_. \<exists>x. uu_ = \<lbrakk>P (Suc x)\<rbrakk>\<^sub>e b \<and> x < n}
[PROOF STEP]
apply (rule cong[of Inf], auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b xa. \<lbrakk>Suc 0 \<le> xa; xa < Suc n\<rbrakk> \<Longrightarrow> \<exists>x. \<lbrakk>P xa\<rbrakk>\<^sub>e b = \<lbrakk>P (Suc x)\<rbrakk>\<^sub>e b \<and> x < n
[PROOF STEP]
using less_Suc_eq_0_disj
[PROOF STATE]
proof (prove)
using this:
(?m < Suc ?n) = (?m = 0 \<or> (\<exists>j. ?m = Suc j \<and> j < ?n))

goal (1 subgoal):
 1. \<And>b xa. \<lbrakk>Suc 0 \<le> xa; xa < Suc n\<rbrakk> \<Longrightarrow> \<exists>x. \<lbrakk>P xa\<rbrakk>\<^sub>e b = \<lbrakk>P (Suc x)\<rbrakk>\<^sub>e b \<and> x < n
[PROOF STEP]
by auto


[STATEMENT]
lemma (in cpx_sq_mat) sum_eigen_projector_trace_right:
  assumes "hermitian A"
and "A\<in> fc_mats"
and "B\<in> fc_mats"
shows "(\<Sum> a \<in> spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) =
  Complex_Matrix.trace (A * B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
have "sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A) =
    sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a) (spectrum A) * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A) = local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a) (spectrum A) * B
[PROOF STEP]
proof (rule mult_sum_mat_distrib_right)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite (spectrum A)
 2. \<And>a. a \<in> spectrum A \<Longrightarrow> a \<cdot>\<^sub>m eigen_projector A a \<in> fc_mats
 3. B \<in> fc_mats
[PROOF STEP]
show "finite (spectrum A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (spectrum A)
[PROOF STEP]
using spectrum_finite[of A]
[PROOF STATE]
proof (prove)
using this:
finite (spectrum A)

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

goal (2 subgoals):
 1. \<And>a. a \<in> spectrum A \<Longrightarrow> a \<cdot>\<^sub>m eigen_projector A a \<in> fc_mats
 2. B \<in> fc_mats
[PROOF STEP]
show "\<And>a. a \<in> spectrum A \<Longrightarrow> a \<cdot>\<^sub>m eigen_projector A a \<in> fc_mats"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<in> spectrum A \<Longrightarrow> a \<cdot>\<^sub>m eigen_projector A a \<in> fc_mats
[PROOF STEP]
using assms(1) assms(2) cpx_sq_mat_smult eigen_projector_carrier
[PROOF STATE]
proof (prove)
using this:
hermitian A
A \<in> fc_mats
?A \<in> fc_mats \<Longrightarrow> ?x \<cdot>\<^sub>m ?A \<in> fc_mats
\<lbrakk>?A \<in> fc_mats; ?a \<in> spectrum ?A; hermitian ?A\<rbrakk> \<Longrightarrow> eigen_projector ?A ?a \<in> fc_mats

goal (1 subgoal):
 1. \<And>a. a \<in> spectrum A \<Longrightarrow> a \<cdot>\<^sub>m eigen_projector A a \<in> fc_mats
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?a3 \<in> spectrum A \<Longrightarrow> ?a3 \<cdot>\<^sub>m eigen_projector A ?a3 \<in> fc_mats

goal (1 subgoal):
 1. B \<in> fc_mats
[PROOF STEP]
show "B\<in> fc_mats"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> fc_mats
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hermitian A
A \<in> fc_mats
B \<in> fc_mats

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A) = local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a) (spectrum A) * B

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A) = local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a) (spectrum A) * B

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
have "... = A * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a) (spectrum A) * B = A * B
[PROOF STEP]
using make_pm_sum' assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> fc_mats; hermitian ?A\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector ?A a) (spectrum ?A) = ?A
hermitian A
A \<in> fc_mats
B \<in> fc_mats

goal (1 subgoal):
 1. local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a) (spectrum A) * B = A * B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a) (spectrum A) * B = A * B

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A) = A * B
[PROOF STEP]
have seq: "sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A) = A * B"
[PROOF STATE]
proof (prove)
using this:
local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A) = A * B

goal (1 subgoal):
 1. local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A) = A * B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A) = A * B

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
have "(\<Sum> a \<in> spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) =
    Complex_Matrix.trace (sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A))
[PROOF STEP]
proof (rule trace_sum_mat[symmetric])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (spectrum A)
 2. \<And>a. a \<in> spectrum A \<Longrightarrow> a \<cdot>\<^sub>m eigen_projector A a * B \<in> fc_mats
[PROOF STEP]
show "finite (spectrum A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (spectrum A)
[PROOF STEP]
using spectrum_finite[of A]
[PROOF STATE]
proof (prove)
using this:
finite (spectrum A)

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

goal (1 subgoal):
 1. \<And>a. a \<in> spectrum A \<Longrightarrow> a \<cdot>\<^sub>m eigen_projector A a * B \<in> fc_mats
[PROOF STEP]
show "\<And>a. a \<in> spectrum A \<Longrightarrow> a \<cdot>\<^sub>m eigen_projector A a * B \<in> fc_mats"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<in> spectrum A \<Longrightarrow> a \<cdot>\<^sub>m eigen_projector A a * B \<in> fc_mats
[PROOF STEP]
by (simp add: assms(1) assms(2) assms(3) cpx_sq_mat_mult cpx_sq_mat_smult
          eigen_projector_carrier)
[PROOF STATE]
proof (state)
this:
?a3 \<in> spectrum A \<Longrightarrow> ?a3 \<cdot>\<^sub>m eigen_projector A ?a3 * B \<in> fc_mats

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A))

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A))

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
have "... = Complex_Matrix.trace (A * B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
using seq
[PROOF STATE]
proof (prove)
using this:
local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A) = A * B

goal (1 subgoal):
 1. Complex_Matrix.trace (local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (local.sum_mat (\<lambda>a. a \<cdot>\<^sub>m eigen_projector A a * B) (spectrum A)) = Complex_Matrix.trace (A * B)

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)

goal (1 subgoal):
 1. (\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>spectrum A. Complex_Matrix.trace (a \<cdot>\<^sub>m eigen_projector A a * B)) = Complex_Matrix.trace (A * B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_V_eq_a: "V \<subseteq> {0..<a} \<Longrightarrow> card V = a \<longleftrightarrow> V = {0..<a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V \<subseteq> {0..<a} \<Longrightarrow> (card V = a) = (V = {0..<a})
[PROOF STEP]
using card_subset_eq[of "{0..<a}" V]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {0..<a}; V \<subseteq> {0..<a}; card V = card {0..<a}\<rbrakk> \<Longrightarrow> V = {0..<a}

goal (1 subgoal):
 1. V \<subseteq> {0..<a} \<Longrightarrow> (card V = a) = (V = {0..<a})
[PROOF STEP]
by auto


[STATEMENT]
lemma icard_bij_eq: "
  \<lbrakk> inj_on f A; f ` A \<subseteq> B; inj_on g B; g ` B \<subseteq> A \<rbrakk> \<Longrightarrow>
  icard A = icard B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f A; f ` A \<subseteq> B; inj_on g B; g ` B \<subseteq> A\<rbrakk> \<Longrightarrow> icard A = icard B
[PROOF STEP]
by (simp add: order_eq_iff icard_inj_on_le)


[STATEMENT]
lemma suffix_tl_subset: "suffix xs ys \<Longrightarrow> set (tl xs) \<subseteq> set (tl ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. suffix xs ys \<Longrightarrow> set (tl xs) \<subseteq> set (tl ys)
[PROOF STEP]
by (metis append_Nil suffix_def set_mono_suffix suffix_tl suffix_order.order_trans tl_append2)


[STATEMENT]
lemma sin_arccos_nonzero: "- 1 < x \<Longrightarrow> x < 1 \<Longrightarrow> sin (arccos x) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 < x; x < 1\<rbrakk> \<Longrightarrow> sin (arccos x) \<noteq> 0
[PROOF STEP]
using arccos_lt_bounded sin_gt_zero
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- 1 < ?y; ?y < 1\<rbrakk> \<Longrightarrow> 0 < arccos ?y \<and> arccos ?y < pi
\<lbrakk>0 < ?x; ?x < pi\<rbrakk> \<Longrightarrow> 0 < sin ?x

goal (1 subgoal):
 1. \<lbrakk>- 1 < x; x < 1\<rbrakk> \<Longrightarrow> sin (arccos x) \<noteq> 0
[PROOF STEP]
by force


[STATEMENT]
theorem integrable_sophomores_dream: "(\<lambda>x::real. x powr x) integrable_on {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x powr x) integrable_on {0..1}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. x powr x) integrable_on {0..1}
[PROOF STEP]
have "(\<lambda>x::real. exp (x * ln x)) integrable_on {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. exp (x * ln x)) integrable_on {0..1}
[PROOF STEP]
by (intro integrable_continuous_real continuous_on_exp x_log_x_continuous)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. exp (x * ln x)) integrable_on {0..1}

goal (1 subgoal):
 1. (\<lambda>x. x powr x) integrable_on {0..1}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. exp (x * ln x)) integrable_on {0..1}

goal (1 subgoal):
 1. (\<lambda>x. x powr x) integrable_on {0..1}
[PROOF STEP]
have "?this \<longleftrightarrow> (\<lambda>x::real. exp (x * ln x)) integrable_on {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp (x * ln x)) integrable_on {0..1}) = ((\<lambda>x. exp (x * ln x)) integrable_on {0<..<1})
[PROOF STEP]
by (simp add: integrable_on_Icc_iff_Ioo)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp (x * ln x)) integrable_on {0..1}) = ((\<lambda>x. exp (x * ln x)) integrable_on {0<..<1})

goal (1 subgoal):
 1. (\<lambda>x. x powr x) integrable_on {0..1}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp (x * ln x)) integrable_on {0..1}) = ((\<lambda>x. exp (x * ln x)) integrable_on {0<..<1})

goal (1 subgoal):
 1. (\<lambda>x. x powr x) integrable_on {0..1}
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<lambda>x::real. x powr x) integrable_on {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp (x * ln x)) integrable_on {0<..<1}) = ((\<lambda>x. x powr x) integrable_on {0<..<1})
[PROOF STEP]
by (intro integrable_cong) (auto simp: powr_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp (x * ln x)) integrable_on {0<..<1}) = ((\<lambda>x. x powr x) integrable_on {0<..<1})

goal (1 subgoal):
 1. (\<lambda>x. x powr x) integrable_on {0..1}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp (x * ln x)) integrable_on {0<..<1}) = ((\<lambda>x. x powr x) integrable_on {0<..<1})

goal (1 subgoal):
 1. (\<lambda>x. x powr x) integrable_on {0..1}
[PROOF STEP]
have "\<dots> \<longleftrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr x) integrable_on {0<..<1}) = ((\<lambda>x. x powr x) integrable_on {0..1})
[PROOF STEP]
by (simp add: integrable_on_Icc_iff_Ioo)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr x) integrable_on {0<..<1}) = ((\<lambda>x. x powr x) integrable_on {0..1})

goal (1 subgoal):
 1. (\<lambda>x. x powr x) integrable_on {0..1}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. x powr x) integrable_on {0..1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. x powr x) integrable_on {0..1}

goal (1 subgoal):
 1. (\<lambda>x. x powr x) integrable_on {0..1}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x powr x) integrable_on {0..1}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_list_update: "set (xs [i := k]) =
  (if i < length xs then insert k (set (take i xs) \<union> set (drop (Suc i) xs)) else set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (xs[i := k]) = (if i < length xs then insert k (set (take i xs) \<union> set (drop (Suc i) xs)) else set xs)
[PROOF STEP]
proof (induct xs arbitrary: i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. set ([][i := k]) = (if i < length [] then insert k (set (take i []) \<union> set (drop (Suc i) [])) else set [])
 2. \<And>a xs i. (\<And>i. set (xs[i := k]) = (if i < length xs then insert k (set (take i xs) \<union> set (drop (Suc i) xs)) else set xs)) \<Longrightarrow> set ((a # xs)[i := k]) = (if i < length (a # xs) then insert k (set (take i (a # xs)) \<union> set (drop (Suc i) (a # xs))) else set (a # xs))
[PROOF STEP]
case (Cons x xs i)
[PROOF STATE]
proof (state)
this:
set (xs[?i := k]) = (if ?i < length xs then insert k (set (take ?i xs) \<union> set (drop (Suc ?i) xs)) else set xs)

goal (2 subgoals):
 1. \<And>i. set ([][i := k]) = (if i < length [] then insert k (set (take i []) \<union> set (drop (Suc i) [])) else set [])
 2. \<And>a xs i. (\<And>i. set (xs[i := k]) = (if i < length xs then insert k (set (take i xs) \<union> set (drop (Suc i) xs)) else set xs)) \<Longrightarrow> set ((a # xs)[i := k]) = (if i < length (a # xs) then insert k (set (take i (a # xs)) \<union> set (drop (Suc i) (a # xs))) else set (a # xs))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
set (xs[?i := k]) = (if ?i < length xs then insert k (set (take ?i xs) \<union> set (drop (Suc ?i) xs)) else set xs)

goal (1 subgoal):
 1. set ((x # xs)[i := k]) = (if i < length (x # xs) then insert k (set (take i (x # xs)) \<union> set (drop (Suc i) (x # xs))) else set (x # xs))
[PROOF STEP]
by (cases i, auto)
[PROOF STATE]
proof (state)
this:
set ((x # xs)[i := k]) = (if i < length (x # xs) then insert k (set (take i (x # xs)) \<union> set (drop (Suc i) (x # xs))) else set (x # xs))

goal (1 subgoal):
 1. \<And>i. set ([][i := k]) = (if i < length [] then insert k (set (take i []) \<union> set (drop (Suc i) [])) else set [])
[PROOF STEP]
qed simp


[STATEMENT]
lemma infnorm_Max:
  fixes x :: "'a::euclidean_space"
  shows "infnorm x = Max ((\<lambda>i. \<bar>x \<bullet> i\<bar>) ` Basis)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infnorm x = (MAX i\<in>Basis. \<bar>x \<bullet> i\<bar>)
[PROOF STEP]
by (simp add: infnorm_def infnorm_set_image cSup_eq_Max)


[STATEMENT]
lemma ortho_a_scalprod0:
  assumes "z1 \<noteq> 0" and "z2 \<noteq> 0"
  shows "\<angle>a z1 z2 = pi/2 \<longleftrightarrow> scalprod z1 z2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<angle>a z1 z2 = pi / 2) = (scalprod z1 z2 = 0)
[PROOF STEP]
unfolding ang_vec_a_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (acute_ang (\<angle>c z1 z2) = pi / 2) = (scalprod z1 z2 = 0)
[PROOF STEP]
using assms ortho_c_scalprod0[of z1 z2]
[PROOF STATE]
proof (prove)
using this:
z1 \<noteq> 0
z2 \<noteq> 0
\<lbrakk>z1 \<noteq> 0; z2 \<noteq> 0\<rbrakk> \<Longrightarrow> (\<angle>c z1 z2 = pi / 2) = (scalprod z1 z2 = 0)

goal (1 subgoal):
 1. (acute_ang (\<angle>c z1 z2) = pi / 2) = (scalprod z1 z2 = 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma DERIV_zero_connected_constant:
  fixes f :: "'a::{real_normed_field,euclidean_space} \<Rightarrow> 'a"
  assumes "connected S"
      and "open S"
      and "finite K"
      and "continuous_on S f"
      and "\<forall>x\<in>(S - K). DERIV f x :> 0"
    obtains c where "\<And>x. x \<in> S \<Longrightarrow> f(x) = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. (\<And>x. x \<in> S \<Longrightarrow> f x = c) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using has_derivative_zero_connected_constant [OF assms(1-4)] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x\<in>S - K. (f has_derivative (\<lambda>h. 0::'a)) (at x within S); \<And>c. (\<And>x. x \<in> S \<Longrightarrow> f x = c) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
connected S
open S
finite K
continuous_on S f
\<forall>x\<in>S - K. (f has_field_derivative (0::'a)) (at x)

goal (1 subgoal):
 1. (\<And>c. (\<And>x. x \<in> S \<Longrightarrow> f x = c) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis DERIV_const has_derivative_const Diff_iff at_within_open frechet_derivative_at has_field_derivative_def)


[STATEMENT]
lemma vunion_vsingleton_iff:
  "A \<union>\<^sub>\<circ> B = set {x} \<longleftrightarrow>
    A = 0 \<and> B = set {x} \<or> A = set {x} \<and> B = 0 \<or> A = set {x} \<and> B = set {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<union>\<^sub>\<circ> B = set {x}) = (A = 0 \<and> B = set {x} \<or> A = set {x} \<and> B = 0 \<or> A = set {x} \<and> B = set {x})
[PROOF STEP]
by
    (
      metis
        vsubset_vsingletonD inf_sup_ord(4) sup.idem sup_V_0_right sup_commute
    )


[STATEMENT]
lemma jordan_block_pow: "(jordan_block n (a :: 'a :: comm_ring_1)) ^\<^sub>m r =
  mat n n (\<lambda> (i,j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a))
[PROOF STEP]
proof (induct r)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. jordan_block n a ^\<^sub>m 0 = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (0 choose (j - i)) * a ^ (0 + i - j) else (0::'a))
 2. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. jordan_block n a ^\<^sub>m 0 = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (0 choose (j - i)) * a ^ (0 + i - j) else (0::'a))
 2. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. jordan_block n a ^\<^sub>m 0 = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (0 choose (j - i)) * a ^ (0 + i - j) else (0::'a))
 2. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
fix i j :: nat
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. jordan_block n a ^\<^sub>m 0 = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (0 choose (j - i)) * a ^ (0 + i - j) else (0::'a))
 2. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
assume "i \<noteq> j" "i \<le> j"
[PROOF STATE]
proof (state)
this:
i \<noteq> j
i \<le> j

goal (2 subgoals):
 1. jordan_block n a ^\<^sub>m 0 = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (0 choose (j - i)) * a ^ (0 + i - j) else (0::'a))
 2. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
hence "j - i > 0"
[PROOF STATE]
proof (prove)
using this:
i \<noteq> j
i \<le> j

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

goal (2 subgoals):
 1. jordan_block n a ^\<^sub>m 0 = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (0 choose (j - i)) * a ^ (0 + i - j) else (0::'a))
 2. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
hence "0 choose (j - i) = 0"
[PROOF STATE]
proof (prove)
using this:
0 < j - i

goal (1 subgoal):
 1. 0 choose (j - i) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 choose (j - i) = 0

goal (2 subgoals):
 1. jordan_block n a ^\<^sub>m 0 = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (0 choose (j - i)) * a ^ (0 + i - j) else (0::'a))
 2. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 \<noteq> ?j2; ?i2 \<le> ?j2\<rbrakk> \<Longrightarrow> 0 choose (?j2 - ?i2) = 0

goal (2 subgoals):
 1. jordan_block n a ^\<^sub>m 0 = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (0 choose (j - i)) * a ^ (0 + i - j) else (0::'a))
 2. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
note [simp] = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 \<noteq> ?j2; ?i2 \<le> ?j2\<rbrakk> \<Longrightarrow> 0 choose (?j2 - ?i2) = 0

goal (2 subgoals):
 1. jordan_block n a ^\<^sub>m 0 = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (0 choose (j - i)) * a ^ (0 + i - j) else (0::'a))
 2. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jordan_block n a ^\<^sub>m 0 = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (0 choose (j - i)) * a ^ (0 + i - j) else (0::'a))
[PROOF STEP]
by (simp, rule eq_matI, auto)
[PROOF STATE]
proof (state)
this:
jordan_block n a ^\<^sub>m 0 = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (0 choose (j - i)) * a ^ (0 + i - j) else (0::'a))

goal (1 subgoal):
 1. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
case (Suc r)
[PROOF STATE]
proof (state)
this:
jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a))

goal (1 subgoal):
 1. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
let ?jb = "jordan_block n a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
let ?rij = "\<lambda> r i j. of_nat (r choose (j - i)) * a ^ (r + i - j)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
let ?v = "\<lambda> i j. if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
have "?jb ^\<^sub>m Suc r = mat n n (\<lambda> (i,j). if i \<le> j then ?rij r i j else 0) * ?jb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a
[PROOF STEP]
by (simp add: Suc)
[PROOF STATE]
proof (state)
this:
jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a

goal (1 subgoal):
 1. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a

goal (1 subgoal):
 1. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
have "\<dots> = mat n n (\<lambda> (i,j). if i \<le> j then ?rij (Suc r) i j else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
assume j: "j < n"
[PROOF STATE]
proof (state)
this:
j < n

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
hence col: "col (jordan_block n a) j = vec n (\<lambda>i. if i = j then a else if Suc i = j then 1 else 0)"
[PROOF STATE]
proof (prove)
using this:
j < n

goal (1 subgoal):
 1. col (jordan_block n a) j = vec n (\<lambda>i. if i = j then a else if Suc i = j then 1::'a else (0::'a))
[PROOF STEP]
unfolding jordan_block_def col_mat[OF j]
[PROOF STATE]
proof (prove)
using this:
j < n

goal (1 subgoal):
 1. vec n (\<lambda>i. case (i, j) of (i, j) \<Rightarrow> if i = j then a else if Suc i = j then 1::'a else (0::'a)) = vec n (\<lambda>i. if i = j then a else if Suc i = j then 1::'a else (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
col (jordan_block n a) j = vec n (\<lambda>i. if i = j then a else if Suc i = j then 1::'a else (0::'a))

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
have "vec n f \<bullet> col (jordan_block n a) j = (f j * a + (if j = 0 then 0 else f (j - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
define p where "p = (\<lambda> i. vec n f $ i * col (jordan_block n a) j $ i)"
[PROOF STATE]
proof (state)
this:
p = (\<lambda>i. vec n f $ i * col (jordan_block n a) j $ i)

goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
have "vec n f \<bullet> col (jordan_block n a) j = (\<Sum>i = 0 ..< n. p i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = sum p {0..<n}
[PROOF STEP]
unfolding scalar_prod_def p_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (col (jordan_block n a) j). vec n f $ i * col (jordan_block n a) j $ i) = (\<Sum>i = 0..<n. vec n f $ i * col (jordan_block n a) j $ i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vec n f \<bullet> col (jordan_block n a) j = sum p {0..<n}

goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec n f \<bullet> col (jordan_block n a) j = sum p {0..<n}

goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
have "\<dots> = p j + sum p ({0 ..< n} - {j})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum p {0..<n} = p j + sum p ({0..<n} - {j})
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < n

goal (1 subgoal):
 1. sum p {0..<n} = p j + sum p ({0..<n} - {j})
[PROOF STEP]
by (subst sum.remove[of _ j], auto)
[PROOF STATE]
proof (state)
this:
sum p {0..<n} = p j + sum p ({0..<n} - {j})

goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum p {0..<n} = p j + sum p ({0..<n} - {j})

goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
have "p j = f j * a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p j = f j * a
[PROOF STEP]
unfolding p_def col
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n f $ j * vec n (\<lambda>i. if i = j then a else if Suc i = j then 1::'a else (0::'a)) $ j = f j * a
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < n

goal (1 subgoal):
 1. vec n f $ j * vec n (\<lambda>i. if i = j then a else if Suc i = j then 1::'a else (0::'a)) $ j = f j * a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p j = f j * a

goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p j = f j * a

goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
have "sum p ({0 ..< n} - {j}) = (if j = 0 then 0 else f (j - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
proof (cases j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. j = 0 \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
 2. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
j = 0

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
 2. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
have "sum p ({0 ..< n} - {j}) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum p ({0..<n} - {j}) = (0::'a)
[PROOF STEP]
by (rule sum.neutral, auto simp: p_def col 0)
[PROOF STATE]
proof (state)
this:
sum p ({0..<n} - {j}) = (0::'a)

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
 2. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sum p ({0..<n} - {j}) = (0::'a)

goal (1 subgoal):
 1. sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
sum p ({0..<n} - {j}) = (0::'a)
j = 0

goal (1 subgoal):
 1. sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))

goal (1 subgoal):
 1. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
case (Suc jj)
[PROOF STATE]
proof (state)
this:
j = Suc jj

goal (1 subgoal):
 1. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
with j
[PROOF STATE]
proof (chain)
picking this:
j < n
j = Suc jj
[PROOF STEP]
have jj: "jj \<in> {0 ..< n} - {j}"
[PROOF STATE]
proof (prove)
using this:
j < n
j = Suc jj

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

goal (1 subgoal):
 1. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
have "sum p ({0 ..< n} - {j}) = p jj + sum p ({0 ..< n} - {j} - {jj})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum p ({0..<n} - {j}) = p jj + sum p ({0..<n} - {j} - {jj})
[PROOF STEP]
by (subst sum.remove[OF _ jj], auto)
[PROOF STATE]
proof (state)
this:
sum p ({0..<n} - {j}) = p jj + sum p ({0..<n} - {j} - {jj})

goal (1 subgoal):
 1. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum p ({0..<n} - {j}) = p jj + sum p ({0..<n} - {j} - {jj})

goal (1 subgoal):
 1. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
have "p jj = f (j - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p jj = f (j - 1)
[PROOF STEP]
unfolding p_def col
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n f $ jj * vec n (\<lambda>i. if i = j then a else if Suc i = j then 1::'a else (0::'a)) $ jj = f (j - 1)
[PROOF STEP]
using jj
[PROOF STATE]
proof (prove)
using this:
jj \<in> {0..<n} - {j}

goal (1 subgoal):
 1. vec n f $ jj * vec n (\<lambda>i. if i = j then a else if Suc i = j then 1::'a else (0::'a)) $ jj = f (j - 1)
[PROOF STEP]
by (auto simp: Suc)
[PROOF STATE]
proof (state)
this:
p jj = f (j - 1)

goal (1 subgoal):
 1. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p jj = f (j - 1)

goal (1 subgoal):
 1. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
have "sum p ({0 ..< n} - {j} - {jj}) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum p ({0..<n} - {j} - {jj}) = (0::'a)
[PROOF STEP]
by (rule sum.neutral, auto simp: p_def col, auto simp: Suc)
[PROOF STATE]
proof (state)
this:
sum p ({0..<n} - {j} - {jj}) = (0::'a)

goal (1 subgoal):
 1. \<And>nat. j = Suc nat \<Longrightarrow> sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum p ({0..<n} - {j}) = f (j - 1) + (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum p ({0..<n} - {j}) = f (j - 1) + (0::'a)

goal (1 subgoal):
 1. sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
unfolding Suc
[PROOF STATE]
proof (prove)
using this:
sum p ({0..<n} - {Suc jj}) = f (Suc jj - 1) + (0::'a)

goal (1 subgoal):
 1. sum p ({0..<n} - {Suc jj}) = (if Suc jj = 0 then 0::'a else f (Suc jj - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum p ({0..<n} - {j}) = (if j = 0 then 0::'a else f (j - 1))

goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))

goal (1 subgoal):
 1. vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
vec n f \<bullet> col (jordan_block n a) j = f j * a + (if j = 0 then 0::'a else f (j - 1))

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?j2 < n \<Longrightarrow> vec n ?f2 \<bullet> col (jordan_block n a) ?j2 = ?f2 ?j2 * a + (if ?j2 = 0 then 0::'a else ?f2 (?j2 - 1))

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
note scalar_to_sum = this
[PROOF STATE]
proof (state)
this:
?j2 < n \<Longrightarrow> vec n ?f2 \<bullet> col (jordan_block n a) ?j2 = ?f2 ?j2 * a + (if ?j2 = 0 then 0::'a else ?f2 (?j2 - 1))

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?j2 < n \<Longrightarrow> vec n ?f2 \<bullet> col (jordan_block n a) ?j2 = ?f2 ?j2 * a + (if ?j2 = 0 then 0::'a else ?f2 (?j2 - 1))

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
assume i: "i < n" and ij: "i > j"
[PROOF STATE]
proof (state)
this:
i < n
j < i

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
hence j: "j < n"
[PROOF STATE]
proof (prove)
using this:
i < n
j < i

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

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
have "vec n (?v i) \<bullet> col (jordan_block n a) j = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n (\<lambda>j. if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<bullet> col (jordan_block n a) j = (0::'a)
[PROOF STEP]
unfolding scalar_to_sum[OF j]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * a + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = (0::'a)
[PROOF STEP]
using ij i j
[PROOF STATE]
proof (prove)
using this:
j < i
i < n
j < n

goal (1 subgoal):
 1. (if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * a + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec n (\<lambda>j. if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<bullet> col (jordan_block n a) j = (0::'a)

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 < n; ?j2 < ?i2\<rbrakk> \<Longrightarrow> vec n (\<lambda>j. if ?i2 \<le> j then of_nat (r choose (j - ?i2)) * a ^ (r + ?i2 - j) else (0::'a)) \<bullet> col (jordan_block n a) ?j2 = (0::'a)

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
note easy_case = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 < n; ?j2 < ?i2\<rbrakk> \<Longrightarrow> vec n (\<lambda>j. if ?i2 \<le> j then of_nat (r choose (j - ?i2)) * a ^ (r + ?i2 - j) else (0::'a)) \<bullet> col (jordan_block n a) ?j2 = (0::'a)

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 < n; ?j2 < ?i2\<rbrakk> \<Longrightarrow> vec n (\<lambda>j. if ?i2 \<le> j then of_nat (r choose (j - ?i2)) * a ^ (r + ?i2 - j) else (0::'a)) \<bullet> col (jordan_block n a) ?j2 = (0::'a)

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
assume j: "j < n" and ij: "i \<le> j"
[PROOF STATE]
proof (state)
this:
j < n
i \<le> j

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
hence i: "i < n" and id: "\<And> p q. (if i \<le> j then p else q) = p"
[PROOF STATE]
proof (prove)
using this:
j < n
i \<le> j

goal (1 subgoal):
 1. i < n &&& (\<And>p q. (if i \<le> j then p else q) = p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < n
(if i \<le> j then ?p else ?q) = ?p

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
have "vec n (?v i) \<bullet> col (jordan_block n a) j =
        (of_nat (r choose (j - i)) * (a ^ (Suc (r + i - j)))) +
          (if j = 0 then 0
         else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n (\<lambda>j. if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<bullet> col (jordan_block n a) j = of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a))
[PROOF STEP]
unfolding scalar_to_sum[OF j]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * a + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a))
[PROOF STEP]
using ij
[PROOF STATE]
proof (prove)
using this:
i \<le> j

goal (1 subgoal):
 1. (if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * a + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vec n (\<lambda>j. if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<bullet> col (jordan_block n a) j = of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a))

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec n (\<lambda>j. if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<bullet> col (jordan_block n a) j = of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a))

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
have "\<dots> = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
proof (cases j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
case (Suc jj)
[PROOF STATE]
proof (state)
this:
j = Suc jj

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
j = Suc jj

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
assume "i \<le> Suc jj" and "\<not> i \<le> jj"
[PROOF STATE]
proof (state)
this:
i \<le> Suc jj
\<not> i \<le> jj

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
hence "i = Suc jj"
[PROOF STATE]
proof (prove)
using this:
i \<le> Suc jj
\<not> i \<le> jj

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

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
hence "a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)"
[PROOF STATE]
proof (prove)
using this:
i = Suc jj

goal (1 subgoal):
 1. a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>i \<le> Suc jj; \<not> i \<le> jj\<rbrakk> \<Longrightarrow> a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>i \<le> Suc jj; \<not> i \<le> jj\<rbrakk> \<Longrightarrow> a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>i \<le> Suc jj; \<not> i \<le> jj\<rbrakk> \<Longrightarrow> a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
assume ijj: "i \<le> jj"
[PROOF STATE]
proof (state)
this:
i \<le> jj

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
have "of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj))
          + of_nat (r choose (jj - i)) * a ^ (r + i - jj) =
            of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
proof (cases "r + i < jj")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. r + i < jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
 2. \<not> r + i < jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
r + i < jj

goal (2 subgoals):
 1. r + i < jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
 2. \<not> r + i < jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
hence gt: "jj - i > r" "Suc jj - i > r" "Suc jj - i > Suc r"
[PROOF STATE]
proof (prove)
using this:
r + i < jj

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

goal (2 subgoals):
 1. r + i < jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
 2. \<not> r + i < jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
unfolding binomial_eq_0[OF gt(1)] binomial_eq_0[OF gt(2)] binomial_eq_0[OF gt(3)]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat 0 * (a * a ^ (r + i - Suc jj)) + of_nat 0 * a ^ (r + i - jj) = of_nat 0 * a ^ (r + i - jj)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)

goal (1 subgoal):
 1. \<not> r + i < jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> r + i < jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> r + i < jj

goal (1 subgoal):
 1. \<not> r + i < jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
hence ge: "r + i \<ge> jj"
[PROOF STATE]
proof (prove)
using this:
\<not> r + i < jj

goal (1 subgoal):
 1. jj \<le> r + i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
jj \<le> r + i

goal (1 subgoal):
 1. \<not> r + i < jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
proof (cases "jj = r + i")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. jj = r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
 2. jj \<noteq> r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
jj = r + i

goal (2 subgoals):
 1. jj = r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
 2. jj \<noteq> r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
have gt: "r < Suc r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r < Suc r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r < Suc r

goal (2 subgoals):
 1. jj = r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
 2. jj \<noteq> r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
unfolding True
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (r choose (Suc (r + i) - i)) * (a * a ^ (r + i - Suc (r + i))) + of_nat (r choose (r + i - i)) * a ^ (r + i - (r + i)) = of_nat (Suc r choose (Suc (r + i) - i)) * a ^ (r + i - (r + i))
[PROOF STEP]
by (simp add: binomial_eq_0[OF gt])
[PROOF STATE]
proof (state)
this:
of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)

goal (1 subgoal):
 1. jj \<noteq> r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jj \<noteq> r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
jj \<noteq> r + i

goal (1 subgoal):
 1. jj \<noteq> r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
with ge
[PROOF STATE]
proof (chain)
picking this:
jj \<le> r + i
jj \<noteq> r + i
[PROOF STEP]
have lt: "jj < r + i"
[PROOF STATE]
proof (prove)
using this:
jj \<le> r + i
jj \<noteq> r + i

goal (1 subgoal):
 1. jj < r + i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jj < r + i

goal (1 subgoal):
 1. jj \<noteq> r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
hence "r + i - jj = Suc (r + i - Suc jj)"
[PROOF STATE]
proof (prove)
using this:
jj < r + i

goal (1 subgoal):
 1. r + i - jj = Suc (r + i - Suc jj)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r + i - jj = Suc (r + i - Suc jj)

goal (1 subgoal):
 1. jj \<noteq> r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
hence prod: "a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)"
[PROOF STATE]
proof (prove)
using this:
r + i - jj = Suc (r + i - Suc jj)

goal (1 subgoal):
 1. a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)

goal (1 subgoal):
 1. jj \<noteq> r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
from ijj
[PROOF STATE]
proof (chain)
picking this:
i \<le> jj
[PROOF STEP]
have id: "Suc jj - i = Suc (jj - i)"
[PROOF STATE]
proof (prove)
using this:
i \<le> jj

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

goal (1 subgoal):
 1. jj \<noteq> r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
have binom: "Suc r choose (Suc jj - i) =
                r choose (Suc jj - i) + (r choose (jj - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc r choose (Suc jj - i) = r choose (Suc jj - i) + (r choose (jj - i))
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc r choose Suc (jj - i) = r choose Suc (jj - i) + (r choose (jj - i))
[PROOF STEP]
by (subst binomial_Suc_Suc, simp)
[PROOF STATE]
proof (state)
this:
Suc r choose (Suc jj - i) = r choose (Suc jj - i) + (r choose (jj - i))

goal (1 subgoal):
 1. jj \<noteq> r + i \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
unfolding prod binom
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (r choose (Suc jj - i)) * a ^ (r + i - jj) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (r choose (Suc jj - i) + (r choose (jj - i))) * a ^ (r + i - jj)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
i \<le> jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)

goal (2 subgoals):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
 2. \<And>nat. j = Suc nat \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>i \<le> Suc jj; \<not> i \<le> jj\<rbrakk> \<Longrightarrow> a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)
i \<le> jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i \<le> Suc jj; \<not> i \<le> jj\<rbrakk> \<Longrightarrow> a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)
i \<le> jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)

goal (1 subgoal):
 1. of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
using ij
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i \<le> Suc jj; \<not> i \<le> jj\<rbrakk> \<Longrightarrow> a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)
i \<le> jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
i \<le> j

goal (1 subgoal):
 1. of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
unfolding Suc
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i \<le> Suc jj; \<not> i \<le> jj\<rbrakk> \<Longrightarrow> a * a ^ (r + i - Suc jj) = a ^ (r + i - jj)
i \<le> jj \<Longrightarrow> of_nat (r choose (Suc jj - i)) * (a * a ^ (r + i - Suc jj)) + of_nat (r choose (jj - i)) * a ^ (r + i - jj) = of_nat (Suc r choose (Suc jj - i)) * a ^ (r + i - jj)
i \<le> Suc jj

goal (1 subgoal):
 1. of_nat (r choose (Suc jj - i)) * a ^ Suc (r + i - Suc jj) + (if Suc jj = 0 then 0::'a else if i \<le> Suc jj - 1 then of_nat (r choose (Suc jj - 1 - i)) * a ^ (r + i - (Suc jj - 1)) else (0::'a)) = of_nat (Suc r choose (Suc jj - i)) * a ^ (Suc (r + i) - Suc jj)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)

goal (1 subgoal):
 1. j = 0 \<Longrightarrow> of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
of_nat (r choose (j - i)) * a ^ Suc (r + i - j) + (if j = 0 then 0::'a else if i \<le> j - 1 then of_nat (r choose (j - 1 - i)) * a ^ (r + i - (j - 1)) else (0::'a)) = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vec n (\<lambda>j. if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<bullet> col (jordan_block n a) j = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
have "vec n (?v i) \<bullet> col (jordan_block n a) j
        = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)"
[PROOF STATE]
proof (prove)
using this:
vec n (\<lambda>j. if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<bullet> col (jordan_block n a) j = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)

goal (1 subgoal):
 1. vec n (\<lambda>j. if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<bullet> col (jordan_block n a) j = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
vec n (\<lambda>j. if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<bullet> col (jordan_block n a) j = of_nat (Suc r choose (j - i)) * a ^ (Suc (r + i) - j)

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?j2 < n; ?i2 \<le> ?j2\<rbrakk> \<Longrightarrow> vec n (\<lambda>j. if ?i2 \<le> j then of_nat (r choose (j - ?i2)) * a ^ (r + ?i2 - j) else (0::'a)) \<bullet> col (jordan_block n a) ?j2 = of_nat (Suc r choose (?j2 - ?i2)) * a ^ (Suc (r + ?i2) - ?j2)

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
note main_case = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?j2 < n; ?i2 \<le> ?j2\<rbrakk> \<Longrightarrow> vec n (\<lambda>j. if ?i2 \<le> j then of_nat (r choose (j - ?i2)) * a ^ (r + ?i2 - j) else (0::'a)) \<bullet> col (jordan_block n a) ?j2 = of_nat (Suc r choose (?j2 - ?i2)) * a ^ (Suc (r + ?i2) - ?j2)

goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
by (rule eq_matI, insert easy_case main_case, auto)
[PROOF STATE]
proof (state)
this:
mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat n n (\<lambda>(i, j). if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) * jordan_block n a = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))

goal (1 subgoal):
 1. \<And>r. jordan_block n a ^\<^sub>m r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (r choose (j - i)) * a ^ (r + i - j) else (0::'a)) \<Longrightarrow> jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>(i, j). if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))

goal (1 subgoal):
 1. jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
jordan_block n a ^\<^sub>m Suc r = mat n n (\<lambda>b. case b of (i, j) \<Rightarrow> if i \<le> j then of_nat (Suc r choose (j - i)) * a ^ (Suc r + i - j) else (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem NUM_subset_TOTAL: "NUM \<subset> TOTAL"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NUM \<subset> TOTAL
[PROOF STEP]
using CP_subseteq_TOTAL FIN_not_subseteq_NUM FIN_subseteq_CP NUM_subseteq_TOTAL
[PROOF STATE]
proof (prove)
using this:
CP \<subseteq> TOTAL
\<not> FIN \<subseteq> NUM
FIN \<subseteq> CP
NUM \<subseteq> TOTAL

goal (1 subgoal):
 1. NUM \<subset> TOTAL
[PROOF STEP]
by auto


[STATEMENT]
theorem suffix_append:
  "suffix xs (ys @ zs) \<longleftrightarrow> suffix xs zs \<or> (\<exists>xs'. xs = xs' @ zs \<and> suffix xs' ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. suffix xs (ys @ zs) = (suffix xs zs \<or> (\<exists>xs'. xs = xs' @ zs \<and> suffix xs' ys))
[PROOF STEP]
by (auto simp: suffix_def append_eq_append_conv2)


[STATEMENT]
lemma ord0_order_trans: "\<lbrakk>(x::ord0) \<le> y; y \<le> z\<rbrakk> \<Longrightarrow> x \<le> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; y \<le> z\<rbrakk> \<Longrightarrow> x \<le> z
[PROOF STEP]
by (unfold ord0_le_def, rule ord0_leq_trans)


[STATEMENT]
lemma find_next_prime_nat:
  fixes n :: nat
  assumes "prime n"
  shows "\<exists> n'. n' > n \<and> prime n' \<and> (\<forall>k. n < k \<longrightarrow> k < n' \<longrightarrow> \<not> prime k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n'>n. prime n' \<and> (\<forall>k>n. k < n' \<longrightarrow> \<not> prime k)
[PROOF STEP]
using ex_least_nat_le[of "\<lambda> k . k > n \<and> prime k"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n < ?n \<and> prime ?n; \<not> (n < 0 \<and> prime 0)\<rbrakk> \<Longrightarrow> \<exists>k\<le>?n. (\<forall>i<k. \<not> (n < i \<and> prime i)) \<and> n < k \<and> prime k

goal (1 subgoal):
 1. \<exists>n'>n. prime n' \<and> (\<forall>k>n. k < n' \<longrightarrow> \<not> prime k)
[PROOF STEP]
by (metis bigger_prime not_prime_0)


[STATEMENT]
lemma continuous_on_sum [continuous_intros]:
  fixes f :: "'a \<Rightarrow> 'b::topological_space \<Rightarrow> 'c::topological_comm_monoid_add"
  shows "(\<And>i. i \<in> I \<Longrightarrow> continuous_on S (f i)) \<Longrightarrow> continuous_on S (\<lambda>x. \<Sum>i\<in>I. f i x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> continuous_on S (f i)) \<Longrightarrow> continuous_on S (\<lambda>x. \<Sum>i\<in>I. f i x)
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> \<forall>x\<in>S. (f i \<longlongrightarrow> f i x) (at x within S)) \<Longrightarrow> \<forall>x\<in>S. ((\<lambda>x. \<Sum>i\<in>I. f i x) \<longlongrightarrow> (\<Sum>i\<in>I. f i x)) (at x within S)
[PROOF STEP]
by (auto intro: tendsto_sum)


[STATEMENT]
theorem bulk_update_safety:
  assumes "0 \<le> i"
  and "\<forall> n . \<rho> n < 1"
  and "\<forall> n m . n \<le> m \<longrightarrow> \<rho> n \<le> \<rho> m"
  and "strictly_solvent \<alpha>"
  shows "0 \<le> net_asset_value (bulk_update_account n \<rho> i \<alpha>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> net_asset_value (bulk_update_account n \<rho> i \<alpha>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> i
\<forall>n. \<rho> n < 1
\<forall>n m. n \<le> m \<longrightarrow> \<rho> n \<le> \<rho> m
strictly_solvent \<alpha>

goal (1 subgoal):
 1. 0 \<le> net_asset_value (bulk_update_account n \<rho> i \<alpha>)
[PROOF STEP]
by (metis
        bulk_update_account_mono
        bulk_update_account_zero
        strictly_solvent_alt_def
        strictly_solvent_net_asset_value)


[STATEMENT]
lemma midpoint_sym: "midpoint a b = midpoint b a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. midpoint a b = midpoint b a
[PROOF STEP]
unfolding midpoint_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + b) /\<^sub>R 2 = (b + a) /\<^sub>R 2
[PROOF STEP]
by (auto simp add: scaleR_right_distrib)


[STATEMENT]
lemma radical_sqrt_normal_form_lemma4:
  assumes "z \<ge> 0" "x \<noteq> y * sqrt z"
  shows
   "1 / (x + y * sqrt z) =
    x / (x * x - y * y * z) - (y * sqrt z) / (x * x - y * y * z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / (x + y * sqrt z) = x / (x * x - y * y * z) - y * sqrt z / (x * x - y * y * z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 / (x + y * sqrt z) = x / (x * x - y * y * z) - y * sqrt z / (x * x - y * y * z)
[PROOF STEP]
have "1 / (x + y * sqrt z) = ((x - y * sqrt z) / (x + y * sqrt z)) / (x - y * sqrt z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / (x + y * sqrt z) = (x - y * sqrt z) / (x + y * sqrt z) / (x - y * sqrt z)
[PROOF STEP]
by (auto simp add: eq_divide_imp assms)
[PROOF STATE]
proof (state)
this:
1 / (x + y * sqrt z) = (x - y * sqrt z) / (x + y * sqrt z) / (x - y * sqrt z)

goal (1 subgoal):
 1. 1 / (x + y * sqrt z) = x / (x * x - y * y * z) - y * sqrt z / (x * x - y * y * z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / (x + y * sqrt z) = (x - y * sqrt z) / (x + y * sqrt z) / (x - y * sqrt z)

goal (1 subgoal):
 1. 1 / (x + y * sqrt z) = x / (x * x - y * y * z) - y * sqrt z / (x * x - y * y * z)
[PROOF STEP]
have "... = x / (x * x - y * y * z) - (y * sqrt z) / (x * x - y * y * z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - y * sqrt z) / (x + y * sqrt z) / (x - y * sqrt z) = x / (x * x - y * y * z) - y * sqrt z / (x * x - y * y * z)
[PROOF STEP]
by (auto simp add: algebra_simps eq_sqrt_squared diff_divide_distrib assms)
[PROOF STATE]
proof (state)
this:
(x - y * sqrt z) / (x + y * sqrt z) / (x - y * sqrt z) = x / (x * x - y * y * z) - y * sqrt z / (x * x - y * y * z)

goal (1 subgoal):
 1. 1 / (x + y * sqrt z) = x / (x * x - y * y * z) - y * sqrt z / (x * x - y * y * z)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 / (x + y * sqrt z) = x / (x * x - y * y * z) - y * sqrt z / (x * x - y * y * z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 / (x + y * sqrt z) = x / (x * x - y * y * z) - y * sqrt z / (x * x - y * y * z)

goal (1 subgoal):
 1. 1 / (x + y * sqrt z) = x / (x * x - y * y * z) - y * sqrt z / (x * x - y * y * z)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
1 / (x + y * sqrt z) = x / (x * x - y * y * z) - y * sqrt z / (x * x - y * y * z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unit_vec_to_col:
  assumes "dim_col A = n" and "i < n"
  shows "col A i = A * |unit_vec n i\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col A i = col_fst (A * |unit_vec n i\<rangle>)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. ia < dim_vec (col_fst (A * |unit_vec n i\<rangle>)) \<Longrightarrow> col A i $ ia = col_fst (A * |unit_vec n i\<rangle>) $ ia
 2. dim_vec (col A i) = dim_vec (col_fst (A * |unit_vec n i\<rangle>))
[PROOF STEP]
show "dim_vec (col A i) = dim_vec (A * |unit_vec n i\<rangle>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (col A i) = dim_vec (col_fst (A * |unit_vec n i\<rangle>))
[PROOF STEP]
using col_def times_mat_def
[PROOF STATE]
proof (prove)
using this:
col ?A ?j = vec (dim_row ?A) (\<lambda>i. ?A $$ (i, ?j))
?A * ?B \<equiv> mat (dim_row ?A) (dim_col ?B) (\<lambda>(i, j). row ?A i \<bullet> col ?B j)

goal (1 subgoal):
 1. dim_vec (col A i) = dim_vec (col_fst (A * |unit_vec n i\<rangle>))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_vec (col A i) = dim_vec (col_fst (A * |unit_vec n i\<rangle>))

goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (col_fst (A * |unit_vec n i\<rangle>)) \<Longrightarrow> col A i $ ia = col_fst (A * |unit_vec n i\<rangle>) $ ia
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (col_fst (A * |unit_vec n i\<rangle>)) \<Longrightarrow> col A i $ ia = col_fst (A * |unit_vec n i\<rangle>) $ ia
[PROOF STEP]
fix j::nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (col_fst (A * |unit_vec n i\<rangle>)) \<Longrightarrow> col A i $ ia = col_fst (A * |unit_vec n i\<rangle>) $ ia
[PROOF STEP]
assume "j < dim_vec (col_fst (A * |unit_vec n i\<rangle>))"
[PROOF STATE]
proof (state)
this:
j < dim_vec (col_fst (A * |unit_vec n i\<rangle>))

goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (col_fst (A * |unit_vec n i\<rangle>)) \<Longrightarrow> col A i $ ia = col_fst (A * |unit_vec n i\<rangle>) $ ia
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j < dim_vec (col_fst (A * |unit_vec n i\<rangle>))
[PROOF STEP]
show "col A i $ j = (A * |unit_vec n i\<rangle>) $ j"
[PROOF STATE]
proof (prove)
using this:
j < dim_vec (col_fst (A * |unit_vec n i\<rangle>))

goal (1 subgoal):
 1. col A i $ j = col_fst (A * |unit_vec n i\<rangle>) $ j
[PROOF STEP]
using assms times_mat_def ket_vec_def
[PROOF STATE]
proof (prove)
using this:
j < dim_vec (col_fst (A * |unit_vec n i\<rangle>))
dim_col A = n
i < n
?A * ?B \<equiv> mat (dim_row ?A) (dim_col ?B) (\<lambda>(i, j). row ?A i \<bullet> col ?B j)
|?v\<rangle> \<equiv> mat (dim_vec ?v) 1 (\<lambda>(i, j). ?v $ i)

goal (1 subgoal):
 1. col A i $ j = col_fst (A * |unit_vec n i\<rangle>) $ j
[PROOF STEP]
by (smt col_fst_is_col dim_col dim_col_mat(1) index_col index_mult_mat(1) index_mult_mat(2)
index_row(1) ket_vec_col less_numeral_extra(1) scalar_prod_right_unit)
[PROOF STATE]
proof (state)
this:
col A i $ j = col_fst (A * |unit_vec n i\<rangle>) $ j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_eq_zero_iff:
  assumes "summable f" and pos: "\<And>n. 0 \<le> f n"
  shows "suminf f = 0 \<longleftrightarrow> (\<forall>n. f n = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (suminf f = (0::'a)) = (\<forall>n. f n = (0::'a))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. suminf f = (0::'a) \<Longrightarrow> \<forall>n. f n = (0::'a)
 2. \<forall>n. f n = (0::'a) \<Longrightarrow> suminf f = (0::'a)
[PROOF STEP]
assume L: "suminf f = 0"
[PROOF STATE]
proof (state)
this:
suminf f = (0::'a)

goal (2 subgoals):
 1. suminf f = (0::'a) \<Longrightarrow> \<forall>n. f n = (0::'a)
 2. \<forall>n. f n = (0::'a) \<Longrightarrow> suminf f = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
suminf f = (0::'a)
[PROOF STEP]
have f: "(\<lambda>n. \<Sum>i<n. f i) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
suminf f = (0::'a)

goal (1 subgoal):
 1. (\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
using summable_LIMSEQ[of f] assms
[PROOF STATE]
proof (prove)
using this:
suminf f = (0::'a)
summable f \<Longrightarrow> (\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> suminf f
summable f
(0::'a) \<le> f ?n

goal (1 subgoal):
 1. (\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> (0::'a)

goal (2 subgoals):
 1. suminf f = (0::'a) \<Longrightarrow> \<forall>n. f n = (0::'a)
 2. \<forall>n. f n = (0::'a) \<Longrightarrow> suminf f = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
have "\<And>i. (\<Sum>n\<in>{i}. f n) \<le> 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> (0::'a)

goal (1 subgoal):
 1. \<And>i. sum f {i} \<le> (0::'a)
[PROOF STEP]
by (metis L \<open>summable f\<close> order_refl pos sum.infinite sum_le_suminf)
[PROOF STATE]
proof (state)
this:
sum f {?i} \<le> (0::'a)

goal (2 subgoals):
 1. suminf f = (0::'a) \<Longrightarrow> \<forall>n. f n = (0::'a)
 2. \<forall>n. f n = (0::'a) \<Longrightarrow> suminf f = (0::'a)
[PROOF STEP]
with pos
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> f ?n
sum f {?i} \<le> (0::'a)
[PROOF STEP]
show "\<forall>n. f n = 0"
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> f ?n
sum f {?i} \<le> (0::'a)

goal (1 subgoal):
 1. \<forall>n. f n = (0::'a)
[PROOF STEP]
by (simp add: order.antisym)
[PROOF STATE]
proof (state)
this:
\<forall>n. f n = (0::'a)

goal (1 subgoal):
 1. \<forall>n. f n = (0::'a) \<Longrightarrow> suminf f = (0::'a)
[PROOF STEP]
qed (metis suminf_zero fun_eq_iff)