[STATEMENT]
lemma separation_by_component_closed:
  fixes S :: "'a :: euclidean_space set"
  assumes "closed S" "\<not> connected(- S)"
  obtains C where "C \<in> components S" "\<not> connected(- C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>C. \<lbrakk>C \<in> components S; \<not> connected (- C)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>C. \<lbrakk>C \<in> components S; \<not> connected (- C)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain x y where "closed S" "x \<notin> S" "y \<notin> S" and "\<not> connected_component (- S) x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>closed S; x \<notin> S; y \<notin> S; \<not> connected_component (- S) x y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
closed S
\<not> connected (- S)

goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>closed S; x \<notin> S; y \<notin> S; \<not> connected_component (- S) x y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: connected_iff_connected_component)
[PROOF STATE]
proof (state)
this:
closed S
x \<notin> S
y \<notin> S
\<not> connected_component (- S) x y

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>C \<in> components S; \<not> connected (- C)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
closed S
x \<notin> S
y \<notin> S
\<not> connected_component (- S) x y
[PROOF STEP]
obtain C where "C \<in> components S" "\<not> connected_component(- C) x y"
[PROOF STATE]
proof (prove)
using this:
closed S
x \<notin> S
y \<notin> S
\<not> connected_component (- S) x y

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>C \<in> components S; \<not> connected_component (- C) x y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using separation_by_component_closed_pointwise
[PROOF STATE]
proof (prove)
using this:
closed S
x \<notin> S
y \<notin> S
\<not> connected_component (- S) x y
\<lbrakk>closed ?S; \<not> connected_component (- ?S) ?a ?b; \<And>C. \<lbrakk>C \<in> components ?S; \<not> connected_component (- C) ?a ?b\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>C \<in> components S; \<not> connected_component (- C) x y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
C \<in> components S
\<not> connected_component (- C) x y

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>C \<in> components S; \<not> connected (- C)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
C \<in> components S
\<not> connected_component (- C) x y
[PROOF STEP]
show "thesis"
[PROOF STATE]
proof (prove)
using this:
C \<in> components S
\<not> connected_component (- C) x y

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (metis Compl_iff \<open>x \<notin> S\<close> \<open>y \<notin> S\<close> connected_component_eq_self in_components_subset mem_Collect_eq subsetD that)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem sum_max_correct:
  assumes PRE: "V\<noteq>{}"
  shows "sum_max V \<le> SPEC (\<lambda>(s,m). s=\<Sum>V \<and> m=Max V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_max V \<le> SPEC (\<lambda>(s, m). s = \<Sum> V \<and> m = Max V)
[PROOF STEP]
txt \<open>
    The precondition \<open>V\<noteq>{}\<close> is necessary, as the
    \<open>Max\<close>-operator from Isabelle/HOL's standard library is not defined
    for empty sets.
\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_max V \<le> SPEC (\<lambda>(s, m). s = \<Sum> V \<and> m = Max V)
[PROOF STEP]
using PRE
[PROOF STATE]
proof (prove)
using this:
V \<noteq> {}

goal (1 subgoal):
 1. sum_max V \<le> SPEC (\<lambda>(s, m). s = \<Sum> V \<and> m = Max V)
[PROOF STEP]
unfolding sum_max_def
[PROOF STATE]
proof (prove)
using this:
V \<noteq> {}

goal (1 subgoal):
 1. WHILE (\<lambda>(V, s, m). V \<noteq> {}) (\<lambda>(V, s, m). SPEC (\<lambda>x. x \<in> V) \<bind> (\<lambda>x. let V = V - {x}; s = s + x; m = max m x in RETURN (V, s, m))) (V, 0, 0) \<bind> (\<lambda>(uu_, s, m). RETURN (s, m)) \<le> SPEC (\<lambda>(s, m). s = \<Sum> V \<and> m = Max V)
[PROOF STEP]
apply (intro WHILE_rule[where I="sum_max_invar V"] refine_vcg) \<comment> \<open>Invoke vcg\<close>
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. V \<noteq> {} \<Longrightarrow> sum_max_invar V (V, 0, 0)
 2. \<And>s a b aa ba x. \<lbrakk>V \<noteq> {}; sum_max_invar V s; case s of (V, s, m) \<Rightarrow> V \<noteq> {}; s = (a, b); b = (aa, ba); x \<in> a\<rbrakk> \<Longrightarrow> sum_max_invar V (a - {x}, aa + x, max ba x)
 3. \<And>s a b aa ba. \<lbrakk>V \<noteq> {}; sum_max_invar V s; \<not> (case s of (V, s, m) \<Rightarrow> V \<noteq> {}); s = (a, b); b = (aa, ba)\<rbrakk> \<Longrightarrow> case (aa, ba) of (s, m) \<Rightarrow> s = \<Sum> V \<and> m = Max V
[PROOF STEP]
txt \<open>Note that we have explicitely instantiated
    the rule for the while-loop with the invariant. If this is not done,
    the verification condition generator will stop at the WHILE-loop.
\<close>
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. V \<noteq> {} \<Longrightarrow> sum_max_invar V (V, 0, 0)
 2. \<And>s a b aa ba x. \<lbrakk>V \<noteq> {}; sum_max_invar V s; case s of (V, s, m) \<Rightarrow> V \<noteq> {}; s = (a, b); b = (aa, ba); x \<in> a\<rbrakk> \<Longrightarrow> sum_max_invar V (a - {x}, aa + x, max ba x)
 3. \<And>s a b aa ba. \<lbrakk>V \<noteq> {}; sum_max_invar V s; \<not> (case s of (V, s, m) \<Rightarrow> V \<noteq> {}); s = (a, b); b = (aa, ba)\<rbrakk> \<Longrightarrow> case (aa, ba) of (s, m) \<Rightarrow> s = \<Sum> V \<and> m = Max V
[PROOF STEP]
apply (auto intro: sum_max_invar_step) \<comment> \<open>Discharge step\<close>
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>\<not> sum_max_invar V (V, 0, 0); x \<in> V\<rbrakk> \<Longrightarrow> False
 2. \<And>aaa baa x. \<lbrakk>sum_max_invar V ({}, aaa, baa); x \<in> V\<rbrakk> \<Longrightarrow> aaa = \<Sum> V
 3. \<And>aaa baa x. \<lbrakk>sum_max_invar V ({}, aaa, baa); x \<in> V\<rbrakk> \<Longrightarrow> baa = Max V
[PROOF STEP]
unfolding sum_max_invar_def \<comment> \<open>Unfold invariant definition\<close>
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>\<not> (case (V, 0, 0) of (Va, s, m) \<Rightarrow> Va \<subseteq> V \<and> s = \<Sum> (V - Va) \<and> m = (if V - Va = {} then 0 else Max (V - Va)) \<and> finite (V - Va)); x \<in> V\<rbrakk> \<Longrightarrow> False
 2. \<And>aaa baa x. \<lbrakk>case ({}, aaa, baa) of (Va, s, m) \<Rightarrow> Va \<subseteq> V \<and> s = \<Sum> (V - Va) \<and> m = (if V - Va = {} then 0 else Max (V - Va)) \<and> finite (V - Va); x \<in> V\<rbrakk> \<Longrightarrow> aaa = \<Sum> V
 3. \<And>aaa baa x. \<lbrakk>case ({}, aaa, baa) of (Va, s, m) \<Rightarrow> Va \<subseteq> V \<and> s = \<Sum> (V - Va) \<and> m = (if V - Va = {} then 0 else Max (V - Va)) \<and> finite (V - Va); x \<in> V\<rbrakk> \<Longrightarrow> baa = Max V
[PROOF STEP]
apply (auto) \<comment> \<open>Discharge remaining goals\<close>
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma pochhammer_0_left:
  "pochhammer 0 n = (if n = 0 then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer (0::'a) n = (if n = 0 then 1::'a else (0::'a))
[PROOF STEP]
by (induction n) (simp_all add: pochhammer_rec)


[STATEMENT]
lemma rep_number_unfold_set: "x \<in> \<V> \<Longrightarrow> size {#bl \<in># \<B> . x \<in> bl#} = \<r>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> \<V> \<Longrightarrow> size (filter_mset ((\<in>) x) \<B>) = \<r>
[PROOF STEP]
using rep_number
[PROOF STATE]
proof (prove)
using this:
?x \<in> \<V> \<Longrightarrow> \<B> rep ?x = \<r>

