[STATEMENT]
lemma l_neq_1_exp_neq_0:
  assumes "l \<in> carrier G"
    and "l \<noteq> \<one>"
    and "l = \<^bold>g [^] (t::nat)"
  shows "t \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<noteq> 0
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> t \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (t \<noteq> 0)"
[PROOF STATE]
proof (state)
this:
\<not> t \<noteq> 0

goal (1 subgoal):
 1. \<not> t \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
hence "t = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> t \<noteq> 0

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

goal (1 subgoal):
 1. \<not> t \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
hence "\<^bold>g [^] t = \<one>"
[PROOF STATE]
proof (prove)
using this:
t = 0

goal (1 subgoal):
 1. \<^bold>g [^] t = \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] t = \<one>

goal (1 subgoal):
 1. \<not> t \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<^bold>g [^] t = \<one>
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] t = \<one>

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] t = \<one>
l \<in> carrier G
l \<noteq> \<one>
l = \<^bold>g [^] t

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma p_eq_0_iff: "s \<in> S \<Longrightarrow> p s = 0 \<longleftrightarrow> (\<forall>cfg\<in>cfg_on s. v cfg = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<in> S \<Longrightarrow> (p s = 0) = (\<forall>cfg\<in>cfg_on s. v cfg = 0)
[PROOF STEP]
unfolding p_eq_SUP_v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<in> S \<Longrightarrow> (\<Squnion> (v ` cfg_on s) = 0) = (\<forall>cfg\<in>cfg_on s. v cfg = 0)
[PROOF STEP]
by (subst SUP_eq_iff) auto


[STATEMENT]
lemma (in \<Z>) finite_category_cat_1:
  assumes "\<aa> \<in>\<^sub>\<circ> Vset \<alpha>" and "\<ff> \<in>\<^sub>\<circ> Vset \<alpha>"
  shows "finite_category \<alpha> (cat_1 \<aa> \<ff>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_category \<alpha> (cat_1 \<aa> \<ff>)
[PROOF STEP]
by (intro finite_categoryI')
    (auto simp: cat_1_components intro: category_cat_1[OF assms])


[STATEMENT]
lemma codomains_comp:
    assumes "seq g f"
    shows "codomains (g \<cdot> f) = codomains g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. codomains (g \<cdot> f) = codomains g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. codomains (g \<cdot> f) = codomains g
[PROOF STEP]
have "codomains (g \<cdot> f) = {b. ide b \<and> seq b (g \<cdot> f)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. codomains (g \<cdot> f) = {b. ide b \<and> seq b (g \<cdot> f)}
[PROOF STEP]
using codomains_def ext
[PROOF STATE]
proof (prove)
using this:
codomains ?f \<equiv> {b. ide b \<and> b \<cdot> ?f \<noteq> null}
?g \<cdot> ?f \<noteq> null \<Longrightarrow> seq ?g ?f

goal (1 subgoal):
 1. codomains (g \<cdot> f) = {b. ide b \<and> seq b (g \<cdot> f)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
codomains (g \<cdot> f) = {b. ide b \<and> seq b (g \<cdot> f)}

goal (1 subgoal):
 1. codomains (g \<cdot> f) = codomains g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
codomains (g \<cdot> f) = {b. ide b \<and> seq b (g \<cdot> f)}

goal (1 subgoal):
 1. codomains (g \<cdot> f) = codomains g
[PROOF STEP]
have "... = {b. ide b \<and> seq b g}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {b. ide b \<and> seq b (g \<cdot> f)} = {b. ide b \<and> seq b g}
[PROOF STEP]
using assms ide_def match_2 match_4
[PROOF STATE]
proof (prove)
using this:
seq g f
ide ?a \<equiv> ?a \<cdot> ?a \<noteq> null \<and> (\<forall>f. (f \<cdot> ?a \<noteq> null \<longrightarrow> f \<cdot> ?a = f) \<and> (?a \<cdot> f \<noteq> null \<longrightarrow> ?a \<cdot> f = f))
\<lbrakk>seq ?h (?g \<cdot> ?f); seq ?g ?f\<rbrakk> \<Longrightarrow> seq ?h ?g
\<lbrakk>seq ?g ?f; seq ?h ?g\<rbrakk> \<Longrightarrow> seq ?h (?g \<cdot> ?f)

goal (1 subgoal):
 1. {b. ide b \<and> seq b (g \<cdot> f)} = {b. ide b \<and> seq b g}
[PROOF STEP]
by meson
[PROOF STATE]
proof (state)
this:
{b. ide b \<and> seq b (g \<cdot> f)} = {b. ide b \<and> seq b g}

goal (1 subgoal):
 1. codomains (g \<cdot> f) = codomains g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{b. ide b \<and> seq b (g \<cdot> f)} = {b. ide b \<and> seq b g}

goal (1 subgoal):
 1. codomains (g \<cdot> f) = codomains g
[PROOF STEP]
have "... = codomains g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {b. ide b \<and> seq b g} = codomains g
[PROOF STEP]
using codomains_def ext
[PROOF STATE]
proof (prove)
using this:
codomains ?f \<equiv> {b. ide b \<and> b \<cdot> ?f \<noteq> null}
?g \<cdot> ?f \<noteq> null \<Longrightarrow> seq ?g ?f

goal (1 subgoal):
 1. {b. ide b \<and> seq b g} = codomains g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{b. ide b \<and> seq b g} = codomains g

goal (1 subgoal):
 1. codomains (g \<cdot> f) = codomains g
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
codomains (g \<cdot> f) = codomains g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
codomains (g \<cdot> f) = codomains g

goal (1 subgoal):
 1. codomains (g \<cdot> f) = codomains g
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
codomains (g \<cdot> f) = codomains g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cindex_pathE_point: "cindex_pathE (linepath a a) b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_pathE (linepath a a) b = 0
[PROOF STEP]
unfolding cindex_pathE_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindexE 0 1 (\<lambda>t. Im (linepath a a t - b) / Re (linepath a a t - b)) = 0
[PROOF STEP]
by (simp add:cindexE_constI)


[STATEMENT]
lemma closed_orbit_eq_rev: "closed_orbit x = rev.closed_orbit x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_orbit x = rev.closed_orbit x
[PROOF STEP]
unfolding closed_orbit_def rev.closed_orbit_def rev_eq_flow rev_existence_ivl_eq0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>T\<in>existence_ivl0 x. T \<noteq> 0 \<and> flow0 x T = x) = (\<exists>T\<in>uminus ` existence_ivl0 x. T \<noteq> 0 \<and> flow0 x (- T) = x)
[PROOF STEP]
by auto


[STATEMENT]
lemma division_product:
 assumes "(b::int)>0"
 and "a \<ge>b"
 shows " (a div b) = ((a - b) div b) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a div b = (a - b) div b + 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a div b = (a - b) div b + 1
[PROOF STEP]
fix c
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a div b = (a - b) div b + 1
[PROOF STEP]
have "a -b \<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> a - b
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
b \<le> a

goal (1 subgoal):
 1. 0 \<le> a - b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> a - b

goal (1 subgoal):
 1. a div b = (a - b) div b + 1
[PROOF STEP]
have 1: "a - b = a + (-1)*b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - b = a + - 1 * b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a - b = a + - 1 * b

goal (1 subgoal):
 1. a div b = (a - b) div b + 1
[PROOF STEP]
have "(b \<noteq> 0) \<longrightarrow> ((a + b * (-1)) div b = (-1) + a div b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<noteq> 0 \<longrightarrow> (a + b * - 1) div b = - 1 + a div b
[PROOF STEP]
using div_mult_self2
[PROOF STATE]
proof (prove)
using this:
?b \<noteq> (0::?'a) \<Longrightarrow> (?a + ?b * ?c) div ?b = ?c + ?a div ?b

goal (1 subgoal):
 1. b \<noteq> 0 \<longrightarrow> (a + b * - 1) div b = - 1 + a div b
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
b \<noteq> 0 \<longrightarrow> (a + b * - 1) div b = - 1 + a div b

goal (1 subgoal):
 1. a div b = (a - b) div b + 1
[PROOF STEP]
with 1 assms(1)
[PROOF STATE]
proof (chain)
picking this:
a - b = a + - 1 * b
0 < b
b \<noteq> 0 \<longrightarrow> (a + b * - 1) div b = - 1 + a div b
[PROOF STEP]
have "((a - b) div b) = (-1) + a div b"
[PROOF STATE]
proof (prove)
using this:
a - b = a + - 1 * b
0 < b
b \<noteq> 0 \<longrightarrow> (a + b * - 1) div b = - 1 + a div b

goal (1 subgoal):
 1. (a - b) div b = - 1 + a div b
[PROOF STEP]
using less_int_code(1)
[PROOF STATE]
proof (prove)
using this:
a - b = a + - 1 * b
0 < b
b \<noteq> 0 \<longrightarrow> (a + b * - 1) div b = - 1 + a div b
(0 < 0) = False

goal (1 subgoal):
 1. (a - b) div b = - 1 + a div b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a - b) div b = - 1 + a div b

goal (1 subgoal):
 1. a div b = (a - b) div b + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(a - b) div b = - 1 + a div b
[PROOF STEP]
have "(a div b) = ((a - b) div b) + 1"
[PROOF STATE]
proof (prove)
using this:
(a - b) div b = - 1 + a div b

goal (1 subgoal):
 1. a div b = (a - b) div b + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a div b = (a - b) div b + 1

goal (1 subgoal):
 1. a div b = (a - b) div b + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a div b = (a - b) div b + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a div b = (a - b) div b + 1

goal (1 subgoal):
 1. a div b = (a - b) div b + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a div b = (a - b) div b + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mono_fMax_commute: "mono f \<Longrightarrow> A \<noteq> {||} \<Longrightarrow> f (fMax A) = fMax (f |`| A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono f; A \<noteq> {||}\<rbrakk> \<Longrightarrow> f (fMax A) = fMax (f |`| A)
[PROOF STEP]
by transfer (rule mono_Max_commute)


[STATEMENT]
lemma sum_k_Bernstein [simp]: "(\<Sum>k\<le>n. real k * Bernstein n k x) = of_nat n * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k * Bernstein n k x) = real n * x
[PROOF STEP]
apply (subst binomial_deriv1 [of n x "1-x", simplified, symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k * Bernstein n k x) = (\<Sum>k\<le>n. real k * real (n choose k) * x ^ (k - Suc 0) * (1 - x) ^ (n - k)) * x
[PROOF STEP]
apply (simp add: sum_distrib_right)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k * Bernstein n k x) = (\<Sum>na\<le>n. real na * real (n choose na) * x ^ (na - Suc 0) * (1 - x) ^ (n - na) * x)
[PROOF STEP]
apply (auto simp: Bernstein_def algebra_simps power_eq_if intro!: sum.cong)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma le_max:
  fixes a b :: "'a :: preorder"
  assumes "c \<le> a \<or> c \<le> b" and "a \<le> b \<or> b \<le> a" shows "c \<le> max a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<le> max a b
[PROOF STEP]
using assms(1) le_max_self[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
c \<le> a \<or> c \<le> b
a \<le> max a b
b \<le> max a b

goal (1 subgoal):
 1. c \<le> max a b
[PROOF STEP]
by (auto dest: order_trans)


[STATEMENT]
lemma sum_abs_complex:
  fixes h  :: "nat \<Rightarrow> nat \<Rightarrow> complex"
  shows "cmod (\<Sum>x\<in>A.\<Sum>y\<in>B. h x y) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod(h x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
have B: "\<forall> x \<in> A. cmod( \<Sum>y\<in>B .h x y) \<le> (\<Sum>y\<in>B. cmod(h x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. cmod (sum (h x) B) \<le> (\<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
using sum_abs norm_sum
[PROOF STATE]
proof (prove)
using this:
\<bar>sum ?f ?A\<bar> \<le> (\<Sum>i\<in>?A. \<bar>?f i\<bar>)
norm (sum ?f ?A) \<le> (\<Sum>i\<in>?A. norm (?f i))

goal (1 subgoal):
 1. \<forall>x\<in>A. cmod (sum (h x) B) \<le> (\<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>A. cmod (sum (h x) B) \<le> (\<Sum>y\<in>B. cmod (h x y))

goal (1 subgoal):
 1. cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
have "cmod (\<Sum>x\<in>A.\<Sum>y\<in>B. h x y) \<le> (\<Sum>x\<in>A.  cmod( \<Sum>y\<in>B .h x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. cmod (sum (h x) B))
[PROOF STEP]
using sum_abs norm_sum
[PROOF STATE]
proof (prove)
using this:
\<bar>sum ?f ?A\<bar> \<le> (\<Sum>i\<in>?A. \<bar>?f i\<bar>)
norm (sum ?f ?A) \<le> (\<Sum>i\<in>?A. norm (?f i))

goal (1 subgoal):
 1. cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. cmod (sum (h x) B))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. cmod (sum (h x) B))

goal (1 subgoal):
 1. cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. cmod (sum (h x) B))

