[STATEMENT]
lemma height_acomplete: assumes "acomplete t"
shows "height t = nat(ceiling(log 2 (size1 t)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
 2. \<not> ?P \<Longrightarrow> height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
[PROOF STEP]
assume *: "complete t"
[PROOF STATE]
proof (state)
this:
Tree.complete t

goal (2 subgoals):
 1. ?P \<Longrightarrow> height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
 2. \<not> ?P \<Longrightarrow> height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
[PROOF STEP]
hence "size1 t = 2 ^ height t"
[PROOF STATE]
proof (prove)
using this:
Tree.complete t

goal (1 subgoal):
 1. size1 t = 2 ^ height t
[PROOF STEP]
by (simp add: size1_if_complete)
[PROOF STATE]
proof (state)
this:
size1 t = 2 ^ height t

goal (2 subgoals):
 1. ?P \<Longrightarrow> height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
 2. \<not> ?P \<Longrightarrow> height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
[PROOF STEP]
from log2_of_power_eq[OF this]
[PROOF STATE]
proof (chain)
picking this:
real (height t) = log 2 (real (size1 t))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (height t) = log 2 (real (size1 t))

goal (1 subgoal):
 1. height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
height t = nat \<lceil>log 2 (real (size1 t))\<rceil>

goal (1 subgoal):
 1. \<not> Tree.complete t \<Longrightarrow> height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> Tree.complete t \<Longrightarrow> height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
[PROOF STEP]
assume *: "\<not> complete t"
[PROOF STATE]
proof (state)
this:
\<not> Tree.complete t

goal (1 subgoal):
 1. \<not> Tree.complete t \<Longrightarrow> height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
[PROOF STEP]
hence **: "height t = min_height t + 1"
[PROOF STATE]
proof (prove)
using this:
\<not> Tree.complete t

goal (1 subgoal):
 1. height t = min_height t + 1
[PROOF STEP]
using assms min_height_le_height[of t]
[PROOF STATE]
proof (prove)
using this:
\<not> Tree.complete t
acomplete t
min_height t \<le> height t

goal (1 subgoal):
 1. height t = min_height t + 1
[PROOF STEP]
by(auto simp add: acomplete_def complete_iff_height)
[PROOF STATE]
proof (state)
this:
height t = min_height t + 1

goal (1 subgoal):
 1. \<not> Tree.complete t \<Longrightarrow> height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
[PROOF STEP]
hence "size1 t \<le> 2 ^ (min_height t + 1)"
[PROOF STATE]
proof (prove)
using this:
height t = min_height t + 1

goal (1 subgoal):
 1. size1 t \<le> 2 ^ (min_height t + 1)
[PROOF STEP]
by (metis size1_height)
[PROOF STATE]
proof (state)
this:
size1 t \<le> 2 ^ (min_height t + 1)

goal (1 subgoal):
 1. \<not> Tree.complete t \<Longrightarrow> height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
[PROOF STEP]
from log2_of_power_le[OF this size1_ge0] min_height_size1_log_if_incomplete[OF *] **
[PROOF STATE]
proof (chain)
picking this:
log 2 (real (size1 t)) \<le> real (min_height t + 1)
real (min_height t) < log 2 (real (size1 t))
height t = min_height t + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
log 2 (real (size1 t)) \<le> real (min_height t + 1)
real (min_height t) < log 2 (real (size1 t))
height t = min_height t + 1

goal (1 subgoal):
 1. height t = nat \<lceil>log 2 (real (size1 t))\<rceil>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
height t = nat \<lceil>log 2 (real (size1 t))\<rceil>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIM_def: "f \<midarrow>a\<rightarrow> L \<longleftrightarrow> (\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a \<and> dist x a < s \<longrightarrow> dist (f x) L < r)"
  for a :: "'a::metric_space" and L :: "'b::metric_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>a\<rightarrow> L = (\<forall>r>0. \<exists>s>0. \<forall>x. x \<noteq> a \<and> dist x a < s \<longrightarrow> dist (f x) L < r)
[PROOF STEP]
unfolding tendsto_iff eventually_at
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<exists>d>0. \<forall>x\<in>UNIV. x \<noteq> a \<and> dist x a < d \<longrightarrow> dist (f x) L < e) = (\<forall>r>0. \<exists>s>0. \<forall>x. x \<noteq> a \<and> dist x a < s \<longrightarrow> dist (f x) L < r)
[PROOF STEP]
by simp


[STATEMENT]
lemma height_size1_log_alpha: assumes "wbt t"
shows "height t \<le> log 2 (size1 t) / log 2 (1/(1-\<alpha>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 / (1 - \<alpha>))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 / (1 - \<alpha>))
[PROOF STEP]
from height_size1_alpha[OF assms]
[PROOF STATE]
proof (chain)
picking this:
(1 / (1 - \<alpha>)) ^ height t \<le> real (size1 t)
[PROOF STEP]
have "height t \<le> log (1/(1-\<alpha>)) (size1 t)"
[PROOF STATE]
proof (prove)
using this:
(1 / (1 - \<alpha>)) ^ height t \<le> real (size1 t)

goal (1 subgoal):
 1. real (height t) \<le> log (1 / (1 - \<alpha>)) (real (size1 t))
[PROOF STEP]
using alpha_pos alpha_ub le_log_of_power
[PROOF STATE]
proof (prove)
using this:
(1 / (1 - \<alpha>)) ^ height t \<le> real (size1 t)
0 < \<alpha>
\<alpha> \<le> 1 / 2
\<lbrakk>?b ^ ?n \<le> ?m; 1 < ?b\<rbrakk> \<Longrightarrow> real ?n \<le> log ?b ?m

goal (1 subgoal):
 1. real (height t) \<le> log (1 / (1 - \<alpha>)) (real (size1 t))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (height t) \<le> log (1 / (1 - \<alpha>)) (real (size1 t))

goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 / (1 - \<alpha>))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (height t) \<le> log (1 / (1 - \<alpha>)) (real (size1 t))

goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 / (1 - \<alpha>))
[PROOF STEP]
have "\<dots> = log 2 (size1 t) / log 2 (1/(1-\<alpha>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log (1 / (1 - \<alpha>)) (real (size1 t)) = log 2 (real (size1 t)) / log 2 (1 / (1 - \<alpha>))
[PROOF STEP]
by (simp add: log_base_change)
[PROOF STATE]
proof (state)
this:
log (1 / (1 - \<alpha>)) (real (size1 t)) = log 2 (real (size1 t)) / log 2 (1 / (1 - \<alpha>))

goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 / (1 - \<alpha>))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 / (1 - \<alpha>))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 / (1 - \<alpha>))

goal (1 subgoal):
 1. real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 / (1 - \<alpha>))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (height t) \<le> log 2 (real (size1 t)) / log 2 (1 / (1 - \<alpha>))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unitarily_equiv_commute:
  assumes "unitarily_equiv A B U"
  and "A*C = C*A"
shows "B * (Complex_Matrix.adjoint U * C * U) =
Complex_Matrix.adjoint U * C * U * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * (Complex_Matrix.adjoint U * C * U) = Complex_Matrix.adjoint U * C * U * B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B * (Complex_Matrix.adjoint U * C * U) = Complex_Matrix.adjoint U * C * U * B
[PROOF STEP]
note car = unitarily_equiv_carrier'[OF assms(1)]
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat (dim_row A) (dim_row A)
B \<in> carrier_mat (dim_row A) (dim_row A)
U \<in> carrier_mat (dim_row A) (dim_row A)

goal (1 subgoal):
 1. B * (Complex_Matrix.adjoint U * C * U) = Complex_Matrix.adjoint U * C * U * B
[PROOF STEP]
have cr: "dim_row C = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row C = dim_col A
[PROOF STEP]
by (metis assms(2) car(1) carrier_matD(2) index_mult_mat(2))
[PROOF STATE]
proof (state)
this:
dim_row C = dim_col A

goal (1 subgoal):
 1. B * (Complex_Matrix.adjoint U * C * U) = Complex_Matrix.adjoint U * C * U * B
[PROOF STEP]
have cd: "dim_col C = dim_row A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col C = dim_row A
[PROOF STEP]
by (metis \<open>dim_row C = dim_col A\<close> assms(2) index_mult_mat(2)
        index_mult_mat(3))
[PROOF STATE]
proof (state)
this:
dim_col C = dim_row A

goal (1 subgoal):
 1. B * (Complex_Matrix.adjoint U * C * U) = Complex_Matrix.adjoint U * C * U * B
[PROOF STEP]
have "Complex_Matrix.adjoint U * A * U = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint U * A * U = B
[PROOF STEP]
using assms unitarily_equiv_adjoint
[PROOF STATE]
proof (prove)
using this:
unitarily_equiv A B U
A * C = C * A
unitarily_equiv ?A ?B ?U \<Longrightarrow> unitarily_equiv ?B ?A (Complex_Matrix.adjoint ?U)

goal (1 subgoal):
 1. Complex_Matrix.adjoint U * A * U = B
[PROOF STEP]
by (metis Complex_Matrix.adjoint_adjoint unitarily_equiv_eq)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint U * A * U = B

goal (1 subgoal):
 1. B * (Complex_Matrix.adjoint U * C * U) = Complex_Matrix.adjoint U * C * U * B
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint U * A * U = B

goal (1 subgoal):
 1. B * (Complex_Matrix.adjoint U * C * U) = Complex_Matrix.adjoint U * C * U * B
[PROOF STEP]
using mat_conj_commute assms car
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint U * A * U = B
\<lbrakk>?A \<in> carrier_mat ?n ?n; ?B \<in> carrier_mat ?n ?n; ?U \<in> carrier_mat ?n ?n; Complex_Matrix.unitary ?U; ?A * ?B = ?B * ?A\<rbrakk> \<Longrightarrow> mat_conj (Complex_Matrix.adjoint ?U) ?A * mat_conj (Complex_Matrix.adjoint ?U) ?B = mat_conj (Complex_Matrix.adjoint ?U) ?B * mat_conj (Complex_Matrix.adjoint ?U) ?A
unitarily_equiv A B U
A * C = C * A
A \<in> carrier_mat (dim_row A) (dim_row A)
B \<in> carrier_mat (dim_row A) (dim_row A)
U \<in> carrier_mat (dim_row A) (dim_row A)

goal (1 subgoal):
 1. B * (Complex_Matrix.adjoint U * C * U) = Complex_Matrix.adjoint U * C * U * B
[PROOF STEP]
by (metis carrier_matD(2) carrier_matI cd cr mat_conj_adjoint
        unitarily_equivD(1))
[PROOF STATE]
proof (state)
this:
B * (Complex_Matrix.adjoint U * C * U) = Complex_Matrix.adjoint U * C * U * B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Imsm_calc_i_0: "$(I^{m}s)^{m}_n = (n*m+1)*n / (2*m)" if "i = 0" "m \<noteq> 0" for n m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $(I^{m}s)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
i = 0
m \<noteq> 0

goal (1 subgoal):
 1. $(I^{m}s)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