goal (1 subgoal):
 1. x \<in> \<V> \<Longrightarrow> size (filter_mset ((\<in>) x) \<B>) = \<r>
[PROOF STEP]
by (simp add: point_replication_number_def)


[STATEMENT]
lemma newton_poly_sum:
  "newton_poly n = sum_list (map (\<lambda> i. smult (c i) (N i)) [0 ..< Suc n])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.newton_poly n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (N i))
[PROOF STEP]
unfolding newton_poly_def N_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))
[PROOF STEP]
assume "j \<le> n"
[PROOF STATE]
proof (state)
this:
j \<le> n

goal (1 subgoal):
 1. b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))
[PROOF STEP]
hence "b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))"
[PROOF STATE]
proof (prove)
using this:
j \<le> n

goal (1 subgoal):
 1. b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
proof (induct j n rule: b.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i n. \<lbrakk>\<lbrakk>\<not> n \<le> i; Suc i \<le> n\<rbrakk> \<Longrightarrow> b (Suc i) n = (\<Sum>ia\<leftarrow>[Suc i..<Suc n]. smult (c ia) (Xij (Suc i) ia)); i \<le> n\<rbrakk> \<Longrightarrow> b i n = (\<Sum>ia\<leftarrow>[i..<Suc n]. smult (c ia) (Xij i ia))
[PROOF STEP]
case (1 j n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> n \<le> j; Suc j \<le> n\<rbrakk> \<Longrightarrow> b (Suc j) n = (\<Sum>i\<leftarrow>[Suc j..<Suc n]. smult (c i) (Xij (Suc j) i))
j \<le> n

goal (1 subgoal):
 1. \<And>i n. \<lbrakk>\<lbrakk>\<not> n \<le> i; Suc i \<le> n\<rbrakk> \<Longrightarrow> b (Suc i) n = (\<Sum>ia\<leftarrow>[Suc i..<Suc n]. smult (c ia) (Xij (Suc i) ia)); i \<le> n\<rbrakk> \<Longrightarrow> b i n = (\<Sum>ia\<leftarrow>[i..<Suc n]. smult (c ia) (Xij i ia))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
proof (cases "j \<ge> n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
 2. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n \<le> j

goal (2 subgoals):
 1. n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
 2. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
with 1(2)
[PROOF STATE]
proof (chain)
picking this:
j \<le> n
n \<le> j
[PROOF STEP]
have j: "j = n"
[PROOF STATE]
proof (prove)
using this:
j \<le> n
n \<le> j

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

goal (2 subgoals):
 1. n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
 2. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
hence "b j n = [:c n:]"
[PROOF STATE]
proof (prove)
using this:
j = n

goal (1 subgoal):
 1. b j n = [:c n:]
[PROOF STEP]
unfolding b.simps[of j n]
[PROOF STATE]
proof (prove)
using this:
j = n

goal (1 subgoal):
 1. (if n \<le> j then [:c n:] else b (Suc j) n * X j + [:c j:]) = [:c n:]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b j n = [:c n:]

goal (2 subgoals):
 1. n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
 2. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
b j n = [:c n:]

goal (1 subgoal):
 1. b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
unfolding j
[PROOF STATE]
proof (prove)
using this:
b n n = [:c n:]

goal (1 subgoal):
 1. b n n = (\<Sum>i\<leftarrow>[n..<Suc n]. smult (c i) (Xij n i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))

goal (1 subgoal):
 1. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> n \<le> j

goal (1 subgoal):
 1. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
hence b: "b j n = b (Suc j) n * X j + [: c j:]"
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> j

goal (1 subgoal):
 1. b j n = b (Suc j) n * X j + [:c j:]
[PROOF STEP]
unfolding b.simps[of j n]
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> j

goal (1 subgoal):
 1. (if n \<le> j then [:c n:] else b (Suc j) n * X j + [:c j:]) = b (Suc j) n * X j + [:c j:]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b j n = b (Suc j) n * X j + [:c j:]

goal (1 subgoal):
 1. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
define nn where "nn = Suc n"
[PROOF STATE]
proof (state)
this:
nn = Suc n

goal (1 subgoal):
 1. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
from 1(2)
[PROOF STATE]
proof (chain)
picking this:
j \<le> n
[PROOF STEP]
have id: "[j..< nn] = j # [Suc j ..< nn]"
[PROOF STATE]
proof (prove)
using this:
j \<le> n

goal (1 subgoal):
 1. [j..<nn] = j # [Suc j..<nn]
[PROOF STEP]
unfolding nn_def
[PROOF STATE]
proof (prove)
using this:
j \<le> n

goal (1 subgoal):
 1. [j..<Suc n] = j # [Suc j..<Suc n]
[PROOF STEP]
by (simp add: upt_rec)
[PROOF STATE]
proof (state)
this:
[j..<nn] = j # [Suc j..<nn]

goal (1 subgoal):
 1. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<not> n \<le> j
[PROOF STEP]
have "Suc j \<le> n"
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> j

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

goal (1 subgoal):
 1. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
note IH = 1(1)[OF False this]
[PROOF STATE]
proof (state)
this:
b (Suc j) n = (\<Sum>i\<leftarrow>[Suc j..<Suc n]. smult (c i) (Xij (Suc j) i))

goal (1 subgoal):
 1. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
have id2: "(\<Sum>x\<leftarrow>[Suc j..< nn]. smult (c x) (Xij (Suc j) x * X j)) =
          (\<Sum>i\<leftarrow>[Suc j..< nn]. smult (c i) (Xij j i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[Suc j..<nn]. smult (c x) (Xij (Suc j) x * X j)) = (\<Sum>i\<leftarrow>[Suc j..<nn]. smult (c i) (Xij j i))
[PROOF STEP]
proof (rule arg_cong[of _ _ sum_list], rule map_ext, intro impI, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> set [Suc j..<nn] \<Longrightarrow> smult (c x) (Xij (Suc j) x * X j) = smult (c x) (Xij j x)
[PROOF STEP]
case (1 i)
[PROOF STATE]
proof (state)
this:
i \<in> set [Suc j..<nn]

goal (1 subgoal):
 1. \<And>x. x \<in> set [Suc j..<nn] \<Longrightarrow> smult (c x) (Xij (Suc j) x * X j) = smult (c x) (Xij j x)
[PROOF STEP]
hence "Xij (Suc j) i * X j = Xij j i"
[PROOF STATE]
proof (prove)
using this:
i \<in> set [Suc j..<nn]

goal (1 subgoal):
 1. Xij (Suc j) i * X j = Xij j i
[PROOF STEP]
by (simp add: Xij_def upt_conv_Cons)
[PROOF STATE]
proof (state)
this:
Xij (Suc j) i * X j = Xij j i

goal (1 subgoal):
 1. \<And>x. x \<in> set [Suc j..<nn] \<Longrightarrow> smult (c x) (Xij (Suc j) x * X j) = smult (c x) (Xij j x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
Xij (Suc j) i * X j = Xij j i

goal (1 subgoal):
 1. smult (c i) (Xij (Suc j) i * X j) = smult (c i) (Xij j i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
smult (c i) (Xij (Suc j) i * X j) = smult (c i) (Xij j i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>[Suc j..<nn]. smult (c x) (Xij (Suc j) x * X j)) = (\<Sum>i\<leftarrow>[Suc j..<nn]. smult (c i) (Xij j i))

goal (1 subgoal):
 1. \<not> n \<le> j \<Longrightarrow> b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
unfolding b IH sum_list_mult_const[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[Suc j..<Suc n]. smult (c x) (Xij (Suc j) x) * X j) + [:c j:] = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))
[PROOF STEP]
unfolding nn_def[symmetric] id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[Suc j..<nn]. smult (c x) (Xij (Suc j) x) * X j) + [:c j:] = (\<Sum>i\<leftarrow>j # [Suc j..<nn]. smult (c i) (Xij j i))
[PROOF STEP]
by (simp add: id2)
[PROOF STATE]
proof (state)
this:
b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b j n = (\<Sum>i\<leftarrow>[j..<Suc n]. smult (c i) (Xij j i))

goal (1 subgoal):
 1. b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?j2 \<le> n \<Longrightarrow> b ?j2 n = (\<Sum>i\<leftarrow>[?j2..<Suc n]. smult (c i) (Xij ?j2 i))

goal (1 subgoal):
 1. b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))
[PROOF STEP]
from this[of 0]
[PROOF STATE]
proof (chain)
picking this:
0 \<le> n \<Longrightarrow> b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))
[PROOF STEP]
show "b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))"
[PROOF STATE]
proof (prove)
using this:
0 \<le> n \<Longrightarrow> b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))