goal (1 subgoal):
 1. cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
have "\<dots> \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod(h x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>A. cmod (sum (h x) B)) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
using sum_abs norm_sum B
[PROOF STATE]
proof (prove)
using this:
\<bar>sum ?f ?A\<bar> \<le> (\<Sum>i\<in>?A. \<bar>?f i\<bar>)
norm (sum ?f ?A) \<le> (\<Sum>i\<in>?A. norm (?f i))
\<forall>x\<in>A. cmod (sum (h x) B) \<le> (\<Sum>y\<in>B. cmod (h x y))

goal (1 subgoal):
 1. (\<Sum>x\<in>A. cmod (sum (h x) B)) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
by (simp add: sum_mono)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>A. cmod (sum (h x) B)) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))

goal (1 subgoal):
 1. cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
have "cmod (\<Sum>x\<in>A. \<Sum>y\<in>B. h x y) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))"
[PROOF STATE]
proof (prove)
using this:
cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))

goal (1 subgoal):
 1. cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))

goal (1 subgoal):
 1. cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))

goal (1 subgoal):
 1. cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cmod (\<Sum>x\<in>A. sum (h x) B) \<le> (\<Sum>x\<in>A. \<Sum>y\<in>B. cmod (h x y))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_svalid[simp, intro]: "finite (svalid F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (svalid F)
[PROOF STEP]
using svalid_subset_S finite_S
[PROOF STATE]
proof (prove)
using this:
svalid ?F \<subseteq> S
finite S

goal (1 subgoal):
 1. finite (svalid F)
[PROOF STEP]
by (blast intro: finite_subset)


[STATEMENT]
lemma real_root_mult_exp_cancel3:
  "\<lbrakk> 0 < x; 0 < n \<rbrakk> \<Longrightarrow> root n (x ^ (n * k)) = x ^ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < n\<rbrakk> \<Longrightarrow> root n (x ^ (n * k)) = x ^ k
[PROOF STEP]
by (auto dest: real_root_mult_exp_cancel2 [of _ 1])


[STATEMENT]
lemma Times_mset_image_mset1: "image_mset f A \<times># B = image_mset (\<lambda>(a, b). (f a, b)) (A \<times># B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset f A \<times># B = {#(f a, b). (a, b) \<in># A \<times># B#}
[PROOF STEP]
by (induct B) (auto simp: Times_insert_left)