apply (subst Ilsm_Ilam, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i = 0; m \<noteq> 0\<rbrakk> \<Longrightarrow> (1 + i) ^ n * $(I^{m}a)^{m}_n = real ((n * m + 1) * n) / real (2 * m)
[PROOF STEP]
by (subst Imam_calc_i_0; simp)


[STATEMENT]
lemma relcl_trans:
     "[| (a,b) \<in> relcl L; (b,c) \<in> relcl L; lattice L |] ==> (a,c) \<in> relcl L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(a, b) \<in> relcl L; (b, c) \<in> relcl L; lattice L\<rbrakk> \<Longrightarrow> (a, c) \<in> relcl L
[PROOF STEP]
apply (simp add: relcl_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b \<in> cl L {a}; c \<in> cl L {b}; lattice L\<rbrakk> \<Longrightarrow> c \<in> cl L {a}
[PROOF STEP]
apply (blast intro: clD cl_in_lattice)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem fp_wf_induction:
  "f x  = x \<Longrightarrow> mono f \<Longrightarrow> (\<forall> w . (y w) \<le> f (Sup_less y w)) \<Longrightarrow> Sup (range y) \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f x = x; mono f; \<forall>w. y w \<le> f (Sup_less y w)\<rbrakk> \<Longrightarrow> Sup (range y) \<le> x
[PROOF STEP]
apply (rule Sup_least)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>f x = x; mono f; \<forall>w. y w \<le> f (Sup_less y w); xa \<in> range y\<rbrakk> \<Longrightarrow> xa \<le> x
[PROOF STEP]
apply (simp add: image_def, safe, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>f x = x; mono f; \<forall>w. y w \<le> f (Sup_less y w)\<rbrakk> \<Longrightarrow> y xa \<le> x
[PROOF STEP]
apply (rule less_induct1, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>f x = x; mono f; \<forall>w. y w \<le> f (Sup_less y w); \<And>ya. ya < xa \<Longrightarrow> y ya \<le> x\<rbrakk> \<Longrightarrow> y xa \<le> x
[PROOF STEP]
apply (rule_tac y = "f (Sup_less y xa)" in order_trans, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>f x = x; mono f; \<forall>w. y w \<le> f (Sup_less y w); \<And>ya. ya < xa \<Longrightarrow> y ya \<le> x\<rbrakk> \<Longrightarrow> f (Sup_less y xa) \<le> x
[PROOF STEP]
apply (drule_tac x = "Sup_less y xa" and y = "x" in monoD)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>f x = x; \<forall>w. y w \<le> f (Sup_less y w); \<And>ya. ya < xa \<Longrightarrow> y ya \<le> x\<rbrakk> \<Longrightarrow> Sup_less y xa \<le> x
 2. \<And>xa. \<lbrakk>f x = x; \<forall>w. y w \<le> f (Sup_less y w); \<And>ya. ya < xa \<Longrightarrow> y ya \<le> x; f (Sup_less y xa) \<le> f x\<rbrakk> \<Longrightarrow> f (Sup_less y xa) \<le> x
[PROOF STEP]
by (simp add: Sup_less_least, auto)


[STATEMENT]
lemma valid_equiv: "valid (\<phi> \<leftrightarrow> \<psi>) = (\<forall>I. fml_sem I \<phi> = fml_sem I \<psi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid (\<phi> \<leftrightarrow> \<psi>) = (\<forall>I. fml_sem I \<phi> = fml_sem I \<psi>)
[PROOF STEP]
using valid_fml_equiv fml_equiv_def
[PROOF STATE]
proof (prove)
using this:
valid (?\<phi> \<leftrightarrow> ?\<psi>) = fml_equiv ?\<phi> ?\<psi>
fml_equiv ?\<phi> ?\<psi> \<equiv> \<forall>I. fml_sem I ?\<phi> = fml_sem I ?\<psi>

goal (1 subgoal):
 1. valid (\<phi> \<leftrightarrow> \<psi>) = (\<forall>I. fml_sem I \<phi> = fml_sem I \<psi>)
[PROOF STEP]
by auto


[STATEMENT]
lemma tendsto_mult_one:
  fixes f g :: "_ \<Rightarrow> 'b::topological_monoid_mult"
  shows "(f \<longlongrightarrow> 1) F \<Longrightarrow> (g \<longlongrightarrow> 1) F \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> 1) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> (1::'b)) F; (g \<longlongrightarrow> (1::'b)) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
by (drule (1) tendsto_mult) simp


[STATEMENT]
lemma subsets_are_rows_R: "\<forall>i < (length subsets). row (alt_matrix_A_R signs subsets) i  = vec (length signs) (\<lambda>j. z_R (subsets ! i) (signs ! j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length subsets. row (alt_matrix_A_R signs subsets) i = vec (length signs) (\<lambda>j. z_R (subsets ! i) (signs ! j))
[PROOF STEP]
unfolding row_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length subsets. vec (dim_col (alt_matrix_A_R signs subsets)) (\<lambda>j. alt_matrix_A_R signs subsets $$ (i, j)) = vec (length signs) (\<lambda>j. z_R (subsets ! i) (signs ! j))
[PROOF STEP]
unfolding alt_matrix_A_R_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length subsets. vec (dim_col (mat (length subsets) (length signs) (\<lambda>(i, j). z_R (subsets ! i) (signs ! j)))) (\<lambda>j. mat (length subsets) (length signs) (\<lambda>(i, j). z_R (subsets ! i) (signs ! j)) $$ (i, j)) = vec (length signs) (\<lambda>j. z_R (subsets ! i) (signs ! j))
[PROOF STEP]
by auto


[STATEMENT]
lemma Un_set_drop_extend: "\<lbrakk>j\<ge>Suc 0; j < length l\<rbrakk>
  \<Longrightarrow> l ! (j - Suc 0) \<union> \<Union>(set (drop j l)) = \<Union>(set (drop (j - Suc 0) l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Suc 0 \<le> j; j < length l\<rbrakk> \<Longrightarrow> l ! (j - Suc 0) \<union> \<Union> (set (drop j l)) = \<Union> (set (drop (j - Suc 0) l))
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>Suc 0 \<le> j; j < length l; x \<in> l ! (j - Suc 0)\<rbrakk> \<Longrightarrow> x \<in> \<Union> (set (drop (j - Suc 0) l))
 2. \<And>x X. \<lbrakk>Suc 0 \<le> j; j < length l; x \<in> X; X \<in> set (drop j l)\<rbrakk> \<Longrightarrow> x \<in> \<Union> (set (drop (j - Suc 0) l))
 3. \<And>x X. \<lbrakk>Suc 0 \<le> j; j < length l; x \<in> X; X \<in> set (drop (j - Suc 0) l); x \<notin> \<Union> (set (drop j l))\<rbrakk> \<Longrightarrow> x \<in> l ! (j - Suc 0)
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>Suc 0 \<le> j; j < length l; x \<in> l ! (j - Suc 0)\<rbrakk> \<Longrightarrow> \<exists>X\<in>set (drop (j - Suc 0) l). x \<in> X
 2. \<And>x X. \<lbrakk>Suc 0 \<le> j; j < length l; x \<in> X; X \<in> set (drop j l)\<rbrakk> \<Longrightarrow> \<exists>X\<in>set (drop (j - Suc 0) l). x \<in> X
 3. \<And>x X. \<lbrakk>Suc 0 \<le> j; j < length l; x \<in> X; X \<in> set (drop (j - Suc 0) l); \<forall>xa\<in>set (drop j l). x \<notin> xa\<rbrakk> \<Longrightarrow> x \<in> l ! (j - Suc 0)
[PROOF STEP]
apply (metis diff_Suc_Suc diff_zero gr0_implies_Suc in_set_drop_conv_nth
    le_refl less_eq_Suc_le order.strict_iff_order)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x X. \<lbrakk>Suc 0 \<le> j; j < length l; x \<in> X; X \<in> set (drop j l)\<rbrakk> \<Longrightarrow> \<exists>X\<in>set (drop (j - Suc 0) l). x \<in> X
 2. \<And>x X. \<lbrakk>Suc 0 \<le> j; j < length l; x \<in> X; X \<in> set (drop (j - Suc 0) l); \<forall>xa\<in>set (drop j l). x \<notin> xa\<rbrakk> \<Longrightarrow> x \<in> l ! (j - Suc 0)
[PROOF STEP]
apply (metis Nat.diff_le_self set_drop_subset_set_drop subset_code(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x X. \<lbrakk>Suc 0 \<le> j; j < length l; x \<in> X; X \<in> set (drop (j - Suc 0) l); \<forall>xa\<in>set (drop j l). x \<notin> xa\<rbrakk> \<Longrightarrow> x \<in> l ! (j - Suc 0)
[PROOF STEP]
by (metis diff_Suc_Suc gr0_implies_Suc in_set_drop_conv_nth
    less_eq_Suc_le order.strict_iff_order minus_nat.diff_0)


[STATEMENT]
lemma ex_eq_or: "(\<exists>m. n = Suc m \<and> (m = k \<or> P m)) \<longleftrightarrow> n = Suc k \<or> (\<exists>m. n = Suc m \<and> P m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>m. n = Suc m \<and> (m = k \<or> P m)) = (n = Suc k \<or> (\<exists>m. n = Suc m \<and> P m))
[PROOF STEP]
by auto


[STATEMENT]
lemma interchange_columns_transpose:
  shows "interchange_columns (transpose A) a b = transpose (interchange_rows A a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interchange_columns (Finite_Cartesian_Product.transpose A) a b = Finite_Cartesian_Product.transpose (interchange_rows A a b)
[PROOF STEP]
unfolding interchange_rows_def interchange_columns_def transpose_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i j. if j = a then (\<chi>i j. A $ j $ i) $ i $ b else if j = b then (\<chi>i j. A $ j $ i) $ i $ a else (\<chi>i j. A $ j $ i) $ i $ j) = (\<chi>i j. (\<chi>i j. if i = a then A $ b $ j else if i = b then A $ a $ j else A $ i $ j) $ j $ i)
[PROOF STEP]
by vector


[STATEMENT]
lemma var_sum_pairwise_indep_2:
  fixes f :: "'b \<Rightarrow> 'a \<Rightarrow> real"
  assumes "finite I"
  assumes "\<And>i. i \<in> I \<Longrightarrow> f i \<in> borel_measurable M"
  assumes "\<And>i. i \<in> I \<Longrightarrow> integrable M (\<lambda>\<omega>. f i \<omega>^2)"
  assumes "\<And>J. J \<subseteq> I \<Longrightarrow> card J = 2 \<Longrightarrow> indep_vars (\<lambda> _. borel) f J"
  shows "variance (\<lambda>\<omega>. (\<Sum>i \<in> I. f i \<omega>)) = (\<Sum>i \<in> I. variance (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>x. ((\<Sum>i\<in>I. f i x) - expectation (\<lambda>\<omega>. \<Sum>i\<in>I. f i \<omega>))\<^sup>2) = (\<Sum>i\<in>I. expectation (\<lambda>x. (f i x - expectation (f i))\<^sup>2))
[PROOF STEP]
using assms(4)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?J12 \<subseteq> I; card ?J12 = 2\<rbrakk> \<Longrightarrow> indep_vars (\<lambda>_. borel) f ?J12

goal (1 subgoal):
 1. expectation (\<lambda>x. ((\<Sum>i\<in>I. f i x) - expectation (\<lambda>\<omega>. \<Sum>i\<in>I. f i \<omega>))\<^sup>2) = (\<Sum>i\<in>I. expectation (\<lambda>x. (f i x - expectation (f i))\<^sup>2))
[PROOF STEP]
by (intro var_sum_pairwise_indep[OF assms(1,2,3)] indep_var_from_indep_vars, auto)


[STATEMENT]
lemma sum_list_concat: "sum_list (concat ls) = sum_list (map sum_list ls)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (concat ls) = sum_list (map sum_list ls)
[PROOF STEP]
by (induct ls, auto)


[STATEMENT]
lemma singleton_subset_conv: "({a} \<subseteq> A) = (a \<in> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a} \<subseteq> A) = (a \<in> A)
[PROOF STEP]
by blast


[STATEMENT]
lemma calc_x_axis_intersection_positive_abs':
  fixes A B :: real
  assumes "B\<^sup>2 > A\<^sup>2" and "A \<noteq> 0"
  shows "abs (sgn(B) * sqrt(B\<^sup>2 - A\<^sup>2) / A) < abs(-B/A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>sgn B * sqrt (B\<^sup>2 - A\<^sup>2) / A\<bar> < \<bar>- B / A\<bar>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>sgn B * sqrt (B\<^sup>2 - A\<^sup>2) / A\<bar> < \<bar>- B / A\<bar>
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
A\<^sup>2 < B\<^sup>2
A \<noteq> 0
[PROOF STEP]
have "B \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
A\<^sup>2 < B\<^sup>2
A \<noteq> 0

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

goal (1 subgoal):
 1. \<bar>sgn B * sqrt (B\<^sup>2 - A\<^sup>2) / A\<bar> < \<bar>- B / A\<bar>
[PROOF STEP]
have "B\<^sup>2 - A\<^sup>2 < B\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B\<^sup>2 - A\<^sup>2 < B\<^sup>2
[PROOF STEP]
using \<open>A \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
A \<noteq> 0

goal (1 subgoal):
 1. B\<^sup>2 - A\<^sup>2 < B\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B\<^sup>2 - A\<^sup>2 < B\<^sup>2

goal (1 subgoal):
 1. \<bar>sgn B * sqrt (B\<^sup>2 - A\<^sup>2) / A\<bar> < \<bar>- B / A\<bar>
[PROOF STEP]
hence "sqrt (B\<^sup>2 - A\<^sup>2) < abs B"
[PROOF STATE]
proof (prove)
using this:
B\<^sup>2 - A\<^sup>2 < B\<^sup>2

goal (1 subgoal):
 1. sqrt (B\<^sup>2 - A\<^sup>2) < \<bar>B\<bar>
[PROOF STEP]
using real_sqrt_less_iff[of "B\<^sup>2 - A\<^sup>2" "B\<^sup>2"]
[PROOF STATE]
proof (prove)
using this:
B\<^sup>2 - A\<^sup>2 < B\<^sup>2
(sqrt (B\<^sup>2 - A\<^sup>2) < sqrt (B\<^sup>2)) = (B\<^sup>2 - A\<^sup>2 < B\<^sup>2)

goal (1 subgoal):
 1. sqrt (B\<^sup>2 - A\<^sup>2) < \<bar>B\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sqrt (B\<^sup>2 - A\<^sup>2) < \<bar>B\<bar>

goal (1 subgoal):
 1. \<bar>sgn B * sqrt (B\<^sup>2 - A\<^sup>2) / A\<bar> < \<bar>- B / A\<bar>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sqrt (B\<^sup>2 - A\<^sup>2) < \<bar>B\<bar>

goal (1 subgoal):
 1. \<bar>sgn B * sqrt (B\<^sup>2 - A\<^sup>2) / A\<bar> < \<bar>- B / A\<bar>
[PROOF STEP]
using assms \<open>B \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
sqrt (B\<^sup>2 - A\<^sup>2) < \<bar>B\<bar>
A\<^sup>2 < B\<^sup>2
A \<noteq> 0
B \<noteq> 0

goal (1 subgoal):
 1. \<bar>sgn B * sqrt (B\<^sup>2 - A\<^sup>2) / A\<bar> < \<bar>- B / A\<bar>
[PROOF STEP]
by (simp add: abs_mult divide_strict_right_mono)
[PROOF STATE]
proof (state)
this:
\<bar>sgn B * sqrt (B\<^sup>2 - A\<^sup>2) / A\<bar> < \<bar>- B / A\<bar>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma invertible_matrix_mult_left_rank':
  fixes A::"'a::{field}^'n::{mod_type}^'m::{mod_type}" and P::"'a^'m::{mod_type}^'m::{mod_type}"
  assumes invertible_P: "invertible P" and B_eq_PA: "B=P**A"
  shows "rank B = rank A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank B = rank A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank B = rank A
[PROOF STEP]
have "rank B = rank (P**A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank B = rank (P ** A)
[PROOF STEP]
using B_eq_PA
[PROOF STATE]
proof (prove)
using this:
B = P ** A

goal (1 subgoal):
 1. rank B = rank (P ** A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rank B = rank (P ** A)

goal (1 subgoal):
 1. rank B = rank A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rank B = rank (P ** A)

goal (1 subgoal):
 1. rank B = rank A
[PROOF STEP]
have "... = rank A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
using invertible_matrix_mult_left_rank[OF invertible_P]
[PROOF STATE]
proof (prove)
using this:
rank (P ** ?A) = rank ?A

goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rank (P ** A) = rank A

goal (1 subgoal):
 1. rank B = rank A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rank B = rank A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rank B = rank A

goal (1 subgoal):
 1. rank B = rank A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rank B = rank A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_add_length_le: "length (poly_add p1 p2) \<le> max (length p1) (length p2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (poly_add p1 p2) \<le> max (length p1) (length p2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (poly_add p1 p2) \<le> max (length p1) (length p2)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (poly_add p1 p2) \<le> max (length p1) (length p2)
[PROOF STEP]
fix p1 p2 :: "'a list"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (poly_add p1 p2) \<le> max (length p1) (length p2)
[PROOF STEP]
assume A: "length p1 \<ge> length p2"
[PROOF STATE]
proof (state)
this:
length p2 \<le> length p1

goal (1 subgoal):
 1. length (poly_add p1 p2) \<le> max (length p1) (length p2)
[PROOF STEP]
let ?p2 = "(replicate (length p1 - length p2) \<zero>) @ p2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (poly_add p1 p2) \<le> max (length p1) (length p2)
[PROOF STEP]
have "length (poly_add p1 p2) \<le> max (length p1) (length p2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (poly_add p1 p2) \<le> max (length p1) (length p2)
[PROOF STEP]
using normalize_length_le[of "map2 (\<oplus>) p1 ?p2"] A
[PROOF STATE]
proof (prove)
using this:
length (local.normalize (map2 (\<oplus>) p1 (replicate (length p1 - length p2) \<zero> @ p2))) \<le> length (map2 (\<oplus>) p1 (replicate (length p1 - length p2) \<zero> @ p2))
length p2 \<le> length p1

goal (1 subgoal):
 1. length (poly_add p1 p2) \<le> max (length p1) (length p2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (poly_add p1 p2) \<le> max (length p1) (length p2)

goal (1 subgoal):
 1. length (poly_add p1 p2) \<le> max (length p1) (length p2)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
length ?p2a2 \<le> length ?p1a2 \<Longrightarrow> length (poly_add ?p1a2 ?p2a2) \<le> max (length ?p1a2) (length ?p2a2)

goal (1 subgoal):
 1. length (poly_add p1 p2) \<le> max (length p1) (length p2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
length ?p2a2 \<le> length ?p1a2 \<Longrightarrow> length (poly_add ?p1a2 ?p2a2) \<le> max (length ?p1a2) (length ?p2a2)

goal (1 subgoal):
 1. length (poly_add p1 p2) \<le> max (length p1) (length p2)
[PROOF STEP]
by (metis le_cases max.commute poly_add.simps)
[PROOF STATE]
proof (state)
this:
length (poly_add p1 p2) \<le> max (length p1) (length p2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma split_cartesian_product_mem_length:
  assumes "a \<in> split_cartesian_product l1 l2 i A B"
  assumes "A \<subseteq> carrier (R\<^bsup>l1\<^esup>)"
  assumes "B \<subseteq> carrier (R\<^bsup>l2\<^esup>)"
  assumes "i \<le> l1"
  shows "length a = l1 + l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length a = l1 + l2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> split_cartesian_product l1 l2 i A B
A \<subseteq> carrier (R\<^bsup>l1\<^esup>)
B \<subseteq> carrier (R\<^bsup>l2\<^esup>)
i \<le> l1

goal (1 subgoal):
 1. length a = l1 + l2
[PROOF STEP]
unfolding split_cartesian_product_def
[PROOF STATE]
proof (prove)
using this:
a \<in> permute_list (scp_permutation l1 l2 i) ` cartesian_product A B
A \<subseteq> carrier (R\<^bsup>l1\<^esup>)
B \<subseteq> carrier (R\<^bsup>l2\<^esup>)
i \<le> l1

goal (1 subgoal):
 1. length a = l1 + l2
[PROOF STEP]
using cartesian_product_closed[of A R l1 B l2] scp_permutes[of i l1 l2]
[PROOF STATE]
proof (prove)
using this:
a \<in> permute_list (scp_permutation l1 l2 i) ` cartesian_product A B
A \<subseteq> carrier (R\<^bsup>l1\<^esup>)
B \<subseteq> carrier (R\<^bsup>l2\<^esup>)
i \<le> l1
\<lbrakk>A \<subseteq> carrier (R\<^bsup>l1\<^esup>); B \<subseteq> carrier (R\<^bsup>l2\<^esup>)\<rbrakk> \<Longrightarrow> cartesian_product A B \<subseteq> carrier (R\<^bsup>l1 + l2\<^esup>)
i \<le> l1 \<Longrightarrow> scp_permutation l1 l2 i permutes {..<l1 + l2}

goal (1 subgoal):
 1. length a = l1 + l2
[PROOF STEP]
by (smt cartesian_power_car_memE imageE in_mono length_permute_list scp_permutation_def)


[STATEMENT]
lemma eventually_times_inverse_1:
  fixes f::"'a \<Rightarrow> 'b::{field,t2_space}"
  assumes "(f \<longlongrightarrow> c) F" "c\<noteq>0"
  shows "\<forall>\<^sub>F x in F. inverse (f x) * f x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. inverse (f x) * f x = (1::'b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. inverse (f x) * f x = (1::'b)
[PROOF STEP]
have "\<forall>\<^sub>F x in F. f x\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<noteq> (0::'b)
[PROOF STEP]
using assms tendsto_imp_eventually_ne
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> c) F
c \<noteq> (0::'b)
\<lbrakk>(?f \<longlongrightarrow> ?c) ?F; ?c \<noteq> ?c'\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F z in ?F. ?f z \<noteq> ?c'

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<noteq> (0::'b)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. f x \<noteq> (0::'b)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. inverse (f x) * f x = (1::'b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. f x \<noteq> (0::'b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x \<noteq> (0::'b)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. inverse (f x) * f x = (1::'b)
[PROOF STEP]
apply (elim eventually_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. f x \<noteq> (0::'b) \<Longrightarrow> inverse (f x) * f x = (1::'b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. inverse (f x) * f x = (1::'b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pmat_extension_mult:
  assumes "m1 \<in> carrier_mat d1 d1"
    and "m2 \<in> carrier_mat d1 d1"
  shows "pmat_extension (m1 * m2) = pmat_extension m1 * pmat_extension m2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmat_extension (m1 * m2) = pmat_extension m1 * pmat_extension m2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat d1 d1
m2 \<in> carrier_mat d1 d1

goal (1 subgoal):
 1. pmat_extension (m1 * m2) = pmat_extension m1 * pmat_extension m2
[PROOF STEP]
by (simp add: pmat_extension_def ptensor_mat_mult[symmetric])


[STATEMENT]
lemma Re_image_box:
  assumes "Re a < Re b" "Im a < Im b"
  shows   "Re ` box a b = {Re a<..<Re b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re ` box a b = {Re a<..<Re b}
[PROOF STEP]
using inner_image_box[of "1::complex" a b] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<in> Basis; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> (\<lambda>x. x \<bullet> 1) ` box a b = {a \<bullet> 1<..<b \<bullet> 1}
Re a < Re b
Im a < Im b

goal (1 subgoal):
 1. Re ` box a b = {Re a<..<Re b}
[PROOF STEP]
by (auto simp: Basis_complex_def)


[STATEMENT]
lemma card_all_edges_betw_neighbor:
  assumes "finite X" "finite Y"
  shows "card (all_edges_between X Y) = (\<Sum>x\<in>X. card (neighbors_ss x Y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_edges_between X Y) = (\<Sum>x\<in>X. card (neighbors_ss x Y))
[PROOF STEP]
using all_edges_betw_sigma_neighbor assms
[PROOF STATE]
proof (prove)
using this:
all_edges_between ?X ?Y = (SIGMA x:?X. neighbors_ss x ?Y)
finite X
finite Y

goal (1 subgoal):
 1. card (all_edges_between X Y) = (\<Sum>x\<in>X. card (neighbors_ss x Y))
[PROOF STEP]
by (simp add: neighbors_ss_def)


[STATEMENT]
lemma jordan_nf_smult: fixes k :: "'a :: field"
  assumes jn: "jordan_nf A n_as"
  and k: "k \<noteq> 0"
  shows "jordan_nf (k \<cdot>\<^sub>m A) (map (\<lambda> (n,a). (n, k * a)) n_as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jordan_nf (k \<cdot>\<^sub>m A) (map (\<lambda>(n, a). (n, k * a)) n_as)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jordan_nf (k \<cdot>\<^sub>m A) (map (\<lambda>(n, a). (n, k * a)) n_as)
[PROOF STEP]
let ?l = "map (\<lambda> (n,a). (n, k * a))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jordan_nf (k \<cdot>\<^sub>m A) (map (\<lambda>(n, a). (n, k * a)) n_as)
[PROOF STEP]
from jn[unfolded jordan_nf_def]
[PROOF STATE]
proof (chain)
picking this:
0 \<notin> fst ` set n_as \<and> similar_mat A (jordan_matrix n_as)
[PROOF STEP]
have sim: "similar_mat A (jordan_matrix n_as)"
[PROOF STATE]
proof (prove)
using this:
0 \<notin> fst ` set n_as \<and> similar_mat A (jordan_matrix n_as)

goal (1 subgoal):
 1. similar_mat A (jordan_matrix n_as)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
similar_mat A (jordan_matrix n_as)

goal (1 subgoal):
 1. jordan_nf (k \<cdot>\<^sub>m A) (map (\<lambda>(n, a). (n, k * a)) n_as)
[PROOF STEP]
from similar_mat_smult[OF this, of k] similar_mat_jordan_matrix_smult[OF k, of n_as]
[PROOF STATE]
proof (chain)
picking this:
similar_mat (k \<cdot>\<^sub>m A) (k \<cdot>\<^sub>m jordan_matrix n_as)
similar_mat (k \<cdot>\<^sub>m jordan_matrix n_as) (jordan_matrix (map (\<lambda>(n, a). (n, k * a)) n_as))
[PROOF STEP]
have "similar_mat (k \<cdot>\<^sub>m A) (jordan_matrix (map (\<lambda>(n, a). (n, k * a)) n_as))"
[PROOF STATE]
proof (prove)
using this:
similar_mat (k \<cdot>\<^sub>m A) (k \<cdot>\<^sub>m jordan_matrix n_as)
similar_mat (k \<cdot>\<^sub>m jordan_matrix n_as) (jordan_matrix (map (\<lambda>(n, a). (n, k * a)) n_as))

goal (1 subgoal):
 1. similar_mat (k \<cdot>\<^sub>m A) (jordan_matrix (map (\<lambda>(n, a). (n, k * a)) n_as))
[PROOF STEP]
using similar_mat_trans
[PROOF STATE]
proof (prove)
using this:
similar_mat (k \<cdot>\<^sub>m A) (k \<cdot>\<^sub>m jordan_matrix n_as)
similar_mat (k \<cdot>\<^sub>m jordan_matrix n_as) (jordan_matrix (map (\<lambda>(n, a). (n, k * a)) n_as))
\<lbrakk>similar_mat ?A ?B; similar_mat ?B ?C\<rbrakk> \<Longrightarrow> similar_mat ?A ?C

goal (1 subgoal):
 1. similar_mat (k \<cdot>\<^sub>m A) (jordan_matrix (map (\<lambda>(n, a). (n, k * a)) n_as))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
similar_mat (k \<cdot>\<^sub>m A) (jordan_matrix (map (\<lambda>(n, a). (n, k * a)) n_as))

goal (1 subgoal):
 1. jordan_nf (k \<cdot>\<^sub>m A) (map (\<lambda>(n, a). (n, k * a)) n_as)
[PROOF STEP]
with jn
[PROOF STATE]
proof (chain)
picking this:
jordan_nf A n_as
similar_mat (k \<cdot>\<^sub>m A) (jordan_matrix (map (\<lambda>(n, a). (n, k * a)) n_as))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
jordan_nf A n_as
similar_mat (k \<cdot>\<^sub>m A) (jordan_matrix (map (\<lambda>(n, a). (n, k * a)) n_as))

goal (1 subgoal):
 1. jordan_nf (k \<cdot>\<^sub>m A) (map (\<lambda>(n, a). (n, k * a)) n_as)
[PROOF STEP]
unfolding jordan_nf_def
[PROOF STATE]
proof (prove)
using this:
0 \<notin> fst ` set n_as \<and> similar_mat A (jordan_matrix n_as)
similar_mat (k \<cdot>\<^sub>m A) (jordan_matrix (map (\<lambda>(n, a). (n, k * a)) n_as))

goal (1 subgoal):
 1. 0 \<notin> fst ` set (map (\<lambda>(n, a). (n, k * a)) n_as) \<and> similar_mat (k \<cdot>\<^sub>m A) (jordan_matrix (map (\<lambda>(n, a). (n, k * a)) n_as))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
jordan_nf (k \<cdot>\<^sub>m A) (map (\<lambda>(n, a). (n, k * a)) n_as)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_binomial_eq_mult_binomial_Suc:
  assumes "k \<le> n"
  shows "real(n choose k) = (n + 1 - k) / (n + 1) * (Suc n choose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (n choose k) = (real n + 1 - real k) / (real n + 1) * real (Suc n choose k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> n

goal (1 subgoal):
 1. real (n choose k) = (real n + 1 - real k) / (real n + 1) * real (Suc n choose k)
[PROOF STEP]
by (simp add: of_nat_binomial_eq_mult_binomial_Suc [of k n] add.commute of_nat_diff)


[STATEMENT]
lemma transpose_zero[simp]: "(transpose A = 0) = (A = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Finite_Cartesian_Product.transpose A = 0) = (A = 0)
[PROOF STEP]
unfolding transpose_def zero_vec_def vec_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i ia. (\<chi>i j. A $ j $ i) $ i $ ia = (\<chi>i ia. (0::'a)) $ i $ ia) = (\<forall>i ia. A $ i $ ia = (\<chi>i ia. (0::'a)) $ i $ ia)
[PROOF STEP]
by auto


[STATEMENT]
lemma iso_compose_rev:
   "\<lbrakk>f \<in> hom G H; g \<in> hom H K; (g \<circ> f) \<in> iso G K\<rbrakk> \<Longrightarrow> f \<in> mon G H \<and> g \<in> epi H K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> hom G H; g \<in> hom H K; g \<circ> f \<in> Group.iso G K\<rbrakk> \<Longrightarrow> f \<in> mon G H \<and> g \<in> epi H K
[PROOF STEP]
unfolding iso_iff_mon_epi
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> hom G H; g \<in> hom H K; g \<circ> f \<in> mon G K \<and> g \<circ> f \<in> epi G K\<rbrakk> \<Longrightarrow> f \<in> mon G H \<and> g \<in> epi H K
[PROOF STEP]
using mon_compose_rev epi_compose_rev
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f \<in> hom ?G ?H; ?g \<in> hom ?H ?K; ?g \<circ> ?f \<in> mon ?G ?K\<rbrakk> \<Longrightarrow> ?f \<in> mon ?G ?H
\<lbrakk>?f \<in> hom ?G ?H; ?g \<in> hom ?H ?K; ?g \<circ> ?f \<in> epi ?G ?K\<rbrakk> \<Longrightarrow> ?g \<in> epi ?H ?K

goal (1 subgoal):
 1. \<lbrakk>f \<in> hom G H; g \<in> hom H K; g \<circ> f \<in> mon G K \<and> g \<circ> f \<in> epi G K\<rbrakk> \<Longrightarrow> f \<in> mon G H \<and> g \<in> epi H K
[PROOF STEP]
by blast


[STATEMENT]
lemma summable_ln_plus:
  fixes f::"nat \<Rightarrow> real"
  assumes "summable f" "\<forall>n. f n>0"
  shows "summable (\<lambda>n. ln (1+f n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. ln (1 + f n))
[PROOF STEP]
proof (rule summable_comparison_test_ev[OF _ assms(1)])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. norm (ln (1 + f n)) \<le> f n
[PROOF STEP]
have "ln (1 + f n) > 0" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < ln (1 + f n)
[PROOF STEP]
by (simp add: assms(2) ln_gt_zero)
[PROOF STATE]
proof (state)
this:
0 < ln (1 + f ?n)

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. norm (ln (1 + f n)) \<le> f n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < ln (1 + f ?n)

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. norm (ln (1 + f n)) \<le> f n
[PROOF STEP]
have "ln (1 + f n) \<le> f n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (1 + f n) \<le> f n
[PROOF STEP]
apply (rule ln_add_one_self_le_self2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 < f n
[PROOF STEP]
using assms(2)[rule_format,of n]
[PROOF STATE]
proof (prove)
using this:
0 < f n

goal (1 subgoal):
 1. - 1 < f n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ln (1 + f ?n) \<le> f ?n

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. norm (ln (1 + f n)) \<le> f n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < ln (1 + f ?n)
ln (1 + f ?n) \<le> f ?n
[PROOF STEP]
show "\<forall>\<^sub>F n in sequentially. norm (ln (1 + f n)) \<le> f n"
[PROOF STATE]
proof (prove)
using this:
0 < ln (1 + f ?n)
ln (1 + f ?n) \<le> f ?n

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. norm (ln (1 + f n)) \<le> f n
[PROOF STEP]
by (auto intro!: eventuallyI simp add:less_imp_le)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. norm (ln (1 + f n)) \<le> f n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lemma_LIMSEQ_incseq_diff_inverse:
  assumes "(\<lambda>n. of_rat (s n)) \<longlonglongrightarrow> x"
  shows " (\<lambda>n. of_rat(s n - 1/of_nat(Suc n))) \<longlonglongrightarrow> (x::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real_of_rat (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. real_of_rat (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> x
[PROOF STEP]
have "(\<lambda>x. real_of_rat (s x) - inverse (real (Suc x))) \<longlonglongrightarrow> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real_of_rat (s x) - inverse (real (Suc x))) \<longlonglongrightarrow> x
[PROOF STEP]
using assms tendsto_diff [OF _ LIMSEQ_inverse_real_of_nat]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. real_of_rat (s n)) \<longlonglongrightarrow> x
?f \<longlonglongrightarrow> ?a \<Longrightarrow> (\<lambda>x. ?f x - inverse (real (Suc x))) \<longlonglongrightarrow> ?a - 0

goal (1 subgoal):
 1. (\<lambda>x. real_of_rat (s x) - inverse (real (Suc x))) \<longlonglongrightarrow> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real_of_rat (s x) - inverse (real (Suc x))) \<longlonglongrightarrow> x

goal (1 subgoal):
 1. (\<lambda>n. real_of_rat (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. real_of_rat (s x) - inverse (real (Suc x))) \<longlonglongrightarrow> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. real_of_rat (s x) - inverse (real (Suc x))) \<longlonglongrightarrow> x

goal (1 subgoal):
 1. (\<lambda>n. real_of_rat (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> x
[PROOF STEP]
by (simp add: divide_inverse  of_rat_diff of_rat_inverse of_rat_add)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. real_of_rat (s n - 1 / rat_of_nat (Suc n))) \<longlonglongrightarrow> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unitary_one:
  shows "unitary ((1\<^sub>m n)::('a::conjugatable_field mat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary (1\<^sub>m n)
[PROOF STEP]
unfolding unitary_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m n \<in> carrier_mat (dim_row (1\<^sub>m n)) (dim_row (1\<^sub>m n)) \<and> inverts_mat (1\<^sub>m n) (adjoint (1\<^sub>m n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1\<^sub>m n \<in> carrier_mat (dim_row (1\<^sub>m n)) (dim_row (1\<^sub>m n)) \<and> inverts_mat (1\<^sub>m n) (adjoint (1\<^sub>m n))
[PROOF STEP]
define I where I_def[simp]: "I \<equiv> ((1\<^sub>m n)::('a::conjugatable_field mat))"
[PROOF STATE]
proof (state)
this:
I \<equiv> 1\<^sub>m n

goal (1 subgoal):
 1. 1\<^sub>m n \<in> carrier_mat (dim_row (1\<^sub>m n)) (dim_row (1\<^sub>m n)) \<and> inverts_mat (1\<^sub>m n) (adjoint (1\<^sub>m n))
[PROOF STEP]
have dim: "I \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
I \<in> carrier_mat n n

goal (1 subgoal):
 1. 1\<^sub>m n \<in> carrier_mat (dim_row (1\<^sub>m n)) (dim_row (1\<^sub>m n)) \<and> inverts_mat (1\<^sub>m n) (adjoint (1\<^sub>m n))
[PROOF STEP]
have "hermitian I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian I
[PROOF STEP]
using hermitian_one
[PROOF STATE]
proof (prove)
using this:
hermitian (1\<^sub>m ?n)

goal (1 subgoal):
 1. hermitian I
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hermitian I

goal (1 subgoal):
 1. 1\<^sub>m n \<in> carrier_mat (dim_row (1\<^sub>m n)) (dim_row (1\<^sub>m n)) \<and> inverts_mat (1\<^sub>m n) (adjoint (1\<^sub>m n))
[PROOF STEP]
hence "adjoint I = I"
[PROOF STATE]
proof (prove)
using this:
hermitian I

goal (1 subgoal):
 1. adjoint I = I
[PROOF STEP]
using hermitian_def
[PROOF STATE]
proof (prove)
using this:
hermitian I
hermitian ?A = (adjoint ?A = ?A)

goal (1 subgoal):
 1. adjoint I = I
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjoint I = I

goal (1 subgoal):
 1. 1\<^sub>m n \<in> carrier_mat (dim_row (1\<^sub>m n)) (dim_row (1\<^sub>m n)) \<and> inverts_mat (1\<^sub>m n) (adjoint (1\<^sub>m n))
[PROOF STEP]
with dim
[PROOF STATE]
proof (chain)
picking this:
I \<in> carrier_mat n n
adjoint I = I
[PROOF STEP]
show "I \<in> carrier_mat (dim_row I) (dim_row I) \<and> inverts_mat I (adjoint I)"
[PROOF STATE]
proof (prove)
using this:
I \<in> carrier_mat n n
adjoint I = I

goal (1 subgoal):
 1. I \<in> carrier_mat (dim_row I) (dim_row I) \<and> inverts_mat I (adjoint I)
[PROOF STEP]
unfolding inverts_mat_def
[PROOF STATE]
proof (prove)
using this:
I \<in> carrier_mat n n
adjoint I = I

goal (1 subgoal):
 1. I \<in> carrier_mat (dim_row I) (dim_row I) \<and> I * adjoint I = 1\<^sub>m (dim_row I)
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
I \<in> carrier_mat n n
adjoint I = I
I \<in> carrier_mat n n

goal (1 subgoal):
 1. I \<in> carrier_mat (dim_row I) (dim_row I) \<and> I * adjoint I = 1\<^sub>m (dim_row I)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
I \<in> carrier_mat (dim_row I) (dim_row I) \<and> inverts_mat I (adjoint I)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_polytope_faces:
  fixes S :: "'a::euclidean_space set"
  assumes "polytope S"
  shows "finite {F. F face_of S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {F. F face_of S}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {F. F face_of S}
[PROOF STEP]
obtain v where "finite v" "S = convex hull v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v. \<lbrakk>finite v; S = convex hull v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms polytope_def
[PROOF STATE]
proof (prove)
using this:
polytope S
polytope ?S \<equiv> \<exists>v. finite v \<and> ?S = convex hull v

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>finite v; S = convex hull v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite v
S = convex hull v

goal (1 subgoal):
 1. finite {F. F face_of S}
[PROOF STEP]
have "finite ((hull) convex ` {T. T \<subseteq> v})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((hull) convex ` {T. T \<subseteq> v})
[PROOF STEP]
by (simp add: \<open>finite v\<close>)
[PROOF STATE]
proof (state)
this:
finite ((hull) convex ` {T. T \<subseteq> v})

goal (1 subgoal):
 1. finite {F. F face_of S}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite ((hull) convex ` {T. T \<subseteq> v})

goal (1 subgoal):
 1. finite {F. F face_of S}
[PROOF STEP]
have "{F. F face_of S} \<subseteq> ((hull) convex ` {T. T \<subseteq> v})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {F. F face_of S} \<subseteq> (hull) convex ` {T. T \<subseteq> v}
[PROOF STEP]
by (metis (no_types, lifting) \<open>finite v\<close> \<open>S = convex hull v\<close> face_of_convex_hull_subset finite_imp_compact image_eqI mem_Collect_eq subsetI)
[PROOF STATE]
proof (state)
this:
{F. F face_of S} \<subseteq> (hull) convex ` {T. T \<subseteq> v}

goal (1 subgoal):
 1. finite {F. F face_of S}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite ((hull) convex ` {T. T \<subseteq> v})
{F. F face_of S} \<subseteq> (hull) convex ` {T. T \<subseteq> v}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite ((hull) convex ` {T. T \<subseteq> v})
{F. F face_of S} \<subseteq> (hull) convex ` {T. T \<subseteq> v}

goal (1 subgoal):
 1. finite {F. F face_of S}
[PROOF STEP]
by (blast intro: finite_subset)
[PROOF STATE]
proof (state)
this:
finite {F. F face_of S}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_geometric_iff [simp]: "summable (\<lambda>n. c ^ n) \<longleftrightarrow> norm c < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable ((^) c) = (norm c < 1)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. summable ((^) c) \<Longrightarrow> norm c < 1
 2. norm c < 1 \<Longrightarrow> summable ((^) c)
[PROOF STEP]
assume "summable (\<lambda>n. c ^ n :: 'a :: real_normed_field)"
[PROOF STATE]
proof (state)
this:
summable ((^) c)

goal (2 subgoals):
 1. summable ((^) c) \<Longrightarrow> norm c < 1
 2. norm c < 1 \<Longrightarrow> summable ((^) c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
summable ((^) c)
[PROOF STEP]
have "(\<lambda>n. norm c ^ n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
summable ((^) c)

goal (1 subgoal):
 1. (^) (norm c) \<longlonglongrightarrow> 0
[PROOF STEP]
by (simp add: norm_power [symmetric] tendsto_norm_zero_iff summable_LIMSEQ_zero)
[PROOF STATE]
proof (state)
this:
(^) (norm c) \<longlonglongrightarrow> 0

goal (2 subgoals):
 1. summable ((^) c) \<Longrightarrow> norm c < 1
 2. norm c < 1 \<Longrightarrow> summable ((^) c)
[PROOF STEP]
from order_tendstoD(2)[OF this zero_less_one]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in sequentially. norm c ^ x < 1
[PROOF STEP]
obtain n where "norm c ^ n < 1"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in sequentially. norm c ^ x < 1

goal (1 subgoal):
 1. (\<And>n. norm c ^ n < 1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: eventually_at_top_linorder)
[PROOF STATE]
proof (state)
this:
norm c ^ n < 1

goal (2 subgoals):
 1. summable ((^) c) \<Longrightarrow> norm c < 1
 2. norm c < 1 \<Longrightarrow> summable ((^) c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm c ^ n < 1
[PROOF STEP]
show "norm c < 1"
[PROOF STATE]
proof (prove)
using this:
norm c ^ n < 1

goal (1 subgoal):
 1. norm c < 1
[PROOF STEP]
using one_le_power[of "norm c" n]
[PROOF STATE]
proof (prove)
using this:
norm c ^ n < 1
1 \<le> norm c \<Longrightarrow> 1 \<le> norm c ^ n

goal (1 subgoal):
 1. norm c < 1
[PROOF STEP]
by (cases "norm c \<ge> 1") (linarith, simp)
[PROOF STATE]
proof (state)
this:
norm c < 1

goal (1 subgoal):
 1. norm c < 1 \<Longrightarrow> summable ((^) c)
[PROOF STEP]
qed (rule summable_geometric)


[STATEMENT]
lemma UNIV_orthogonal_complement_decomposition:
  fixes S::"'a::{euclidean_space} set"
  assumes s: "subspace S"
  shows "UNIV = S + (orthogonal_complement S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = S + orthogonal_complement S
[PROOF STEP]
proof (unfold set_plus_def, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. x = a + b
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. x = a + b
[PROOF STEP]
obtain X where ind_X: "independent X"
    and X: "X \<subseteq> S"
    and span_X: "S \<subseteq> span X"
    and o: "pairwise orthogonal X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. \<lbrakk>independent X; X \<subseteq> S; S \<subseteq> span X; pairwise orthogonal X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis order_refl orthonormal_basis_subspace s)
[PROOF STATE]
proof (state)
this:
independent X
X \<subseteq> S
S \<subseteq> span X
pairwise orthogonal X

goal (1 subgoal):
 1. \<And>x. \<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. x = a + b
[PROOF STEP]
have finite_X: "finite X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite X
[PROOF STEP]
by (metis independent_bound_general ind_X)
[PROOF STATE]
proof (state)
this:
finite X

goal (1 subgoal):
 1. \<And>x. \<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. x = a + b
[PROOF STEP]
let ?p="proj_onto v X"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. x = a + b
[PROOF STEP]
have "v=?p +(v-?p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = proj_onto v X + (v - proj_onto v X)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
v = proj_onto v X + (v - proj_onto v X)

goal (1 subgoal):
 1. \<And>x. \<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. x = a + b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
v = proj_onto v X + (v - proj_onto v X)

goal (1 subgoal):
 1. \<And>x. \<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. x = a + b
[PROOF STEP]
have "?p \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_onto v X \<in> S
[PROOF STEP]
unfolding proj_onto_def proj_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>u\<in>X. (v \<bullet> u / (u \<bullet> u)) *\<^sub>R u) \<in> S
[PROOF STEP]
by (rule subspace_sum[OF s])
      (simp add: X s rev_subsetD subspace_mul)
[PROOF STATE]
proof (state)
this:
proj_onto v X \<in> S

goal (1 subgoal):
 1. \<And>x. \<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. x = a + b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
proj_onto v X \<in> S

goal (1 subgoal):
 1. \<And>x. \<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. x = a + b
[PROOF STEP]
have "(v-?p) \<in> orthogonal_complement S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v - proj_onto v X \<in> orthogonal_complement S
[PROOF STEP]
by (rule v_minus_p_orthogonal_complement[OF s ind_X X span_X o])
[PROOF STATE]
proof (state)
this:
v - proj_onto v X \<in> orthogonal_complement S

goal (1 subgoal):
 1. \<And>x. \<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. x = a + b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
v = proj_onto v X + (v - proj_onto v X)
proj_onto v X \<in> S
v - proj_onto v X \<in> orthogonal_complement S
[PROOF STEP]
show "\<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. v = a + b"
[PROOF STATE]
proof (prove)
using this:
v = proj_onto v X + (v - proj_onto v X)
proj_onto v X \<in> S
v - proj_onto v X \<in> orthogonal_complement S

goal (1 subgoal):
 1. \<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. v = a + b
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>S. \<exists>b\<in>orthogonal_complement S. v = a + b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_all_edges_between_commute:
  "card (all_edges_between X Y) = card (all_edges_between Y X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_edges_between X Y) = card (all_edges_between Y X)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (all_edges_between X Y) = card (all_edges_between Y X)
[PROOF STEP]
have "inj_on (\<lambda>(x, y). (y, x)) A" for A :: "(nat*nat)set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>(x, y). (y, x)) A
[PROOF STEP]
by (auto simp: inj_on_def)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>(x, y). (y, x)) ?A

goal (1 subgoal):
 1. card (all_edges_between X Y) = card (all_edges_between Y X)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj_on (\<lambda>(x, y). (y, x)) ?A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>(x, y). (y, x)) ?A

goal (1 subgoal):
 1. card (all_edges_between X Y) = card (all_edges_between Y X)
[PROOF STEP]
using all_edges_between_swap [of X Y] card_image
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>(x, y). (y, x)) ?A
all_edges_between X Y = (\<lambda>(x, y). (y, x)) ` all_edges_between Y X
inj_on ?f ?A \<Longrightarrow> card (?f ` ?A) = card ?A

goal (1 subgoal):
 1. card (all_edges_between X Y) = card (all_edges_between Y X)
[PROOF STEP]
by (metis swap_inj_on)
[PROOF STATE]
proof (state)
this:
card (all_edges_between X Y) = card (all_edges_between Y X)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma per_col_mult_adjoint:
  assumes "A \<in> carrier_mat n n"
  and "i < n"
  and "j < n"
  and "f i < n"
  and "f j < n"
shows "((Complex_Matrix.adjoint (per_col A f)) * (per_col A f))$$(i,j) =
  ((Complex_Matrix.adjoint A) * A)$$(f i, f j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
have "((Complex_Matrix.adjoint (per_col A f)) * (per_col A f))$$(i,j) =
    Matrix.scalar_prod (Matrix.row (Complex_Matrix.adjoint (per_col A f)) i)
      (Matrix.col A (f j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = Matrix.row (Complex_Matrix.adjoint (per_col A f)) i \<bullet> Matrix.col A (f j)
[PROOF STEP]
using assms per_col_col
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
i < n
j < n
f i < n
f j < n
\<lbrakk>?A \<in> carrier_mat ?n ?m; ?j < ?m\<rbrakk> \<Longrightarrow> Matrix.col (per_col ?A ?f) ?j = Matrix.col ?A (?f ?j)

goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = Matrix.row (Complex_Matrix.adjoint (per_col A f)) i \<bullet> Matrix.col A (f j)
[PROOF STEP]
unfolding times_mat_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
i < n
j < n
f i < n
f j < n
\<lbrakk>?A \<in> carrier_mat ?n ?m; ?j < ?m\<rbrakk> \<Longrightarrow> Matrix.col (per_col ?A ?f) ?j = Matrix.col ?A (?f ?j)

goal (1 subgoal):
 1. Matrix.mat (dim_row (Complex_Matrix.adjoint (per_col A f))) (dim_col (per_col A f)) (\<lambda>(i, j). Matrix.row (Complex_Matrix.adjoint (per_col A f)) i \<bullet> Matrix.col (per_col A f) j) $$ (i, j) = Matrix.row (Complex_Matrix.adjoint (per_col A f)) i \<bullet> Matrix.col A (f j)
[PROOF STEP]
by (metis adjoint_dim_row carrier_matD(2) dim_col_mat(1) index_mat(1)
        old.prod.case per_col_def)
[PROOF STATE]
proof (state)
this:
(Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = Matrix.row (Complex_Matrix.adjoint (per_col A f)) i \<bullet> Matrix.col A (f j)

goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = Matrix.row (Complex_Matrix.adjoint (per_col A f)) i \<bullet> Matrix.col A (f j)

goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
have "... = Matrix.scalar_prod
      (Matrix.row (Complex_Matrix.adjoint A) (f i))
      (Matrix.col A (f j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i \<bullet> Matrix.col A (f j) = Matrix.row (Complex_Matrix.adjoint A) (f i) \<bullet> Matrix.col A (f j)
[PROOF STEP]
using assms per_col_adjoint_row
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
i < n
j < n
f i < n
f j < n
\<lbrakk>?A \<in> carrier_mat ?n ?n; ?i < ?n; ?f ?i < ?n\<rbrakk> \<Longrightarrow> Matrix.row (Complex_Matrix.adjoint (per_col ?A ?f)) ?i = Matrix.row (Complex_Matrix.adjoint ?A) (?f ?i)

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint (per_col A f)) i \<bullet> Matrix.col A (f j) = Matrix.row (Complex_Matrix.adjoint A) (f i) \<bullet> Matrix.col A (f j)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
Matrix.row (Complex_Matrix.adjoint (per_col A f)) i \<bullet> Matrix.col A (f j) = Matrix.row (Complex_Matrix.adjoint A) (f i) \<bullet> Matrix.col A (f j)

goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Matrix.row (Complex_Matrix.adjoint (per_col A f)) i \<bullet> Matrix.col A (f j) = Matrix.row (Complex_Matrix.adjoint A) (f i) \<bullet> Matrix.col A (f j)

goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
have "... = ((Complex_Matrix.adjoint A) * A)$$(f i, f j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint A) (f i) \<bullet> Matrix.col A (f j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
i < n
j < n
f i < n
f j < n

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint A) (f i) \<bullet> Matrix.col A (f j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
unfolding times_mat_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
i < n
j < n
f i < n
f j < n

goal (1 subgoal):
 1. Matrix.row (Complex_Matrix.adjoint A) (f i) \<bullet> Matrix.col A (f j) = Matrix.mat (dim_row (Complex_Matrix.adjoint A)) (dim_col A) (\<lambda>(i, j). Matrix.row (Complex_Matrix.adjoint A) i \<bullet> Matrix.col A j) $$ (f i, f j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix.row (Complex_Matrix.adjoint A) (f i) \<bullet> Matrix.col A (f j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)

goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)

goal (1 subgoal):
 1. (Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(Complex_Matrix.adjoint (per_col A f) * per_col A f) $$ (i, j) = (Complex_Matrix.adjoint A * A) $$ (f i, f j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ports_to_set: "ports_to_set pts = \<Union> {{s..e} | s e . (s,e) \<in> set pts}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ports_to_set pts = \<Union> {{s..e} |s e. (s, e) \<in> set pts}
[PROOF STEP]
proof(induction pts)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ports_to_set [] = \<Union> {{s..e} |s e. (s, e) \<in> set []}
 2. \<And>a pts. ports_to_set pts = \<Union> {{s..e} |s e. (s, e) \<in> set pts} \<Longrightarrow> ports_to_set (a # pts) = \<Union> {{s..e} |s e. (s, e) \<in> set (a # pts)}
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. ports_to_set [] = \<Union> {{s..e} |s e. (s, e) \<in> set []}
 2. \<And>a pts. ports_to_set pts = \<Union> {{s..e} |s e. (s, e) \<in> set pts} \<Longrightarrow> ports_to_set (a # pts) = \<Union> {{s..e} |s e. (s, e) \<in> set (a # pts)}
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ports_to_set [] = \<Union> {{s..e} |s e. (s, e) \<in> set []}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ports_to_set [] = \<Union> {{s..e} |s e. (s, e) \<in> set []}

goal (1 subgoal):
 1. \<And>a pts. ports_to_set pts = \<Union> {{s..e} |s e. (s, e) \<in> set pts} \<Longrightarrow> ports_to_set (a # pts) = \<Union> {{s..e} |s e. (s, e) \<in> set (a # pts)}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a pts. ports_to_set pts = \<Union> {{s..e} |s e. (s, e) \<in> set pts} \<Longrightarrow> ports_to_set (a # pts) = \<Union> {{s..e} |s e. (s, e) \<in> set (a # pts)}
[PROOF STEP]
case (Cons p pts)
[PROOF STATE]
proof (state)
this:
ports_to_set pts = \<Union> {{s..e} |s e. (s, e) \<in> set pts}

goal (1 subgoal):
 1. \<And>a pts. ports_to_set pts = \<Union> {{s..e} |s e. (s, e) \<in> set pts} \<Longrightarrow> ports_to_set (a # pts) = \<Union> {{s..e} |s e. (s, e) \<in> set (a # pts)}
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
ports_to_set pts = \<Union> {{s..e} |s e. (s, e) \<in> set pts}

goal (1 subgoal):
 1. ports_to_set (p # pts) = \<Union> {{s..e} |s e. (s, e) \<in> set (p # pts)}
[PROOF STEP]
by(cases p, simp, blast)
[PROOF STATE]
proof (state)
this:
ports_to_set (p # pts) = \<Union> {{s..e} |s e. (s, e) \<in> set (p # pts)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma content_le_lead_coeff: "abs (content (f :: int poly)) \<le> abs (lead_coeff f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
[PROOF STEP]
proof (cases "f = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f = 0 \<Longrightarrow> \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
 2. f \<noteq> 0 \<Longrightarrow> \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f \<noteq> 0

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
 2. f \<noteq> 0 \<Longrightarrow> \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
[PROOF STEP]
from content_dvd_coeff[of f "degree f"]
[PROOF STATE]
proof (chain)
picking this:
content f dvd lead_coeff f
[PROOF STEP]
have "abs (content f) dvd abs (lead_coeff f)"
[PROOF STATE]
proof (prove)
using this:
content f dvd lead_coeff f

goal (1 subgoal):
 1. \<bar>content f\<bar> dvd \<bar>lead_coeff f\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>content f\<bar> dvd \<bar>lead_coeff f\<bar>

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
 2. f \<noteq> 0 \<Longrightarrow> \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<bar>content f\<bar> dvd \<bar>lead_coeff f\<bar>

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
 2. f \<noteq> 0 \<Longrightarrow> \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
[PROOF STEP]
have "abs (lead_coeff f) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>lead_coeff f\<bar> \<noteq> 0
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0

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

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
 2. f \<noteq> 0 \<Longrightarrow> \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<bar>content f\<bar> dvd \<bar>lead_coeff f\<bar>
\<bar>lead_coeff f\<bar> \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>content f\<bar> dvd \<bar>lead_coeff f\<bar>
\<bar>lead_coeff f\<bar> \<noteq> 0

goal (1 subgoal):
 1. \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
[PROOF STEP]
by (smt dvd_imp_le_int)
[PROOF STATE]
proof (state)
this:
\<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>

goal (1 subgoal):
 1. f = 0 \<Longrightarrow> \<bar>content f\<bar> \<le> \<bar>lead_coeff f\<bar>
[PROOF STEP]
qed auto


[STATEMENT]
theorem not_disjoint_implies_equal:
  assumes not_disjoint: "Class a \<inter> Class b \<noteq> {}"
  assumes closed: "a \<in> S" "b \<in> S"
  shows "Class a = Class b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Class a = Class b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Class a = Class b
[PROOF STEP]
from not_disjoint and closed
[PROOF STATE]
proof (chain)
picking this:
Class a \<inter> Class b \<noteq> {}
a \<in> S
b \<in> S
[PROOF STEP]
obtain c where witness: "c \<in> Class a \<inter> Class b"
[PROOF STATE]
proof (prove)
using this:
Class a \<inter> Class b \<noteq> {}
a \<in> S
b \<in> S

goal (1 subgoal):
 1. (\<And>c. c \<in> Class a \<inter> Class b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
c \<in> Class a \<inter> Class b

goal (1 subgoal):
 1. Class a = Class b
[PROOF STEP]
with closed
[PROOF STATE]
proof (chain)
picking this:
a \<in> S
b \<in> S
c \<in> Class a \<inter> Class b
[PROOF STEP]
have "(a, c) \<in> E"
[PROOF STATE]
proof (prove)
using this:
a \<in> S
b \<in> S
c \<in> Class a \<inter> Class b

goal (1 subgoal):
 1. (a, c) \<in> E
[PROOF STEP]
by (blast intro: symmetric)
[PROOF STATE]
proof (state)
this:
(a, c) \<in> E

goal (1 subgoal):
 1. Class a = Class b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a, c) \<in> E

goal (1 subgoal):
 1. Class a = Class b
[PROOF STEP]
from witness and closed
[PROOF STATE]
proof (chain)
picking this:
c \<in> Class a \<inter> Class b
a \<in> S
b \<in> S
[PROOF STEP]
have "(c, b) \<in> E"
[PROOF STATE]
proof (prove)
using this:
c \<in> Class a \<inter> Class b
a \<in> S
b \<in> S

goal (1 subgoal):
 1. (c, b) \<in> E
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
(c, b) \<in> E

goal (1 subgoal):
 1. Class a = Class b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(a, b) \<in> E
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> E

goal (1 subgoal):
 1. Class a = Class b
[PROOF STEP]
by (rule Class_eq)
[PROOF STATE]
proof (state)
this:
Class a = Class b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_same_affine_hull [simp]:
  fixes S :: "'n::euclidean_space set"
  shows "affine hull (closure S) = affine hull S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull closure S = affine hull S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. affine hull closure S = affine hull S
[PROOF STEP]
have "affine hull (closure S) \<subseteq> affine hull S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull closure S \<subseteq> affine hull S
[PROOF STEP]
using hull_mono[of "closure S" "affine hull S" "affine"]
      closure_affine_hull[of S] hull_hull[of "affine" S]
[PROOF STATE]
proof (prove)
using this:
closure S \<subseteq> affine hull S \<Longrightarrow> affine hull closure S \<subseteq> affine hull (affine hull S)
closure S \<subseteq> affine hull S
affine hull (affine hull S) = affine hull S

goal (1 subgoal):
 1. affine hull closure S \<subseteq> affine hull S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine hull closure S \<subseteq> affine hull S

goal (1 subgoal):
 1. affine hull closure S = affine hull S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
affine hull closure S \<subseteq> affine hull S

goal (1 subgoal):
 1. affine hull closure S = affine hull S
[PROOF STEP]
have "affine hull (closure S) \<supseteq> affine hull S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull S \<subseteq> affine hull closure S
[PROOF STEP]
using hull_mono[of "S" "closure S" "affine"] closure_subset
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> closure S \<Longrightarrow> affine hull S \<subseteq> affine hull closure S
?S \<subseteq> closure ?S

goal (1 subgoal):
 1. affine hull S \<subseteq> affine hull closure S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine hull S \<subseteq> affine hull closure S

goal (1 subgoal):
 1. affine hull closure S = affine hull S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
affine hull closure S \<subseteq> affine hull S
affine hull S \<subseteq> affine hull closure S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
affine hull closure S \<subseteq> affine hull S
affine hull S \<subseteq> affine hull closure S

goal (1 subgoal):
 1. affine hull closure S = affine hull S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine hull closure S = affine hull S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vderiv_on_exp_scaleRlI[poly_derivatives]:
  assumes "D f = f' on T" and "g' = (\<lambda>x. f' x *\<^sub>R exp (f x *\<^sub>R A) * A)"
  shows "D (\<lambda>x. exp (f x *\<^sub>R A)) = g' on T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1.  D (\<lambda>x. exp (f x *\<^sub>R A)) = g' on T
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
 D f = f' on T
g' = (\<lambda>x. f' x *\<^sub>R exp (f x *\<^sub>R A) * A)

goal (1 subgoal):
 1.  D (\<lambda>x. exp (f x *\<^sub>R A)) = g' on T
[PROOF STEP]
unfolding has_vderiv_on_def has_vector_derivative_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>T. D f \<mapsto> (\<lambda>xa. xa *\<^sub>R f' x) at x within T
g' = (\<lambda>x. f' x *\<^sub>R exp (f x *\<^sub>R A) * A)

goal (1 subgoal):
 1. \<forall>x\<in>T. D (\<lambda>x. exp (f x *\<^sub>R A)) \<mapsto> (\<lambda>xa. xa *\<^sub>R g' x) at x within T
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x\<in>T. D f \<mapsto> (\<lambda>xa. xa * f' x) at x within T; g' = (\<lambda>x. f' x *\<^sub>R (exp (f x *\<^sub>R A) * A)); x \<in> T\<rbrakk> \<Longrightarrow> D (\<lambda>x. exp (f x *\<^sub>R A)) \<mapsto> (\<lambda>xa. (xa * f' x) *\<^sub>R (exp (f x *\<^sub>R A) * A)) at x within T
[PROOF STEP]
by (rule has_derivative_exp_scaleRl, auto simp: fun_eq_iff)


[STATEMENT]
lemma conjugate_exponent_real_iff:
  assumes "p > (1::real)"
  shows "q = conjugate_exponent p \<longleftrightarrow> (1/p + 1/q = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (q = conjugate_exponent p) = (1 / p + 1 / q = 1)
[PROOF STEP]
unfolding conjugate_exponent_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (q = 1 + 1 / (p - 1)) = (1 / p + 1 / q = 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < p

goal (1 subgoal):
 1. (q = 1 + 1 / (p - 1)) = (1 / p + 1 / q = 1)
[PROOF STEP]
by (auto simp add: algebra_simps divide_simps)


[STATEMENT]
lemma sin_integer_2pi: "n \<in> \<int> \<Longrightarrow> sin(2 * pi * n) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<in> \<int> \<Longrightarrow> sin (2 * pi * n) = 0
[PROOF STEP]
by (metis sin_two_pi Ints_mult mult.assoc mult.commute sin_times_pi_eq_0)


[STATEMENT]
lemma finiteRelationCharacterization:
  "(finite (Domain Q) & finite (Range Q)) = finite Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (finite (Domain Q) \<and> finite (Range Q)) = finite Q
[PROOF STEP]
using rev_finite_subset finite_SigmaI lm095 finite_Domain finite_Range
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> finite ?A
\<lbrakk>finite ?A; \<And>a. a \<in> ?A \<Longrightarrow> finite (?B a)\<rbrakk> \<Longrightarrow> finite (Sigma ?A ?B)
?R \<subseteq> Domain ?R \<times> Range ?R
finite ?r \<Longrightarrow> finite (Domain ?r)
finite ?r \<Longrightarrow> finite (Range ?r)

goal (1 subgoal):
 1. (finite (Domain Q) \<and> finite (Range Q)) = finite Q
[PROOF STEP]
by metis


[STATEMENT]
lemma Im_complex_div_lemma: "Im((1 - \<i>*z) / (1 + \<i>*z)) = 0 \<longleftrightarrow> Re z = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Im ((1 - \<i> * z) / (1 + \<i> * z)) = 0) = (Re z = 0)
[PROOF STEP]
by (auto simp: Im_complex_div_eq_0 algebra_simps)


[STATEMENT]
theorem (in state_space)
  shows "\<Gamma>\<turnstile> \<lbrace>True\<rbrace>
           \<acute>S :== 0;; \<acute>I :== 1;;
           WHILE \<acute>I \<noteq> n
           DO
             \<acute>S :== \<acute>S + \<acute>I;;
             \<acute>I :== \<acute>I + 1
           OD
           \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>"
  (is "\<Gamma>\<turnstile> _ (_;; ?while) _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
let ?sum = "\<lambda>k. SUMM j<k. j"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
let ?inv = "\<lambda>s i. s = ?sum i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
have "\<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>?inv \<acute>S \<acute>I\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
have "True \<longrightarrow> 0 = ?sum 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. True \<longrightarrow> 0 = (SUMM j<1. j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
True \<longrightarrow> 0 = (SUMM j<1. j)

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
True \<longrightarrow> 0 = (SUMM j<1. j)

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
have "\<Gamma>\<turnstile> \<lbrace>\<dots>\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>?inv \<acute>S \<acute>I\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>0 = (SUMM j<1. j)\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
by vcg
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>0 = (SUMM j<1. j)\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
have "\<Gamma>\<turnstile> \<lbrace>?inv \<acute>S \<acute>I\<rbrace> ?while \<lbrace>?inv \<acute>S \<acute>I \<and> \<not> \<acute>I \<noteq> n\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace> WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<not> \<acute>I \<noteq> n\<rbrace>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<acute>I \<noteq> n\<rbrace> \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
let ?body = "\<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<acute>I \<noteq> n\<rbrace> \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
have "\<And>s i. ?inv s i \<and> i \<noteq> n \<longrightarrow>  ?inv (s + i) (i + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s i. s = (SUMM j<i. j) \<and> i \<noteq> n \<longrightarrow> s + i = (SUMM j<i + 1. j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?s1 = (SUMM j<?i1. j) \<and> ?i1 \<noteq> n \<longrightarrow> ?s1 + ?i1 = (SUMM j<?i1 + 1. j)

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<acute>I \<noteq> n\<rbrace> \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
?s1 = (SUMM j<?i1. j) \<and> ?i1 \<noteq> n \<longrightarrow> ?s1 + ?i1 = (SUMM j<?i1 + 1. j)

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<acute>I \<noteq> n\<rbrace> \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
have "\<Gamma>\<turnstile> \<lbrace>\<acute>S + \<acute>I = ?sum (\<acute>I + 1)\<rbrace> ?body \<lbrace>?inv \<acute>S \<acute>I\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S + \<acute>I = (SUMM j<\<acute>I + 1. j)\<rbrace> \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
by vcg
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S + \<acute>I = (SUMM j<\<acute>I + 1. j)\<rbrace> \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<acute>I \<noteq> n\<rbrace> \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<acute>I \<noteq> n\<rbrace> \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
show "\<Gamma>\<turnstile> \<lbrace>?inv \<acute>S \<acute>I \<and> \<acute>I \<noteq> n\<rbrace> ?body \<lbrace>?inv \<acute>S \<acute>I\<rbrace>"
[PROOF STATE]
proof (prove)
using this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<acute>I \<noteq> n\<rbrace> \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<acute>I \<noteq> n\<rbrace> \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<acute>I \<noteq> n\<rbrace> \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace> WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<not> \<acute>I \<noteq> n\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace> WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<\<acute>I. j) \<and> \<not> \<acute>I \<noteq> n\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
have "\<And>s i. s = ?sum i \<and> \<not> i \<noteq> n \<longrightarrow> s = ?sum n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s i. s = (SUMM j<i. j) \<and> \<not> i \<noteq> n \<longrightarrow> s = (SUMM j<n. j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?s = (SUMM j<?i. j) \<and> \<not> ?i \<noteq> n \<longrightarrow> ?s = (SUMM j<n. j)

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>

goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_integral_0_cbox_imp_0:
  fixes f :: "'a::euclidean_space \<Rightarrow> real"
  assumes "continuous_on (cbox a b) f" and "\<And>x. x \<in> box a b \<Longrightarrow> 0 \<le> f x"
  assumes "(f has_integral 0) (cbox a b)"
  assumes ne: "box a b \<noteq> {}"
  assumes x: "x \<in> cbox a b"
  shows "f x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
have "0 < emeasure lborel (box a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < emeasure lborel (box a b)
[PROOF STEP]
using ne x
[PROOF STATE]
proof (prove)
using this:
box a b \<noteq> {}
x \<in> cbox a b

goal (1 subgoal):
 1. 0 < emeasure lborel (box a b)
[PROOF STEP]
unfolding emeasure_lborel_box_eq
[PROOF STATE]
proof (prove)
using this:
box a b \<noteq> {}
x \<in> cbox a b

goal (1 subgoal):
 1. 0 < ennreal (if \<forall>ba\<in>Basis. a \<bullet> ba \<le> b \<bullet> ba then prod ((\<bullet>) (b - a)) Basis else 0)
[PROOF STEP]
by (force intro!: prod_pos simp: mem_box algebra_simps)
[PROOF STATE]
proof (state)
this:
0 < emeasure lborel (box a b)

goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < emeasure lborel (box a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < emeasure lborel (box a b)

goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < emeasure lborel (box a b)
continuous_on (cbox a b) f
?x \<in> box a b \<Longrightarrow> 0 \<le> f ?x
(f has_integral 0) (cbox a b)
box a b \<noteq> {}
x \<in> cbox a b

goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
by (intro has_integral_0_closure_imp_0[of "box a b" f x])
      (auto simp: emeasure_lborel_box_eq emeasure_lborel_cbox_eq algebra_simps mem_box)
[PROOF STATE]
proof (state)
this:
f x = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma totient_prime_power_Suc:
  assumes "prime p"
  shows   "totient (p ^ Suc n) = p ^ Suc n - p ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient (p ^ Suc n) = p ^ Suc n - p ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. totient (p ^ Suc n) = p ^ Suc n - p ^ n
[PROOF STEP]
have "totient (p ^ Suc n) = p ^ Suc n - card ((*) p ` {0<..p ^ n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient (p ^ Suc n) = p ^ Suc n - card ((*) p ` {0<..p ^ n})
[PROOF STEP]
unfolding totient_def totatives_prime_power_Suc[OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({0<..p ^ Suc n} - (*) p ` {0<..p ^ n}) = p ^ Suc n - card ((*) p ` {0<..p ^ n})
[PROOF STEP]
by (subst card_Diff_subset) (insert assms, auto simp: prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
totient (p ^ Suc n) = p ^ Suc n - card ((*) p ` {0<..p ^ n})

goal (1 subgoal):
 1. totient (p ^ Suc n) = p ^ Suc n - p ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
totient (p ^ Suc n) = p ^ Suc n - card ((*) p ` {0<..p ^ n})

goal (1 subgoal):
 1. totient (p ^ Suc n) = p ^ Suc n - p ^ n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime p
[PROOF STEP]
have "card ((*) p ` {0<..p^n}) = p ^ n"
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. card ((*) p ` {0<..p ^ n}) = p ^ n
[PROOF STEP]
by (subst card_image) (auto simp: inj_on_def)
[PROOF STATE]
proof (state)
this:
card ((*) p ` {0<..p ^ n}) = p ^ n

goal (1 subgoal):
 1. totient (p ^ Suc n) = p ^ Suc n - p ^ n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
totient (p ^ Suc n) = p ^ Suc n - p ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
totient (p ^ Suc n) = p ^ Suc n - p ^ n

goal (1 subgoal):
 1. totient (p ^ Suc n) = p ^ Suc n - p ^ n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
totient (p ^ Suc n) = p ^ Suc n - p ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem H3:
  assumes h1: "\<turnstile> \<box>[P \<longrightarrow> Q]_v" and h2: "\<turnstile> \<box>[Q \<longrightarrow> R]_v"
  shows "\<turnstile> \<box>[P \<longrightarrow> R]_v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<box>[P \<longrightarrow> R]_v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<turnstile> \<box>[P \<longrightarrow> R]_v
[PROOF STEP]
have "|~ (P \<longrightarrow> Q) \<longrightarrow> (Q \<longrightarrow> R) \<longrightarrow> (P \<longrightarrow> R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |~ (P \<longrightarrow> Q) \<longrightarrow> (Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
|~ (P \<longrightarrow> Q) \<longrightarrow> (Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R

goal (1 subgoal):
 1. \<turnstile> \<box>[P \<longrightarrow> R]_v
[PROOF STEP]
hence "\<turnstile> \<box>[(P \<longrightarrow> Q) \<longrightarrow> (Q \<longrightarrow> R) \<longrightarrow> (P \<longrightarrow> R)]_v"
[PROOF STATE]
proof (prove)
using this:
|~ (P \<longrightarrow> Q) \<longrightarrow> (Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R

goal (1 subgoal):
 1. \<turnstile> \<box>[(P \<longrightarrow> Q) \<longrightarrow> (Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R]_v
[PROOF STEP]
by (rule sq)
[PROOF STATE]
proof (state)
this:
\<turnstile> \<box>[(P \<longrightarrow> Q) \<longrightarrow> (Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R]_v

goal (1 subgoal):
 1. \<turnstile> \<box>[P \<longrightarrow> R]_v
[PROOF STEP]
with h1
[PROOF STATE]
proof (chain)
picking this:
\<turnstile> \<box>[P \<longrightarrow> Q]_v
\<turnstile> \<box>[(P \<longrightarrow> Q) \<longrightarrow> (Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R]_v
[PROOF STEP]
have "\<turnstile> \<box>[(Q \<longrightarrow> R) \<longrightarrow> (P \<longrightarrow> R)]_v"
[PROOF STATE]
proof (prove)
using this:
\<turnstile> \<box>[P \<longrightarrow> Q]_v
\<turnstile> \<box>[(P \<longrightarrow> Q) \<longrightarrow> (Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R]_v

goal (1 subgoal):
 1. \<turnstile> \<box>[(Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R]_v
[PROOF STEP]
by (rule H1)
[PROOF STATE]
proof (state)
this:
\<turnstile> \<box>[(Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R]_v

goal (1 subgoal):
 1. \<turnstile> \<box>[P \<longrightarrow> R]_v
[PROOF STEP]
with h2
[PROOF STATE]
proof (chain)
picking this:
\<turnstile> \<box>[Q \<longrightarrow> R]_v
\<turnstile> \<box>[(Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R]_v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<turnstile> \<box>[Q \<longrightarrow> R]_v
\<turnstile> \<box>[(Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R]_v

goal (1 subgoal):
 1. \<turnstile> \<box>[P \<longrightarrow> R]_v
[PROOF STEP]
by (rule H1)
[PROOF STATE]
proof (state)
this:
\<turnstile> \<box>[P \<longrightarrow> R]_v

goal:
No subgoals!
[PROOF STEP]
qed