goal (1 subgoal):
 1. b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b 0 n = (\<Sum>i\<leftarrow>[0..<Suc n]. smult (c i) (Xij 0 i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_exp_nth_deriv[simp]:
  "fps_nth_deriv n (fps_exp (a::'a::field_char_0)) = (fps_const a)^n * (fps_exp a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_nth_deriv n (fps_exp a) = fps_const a ^ n * fps_exp a
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma conga2_cop2__col_1:
  assumes "\<not> Col A B C" and
    "P B A CongA P B C" and
    "P' B A CongA P' B C" and
    "Coplanar A B C P" and
    "Coplanar A B C P'"
  shows "Col B P P'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Col B P P'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Col B P P'
[PROOF STEP]
have P1: "\<not> B Out A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> B Out A C
[PROOF STEP]
using Col_cases assms(1) out_col
[PROOF STATE]
proof (prove)
using this:
Col ?A ?B ?C \<or> Col ?A ?C ?B \<or> Col ?B ?A ?C \<or> Col ?B ?C ?A \<or> Col ?C ?A ?B \<or> Col ?C ?B ?A \<Longrightarrow> Col ?A ?B ?C
\<not> Col A B C
?A Out ?B ?C \<Longrightarrow> Col ?A ?B ?C

goal (1 subgoal):
 1. \<not> B Out A C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> B Out A C

goal (1 subgoal):
 1. Col B P P'
[PROOF STEP]
have P2: "Coplanar A B P P'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar A B P P'
[PROOF STEP]
by (meson assms(1) assms(4) assms(5) coplanar_perm_12 coplanar_trans_1 not_col_permutation_2)
[PROOF STATE]
proof (state)
this:
Coplanar A B P P'

goal (1 subgoal):
 1. Col B P P'
[PROOF STEP]
have "Coplanar B C P P'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar B C P P'
[PROOF STEP]
using assms(1) assms(4) assms(5) coplanar_trans_1
[PROOF STATE]
proof (prove)
using this:
\<not> Col A B C
Coplanar A B C P
Coplanar A B C P'
\<lbrakk>\<not> Col ?P ?Q ?R; Coplanar ?P ?Q ?R ?A; Coplanar ?P ?Q ?R ?B\<rbrakk> \<Longrightarrow> Coplanar ?Q ?R ?A ?B

goal (1 subgoal):
 1. Coplanar B C P P'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Coplanar B C P P'

goal (1 subgoal):
 1. Col B P P'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Coplanar B C P P'

goal (1 subgoal):
 1. Col B P P'
[PROOF STEP]
using P1 P2 conga2_cop2__col assms(2) assms(3) conga2_cop2__col
[PROOF STATE]
proof (prove)
using this:
Coplanar B C P P'
\<not> B Out A C
Coplanar A B P P'
\<lbrakk>\<not> ?B Out ?A ?C; ?P ?B ?A CongA ?P ?B ?C; ?P' ?B ?A CongA ?P' ?B ?C; Coplanar ?A ?B ?P ?P'; Coplanar ?B ?C ?P ?P'\<rbrakk> \<Longrightarrow> Col ?B ?P ?P'
P B A CongA P B C
P' B A CongA P' B C
\<lbrakk>\<not> ?B Out ?A ?C; ?P ?B ?A CongA ?P ?B ?C; ?P' ?B ?A CongA ?P' ?B ?C; Coplanar ?A ?B ?P ?P'; Coplanar ?B ?C ?P ?P'\<rbrakk> \<Longrightarrow> Col ?B ?P ?P'

goal (1 subgoal):
 1. Col B P P'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Col B P P'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trms_of_deg_leq_id':
  assumes "f \<in> carrier P"
  shows "f = (trms_of_deg_leq k f)  \<oplus>\<^bsub>P\<^esub> shift (Suc k) f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = trms_of_deg_leq k f \<oplus>\<^bsub>P\<^esub> shift (Suc k) f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc k)
[PROOF STEP]
using trms_of_deg_leq_id assms  trms_of_deg_leq_closed[of f]
[PROOF STATE]
proof (prove)
using this:
?f \<in> carrier P \<Longrightarrow> ?f \<ominus>\<^bsub>P\<^esub> trms_of_deg_leq ?k ?f = shift (Suc ?k) ?f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc ?k)
f \<in> carrier P
f \<in> carrier P \<Longrightarrow> trms_of_deg_leq ?n f \<in> carrier P

goal (1 subgoal):
 1. f = trms_of_deg_leq k f \<oplus>\<^bsub>P\<^esub> shift (Suc k) f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc k)
[PROOF STEP]
by (smt P.add.inv_closed P.l_zero P.m_closed P.minus_add P.minus_minus P.r_neg R.one_closed UP_a_assoc a_minus_def monom_closed shift_closed)


[STATEMENT]
lemma octo_inner_e6_left [simp]: "inner e6 x  = Im6 x"
 and octo_inner_e6_right [simp]: "inner x e6 = Im6 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e6 \<bullet> x = Im6 x &&& x \<bullet> e6 = Im6 x
[PROOF STEP]
unfolding inner_octo_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ree e6 * Ree x + Im1 e6 * Im1 x + Im2 e6 * Im2 x + Im3 e6 * Im3 x + Im4 e6 * Im4 x + Im5 e6 * Im5 x + Im6 e6 * Im6 x + Im7 e6 * Im7 x = Im6 x &&& Ree x * Ree e6 + Im1 x * Im1 e6 + Im2 x * Im2 e6 + Im3 x * Im3 e6 + Im4 x * Im4 e6 + Im5 x * Im5 e6 + Im6 x * Im6 e6 + Im7 x * Im7 e6 = Im6 x
[PROOF STEP]
by simp_all


[STATEMENT]
lemma covering_space_locally_compact_eq:
  fixes p :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
  assumes "covering_space C p S"
  shows "locally compact S \<longleftrightarrow> locally compact C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally compact S = locally compact C
[PROOF STEP]
proof (rule covering_space_locally_eq [OF assms])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>T. \<lbrakk>T \<subseteq> C; compact T\<rbrakk> \<Longrightarrow> compact (p ` T)
 2. \<And>q U. \<lbrakk>U \<subseteq> S; continuous_on U q; compact U\<rbrakk> \<Longrightarrow> compact (q ` U)
[PROOF STEP]
show "\<And>T. \<lbrakk>T \<subseteq> C; compact T\<rbrakk> \<Longrightarrow> compact (p ` T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>T. \<lbrakk>T \<subseteq> C; compact T\<rbrakk> \<Longrightarrow> compact (p ` T)
[PROOF STEP]
by (meson assms compact_continuous_image continuous_on_subset covering_space_imp_continuous)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?T \<subseteq> C; compact ?T\<rbrakk> \<Longrightarrow> compact (p ` ?T)

goal (1 subgoal):
 1. \<And>q U. \<lbrakk>U \<subseteq> S; continuous_on U q; compact U\<rbrakk> \<Longrightarrow> compact (q ` U)
[PROOF STEP]
qed (use compact_continuous_image in blast)


[STATEMENT]
lemma fv_EXISTS: "fv (EXISTS xs Q) = fv Q - set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv (EXISTS xs Q) = fv Q - set xs
[PROOF STEP]
by (induct xs arbitrary: Q) (auto simp: EXISTS_def)