[STATEMENT]
lemma bin_to_bl_cat_app:
  "bin_to_bl (n + nw) (concat_bit nw wa w) = bin_to_bl n w @ bin_to_bl nw wa"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_to_bl (n + nw) (concat_bit nw wa w) = bin_to_bl n w @ bin_to_bl nw wa
[PROOF STEP]
by (simp only: bin_to_bl_def bin_to_bl_aux_cat_app)


[STATEMENT]
lemma is_iso_arrD[dest]:
  assumes "f : a \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> b"
  shows "f : a \<mapsto>\<^bsub>\<CC>\<^esub> b" and "\<exists>g. is_inverse \<CC> g f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f : a \<mapsto>\<^bsub>\<CC>\<^esub> b &&& \<exists>g. is_inverse \<CC> g f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f : a \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> b

goal (1 subgoal):
 1. f : a \<mapsto>\<^bsub>\<CC>\<^esub> b &&& \<exists>g. is_inverse \<CC> g f
[PROOF STEP]
unfolding is_iso_arr_def
[PROOF STATE]
proof (prove)
using this:
f : a \<mapsto>\<^bsub>\<CC>\<^esub> b \<and> (\<exists>g. is_inverse \<CC> g f)

goal (1 subgoal):
 1. f : a \<mapsto>\<^bsub>\<CC>\<^esub> b &&& \<exists>g. is_inverse \<CC> g f
[PROOF STEP]
by auto


[STATEMENT]
theorem partition:
  "partition S Partition"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partition S Partition
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. Partition \<subseteq> Pow S
 2. {} \<notin> Partition
 3. \<Union> Partition = S
 4. \<And>A B. \<lbrakk>A \<in> Partition; B \<in> Partition; A \<noteq> B\<rbrakk> \<Longrightarrow> A \<inter> B = {}
[PROOF STEP]
fix A and B
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. Partition \<subseteq> Pow S
 2. {} \<notin> Partition
 3. \<Union> Partition = S
 4. \<And>A B. \<lbrakk>A \<in> Partition; B \<in> Partition; A \<noteq> B\<rbrakk> \<Longrightarrow> A \<inter> B = {}
[PROOF STEP]
assume closed: "A \<in> Partition" "B \<in> Partition"
[PROOF STATE]
proof (state)
this:
A \<in> Partition
B \<in> Partition