[STATEMENT]
lemma monotonic: "mono(\<lambda>p x1 x2.
        \<exists>P Q. x1 = P \<and>
              x2 = Q \<and> P \<leadsto>[{(xa, x). p xa x}] Q \<and> Q \<leadsto>[{(xa, x). p xa x}] P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono (\<lambda>p x1 x2. \<exists>P Q. x1 = P \<and> x2 = Q \<and> P \<leadsto>[{(xa, x). p xa x}] Q \<and> Q \<leadsto>[{(xa, x). p xa x}] P)
[PROOF STEP]
apply(rule monoI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. x \<le> y \<Longrightarrow> (\<lambda>x1 x2. \<exists>P Q. x1 = P \<and> x2 = Q \<and> P \<leadsto>[{(xaa, xa). x xaa xa}] Q \<and> Q \<leadsto>[{(xaa, xa). x xaa xa}] P) \<le> (\<lambda>x1 x2. \<exists>P Q. x1 = P \<and> x2 = Q \<and> P \<leadsto>[{(xa, x). y xa x}] Q \<and> Q \<leadsto>[{(xa, x). y xa x}] P)
[PROOF STEP]
by(auto intro: Strong_Late_Sim.monotonic)


[STATEMENT]
lemma cblinfun_compose_image:
  \<open>(A o\<^sub>C\<^sub>L B) *\<^sub>S S =  A *\<^sub>S (B *\<^sub>S S)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A o\<^sub>C\<^sub>L B) *\<^sub>S S = A *\<^sub>S B *\<^sub>S S
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B S. \<lbrakk>bounded_clinear A; bounded_clinear B; closed_csubspace S\<rbrakk> \<Longrightarrow> closure ((A \<circ> B) ` S) = closure (A ` closure (B ` S))
[PROOF STEP]
unfolding image_comp[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B S. \<lbrakk>bounded_clinear A; bounded_clinear B; closed_csubspace S\<rbrakk> \<Longrightarrow> closure (A ` B ` S) = closure (A ` closure (B ` S))
[PROOF STEP]
apply (rule closure_bounded_linear_image_subset_eq[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B S. \<lbrakk>bounded_clinear A; bounded_clinear B; closed_csubspace S\<rbrakk> \<Longrightarrow> bounded_linear A
[PROOF STEP]
by (simp add: bounded_clinear.bounded_linear)


[STATEMENT]
lemma last_half_segments:
  assumes "half_segments_of_aform X \<noteq> []"
  shows "snd (last (half_segments_of_aform X)) =
    mirror_point (fst X) (lowest_vertex (fst X, nlex_pdevs (snd X)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (last (half_segments_of_aform X)) = mirror_point (fst X) (lowest_vertex (fst X, nlex_pdevs (snd X)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
half_segments_of_aform X \<noteq> []

goal (1 subgoal):
 1. snd (last (half_segments_of_aform X)) = mirror_point (fst X) (lowest_vertex (fst X, nlex_pdevs (snd X)))
[PROOF STEP]
by (auto simp add: half_segments_of_aform_def Let_def lowest_vertex_def mirror_point_def scaleR_2
    scaleR_sum_list[symmetric] last_polychain_of sum_list_distinct_selsort inl_def
    sum_list_independent_pdevs sum_list_list_of_pdevs)


[STATEMENT]
lemma H_tensor_iter_tensor_of_H:
  fixes n:: nat
  shows  "(H \<Otimes> H^\<^sub>\<otimes> n) = H^\<^sub>\<otimes> (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n))); j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))\<rbrakk> \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 2. dim_row (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
 3. dim_col (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
fix i j:: nat
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n))); j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))\<rbrakk> \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 2. dim_row (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
 3. dim_col (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
assume a0: "i < dim_row (H^\<^sub>\<otimes> (Suc n))" and a1: "j < dim_col (H^\<^sub>\<otimes> (Suc n))"
[PROOF STATE]
proof (state)
this:
i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n))); j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))\<rbrakk> \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 2. dim_row (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
 3. dim_col (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
have f0: "i \<in> {0..<2^(n+1)} \<and> j \<in> {0..<2^(n+1)}"
[PROOF STATE]
proof (prove)
using this:
i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))

goal (1 subgoal):
 1. i \<in> {0..<2 ^ (n + 1)} \<and> j \<in> {0..<2 ^ (n + 1)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i \<in> {0..<2 ^ (n + 1)} \<and> j \<in> {0..<2 ^ (n + 1)}

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n))); j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))\<rbrakk> \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 2. dim_row (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
 3. dim_col (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> {0..<2 ^ (n + 1)} \<and> j \<in> {0..<2 ^ (n + 1)}
[PROOF STEP]
have f1: "(H \<Otimes> H^\<^sub>\<otimes> n) $$ (i,j) = H $$ (i div (dim_row (H^\<^sub>\<otimes> n)),j div (dim_col (H^\<^sub>\<otimes> n)))
                                       * (H^\<^sub>\<otimes> n) $$ (i mod (dim_row (H^\<^sub>\<otimes> n)),j mod (dim_col (H^\<^sub>\<otimes> n)))"
[PROOF STATE]
proof (prove)
using this:
i \<in> {0..<2 ^ (n + 1)} \<and> j \<in> {0..<2 ^ (n + 1)}

goal (1 subgoal):
 1. (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j mod dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))))
[PROOF STEP]
by (simp add: H_without_scalar_prod)
[PROOF STATE]
proof (state)
this:
(H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j mod dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))))

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n))); j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))\<rbrakk> \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 2. dim_row (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
 3. dim_col (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
show "(H \<Otimes> H^\<^sub>\<otimes> n) $$ (i,j) = (H^\<^sub>\<otimes> (Suc n)) $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
proof (rule disjE)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?P \<or> ?Q
 2. ?P \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 3. ?Q \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
show "(i < 2^n \<or> j < 2^n) \<or> \<not>(i < 2^n \<or> j < 2^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < 2 ^ n \<or> j < 2 ^ n) \<or> \<not> (i < 2 ^ n \<or> j < 2 ^ n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(i < 2 ^ n \<or> j < 2 ^ n) \<or> \<not> (i < 2 ^ n \<or> j < 2 ^ n)

goal (2 subgoals):
 1. i < 2 ^ n \<or> j < 2 ^ n \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 2. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i < 2 ^ n \<or> j < 2 ^ n \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 2. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
assume a2: "(i < 2^n \<or> j < 2^n)"
[PROOF STATE]
proof (state)
this:
i < 2 ^ n \<or> j < 2 ^ n

goal (2 subgoals):
 1. i < 2 ^ n \<or> j < 2 ^ n \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 2. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < 2 ^ n \<or> j < 2 ^ n
[PROOF STEP]
have "(H^\<^sub>\<otimes> (Suc n)) $$ (i,j) = 1/sqrt(2) * ((H^\<^sub>\<otimes> n) $$ (i mod 2^n, j mod 2^n))"
[PROOF STATE]
proof (prove)
using this:
i < 2 ^ n \<or> j < 2 ^ n

goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
[PROOF STEP]
using a0 a1 f0 iter_tensor_of_H_fst_pos
[PROOF STATE]
proof (prove)
using this:
i < 2 ^ n \<or> j < 2 ^ n
i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
i \<in> {0..<2 ^ (n + 1)} \<and> j \<in> {0..<2 ^ (n + 1)}
\<lbrakk>?i < 2 ^ ?n \<or> ?j < 2 ^ ?n; ?i < 2 ^ (?n + 1) \<and> ?j < 2 ^ (?n + 1)\<rbrakk> \<Longrightarrow> Matrix.mat (2 ^ Suc ?n) (2 ^ Suc ?n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc ?n\<^esub>  j / sqrt 2 ^ Suc ?n)) $$ (?i, ?j) = complex_of_real (1 / sqrt 2) * Matrix.mat (2 ^ ?n) (2 ^ ?n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>?n\<^esub>  j / sqrt 2 ^ ?n)) $$ (?i mod 2 ^ ?n, ?j mod 2 ^ ?n)

goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
[PROOF STEP]
by (metis (mono_tags, lifting) atLeastLessThan_iff)
[PROOF STATE]
proof (state)
this:
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)

goal (2 subgoals):
 1. i < 2 ^ n \<or> j < 2 ^ n \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 2. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)

goal (2 subgoals):
 1. i < 2 ^ n \<or> j < 2 ^ n \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 2. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
have "H $$ (i div (dim_row (H^\<^sub>\<otimes> n)),j div (dim_col (H^\<^sub>\<otimes> n))) = 1/sqrt 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (1 / sqrt 2)
[PROOF STEP]
using a0 a1 f0 H_without_scalar_prod H_values a2
[PROOF STATE]
proof (prove)
using this:
i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
i \<in> {0..<2 ^ (n + 1)} \<and> j \<in> {0..<2 ^ (n + 1)}
H = Matrix.mat 2 2 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if i \<noteq> j then 1 / sqrt 2 else if i = 0 then 1 / sqrt 2 else - (1 / sqrt 2)))
\<lbrakk>?i < dim_row H; ?j < dim_col H; ?i \<noteq> 1 \<or> ?j \<noteq> 1\<rbrakk> \<Longrightarrow> H $$ (?i, ?j) = complex_of_real (1 / sqrt 2)
i < 2 ^ n \<or> j < 2 ^ n

goal (1 subgoal):
 1. H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (1 / sqrt 2)
[PROOF STEP]
by (metis (no_types, lifting) dim_col_mat(1) dim_row_mat(1) div_less le_eq_less_or_eq
          le_numeral_extra(2) less_power_add_imp_div_less plus_1_eq_Suc power_one_right)
[PROOF STATE]
proof (state)
this:
H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (1 / sqrt 2)

goal (2 subgoals):
 1. i < 2 ^ n \<or> j < 2 ^ n \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
 2. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (1 / sqrt 2)
[PROOF STEP]
show "(H \<Otimes> H^\<^sub>\<otimes> n) $$ (i,j) = (H^\<^sub>\<otimes> (Suc n)) $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (1 / sqrt 2)

goal (1 subgoal):
 1. (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (1 / sqrt 2)
(H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j mod dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))))

goal (1 subgoal):
 1. (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)

goal (1 subgoal):
 1. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
assume a2: "\<not>(i < 2^n \<or> j < 2^n)"
[PROOF STATE]
proof (state)
this:
\<not> (i < 2 ^ n \<or> j < 2 ^ n)

goal (1 subgoal):
 1. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (i < 2 ^ n \<or> j < 2 ^ n)
[PROOF STEP]
have "i \<ge> 2^n \<and> j \<ge> 2^n"
[PROOF STATE]
proof (prove)
using this:
\<not> (i < 2 ^ n \<or> j < 2 ^ n)

goal (1 subgoal):
 1. 2 ^ n \<le> i \<and> 2 ^ n \<le> j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ n \<le> i \<and> 2 ^ n \<le> j

goal (1 subgoal):
 1. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ n \<le> i \<and> 2 ^ n \<le> j
[PROOF STEP]
have f2:"(H^\<^sub>\<otimes> (Suc n)) $$ (i,j) = -1/sqrt(2) * ((H^\<^sub>\<otimes> n) $$ (i mod 2^n, j mod 2^n))"
[PROOF STATE]
proof (prove)
using this:
2 ^ n \<le> i \<and> 2 ^ n \<le> j

goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
[PROOF STEP]
using a0 a1 f0 iter_tensor_of_H_fst_neg
[PROOF STATE]
proof (prove)
using this:
2 ^ n \<le> i \<and> 2 ^ n \<le> j
i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
i \<in> {0..<2 ^ (n + 1)} \<and> j \<in> {0..<2 ^ (n + 1)}
\<lbrakk>2 ^ ?n \<le> ?i \<and> 2 ^ ?n \<le> ?j; ?i < 2 ^ (?n + 1) \<and> ?j < 2 ^ (?n + 1)\<rbrakk> \<Longrightarrow> Matrix.mat (2 ^ Suc ?n) (2 ^ Suc ?n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc ?n\<^esub>  j / sqrt 2 ^ Suc ?n)) $$ (?i, ?j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ ?n) (2 ^ ?n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>?n\<^esub>  j / sqrt 2 ^ ?n)) $$ (?i mod 2 ^ ?n, ?j mod 2 ^ ?n)

goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)

goal (1 subgoal):
 1. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
have "i div (dim_row (H^\<^sub>\<otimes> n)) =1" and "j div (dim_row (H^\<^sub>\<otimes> n)) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1 &&& j div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1
[PROOF STEP]
using a2 a0 a1
[PROOF STATE]
proof (prove)
using this:
\<not> (i < 2 ^ n \<or> j < 2 ^ n)
i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))

goal (1 subgoal):
 1. i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1 &&& j div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1
j div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1

goal (1 subgoal):
 1. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1
j div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1
[PROOF STEP]
have "H $$ (i div (dim_row (H^\<^sub>\<otimes> n)),j div (dim_col (H^\<^sub>\<otimes> n))) = -1/sqrt 2"
[PROOF STATE]
proof (prove)
using this:
i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1
j div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1

goal (1 subgoal):
 1. H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (- 1 / sqrt 2)
[PROOF STEP]
using a0 a1 f0 H_values_right_bottom[of "i div (dim_row (H^\<^sub>\<otimes> n))" "j div (dim_col (H^\<^sub>\<otimes> n))"] a2
[PROOF STATE]
proof (prove)
using this:
i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1
j div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1
i < dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
j < dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
i \<in> {0..<2 ^ (n + 1)} \<and> j \<in> {0..<2 ^ (n + 1)}
i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1 \<and> j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = 1 \<Longrightarrow> H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (- 1 / sqrt 2)
\<not> (i < 2 ^ n \<or> j < 2 ^ n)

goal (1 subgoal):
 1. H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (- 1 / sqrt 2)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (- 1 / sqrt 2)

goal (1 subgoal):
 1. \<not> (i < 2 ^ n \<or> j < 2 ^ n) \<Longrightarrow> (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (- 1 / sqrt 2)
[PROOF STEP]
show "(H \<Otimes> H^\<^sub>\<otimes> n) $$ (i,j) = (H^\<^sub>\<otimes> (Suc n)) $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (- 1 / sqrt 2)

goal (1 subgoal):
 1. (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
using f1 f2
[PROOF STATE]
proof (prove)
using this:
H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) = complex_of_real (- 1 / sqrt 2)
(H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = H $$ (i div dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j div dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)))) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod dim_row (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))), j mod dim_col (Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))))
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)

goal (1 subgoal):
 1. (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) $$ (i, j) = Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j)

goal (2 subgoals):
 1. dim_row (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
 2. dim_col (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim_row (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
 2. dim_col (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
show "dim_row (H \<Otimes> H^\<^sub>\<otimes> n) = dim_row (H^\<^sub>\<otimes> (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
by (simp add: H_without_scalar_prod)
[PROOF STATE]
proof (state)
this:
dim_row (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_row (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))

goal (1 subgoal):
 1. dim_col (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim_col (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
show "dim_col (H \<Otimes> H^\<^sub>\<otimes> n) = dim_col (H^\<^sub>\<otimes> (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))
[PROOF STEP]
by (simp add: H_without_scalar_prod)
[PROOF STATE]
proof (state)
this:
dim_col (H \<Otimes> Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n))) = dim_col (Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lesso_add: "f <o g =o O(h) \<Longrightarrow> k <o l =o O(h) \<Longrightarrow> (f + k) <o (g + l) =o O(h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f <o g \<in> O(h); k <o l \<in> O(h)\<rbrakk> \<Longrightarrow> (f + k) <o (g + l) \<in> O(h)
[PROOF STEP]
apply (unfold lesso_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(h); (\<lambda>x. max (k x - l x) (0::'b)) \<in> O(h)\<rbrakk> \<Longrightarrow> (\<lambda>x. max ((f + k) x - (g + l) x) (0::'b)) \<in> O(h)
[PROOF STEP]
apply (rule bigo_lesseq3)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(h); (\<lambda>x. max (k x - l x) (0::'b)) \<in> O(h)\<rbrakk> \<Longrightarrow> ?f \<in> O(h)
 2. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(h); (\<lambda>x. max (k x - l x) (0::'b)) \<in> O(h)\<rbrakk> \<Longrightarrow> \<forall>x. (0::'b) \<le> max ((f + k) x - (g + l) x) (0::'b)
 3. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(h); (\<lambda>x. max (k x - l x) (0::'b)) \<in> O(h)\<rbrakk> \<Longrightarrow> \<forall>x. max ((f + k) x - (g + l) x) (0::'b) \<le> ?f x
[PROOF STEP]
apply (erule bigo_useful_add)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<lambda>x. max (k x - l x) (0::'b)) \<in> O(h) \<Longrightarrow> ?g4 \<in> O(h)
 2. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(h); (\<lambda>x. max (k x - l x) (0::'b)) \<in> O(h)\<rbrakk> \<Longrightarrow> \<forall>x. (0::'b) \<le> max ((f + k) x - (g + l) x) (0::'b)
 3. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(h); (\<lambda>x. max (k x - l x) (0::'b)) \<in> O(h)\<rbrakk> \<Longrightarrow> \<forall>x. max ((f + k) x - (g + l) x) (0::'b) \<le> ((\<lambda>x. max (f x - g x) (0::'b)) + ?g4) x
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(h); (\<lambda>x. max (k x - l x) (0::'b)) \<in> O(h)\<rbrakk> \<Longrightarrow> \<forall>x. (0::'b) \<le> max ((f + k) x - (g + l) x) (0::'b)
 2. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(h); (\<lambda>x. max (k x - l x) (0::'b)) \<in> O(h)\<rbrakk> \<Longrightarrow> \<forall>x. max ((f + k) x - (g + l) x) (0::'b) \<le> ((\<lambda>x. max (f x - g x) (0::'b)) + (\<lambda>x. max (k x - l x) (0::'b))) x
[PROOF STEP]
apply (force split: split_max)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(h); (\<lambda>x. max (k x - l x) (0::'b)) \<in> O(h)\<rbrakk> \<Longrightarrow> \<forall>x. max ((f + k) x - (g + l) x) (0::'b) \<le> ((\<lambda>x. max (f x - g x) (0::'b)) + (\<lambda>x. max (k x - l x) (0::'b))) x
[PROOF STEP]
apply (auto split: split_max simp add: func_plus)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nat_ge2_conv: "((2::nat) \<le> n) = (n \<noteq> 0 \<and> n \<noteq> 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 \<le> n) = (n \<noteq> 0 \<and> n \<noteq> 1)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma q_gt_two: "q>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 < q
[PROOF STEP]
using kyber_spec_axioms kyber_spec_def
[PROOF STATE]
proof (prove)
using this:
kyber_spec TYPE('a) TYPE('k) n q k n'
kyber_spec TYPE(?'a) TYPE(?'k) ?n ?q ?k ?n' \<equiv> ((?n = 2 ^ ?n' \<and> 0 < ?n') \<and> 2 < ?q \<and> ?q mod 4 = 1) \<and> (prime ?q \<and> int CARD(?'a) = ?q) \<and> int CARD(?'k) = int ?k \<and> qr_poly' TYPE(?'a) = Polynomial.monom 1 (nat ?n) + 1

goal (1 subgoal):
 1. 2 < q
[PROOF STEP]
by (smt (z3))


[STATEMENT]
lemma (in Order) less_le_trans:"\<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D;
      a \<prec> b; b \<preceq> c \<rbrakk> \<Longrightarrow> a \<prec> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D; a \<prec> b; b \<preceq> c\<rbrakk> \<Longrightarrow> a \<prec> c
[PROOF STEP]
apply (simp add:oless_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D; a \<preceq> b \<and> a \<noteq> b; b \<preceq> c\<rbrakk> \<Longrightarrow> a \<preceq> c \<and> a \<noteq> c
[PROOF STEP]
apply ( erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D; b \<preceq> c; a \<preceq> b; a \<noteq> b\<rbrakk> \<Longrightarrow> a \<preceq> c \<and> a \<noteq> c
[PROOF STEP]
apply (simp add:le_trans[of a b c])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D; b \<preceq> c; a \<preceq> b; a \<noteq> b\<rbrakk> \<Longrightarrow> a \<noteq> c
[PROOF STEP]
apply (rule contrapos_pp, simp+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b \<in> carrier D; c \<in> carrier D; b \<preceq> c; c \<preceq> b; c \<noteq> b; a = c\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (frule le_antisym[of "b" "c"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>b \<in> carrier D; c \<in> carrier D; b \<preceq> c; c \<preceq> b; c \<noteq> b; a = c\<rbrakk> \<Longrightarrow> c \<in> carrier D
 2. \<lbrakk>b \<in> carrier D; c \<in> carrier D; b \<preceq> c; c \<preceq> b; c \<noteq> b; a = c\<rbrakk> \<Longrightarrow> b \<preceq> c
 3. \<lbrakk>b \<in> carrier D; c \<in> carrier D; b \<preceq> c; c \<preceq> b; c \<noteq> b; a = c\<rbrakk> \<Longrightarrow> c \<preceq> b
 4. \<lbrakk>b \<in> carrier D; c \<in> carrier D; b \<preceq> c; c \<preceq> b; c \<noteq> b; a = c; b = c\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply assumption+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b \<in> carrier D; c \<in> carrier D; b \<preceq> c; c \<preceq> b; c \<noteq> b; a = c; b = c\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem wls_swapEnv_compose:
assumes "wlsEnv rho"
shows "((rho &[x \<and> y]_zs) &[x' \<and> y']_zs') =
       ((rho &[x' \<and> y']_zs') &[(x @zs[x' \<and> y']_zs') \<and> (y @zs[x' \<and> y']_zs')]_zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[x \<and> y]_zs &[x' \<and> y']_zs' = rho &[x' \<and> y']_zs' &[x @zs[x' \<and> y']_zs' \<and> y @zs[x' \<and> y']_zs']_zs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsEnv rho

goal (1 subgoal):
 1. rho &[x \<and> y]_zs &[x' \<and> y']_zs' = rho &[x' \<and> y']_zs' &[x @zs[x' \<and> y']_zs' \<and> y @zs[x' \<and> y']_zs']_zs
[PROOF STEP]
by (intro swapEnv_compose) auto


[STATEMENT]
lemma lm132:
  assumes "Y \<subseteq> f-`{0}" "finite X"
  shows "sum f X = sum f (X-Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f X = sum f (X - Y)
[PROOF STEP]
using Int_lower2 add.comm_neutral assms(1) assms(2) lm078 lm131 order_trans
[PROOF STATE]
proof (prove)
using this:
?A \<inter> ?B \<subseteq> ?B
?a + (0::?'a) = ?a
Y \<subseteq> f -` {0::'b}
finite X
finite ?X \<Longrightarrow> sum ?f ?X = sum ?f (?X - ?Y) + sum ?f (?X \<inter> ?Y)
?Y \<subseteq> ?f -` {0::?'b} \<Longrightarrow> sum ?f ?Y = (0::?'b)
\<lbrakk>?x \<le> ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x \<le> ?z

goal (1 subgoal):
 1. sum f X = sum f (X - Y)
[PROOF STEP]
by (metis (no_types))


[STATEMENT]
lemma dist_\<L>\<^sub>b_split_lt_dist_opt: "dist v (GS_rec_fun\<^sub>b v) \<le> 2 * dist v \<nu>\<^sub>b_opt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist v (GS_rec_fun\<^sub>b v) \<le> 2 * dist v \<nu>\<^sub>b_opt
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist v (GS_rec_fun\<^sub>b v) \<le> 2 * dist v \<nu>\<^sub>b_opt
[PROOF STEP]
have le1: "dist v (GS_rec_fun\<^sub>b v) \<le> dist v \<nu>\<^sub>b_opt + dist (GS_rec_fun\<^sub>b v) \<nu>\<^sub>b_opt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist v (GS_rec_fun\<^sub>b v) \<le> dist v \<nu>\<^sub>b_opt + dist (GS_rec_fun\<^sub>b v) \<nu>\<^sub>b_opt
[PROOF STEP]
by (simp add: dist_triangle dist_commute)
[PROOF STATE]
proof (state)
this:
dist v (GS_rec_fun\<^sub>b v) \<le> dist v \<nu>\<^sub>b_opt + dist (GS_rec_fun\<^sub>b v) \<nu>\<^sub>b_opt

goal (1 subgoal):
 1. dist v (GS_rec_fun\<^sub>b v) \<le> 2 * dist v \<nu>\<^sub>b_opt
[PROOF STEP]
have le2: "dist (GS_rec_fun\<^sub>b v) \<nu>\<^sub>b_opt \<le> GS.QR_disc * dist v \<nu>\<^sub>b_opt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (GS_rec_fun\<^sub>b v) \<nu>\<^sub>b_opt \<le> GS.QR_disc * dist v \<nu>\<^sub>b_opt
[PROOF STEP]
using GS.\<L>\<^sub>b_split_contraction GS.\<L>\<^sub>b_split_fix
[PROOF STATE]
proof (prove)
using this:
dist (GS_rec_fun\<^sub>b ?v) (GS_rec_fun\<^sub>b ?u) \<le> GS.QR_disc * dist ?v ?u
GS_rec_fun\<^sub>b \<nu>\<^sub>b_opt = \<nu>\<^sub>b_opt

goal (1 subgoal):
 1. dist (GS_rec_fun\<^sub>b v) \<nu>\<^sub>b_opt \<le> GS.QR_disc * dist v \<nu>\<^sub>b_opt
[PROOF STEP]
by (metis (no_types, lifting))
[PROOF STATE]
proof (state)
this:
dist (GS_rec_fun\<^sub>b v) \<nu>\<^sub>b_opt \<le> GS.QR_disc * dist v \<nu>\<^sub>b_opt

goal (1 subgoal):
 1. dist v (GS_rec_fun\<^sub>b v) \<le> 2 * dist v \<nu>\<^sub>b_opt
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist v (GS_rec_fun\<^sub>b v) \<le> 2 * dist v \<nu>\<^sub>b_opt
[PROOF STEP]
using mult_right_mono[of GS.QR_disc 1] GS.QR_contraction
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>GS.QR_disc \<le> 1; 0 \<le> ?c\<rbrakk> \<Longrightarrow> GS.QR_disc * ?c \<le> 1 * ?c
GS.QR_disc < 1

goal (1 subgoal):
 1. dist v (GS_rec_fun\<^sub>b v) \<le> 2 * dist v \<nu>\<^sub>b_opt
[PROOF STEP]
by (fastforce intro!: order.trans[OF le2] order.trans[OF le1])
[PROOF STATE]
proof (state)
this:
dist v (GS_rec_fun\<^sub>b v) \<le> 2 * dist v \<nu>\<^sub>b_opt

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Ring) nsEqElm:  "\<lbrakk> x \<in> carrier R; y \<in> carrier R; x = y \<rbrakk>
        \<Longrightarrow> (nscal R x n) = (nscal R y n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; x = y\<rbrakk> \<Longrightarrow>  n \<times>\<^bsub>R\<^esub> x =  n \<times>\<^bsub>R\<^esub> y
[PROOF STEP]
by simp


[STATEMENT]
lemma trms\<^sub>s\<^sub>s\<^sub>t_append[simp]: "trms\<^sub>s\<^sub>s\<^sub>t (A@B) = trms\<^sub>s\<^sub>s\<^sub>t A \<union> trms\<^sub>s\<^sub>s\<^sub>t B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trms\<^sub>s\<^sub>s\<^sub>t (A @ B) = trms\<^sub>s\<^sub>s\<^sub>t A \<union> trms\<^sub>s\<^sub>s\<^sub>t B
[PROOF STEP]
unfolding trms\<^sub>s\<^sub>s\<^sub>t_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (trms\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set (A @ B)) = \<Union> (trms\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set A) \<union> \<Union> (trms\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set B)
[PROOF STEP]
by force


[STATEMENT]
lemma EmptyMap_Union_ran_override:
 "\<lbrakk> S \<noteq> {};
    S \<inter> dom G = {} \<rbrakk> \<Longrightarrow>
  (Union (ran (G ++ (EmptyMap S)))) = (Union (ran G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<noteq> {}; S \<inter> dom G = {}\<rbrakk> \<Longrightarrow> \<Union> (ran (G ++ EmptyMap S)) = \<Union> (ran G)
[PROOF STEP]
apply (subst EmptyMap_ran_override)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>S \<noteq> {}; S \<inter> dom G = {}\<rbrakk> \<Longrightarrow> S \<noteq> {}
 2. \<lbrakk>S \<noteq> {}; S \<inter> dom G = {}\<rbrakk> \<Longrightarrow> S \<inter> dom G = {}
 3. \<lbrakk>S \<noteq> {}; S \<inter> dom G = {}\<rbrakk> \<Longrightarrow> \<Union> (insert {} (ran G)) = \<Union> (ran G)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma continuous_on_cases_local:
     "\<lbrakk>closedin (top_of_set (s \<union> t)) s; closedin (top_of_set (s \<union> t)) t;
       continuous_on s f; continuous_on t g;
       \<And>x. \<lbrakk>x \<in> s \<and> \<not>P x \<or> x \<in> t \<and> P x\<rbrakk> \<Longrightarrow> f x = g x\<rbrakk>
      \<Longrightarrow> continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>closedin (top_of_set (s \<union> t)) s; closedin (top_of_set (s \<union> t)) t; continuous_on s f; continuous_on t g; \<And>x. x \<in> s \<and> \<not> P x \<or> x \<in> t \<and> P x \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)
[PROOF STEP]
by (rule continuous_on_Un_local) (auto intro: continuous_on_eq)


[STATEMENT]
lemma (in is_cat_rKe) is_cat_lKe_op'[cat_op_intros]:
  assumes "\<TT>' = op_cf \<TT>"
    and "\<GG>' = op_cf \<GG>"
    and "\<KK>' = op_cf \<KK>"
    and "\<BB>' = op_cat \<BB>"
    and "\<AA>' = op_cat \<AA>"
    and "\<CC>' = op_cat \<CC>"
  shows "op_ntcf \<epsilon> : \<TT>' \<mapsto>\<^sub>C\<^sub>F\<^sub>.\<^sub>l\<^sub>K\<^sub>e\<^bsub>\<alpha>\<^esub> \<GG>' \<circ>\<^sub>C\<^sub>F \<KK>' : \<BB>' \<mapsto>\<^sub>C \<CC>' \<mapsto>\<^sub>C \<AA>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_ntcf \<epsilon> : \<TT>' \<mapsto>\<^sub>C\<^sub>F\<^sub>.\<^sub>l\<^sub>K\<^sub>e\<^bsub>\<alpha>\<^esub> \<GG>' \<circ>\<^sub>C\<^sub>F \<KK>' : \<BB>' \<mapsto>\<^sub>C \<CC>' \<mapsto>\<^sub>C \<AA>'
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_ntcf \<epsilon> : op_cf \<TT> \<mapsto>\<^sub>C\<^sub>F\<^sub>.\<^sub>l\<^sub>K\<^sub>e\<^bsub>\<alpha>\<^esub> op_cf \<GG> \<circ>\<^sub>C\<^sub>F op_cf \<KK> : op_cat \<BB> \<mapsto>\<^sub>C op_cat \<CC> \<mapsto>\<^sub>C op_cat \<AA>
[PROOF STEP]
by (rule is_cat_lKe_op)


[STATEMENT]
lemma \<nu>_stationary: "\<nu>\<^sub>b (mk_stationary d) = (\<Sum>t. l^t *\<^sub>R (\<P>\<^sub>1 ^^ t)) (r_dec\<^sub>b d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary d) = blinfun_apply (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary d) = blinfun_apply (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)
[PROOF STEP]
have "\<nu>\<^sub>b (mk_stationary d) = (\<Sum>t. (l ^ t *\<^sub>R (\<P>\<^sub>1 ^^ t)) (r_dec\<^sub>b d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary d) = (\<Sum>t. blinfun_apply (l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d))
[PROOF STEP]
by (simp add: \<nu>\<^sub>b_eq_\<P>\<^sub>X \<P>\<^sub>1_pow \<P>\<^sub>1.rep_eq scaleR_blinfun.rep_eq \<P>\<^sub>X_sconst)
[PROOF STATE]
proof (state)
this:
\<nu>\<^sub>b (mk_stationary d) = (\<Sum>t. blinfun_apply (l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d))

goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary d) = blinfun_apply (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<nu>\<^sub>b (mk_stationary d) = (\<Sum>t. blinfun_apply (l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d))

goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary d) = blinfun_apply (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)
[PROOF STEP]
have "...  = (\<Sum>t. (l ^ t *\<^sub>R (\<P>\<^sub>1 ^^ t))) (r_dec\<^sub>b d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t. blinfun_apply (l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)) = blinfun_apply (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)
[PROOF STEP]
by (subst bounded_linear.suminf[where f = "\<lambda>x. blinfun_apply x (r_dec\<^sub>b d)"])
      (auto intro!: bounded_linear.suminf boundedI)
[PROOF STATE]
proof (state)
this:
(\<Sum>t. blinfun_apply (l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)) = blinfun_apply (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)

goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary d) = blinfun_apply (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<nu>\<^sub>b (mk_stationary d) = blinfun_apply (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<nu>\<^sub>b (mk_stationary d) = blinfun_apply (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)

goal (1 subgoal):
 1. \<nu>\<^sub>b (mk_stationary d) = blinfun_apply (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<nu>\<^sub>b (mk_stationary d) = blinfun_apply (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) (r_dec\<^sub>b d)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_of_ereal_image_greaterThanLessThan_iff:
  "real_of_ereal ` {a <..< b} = real_of_ereal ` {c <..< d} \<longleftrightarrow> (a \<ge> b \<and> c \<ge> d \<or> a = c \<and> b = d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real_of_ereal ` {a<..<b} = real_of_ereal ` {c<..<d}) = (b \<le> a \<and> d \<le> c \<or> a = c \<and> b = d)
[PROOF STEP]
unfolding real_atLeastGreaterThan_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if a = \<infinity> then {} else if a = - \<infinity> then if b = \<infinity> then UNIV else if b = - \<infinity> then {} else {..<real_of_ereal b} else if b = - \<infinity> then {} else if b = \<infinity> then {real_of_ereal a<..} else {real_of_ereal a<..<real_of_ereal b}) = (if c = \<infinity> then {} else if c = - \<infinity> then if d = \<infinity> then UNIV else if d = - \<infinity> then {} else {..<real_of_ereal d} else if d = - \<infinity> then {} else if d = \<infinity> then {real_of_ereal c<..} else {real_of_ereal c<..<real_of_ereal d})) = (b \<le> a \<and> d \<le> c \<or> a = c \<and> b = d)
[PROOF STEP]
by (cases a; cases b; cases c; cases d;
    simp add: greaterThanLessThan_eq_iff interval_neqs interval_neqs[symmetric])


[STATEMENT]
lemma eventually_disj_iff: "eventually (\<lambda>x. P x \<or> Q x) F \<longleftrightarrow> eventually P F \<or> eventually Q F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>F x in F. P x \<or> Q x) = (eventually P F \<or> eventually Q F)
[PROOF STEP]
unfolding frequently_eq_eventually[symmetric] frequently_disj_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (frequently P F \<or> frequently Q F) = (frequently P F \<or> frequently Q F)
[PROOF STEP]
..


[STATEMENT]
lemma uniform_limit_cot_pfd_real:
  assumes "R \<ge> 0"
  shows   "uniform_limit (cball 0 R :: real set)
             (\<lambda>N x. \<Sum>n<N. 2 * x / (x ^ 2 - of_nat (Suc n) ^ 2)) cot_pfd sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit (cball 0 R) (\<lambda>N x. \<Sum>n<N. 2 * x / (x\<^sup>2 - (real (Suc n))\<^sup>2)) cot_pfd sequentially
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uniform_limit (cball 0 R) (\<lambda>N x. \<Sum>n<N. 2 * x / (x\<^sup>2 - (real (Suc n))\<^sup>2)) cot_pfd sequentially
[PROOF STEP]
have "uniform_limit (cball 0 R)
          (\<lambda>N x. Re (\<Sum>n<N. 2 * x / (x ^ 2 - of_nat (Suc n) ^ 2))) (\<lambda>x. Re (cot_pfd x)) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit (cball 0 R) (\<lambda>N x. Re (\<Sum>n<N. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2))) (\<lambda>x. Re (cot_pfd x)) sequentially
[PROOF STEP]
by (intro uniform_limit_intros uniform_limit_cot_pfd_complex assms)
[PROOF STATE]
proof (state)
this:
uniform_limit (cball 0 R) (\<lambda>N x. Re (\<Sum>n<N. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2))) (\<lambda>x. Re (cot_pfd x)) sequentially

goal (1 subgoal):
 1. uniform_limit (cball 0 R) (\<lambda>N x. \<Sum>n<N. 2 * x / (x\<^sup>2 - (real (Suc n))\<^sup>2)) cot_pfd sequentially
[PROOF STEP]
hence "uniform_limit (of_real ` cball 0 R)
          (\<lambda>N x. Re (\<Sum>n<N. 2 * x / (x ^ 2 - of_nat (Suc n) ^ 2))) (\<lambda>x. Re (cot_pfd x)) sequentially"
[PROOF STATE]
proof (prove)
using this:
uniform_limit (cball 0 R) (\<lambda>N x. Re (\<Sum>n<N. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2))) (\<lambda>x. Re (cot_pfd x)) sequentially

goal (1 subgoal):
 1. uniform_limit (complex_of_real ` cball 0 R) (\<lambda>N x. Re (\<Sum>n<N. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2))) (\<lambda>x. Re (cot_pfd x)) sequentially
[PROOF STEP]
by (rule uniform_limit_on_subset) auto
[PROOF STATE]
proof (state)
this:
uniform_limit (complex_of_real ` cball 0 R) (\<lambda>N x. Re (\<Sum>n<N. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2))) (\<lambda>x. Re (cot_pfd x)) sequentially