goal (4 subgoals):
 1. Partition \<subseteq> Pow S
 2. {} \<notin> Partition
 3. \<Union> Partition = S
 4. \<And>A B. \<lbrakk>A \<in> Partition; B \<in> Partition; A \<noteq> B\<rbrakk> \<Longrightarrow> A \<inter> B = {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<in> Partition
B \<in> Partition
[PROOF STEP]
obtain a and b where eq: "A = Class a" "B = Class b" and ab: "a \<in> S" "b \<in> S"
[PROOF STATE]
proof (prove)
using this:
A \<in> Partition
B \<in> Partition

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>A = Class a; B = Class b; a \<in> S; b \<in> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Partition_def
[PROOF STATE]
proof (prove)
using this:
A \<in> Class ` S
B \<in> Class ` S

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>A = Class a; B = Class b; a \<in> S; b \<in> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = Class a
B = Class b
a \<in> S
b \<in> S

goal (4 subgoals):
 1. Partition \<subseteq> Pow S
 2. {} \<notin> Partition
 3. \<Union> Partition = S
 4. \<And>A B. \<lbrakk>A \<in> Partition; B \<in> Partition; A \<noteq> B\<rbrakk> \<Longrightarrow> A \<inter> B = {}
[PROOF STEP]
assume distinct: "A \<noteq> B"
[PROOF STATE]
proof (state)
this:
A \<noteq> B

goal (4 subgoals):
 1. Partition \<subseteq> Pow S
 2. {} \<notin> Partition
 3. \<Union> Partition = S
 4. \<And>A B. \<lbrakk>A \<in> Partition; B \<in> Partition; A \<noteq> B\<rbrakk> \<Longrightarrow> A \<inter> B = {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<noteq> B
[PROOF STEP]
show "A \<inter> B = {}"
[PROOF STATE]
proof (prove)
using this:
A \<noteq> B

goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
proof (rule contrapos_np)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<inter> B \<noteq> {} \<Longrightarrow> A = B
[PROOF STEP]
assume not_disjoint: "A \<inter> B \<noteq> {}"
[PROOF STATE]
proof (state)
this:
A \<inter> B \<noteq> {}

goal (1 subgoal):
 1. A \<inter> B \<noteq> {} \<Longrightarrow> A = B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<inter> B \<noteq> {}
[PROOF STEP]
show "A = B"
[PROOF STATE]
proof (prove)
using this:
A \<inter> B \<noteq> {}

goal (1 subgoal):
 1. A = B
[PROOF STEP]
by (simp add: eq) (metis not_disjoint_implies_equal ab)
[PROOF STATE]
proof (state)
this:
A = B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A \<inter> B = {}

goal (3 subgoals):
 1. Partition \<subseteq> Pow S
 2. {} \<notin> Partition
 3. \<Union> Partition = S
[PROOF STEP]
qed (auto simp: Partition_def)


[STATEMENT]
lemma lnull_ldropWhile [simp]:
  "lnull (ldropWhile P xs) \<longleftrightarrow> (\<forall>x \<in> lset xs. P x)" (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lnull (ldropWhile P xs) = (\<forall>x\<in>lset xs. P x)
[PROOF STEP]
unfolding lnull_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ldropWhile P xs = LNil) = (\<forall>x\<in>lset xs. P x)
[PROOF STEP]
by(simp add: ldropWhile_eq_LNil_iff)


[STATEMENT]
lemma Vars_indeps_foldr:
  assumes "set xs \<subseteq> set Vars"
  shows "foldr (\<squnion>\<^sub>S) xs \<bottom>\<^sub>S \<bowtie>\<^sub>S foldr (\<squnion>\<^sub>S) (filter (\<lambda>x. x \<notin> set xs) Vars) \<bottom>\<^sub>S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>\<^sub>S xs \<bowtie>\<^sub>S \<Squnion>\<^sub>S (filter (\<lambda>x. x \<notin> set xs) Vars)
[PROOF STEP]
apply (rule foldr_scene_indep)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. pairwise (##\<^sub>S) (set (filter (\<lambda>x. x \<notin> set xs) Vars))
 2. \<forall>b\<in>set (filter (\<lambda>x. x \<notin> set xs) Vars). \<Squnion>\<^sub>S xs \<bowtie>\<^sub>S b
[PROOF STEP]
apply (meson filter_is_subset pairwise_subset scene_space_compats)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b\<in>set (filter (\<lambda>x. x \<notin> set xs) Vars). \<Squnion>\<^sub>S xs \<bowtie>\<^sub>S b
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. x \<in> set Vars \<and> x \<notin> set xs \<longrightarrow> \<Squnion>\<^sub>S xs \<bowtie>\<^sub>S x
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> set Vars; x \<notin> set xs\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S xs \<bowtie>\<^sub>S x
[PROOF STEP]
apply (rule scene_indep_sym)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> set Vars; x \<notin> set xs\<rbrakk> \<Longrightarrow> x \<bowtie>\<^sub>S \<Squnion>\<^sub>S xs
[PROOF STEP]
apply (metis (no_types, lifting) assms foldr_scene_indep local.indep_Vars pairwiseD pairwise_mono scene_indeps_def scene_space_compats subset_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma open_prod_intro:
  assumes "\<And>x. x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S"
  shows "open S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> ?x \<in> A \<times> B \<and> A \<times> B \<subseteq> S

goal (1 subgoal):
 1. open S
[PROOF STEP]
unfolding open_prod_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> ?x \<in> A \<times> B \<and> A \<times> B \<subseteq> S

goal (1 subgoal):
 1. \<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S
[PROOF STEP]
by fast


[STATEMENT]
lemma drop_bit_word_numeral [simp]:
  \<open>drop_bit (numeral n) (numeral k) =
    (word_of_int (drop_bit (numeral n) (take_bit LENGTH('a) (numeral k))) :: 'a::len word)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop_bit (numeral n) (numeral k) = word_of_int (drop_bit (numeral n) (take_bit LENGTH('a) (numeral k)))
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma signed_take_bit_mult:
  \<open>signed_take_bit n (signed_take_bit n k * signed_take_bit n l) = signed_take_bit n (k * l)\<close>
  for k l :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. signed_take_bit n (signed_take_bit n k * signed_take_bit n l) = signed_take_bit n (k * l)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. signed_take_bit n (signed_take_bit n k * signed_take_bit n l) = signed_take_bit n (k * l)
[PROOF STEP]
have \<open>take_bit (Suc n)
     (take_bit (Suc n) (signed_take_bit n k) *
      take_bit (Suc n) (signed_take_bit n l)) =
    take_bit (Suc n) (k * l)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (Suc n) (take_bit (Suc n) (signed_take_bit n k) * take_bit (Suc n) (signed_take_bit n l)) = take_bit (Suc n) (k * l)
[PROOF STEP]
by (simp add: take_bit_signed_take_bit take_bit_mult)
[PROOF STATE]
proof (state)
this:
take_bit (Suc n) (take_bit (Suc n) (signed_take_bit n k) * take_bit (Suc n) (signed_take_bit n l)) = take_bit (Suc n) (k * l)

goal (1 subgoal):
 1. signed_take_bit n (signed_take_bit n k * signed_take_bit n l) = signed_take_bit n (k * l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
take_bit (Suc n) (take_bit (Suc n) (signed_take_bit n k) * take_bit (Suc n) (signed_take_bit n l)) = take_bit (Suc n) (k * l)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
take_bit (Suc n) (take_bit (Suc n) (signed_take_bit n k) * take_bit (Suc n) (signed_take_bit n l)) = take_bit (Suc n) (k * l)

goal (1 subgoal):
 1. signed_take_bit n (signed_take_bit n k * signed_take_bit n l) = signed_take_bit n (k * l)
[PROOF STEP]
by (simp only: signed_take_bit_eq_iff_take_bit_eq take_bit_mult)
[PROOF STATE]
proof (state)
this:
signed_take_bit n (signed_take_bit n k * signed_take_bit n l) = signed_take_bit n (k * l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exact_division: assumes "of_int x / (of_int y  :: 'a :: floor_ceiling) \<in> \<int>"
  shows "of_int (x div y) = of_int x / (of_int y :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (x div y) = of_int x / of_int y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
of_int x / of_int y \<in> \<int>

goal (1 subgoal):
 1. of_int (x div y) = of_int x / of_int y
[PROOF STEP]
by (metis Ints_cases division_to_div)


[STATEMENT]
lemma zmset_subset_add_iff2:
  \<open>i \<le> j \<Longrightarrow> (repeat_zmset i u + m \<subset>#\<^sub>z repeat_zmset j u + n) = (m \<subset>#\<^sub>z repeat_zmset (j - i) u + n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> (repeat_zmset i u + m \<subset>#\<^sub>z repeat_zmset j u + n) = (m \<subset>#\<^sub>z repeat_zmset (j - i) u + n)
[PROOF STEP]
by (simp add: subset_zmset.less_le_not_le zmset_subseteq_add_iff1 zmset_subseteq_add_iff2)


[STATEMENT]
lemma subsubformulae: "G \<in> set (subformulae F) \<Longrightarrow> H \<in> set (subformulae G) \<Longrightarrow> H \<in> set (subformulae F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<in> set (subformulae F); H \<in> set (subformulae G)\<rbrakk> \<Longrightarrow> H \<in> set (subformulae F)
[PROOF STEP]
by(induction F; force)


[STATEMENT]
lemma convex_halfspace_Im_le: "convex {x. Im x \<le> b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex {x. Im x \<le> b}
[PROOF STEP]
using convex_halfspace_le[of \<i> b]
[PROOF STATE]
proof (prove)
using this:
convex {x. \<i> \<bullet> x \<le> b}

goal (1 subgoal):
 1. convex {x. Im x \<le> b}
[PROOF STEP]
by simp


[STATEMENT]
lemma column_Gram_Schmidt_column_k_eq_efficient:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes "Gram_Schmidt_upt_k A k = foldl Gram_Schmidt_column_k_efficient A [0..<Suc k]"
  and suc_k: "Suc k < ncols A"
  shows "column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))
  = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
proof (cases "b = from_nat (Suc k)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
 2. b \<noteq> mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
b \<noteq> mod_type_class.from_nat (Suc k)

goal (2 subgoals):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
 2. b \<noteq> mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
b \<noteq> mod_type_class.from_nat (Suc k)

goal (1 subgoal):
 1. column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
unfolding Gram_Schmidt_column_k_efficient_def Gram_Schmidt_column_k_def column_def
[PROOF STATE]
proof (prove)
using this:
b \<noteq> mod_type_class.from_nat (Suc k)

goal (1 subgoal):
 1. (\<chi>i. (\<chi>a b. (if b = mod_type_class.from_nat (Suc k) then (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) - proj_onto (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) {\<chi>ia. Gram_Schmidt_upt_k A k $ ia $ i |i. i < b} else \<chi>i. Gram_Schmidt_upt_k A k $ i $ b) $ a) $ i $ b) = (\<chi>i. (\<chi>a b. (if b = mod_type_class.from_nat (Suc k) then (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) - (\<Sum>x\<leftarrow>map (\<lambda>n. \<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat n) [0..<mod_type_class.to_nat b]. ((\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) \<bullet> x / (x \<bullet> x)) *\<^sub>R x) else \<chi>i. Gram_Schmidt_upt_k A k $ i $ b) $ a) $ i $ b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b = mod_type_class.from_nat (Suc k)

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
have tn_fn_suc: "to_nat (from_nat (Suc k)::'n) = Suc k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (mod_type_class.from_nat (Suc k)) = Suc k
[PROOF STEP]
using suc_k to_nat_from_nat_id
[PROOF STATE]
proof (prove)
using this:
Suc k < ncols A
?x < CARD(?'a) \<Longrightarrow> mod_type_class.to_nat (mod_type_class.from_nat ?x) = ?x

goal (1 subgoal):
 1. mod_type_class.to_nat (mod_type_class.from_nat (Suc k)) = Suc k
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
Suc k < CARD('n)
?x < CARD(?'a) \<Longrightarrow> mod_type_class.to_nat (mod_type_class.from_nat ?x) = ?x

goal (1 subgoal):
 1. mod_type_class.to_nat (mod_type_class.from_nat (Suc k)) = Suc k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (mod_type_class.from_nat (Suc k)) = Suc k

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
define G where"G = Gram_Schmidt_upt_k A k"
[PROOF STATE]
proof (state)
this:
G = Gram_Schmidt_upt_k A k

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
let ?f="(\<lambda>x. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
let ?g="(\<lambda>n. column (from_nat n) G) "
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
have proj_eq: "proj_onto (column b G) {column i G |i. i < b}
    = sum_list (map ?f (map ?g [0..<to_nat b]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "proj_onto (column b G) {column i G |i. i < b} = sum ?f {column i G |i. i < b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
unfolding proj_onto_def proj_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>u\<in>{column i G |i. i < b}. (column b G \<bullet> u / (u \<bullet> u)) *\<^sub>R u) = (\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "... = sum ?f (set (map ?g [0..<to_nat b]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
by (rule sum.cong, auto simp add: set_map_column[symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "... = sum_list (map ?f (remdups (map ?g [0..<to_nat b])))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
unfolding sum_code
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "... = sum_list ((map ?f ((map ?g [0..<to_nat b]))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
proof (rule sum_list_remdups_2, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < mod_type_class.to_nat b; j < mod_type_class.to_nat b; i \<noteq> j; column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G; column (mod_type_class.from_nat j) G \<noteq> 0\<rbrakk> \<Longrightarrow> column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < mod_type_class.to_nat b; j < mod_type_class.to_nat b; i \<noteq> j; column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G; column (mod_type_class.from_nat j) G \<noteq> 0\<rbrakk> \<Longrightarrow> column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
assume i: "i < to_nat b"
        and j: "j < to_nat b" and ij: "i \<noteq> j"
        and col_eq: "column (from_nat i) G = column (from_nat j) G"
        and col_0: "column (from_nat j) G \<noteq> 0"
[PROOF STATE]
proof (state)
this:
i < mod_type_class.to_nat b
j < mod_type_class.to_nat b
i \<noteq> j
column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G
column (mod_type_class.from_nat j) G \<noteq> 0

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < mod_type_class.to_nat b; j < mod_type_class.to_nat b; i \<noteq> j; column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G; column (mod_type_class.from_nat j) G \<noteq> 0\<rbrakk> \<Longrightarrow> column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
have k: "to_nat (from_nat k::'n) = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (mod_type_class.from_nat k) = k
[PROOF STEP]
by (metis Suc_lessD ncols_def suc_k to_nat_from_nat_id)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (mod_type_class.from_nat k) = k

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < mod_type_class.to_nat b; j < mod_type_class.to_nat b; i \<noteq> j; column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G; column (mod_type_class.from_nat j) G \<noteq> 0\<rbrakk> \<Longrightarrow> column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
have "column (from_nat j) G = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
proof (unfold G_def, rule column_Gram_Schmidt_upt_k_repeated(1)
          [of "(from_nat i)::'n" "from_nat j" "from_nat k" A, unfolded k])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
 2. mod_type_class.from_nat i \<le> mod_type_class.from_nat k
 3. mod_type_class.from_nat j \<le> mod_type_class.from_nat k
 4. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
have "from_nat i < (from_nat (Suc k)::'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)
[PROOF STEP]
using from_nat_mono[of i "Suc k"] suc_k i
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i < Suc k; Suc k < CARD(?'a)\<rbrakk> \<Longrightarrow> mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)
Suc k < ncols A
i < mod_type_class.to_nat b

goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)
[PROOF STEP]
unfolding True tn_fn_suc ncols_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i < Suc k; Suc k < CARD(?'a)\<rbrakk> \<Longrightarrow> mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)
Suc k < CARD('n)
i < Suc k

goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)

goal (4 subgoals):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
 2. mod_type_class.from_nat i \<le> mod_type_class.from_nat k
 3. mod_type_class.from_nat j \<le> mod_type_class.from_nat k
 4. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
thus "from_nat i \<le> (from_nat k::'n)"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)

goal (1 subgoal):
 1. mod_type_class.from_nat i \<le> mod_type_class.from_nat k
[PROOF STEP]
by (metis Suc_lessD True from_nat_mono' i less_Suc_eq_le ncols_def suc_k tn_fn_suc)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i \<le> mod_type_class.from_nat k

goal (3 subgoals):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
 2. mod_type_class.from_nat j \<le> mod_type_class.from_nat k
 3. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
have "from_nat j < (from_nat (Suc k)::'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)
[PROOF STEP]
using from_nat_mono[of j "Suc k"] suc_k j
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>j < Suc k; Suc k < CARD(?'a)\<rbrakk> \<Longrightarrow> mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)
Suc k < ncols A
j < mod_type_class.to_nat b

goal (1 subgoal):
 1. mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)
[PROOF STEP]
unfolding True tn_fn_suc ncols_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>j < Suc k; Suc k < CARD(?'a)\<rbrakk> \<Longrightarrow> mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)
Suc k < CARD('n)
j < Suc k

goal (1 subgoal):
 1. mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)

goal (3 subgoals):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
 2. mod_type_class.from_nat j \<le> mod_type_class.from_nat k
 3. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
thus "from_nat j \<le> (from_nat k::'n)"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)

goal (1 subgoal):
 1. mod_type_class.from_nat j \<le> mod_type_class.from_nat k
[PROOF STEP]
by (metis Suc_lessD True from_nat_mono' j less_Suc_eq_le ncols_def suc_k tn_fn_suc)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat j \<le> mod_type_class.from_nat k

goal (2 subgoals):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
 2. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
show "from_nat i \<noteq> (from_nat j::'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
[PROOF STEP]
using ij i j True suc_k
[PROOF STATE]
proof (prove)
using this:
i \<noteq> j
i < mod_type_class.to_nat b
j < mod_type_class.to_nat b
b = mod_type_class.from_nat (Suc k)
Suc k < ncols A

goal (1 subgoal):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
[PROOF STEP]
by (metis (no_types, lifting) dual_order.strict_trans from_nat_eq_imp_eq ncols_def tn_fn_suc)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j

goal (1 subgoal):
 1. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
show "column (from_nat j) (Gram_Schmidt_upt_k A k)
          = column (from_nat i) (Gram_Schmidt_upt_k A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
using G_def col_eq
[PROOF STATE]
proof (prove)
using this:
G = Gram_Schmidt_upt_k A k
column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G

goal (1 subgoal):
 1. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
column (mod_type_class.from_nat j) G = 0

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < mod_type_class.to_nat b; j < mod_type_class.to_nat b; i \<noteq> j; column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G; column (mod_type_class.from_nat j) G \<noteq> 0\<rbrakk> \<Longrightarrow> column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
thus "column b G \<bullet> column (from_nat j) G = 0"
[PROOF STATE]
proof (prove)
using this:
column (mod_type_class.from_nat j) G = 0

goal (1 subgoal):
 1. column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
using col_0
[PROOF STATE]
proof (prove)
using this:
column (mod_type_class.from_nat j) G = 0
column (mod_type_class.from_nat j) G \<noteq> 0

goal (1 subgoal):
 1. column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
by contradiction
[PROOF STATE]
proof (state)
this:
column b G \<bullet> column (mod_type_class.from_nat j) G = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
have "column b (Gram_Schmidt_column_k G (Suc k))
    = column b G - proj_onto (column b G) {column i G |i. i < b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column b (Gram_Schmidt_column_k G (Suc k)) = column b G - proj_onto (column b G) {column i G |i. i < b}
[PROOF STEP]
unfolding True
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column (mod_type_class.from_nat (Suc k)) (Gram_Schmidt_column_k G (Suc k)) = column (mod_type_class.from_nat (Suc k)) G - proj_onto (column (mod_type_class.from_nat (Suc k)) G) {column i G |i. i < mod_type_class.from_nat (Suc k)}
[PROOF STEP]
unfolding Gram_Schmidt_column_k_def G_def column_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i. (\<chi>a b. (if b = mod_type_class.from_nat (Suc k) then (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) - proj_onto (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) {\<chi>ia. Gram_Schmidt_upt_k A k $ ia $ i |i. i < b} else \<chi>i. Gram_Schmidt_upt_k A k $ i $ b) $ a) $ i $ mod_type_class.from_nat (Suc k)) = (\<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat (Suc k)) - proj_onto (\<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat (Suc k)) {\<chi>ia. Gram_Schmidt_upt_k A k $ ia $ i |i. i < mod_type_class.from_nat (Suc k)}
[PROOF STEP]
by vector
[PROOF STATE]
proof (state)
this:
column b (Gram_Schmidt_column_k G (Suc k)) = column b G - proj_onto (column b G) {column i G |i. i < b}

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column b (Gram_Schmidt_column_k G (Suc k)) = column b G - proj_onto (column b G) {column i G |i. i < b}

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
have "... = column b G
    - (\<Sum>x\<leftarrow>map (\<lambda>n. column (from_nat n) G) [0..<to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column b G - proj_onto (column b G) {column i G |i. i < b} = column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
unfolding proj_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
column b G - proj_onto (column b G) {column i G |i. i < b} = column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column b G - proj_onto (column b G) {column i G |i. i < b} = column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
have "... = column b (Gram_Schmidt_column_k_efficient G (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = column b (Gram_Schmidt_column_k_efficient G (Suc k))
[PROOF STEP]
unfolding True Gram_Schmidt_column_k_efficient_def G_def column_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat (Suc k)) - (\<Sum>x\<leftarrow>map (\<lambda>n. \<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat n) [0..<mod_type_class.to_nat (mod_type_class.from_nat (Suc k))]. ((\<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat (Suc k)) \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<chi>i. (\<chi>a b. (if b = mod_type_class.from_nat (Suc k) then (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) - (\<Sum>x\<leftarrow>map (\<lambda>n. \<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat n) [0..<mod_type_class.to_nat b]. ((\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) \<bullet> x / (x \<bullet> x)) *\<^sub>R x) else \<chi>i. Gram_Schmidt_upt_k A k $ i $ b) $ a) $ i $ mod_type_class.from_nat (Suc k))
[PROOF STEP]
by vector
[PROOF STATE]
proof (state)
this:
column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = column b (Gram_Schmidt_column_k_efficient G (Suc k))

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
column b (Gram_Schmidt_column_k G (Suc k)) = column b (Gram_Schmidt_column_k_efficient G (Suc k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
column b (Gram_Schmidt_column_k G (Suc k)) = column b (Gram_Schmidt_column_k_efficient G (Suc k))

goal (1 subgoal):
 1. column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
unfolding G_def
[PROOF STATE]
proof (prove)
using this:
column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))

goal (1 subgoal):
 1. column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quantifier_change_order_twice:
  fixes P :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> bool" and m n :: nat
  shows "\<forall>i<m. \<forall>j<n. \<exists> no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
assume fact: "\<forall>i<m. \<forall>j<n. \<exists> no. \<forall>n\<ge>no. P n i j"
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
have one: "\<forall>i<m. \<exists>no.\<forall>j<n. \<forall>n\<ge>no. P n i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
using fact quantifier_change_order_once
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j
\<forall>j<?m. \<exists>no. \<forall>n\<ge>no. ?P n j \<Longrightarrow> \<exists>no. \<forall>j<?m. \<forall>n\<ge>no. ?P n j

goal (1 subgoal):
 1. \<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
have two: "\<forall>i<m. \<exists>no.\<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
proof (induct m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i<0. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<0. \<forall>j<n. \<forall>n\<ge>no. P n i j
 2. \<And>m. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
\<forall>i<0. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (2 subgoals):
 1. \<forall>i<0. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<0. \<forall>j<n. \<forall>n\<ge>no. P n i j
 2. \<And>m. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<0. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>i<0. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<0. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>i<0. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<And>m. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
\<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<And>m. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
\<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
\<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
obtain M where MM: "\<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>M. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
\<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. (\<And>M. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j

goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
obtain N where NN: "\<forall>j<n. \<forall>n\<ge>N. P n m j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>N. \<forall>j<n. \<forall>n\<ge>N. P n m j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc(2)
[PROOF STATE]
proof (prove)
using this:
\<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. (\<And>N. \<forall>j<n. \<forall>n\<ge>N. P n m j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>j<n. \<forall>n\<ge>N. P n m j

goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
let ?N = "max M N"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
from MM NN
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j
\<forall>j<n. \<forall>n\<ge>N. P n m j
[PROOF STEP]
have "\<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>?N. P n i j"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j
\<forall>j<n. \<forall>n\<ge>N. P n m j

goal (1 subgoal):
 1. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>max M N. P n i j
[PROOF STEP]
by (metis less_antisym max.boundedE)
[PROOF STATE]
proof (state)
this:
\<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>max M N. P n i j

goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>max M N. P n i j
[PROOF STEP]
have "\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>max M N. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
with fact
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
using one
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zcf_monom_sub':
  assumes "p \<in> carrier P"
  assumes "a \<in> carrier R"
  shows "zcf ((monom P a (Suc n)) of  p) = a \<otimes> zcf p [^] (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zcf (Cring_Poly.compose R (monom P a (Suc n)) p) = a \<otimes> zcf p [^] Suc n
[PROOF STEP]
using zcf_monom_sub assms P_def R.zero_closed UP_cring.ctrm_of_sub UP_cring.to_fun_monom UP_cring_axioms
    zcf_to_fun to_fun_closed monom_closed
[PROOF STATE]
proof (prove)
using this:
?p \<in> carrier P \<Longrightarrow> zcf (Cring_Poly.compose R (monom P \<one> (Suc ?n)) ?p) = zcf ?p [^] Suc ?n
p \<in> carrier P
a \<in> carrier R
P \<equiv> UP R
\<zero> \<in> carrier R
\<lbrakk>UP_cring ?R; ?f \<in> carrier (UP ?R); ?g \<in> carrier (UP ?R)\<rbrakk> \<Longrightarrow> zcf (Cring_Poly.compose ?R ?f ?g) = UP_cring.to_fun ?R ?f (zcf ?g)
\<lbrakk>UP_cring ?R; ?c \<in> carrier ?R; ?x \<in> carrier ?R\<rbrakk> \<Longrightarrow> UP_cring.to_fun ?R (monom (UP ?R) ?c ?n) ?x = ?c \<otimes>\<^bsub>?R\<^esub> ?x [^]\<^bsub>?R\<^esub> ?n
UP_cring R
?p \<in> carrier P \<Longrightarrow> zcf ?p = to_fun ?p \<zero>
\<lbrakk>?f \<in> carrier P; ?x \<in> carrier R\<rbrakk> \<Longrightarrow> to_fun ?f ?x \<in> carrier R
?a \<in> carrier R \<Longrightarrow> monom P ?a ?n \<in> carrier P

goal (1 subgoal):
 1. zcf (Cring_Poly.compose R (monom P a (Suc n)) p) = a \<otimes> zcf p [^] Suc n
[PROOF STEP]
by fastforce


[STATEMENT]
lemma bounded_linear_scaleR_left: "bounded_linear (\<lambda>r. scaleR r x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear (\<lambda>r. r *\<^sub>R x)
[PROOF STEP]
using bounded_bilinear_scaleR
[PROOF STATE]
proof (prove)
using this:
bounded_bilinear (*\<^sub>R)

goal (1 subgoal):
 1. bounded_linear (\<lambda>r. r *\<^sub>R x)
[PROOF STEP]
by (rule bounded_bilinear.bounded_linear_left)


[STATEMENT]
lemma stream_pred_coinduct[case_names stream_pred, coinduct pred: pred_stream]:
    assumes "R w"
    assumes "\<And> a w. R (a ## w) \<Longrightarrow> P a \<and> R w"
    shows "pred_stream P w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pred_stream P w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
R w
R (?a ## ?w) \<Longrightarrow> P ?a \<and> R ?w

goal (1 subgoal):
 1. pred_stream P w
[PROOF STEP]
unfolding stream.pred_rel eq_onp_def
[PROOF STATE]
proof (prove)
using this:
R w
R (?a ## ?w) \<Longrightarrow> P ?a \<and> R ?w

goal (1 subgoal):
 1. stream_all2 (\<lambda>x y. P x \<and> x = y) w w
[PROOF STEP]
by (coinduction arbitrary: w) (auto)


[STATEMENT]
lemma mod_diff_right_eq: "
  (a::nat) \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
assume a_as:"a \<le> b"
[PROOF STATE]
proof (state)
this:
a \<le> b

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
have "(b - a) mod m = (b - a + a div m * m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a) mod m = (b - a + a div m * m) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b - a) mod m = (b - a + a div m * m) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - a) mod m = (b - a + a div m * m) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b + a div m * m - a) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a + a div m * m) mod m = (b + a div m * m - a) mod m
[PROOF STEP]
using a_as
[PROOF STATE]
proof (prove)
using this:
a \<le> b

goal (1 subgoal):
 1. (b - a + a div m * m) mod m = (b + a div m * m - a) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b - a + a div m * m) mod m = (b + a div m * m - a) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - a + a div m * m) mod m = (b + a div m * m - a) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b + a div m * m - (a div m * m + a mod m)) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b + a div m * m - a) mod m = (b + a div m * m - (a div m * m + a mod m)) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b + a div m * m - a) mod m = (b + a div m * m - (a div m * m + a mod m)) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b + a div m * m - a) mod m = (b + a div m * m - (a div m * m + a mod m)) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b + a div m * m - a div m * m - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b + a div m * m - (a div m * m + a mod m)) mod m = (b + a div m * m - a div m * m - a mod m) mod m
[PROOF STEP]
by (simp only: diff_diff_left[symmetric])
[PROOF STATE]
proof (state)
this:
(b + a div m * m - (a div m * m + a mod m)) mod m = (b + a div m * m - a div m * m - a mod m) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b + a div m * m - (a div m * m + a mod m)) mod m = (b + a div m * m - a div m * m - a mod m) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b + a div m * m - a div m * m - a mod m) mod m = (b - a mod m) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b + a div m * m - a div m * m - a mod m) mod m = (b - a mod m) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(b - a) mod m = (b - a mod m) mod m

goal (1 subgoal):
 1. (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(b - a) mod m = (b - a mod m) mod m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutations_of_set_aux_list_refine:
  assumes "distinct xs"
  shows   "set (permutations_of_set_aux_list acc xs) = permutations_of_set_aux acc (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (permutations_of_set_aux_list acc xs) = permutations_of_set_aux acc (set xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. set (permutations_of_set_aux_list acc xs) = permutations_of_set_aux acc (set xs)
[PROOF STEP]
by (induction acc xs rule: permutations_of_set_aux_list.induct)
     (subst permutations_of_set_aux_list.simps,
      subst permutations_of_set_aux.simps,
      simp_all add: set_list_bind)


[STATEMENT]
lemma starfun_ln_ge_zero [simp]: "\<And>x. 1 \<le> x \<Longrightarrow> 0 \<le> ( *f* real_ln) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 1 \<le> x \<Longrightarrow> 0 \<le> (*f* real_ln) x
[PROOF STEP]
by transfer (rule ln_ge_zero)


[STATEMENT]
lemma pseudo_rationalizable_on_path_independent_on:
  assumes "pseudo_rationalizable_on A Rs f"
  shows "path_independent_on A f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_independent_on A f
[PROOF STEP]
proof %invisible (rule path_independent_onI2)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. f_range_on A f
 2. Chernoff_on A f
 3. consistency_on A f
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
pseudo_rationalizable_on A Rs f
[PROOF STEP]
show "f_range_on A f"
[PROOF STATE]
proof (prove)
using this:
pseudo_rationalizable_on A Rs f

goal (1 subgoal):
 1. f_range_on A f
[PROOF STEP]
unfolding f_range_on_def pseudo_rationalizable_on_def2
[PROOF STATE]
proof (prove)
using this:
(\<forall>r\<in>Rs. Linear_order r) \<and> (\<forall>B\<subseteq>A. f B = (\<Union>r\<in>Rs. set_option (MaxR.MaxR_opt r B)))

goal (1 subgoal):
 1. \<forall>B\<subseteq>A. f B \<subseteq> B
[PROOF STEP]
using MaxR.range_Some[unfolded MaxR_def]
[PROOF STATE]
proof (prove)
using this:
(\<forall>r\<in>Rs. Linear_order r) \<and> (\<forall>B\<subseteq>A. f B = (\<Union>r\<in>Rs. set_option (MaxR.MaxR_opt r B)))
Linear_order ?r \<Longrightarrow> MaxR.MaxR_opt ?r ?A = Some ?a \<longrightarrow> ?a \<in> ?A \<inter> Field ?r

goal (1 subgoal):
 1. \<forall>B\<subseteq>A. f B \<subseteq> B
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f_range_on A f

goal (2 subgoals):
 1. Chernoff_on A f
 2. consistency_on A f
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
pseudo_rationalizable_on A Rs f
[PROOF STEP]
show "Chernoff_on A f"
[PROOF STATE]
proof (prove)
using this:
pseudo_rationalizable_on A Rs f

goal (1 subgoal):
 1. Chernoff_on A f
[PROOF STEP]
unfolding pseudo_rationalizable_on_def2
[PROOF STATE]
proof (prove)
using this:
(\<forall>r\<in>Rs. Linear_order r) \<and> (\<forall>B\<subseteq>A. f B = (\<Union>r\<in>Rs. set_option (MaxR.MaxR_opt r B)))

goal (1 subgoal):
 1. Chernoff_on A f
[PROOF STEP]
by - (rule Chernoff_onI; clarsimp; metis MaxR.intro MaxR.subset empty_subsetI insert_subset option.simps(15))
[PROOF STATE]
proof (state)
this:
Chernoff_on A f

goal (1 subgoal):
 1. consistency_on A f
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
pseudo_rationalizable_on A Rs f
[PROOF STEP]
show "consistency_on A f"
[PROOF STATE]
proof (prove)
using this:
pseudo_rationalizable_on A Rs f

goal (1 subgoal):
 1. consistency_on A f
[PROOF STEP]
unfolding pseudo_rationalizable_on_def2
[PROOF STATE]
proof (prove)
using this:
(\<forall>r\<in>Rs. Linear_order r) \<and> (\<forall>B\<subseteq>A. f B = (\<Union>r\<in>Rs. set_option (MaxR.MaxR_opt r B)))

goal (1 subgoal):
 1. consistency_on A f
[PROOF STEP]
by - (rule consistency_onI; simp; metis (no_types, lifting) MaxR.intro MaxR.subset SUP_cong SUP_le_iff)
[PROOF STATE]
proof (state)
this:
consistency_on A f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measurable_compose_inv:
  assumes inj: "\<And>j. j \<in> J \<Longrightarrow> f' (f j) = j"
  shows "(\<lambda>m. compose (f ` J) m f') \<in> measurable (PiM J (\<lambda>_. M)) (PiM (f ` J) (\<lambda>_. M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. compose (f ` J) m f') \<in> Pi\<^sub>M J (\<lambda>_. M) \<rightarrow>\<^sub>M Pi\<^sub>M (f ` J) (\<lambda>_. M)
[PROOF STEP]
unfolding compose_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. \<lambda>x\<in>f ` J. m (f' x)) \<in> Pi\<^sub>M J (\<lambda>_. M) \<rightarrow>\<^sub>M Pi\<^sub>M (f ` J) (\<lambda>_. M)
[PROOF STEP]
by (rule measurable_restrict) (auto simp: inj)


[STATEMENT]
lemma fds_deriv_const [simp]: "fds_deriv (fds_const c) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_deriv (fds_const c) = 0
[PROOF STEP]
by (rule fds_eqI) (simp add: fds_nth_deriv fds_nth_const)


[STATEMENT]
lemma (in Ring) whole_ideal:"ideal R (carrier R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal R (carrier R)
[PROOF STEP]
apply (rule ideal_condition1)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. carrier R \<subseteq> carrier R
 2. carrier R \<noteq> {}
 3. \<forall>x\<in>carrier R. \<forall>y\<in>carrier R. x \<plusminus> y \<in> carrier R
 4. \<forall>r\<in>carrier R. \<forall>x\<in>carrier R. r \<cdot>\<^sub>r x \<in> carrier R
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. carrier R \<noteq> {}
 2. \<forall>x\<in>carrier R. \<forall>y\<in>carrier R. x \<plusminus> y \<in> carrier R
 3. \<forall>r\<in>carrier R. \<forall>x\<in>carrier R. r \<cdot>\<^sub>r x \<in> carrier R
[PROOF STEP]
apply (cut_tac ring_zero, blast)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x\<in>carrier R. \<forall>y\<in>carrier R. x \<plusminus> y \<in> carrier R
 2. \<forall>r\<in>carrier R. \<forall>x\<in>carrier R. r \<cdot>\<^sub>r x \<in> carrier R
[PROOF STEP]
apply (cut_tac ring_is_ag,
        simp add:aGroup.ag_pOp_closed,
        simp add:ring_tOp_closed)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Ln_inverse_if:
  assumes "z \<noteq> 0"
    shows "Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then -(Ln z) + \<i> * 2 * complex_of_real pi else -(Ln z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
proof (cases "z \<in> \<real>\<^sub>\<le>\<^sub>0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
 2. z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
z \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (2 subgoals):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
 2. z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<notin> \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
by (simp add: Ln_inverse)
[PROOF STATE]
proof (state)
this:
Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
z \<in> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
have z: "Im z = 0" "Re z < 0" "- z \<notin> \<real>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
using this:
z \<in> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. Im z = 0 &&& Re z < 0 &&& - z \<notin> \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
using assms complex_eq_iff complex_nonpos_Reals_iff
[PROOF STATE]
proof (prove)
using this:
z \<in> \<real>\<^sub>\<le>\<^sub>0
z \<noteq> 0
(?x = ?y) = (Re ?x = Re ?y \<and> Im ?x = Im ?y)
(?z \<in> \<real>\<^sub>\<le>\<^sub>0) = (Re ?z \<le> 0 \<and> Im ?z = 0)

goal (1 subgoal):
 1. Im z = 0 &&& Re z < 0 &&& - z \<notin> \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im z = 0
Re z < 0
- z \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
have "Ln(inverse z) = Ln(- (inverse (-z)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (inverse z) = Ln (- inverse (- z))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Ln (inverse z) = Ln (- inverse (- z))

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Ln (inverse z) = Ln (- inverse (- z))

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
have "\<dots> = Ln (inverse (-z)) + \<i> * complex_of_real pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (- inverse (- z)) = Ln (inverse (- z)) + \<i> * complex_of_real pi
[PROOF STEP]
using assms z
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0
Im z = 0
Re z < 0
- z \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. Ln (- inverse (- z)) = Ln (inverse (- z)) + \<i> * complex_of_real pi
[PROOF STEP]
by (simp add: Ln_minus divide_less_0_iff)
[PROOF STATE]
proof (state)
this:
Ln (- inverse (- z)) = Ln (inverse (- z)) + \<i> * complex_of_real pi

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Ln (- inverse (- z)) = Ln (inverse (- z)) + \<i> * complex_of_real pi

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
have "\<dots> = - Ln (- z) + \<i> * complex_of_real pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (inverse (- z)) + \<i> * complex_of_real pi = - Ln (- z) + \<i> * complex_of_real pi
[PROOF STEP]
using z Ln_inverse
[PROOF STATE]
proof (prove)
using this:
Im z = 0
Re z < 0
- z \<notin> \<real>\<^sub>\<le>\<^sub>0
?z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse ?z) = - Ln ?z

goal (1 subgoal):
 1. Ln (inverse (- z)) + \<i> * complex_of_real pi = - Ln (- z) + \<i> * complex_of_real pi
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
Ln (inverse (- z)) + \<i> * complex_of_real pi = - Ln (- z) + \<i> * complex_of_real pi

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Ln (inverse (- z)) + \<i> * complex_of_real pi = - Ln (- z) + \<i> * complex_of_real pi

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
have "\<dots> = - (Ln z) + \<i> * 2 * complex_of_real pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - Ln (- z) + \<i> * complex_of_real pi = - Ln z + \<i> * 2 * complex_of_real pi
[PROOF STEP]
using Ln_minus assms z
[PROOF STATE]
proof (prove)
using this:
?z \<noteq> 0 \<Longrightarrow> Ln (- ?z) = (if Im ?z \<le> 0 \<and> \<not> (Re ?z < 0 \<and> Im ?z = 0) then Ln ?z + \<i> * complex_of_real pi else Ln ?z - \<i> * complex_of_real pi)
z \<noteq> 0
Im z = 0
Re z < 0
- z \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. - Ln (- z) + \<i> * complex_of_real pi = - Ln z + \<i> * 2 * complex_of_real pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- Ln (- z) + \<i> * complex_of_real pi = - Ln z + \<i> * 2 * complex_of_real pi

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Ln (inverse z) = - Ln z + \<i> * 2 * complex_of_real pi
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Ln (inverse z) = - Ln z + \<i> * 2 * complex_of_real pi

goal (1 subgoal):
 1. Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
by (simp add: True)
[PROOF STATE]
proof (state)
this:
Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_set_rel_transfer: "\<lbrakk>(s,s')\<in>\<langle>R\<rangle>set_rel; single_valued R; finite s\<rbrakk> \<Longrightarrow> finite s'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(s, s') \<in> \<langle>R\<rangle>set_rel; single_valued R; finite s\<rbrakk> \<Longrightarrow> finite s'
[PROOF STEP]
unfolding set_rel_alt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(s, s') \<in> {(A, B). A \<subseteq> R\<inverse> `` B \<and> B \<subseteq> R `` A}; single_valued R; finite s\<rbrakk> \<Longrightarrow> finite s'
[PROOF STEP]
by (blast intro: finite_subset[OF _ finite_Image_sv])


[STATEMENT]
lemma open_prod_intro:
  assumes "\<And>x. x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S"
  shows "open S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> ?x \<in> A \<times> B \<and> A \<times> B \<subseteq> S

goal (1 subgoal):
 1. open S
[PROOF STEP]
unfolding open_prod_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> ?x \<in> A \<times> B \<and> A \<times> B \<subseteq> S

goal (1 subgoal):
 1. \<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S
[PROOF STEP]
by fast


[STATEMENT]
lemma unwinding_in_Ints: "(z - Ln(exp z)) / (of_real(2*pi) * \<i>) \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z - Ln (exp z)) / (complex_of_real (2 * pi) * \<i>) \<in> \<int>
[PROOF STEP]
using Arg_exp_diff_2pi [of z]
[PROOF STATE]
proof (prove)
using this:
\<exists>k. Im z - real_of_int k * (2 * pi) = Arg (exp z)

goal (1 subgoal):
 1. (z - Ln (exp z)) / (complex_of_real (2 * pi) * \<i>) \<in> \<int>
[PROOF STEP]
by (force simp: Ints_def image_def field_simps Arg_def intro!: complex_eqI)


[STATEMENT]
lemma ring_hom_trans: \<^marker>\<open>contributor \<open>Paulo Em?lio de Vilhena\<close>\<close>
  "\<lbrakk> f \<in> ring_hom R S; g \<in> ring_hom S T \<rbrakk> \<Longrightarrow> g \<circ> f \<in> ring_hom R T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> ring_hom R S; g \<in> ring_hom S T\<rbrakk> \<Longrightarrow> g \<circ> f \<in> ring_hom R T
[PROOF STEP]
by (rule ring_hom_memI) (auto simp add: ring_hom_closed ring_hom_mult ring_hom_add ring_hom_one)