goal (1 subgoal):
 1. uniform_limit (cball 0 R) (\<lambda>N x. \<Sum>n<N. 2 * x / (x\<^sup>2 - (real (Suc n))\<^sup>2)) cot_pfd sequentially
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
uniform_limit (complex_of_real ` cball 0 R) (\<lambda>N x. Re (\<Sum>n<N. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2))) (\<lambda>x. Re (cot_pfd x)) sequentially

goal (1 subgoal):
 1. uniform_limit (cball 0 R) (\<lambda>N x. \<Sum>n<N. 2 * x / (x\<^sup>2 - (real (Suc n))\<^sup>2)) cot_pfd sequentially
[PROOF STEP]
by (simp add: uniform_limit_image)
[PROOF STATE]
proof (state)
this:
uniform_limit (cball 0 R) (\<lambda>N x. \<Sum>n<N. 2 * x / (x\<^sup>2 - (real (Suc n))\<^sup>2)) cot_pfd sequentially

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ringE:
  fixes R (structure)
  assumes "ring R"
  shows "abelian_group R"
    and "monoid R"
    and "\<And>x y z. \<lbrakk> x \<in> carrier R; y \<in> carrier R; z \<in> carrier R \<rbrakk> \<Longrightarrow> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z"
    and "\<And>x y z. \<lbrakk> x \<in> carrier R; y \<in> carrier R; z \<in> carrier R \<rbrakk> \<Longrightarrow> z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (abelian_group R &&& Group.monoid R) &&& (\<And>x y z. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z) &&& (\<And>x y z. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ring R

goal (1 subgoal):
 1. (abelian_group R &&& Group.monoid R) &&& (\<And>x y z. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z) &&& (\<And>x y z. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y)
[PROOF STEP]
unfolding ring_def ring_axioms_def
[PROOF STATE]
proof (prove)
using this:
abelian_group R \<and> Group.monoid R \<and> (\<forall>x y z. x \<in> carrier R \<longrightarrow> y \<in> carrier R \<longrightarrow> z \<in> carrier R \<longrightarrow> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z) \<and> (\<forall>x y z. x \<in> carrier R \<longrightarrow> y \<in> carrier R \<longrightarrow> z \<in> carrier R \<longrightarrow> z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y)

goal (1 subgoal):
 1. (abelian_group R &&& Group.monoid R) &&& (\<And>x y z. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z) &&& (\<And>x y z. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y)
[PROOF STEP]
by auto