[STATEMENT]
lemma radj_adj:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'b::complete_lattice"
  shows "f \<stileturn> g \<Longrightarrow> g = (radj f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<stileturn> g \<Longrightarrow> g = radj f
[PROOF STEP]
unfolding adj_def radj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. (f x \<le> y) = (x \<le> g y) \<Longrightarrow> g = (\<lambda>y. \<Squnion> {x. f x \<le> y})
[PROOF STEP]
by (metis (mono_tags, lifting) cSup_eq_maximum eq_iff mem_Collect_eq)


[STATEMENT]
lemma fcard_image_le: "fcard (f |`| xs) \<le> fcard xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fcard (f |`| xs) \<le> fcard xs
[PROOF STEP]
by (simp add: FSet.fcard.rep_eq card_image_le)


[STATEMENT]
lemma Transset_inf: "Transset x \<Longrightarrow> Transset y \<Longrightarrow> Transset (x \<sqinter> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Transset x; Transset y\<rbrakk> \<Longrightarrow> Transset (x \<sqinter> y)
[PROOF STEP]
by (auto simp: Transset_def)


[STATEMENT]
lemma pmf_2elemlist: "pmf (bv (Suc 0)) ([x]) = pmf (bv 0) [] * pmf (bernoulli_pmf (5 / 10)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (bv (Suc 0)) [x] = pmf (bv 0) [] * pmf (bernoulli_pmf (5 / 10)) x
[PROOF STEP]
unfolding bv.simps(2)[where n=0] pmf_bind pmf_return
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation (bv 0) (\<lambda>xa. measure_pmf.expectation (bernoulli_pmf (5 / 10)) (\<lambda>xb. indicat_real {[x]} (xb # xa))) = pmf (bv 0) [] * pmf (bernoulli_pmf (5 / 10)) x
[PROOF STEP]
apply (subst integral_measure_pmf[where A="{[]}"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {[]}
 2. \<And>a. \<lbrakk>a \<in> set_pmf (bv 0); measure_pmf.expectation (bernoulli_pmf (5 / 10)) (\<lambda>xa. indicat_real {[x]} (xa # a)) \<noteq> 0\<rbrakk> \<Longrightarrow> a \<in> {[]}
 3. (\<Sum>a\<in>{[]}. pmf (bv 0) a *\<^sub>R measure_pmf.expectation (bernoulli_pmf (5 / 10)) (\<lambda>xa. indicat_real {[x]} (xa # a))) = pmf (bv 0) [] * pmf (bernoulli_pmf (5 / 10)) x
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indicat_real {[x]} [True] + indicat_real {[x]} [False] = 1
[PROOF STEP]
by (cases x) auto


[STATEMENT]
lemma accept_eps_Un: "accept_eps (\<Union>x \<in> X. R x) bs \<longleftrightarrow> (\<exists>x \<in> X. accept_eps (R x) bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. accept_eps (\<Union> (R ` X)) bs = (\<exists>x\<in>X. accept_eps (R x) bs)
[PROOF STEP]
by (auto simp add: accept_eps_def step_eps_closure_set_def)


[STATEMENT]
lemma p_Suc':
  "p x y (Suc n) = (\<integral>x'. p x' y n \<partial>K x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p x y (Suc n) = measure_pmf.expectation (K x) (\<lambda>x'. p x' y n)
[PROOF STEP]
using p_Suc[of x y n]
[PROOF STATE]
proof (prove)
using this:
ennreal (p x y (Suc n)) = \<integral>\<^sup>+ x. ennreal (p x y n) \<partial>measure_pmf (K x)

goal (1 subgoal):
 1. p x y (Suc n) = measure_pmf.expectation (K x) (\<lambda>x'. p x' y n)
[PROOF STEP]
by (subst (asm) nn_integral_eq_integral)
     (auto simp: p_le_1 intro!: measure_pmf.integrable_const_bound[where B=1])


[STATEMENT]
lemma sym_sum_inter_num_to_zero:
  assumes "b1 \<in># \<B>"
  shows "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (int (b1 |\<inter>| bl) - (int \<Lambda>))^2) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
have rm1_size: "size (remove1_mset b1 \<B>) = \<v> - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (remove1_mset b1 \<B>) = \<v> - 1
[PROOF STEP]
using assms b_non_zero int_ops(6)
[PROOF STATE]
proof (prove)
using this:
b1 \<in># \<B>
\<b> \<noteq> 0
int (?a - ?b) = (if int ?a < int ?b then 0 else int ?a - int ?b)

goal (1 subgoal):
 1. size (remove1_mset b1 \<B>) = \<v> - 1
[PROOF STEP]
by (auto simp add: symmetric size_remove1_mset_If)
[PROOF STATE]
proof (state)
this:
size (remove1_mset b1 \<B>) = \<v> - 1

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
have  "(\<Sum>bl \<in># (remove1_mset b1 \<B>). ((int (b1 |\<inter>| bl))^2)) =
    (\<Sum>bl \<in># (remove1_mset b1 \<B>). (((b1 |\<inter>| bl))^2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) = int (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) = int (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) = int (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2)
[PROOF STEP]
have ssi: "(\<Sum>bl \<in># (remove1_mset b1 \<B>). ((int (b1 |\<inter>| bl))^2)) = \<Lambda>^2 * (\<v> - 1)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) = int (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) = int (\<Lambda>\<^sup>2 * (\<v> - 1))
[PROOF STEP]
using sym_sum_inter_num_sq assms
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) = int (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2)
?b1.0 \<in># \<B> \<Longrightarrow> (\<Sum>bl\<in>#remove1_mset ?b1.0 \<B>. (?b1.0 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
b1 \<in># \<B>

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) = int (\<Lambda>\<^sup>2 * (\<v> - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) = int (\<Lambda>\<^sup>2 * (\<v> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
have "\<And> bl . bl \<in># (remove1_mset b1 \<B>) \<Longrightarrow> (int (b1 |\<inter>| bl) - (int \<Lambda>))^2 =
        (((int (b1 |\<inter>| bl))^2) - (2 * (int \<Lambda>) * (int (b1 |\<inter>| bl))) + ((int \<Lambda>)^2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>bl. bl \<in># remove1_mset b1 \<B> \<Longrightarrow> (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2 = (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl) + (int \<Lambda>)\<^sup>2
[PROOF STEP]
by (simp add: power2_diff)
[PROOF STATE]
proof (state)
this:
?bl \<in># remove1_mset b1 \<B> \<Longrightarrow> (int (b1 |\<inter>| ?bl) - int \<Lambda>)\<^sup>2 = (int (b1 |\<inter>| ?bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| ?bl) + (int \<Lambda>)\<^sup>2

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?bl \<in># remove1_mset b1 \<B> \<Longrightarrow> (int (b1 |\<inter>| ?bl) - int \<Lambda>)\<^sup>2 = (int (b1 |\<inter>| ?bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| ?bl) + (int \<Lambda>)\<^sup>2
[PROOF STEP]
have "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (int (b1 |\<inter>| bl) - (int \<Lambda>))^2) =
              (\<Sum>bl \<in># (remove1_mset b1 \<B>). (((int (b1 |\<inter>| bl))^2) - (2 * (int \<Lambda>) * (int (b1 |\<inter>| bl))) + ((int \<Lambda>)^2)))"
[PROOF STATE]
proof (prove)
using this:
?bl \<in># remove1_mset b1 \<B> \<Longrightarrow> (int (b1 |\<inter>| ?bl) - int \<Lambda>)\<^sup>2 = (int (b1 |\<inter>| ?bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| ?bl) + (int \<Lambda>)\<^sup>2

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl) + (int \<Lambda>)\<^sup>2)
[PROOF STEP]
using sum_over_fun_eq
[PROOF STATE]
proof (prove)
using this:
?bl \<in># remove1_mset b1 \<B> \<Longrightarrow> (int (b1 |\<inter>| ?bl) - int \<Lambda>)\<^sup>2 = (int (b1 |\<inter>| ?bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| ?bl) + (int \<Lambda>)\<^sup>2
(\<And>x. x \<in># ?A \<Longrightarrow> ?f x = ?g x) \<Longrightarrow> \<Sum>\<^sub># (image_mset ?f ?A) = \<Sum>\<^sub># (image_mset ?g ?A)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl) + (int \<Lambda>)\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl) + (int \<Lambda>)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl) + (int \<Lambda>)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
have "... = (\<Sum>bl \<in># (remove1_mset b1 \<B>). (((int (b1 |\<inter>| bl))^2)
      -  (2 * (int \<Lambda>) * (int (b1 |\<inter>| bl))))) + (\<Sum> bl \<in># (remove1_mset b1 \<B>) . ((int \<Lambda>)^2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl) + (int \<Lambda>)\<^sup>2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2)
[PROOF STEP]
by (simp add: sum_mset.distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl) + (int \<Lambda>)\<^sup>2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl) + (int \<Lambda>)\<^sup>2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
have "... = (\<Sum>bl \<in># (remove1_mset b1 \<B>). ((int (b1 |\<inter>| bl))^2))
      - (\<Sum>bl \<in># (remove1_mset b1 \<B>). (2 * (int \<Lambda>) * (int (b1 |\<inter>| bl)))) + (\<Sum> bl \<in># (remove1_mset b1 \<B>) . ((int \<Lambda>)^2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) - (\<Sum>bl\<in>#remove1_mset b1 \<B>. 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2)
[PROOF STEP]
using sum_mset_add_diff_int[of "(\<lambda> bl . ((int (b1 |\<inter>| bl))^2))" "(\<lambda> bl . (2 * (int \<Lambda>) * (int (b1 |\<inter>| bl))))" "(remove1_mset b1 \<B>)"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| x))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| x)) = (\<Sum>x\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| x))\<^sup>2) - (\<Sum>x\<in>#remove1_mset b1 \<B>. 2 * int \<Lambda> * int (b1 |\<inter>| x))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) - (\<Sum>bl\<in>#remove1_mset b1 \<B>. 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) - (\<Sum>bl\<in>#remove1_mset b1 \<B>. 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2 - 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) - (\<Sum>bl\<in>#remove1_mset b1 \<B>. 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
have "... =  \<Lambda>^2 * (\<v> - 1) - 2 * (int \<Lambda>) *(\<Sum>bl \<in># (remove1_mset b1 \<B>). ((b1 |\<inter>| bl)))
      + (\<v> - 1) * ((int \<Lambda>)^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) - (\<Sum>bl\<in>#remove1_mset b1 \<B>. 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2) = int (\<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>))) + int (\<v> - 1) * (int \<Lambda>)\<^sup>2
[PROOF STEP]
using ssi rm1_size assms
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) = int (\<Lambda>\<^sup>2 * (\<v> - 1))
size (remove1_mset b1 \<B>) = \<v> - 1
b1 \<in># \<B>

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) - (\<Sum>bl\<in>#remove1_mset b1 \<B>. 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2) = int (\<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>))) + int (\<v> - 1) * (int \<Lambda>)\<^sup>2
[PROOF STEP]
by (simp add: sum_mset_distrib_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) - (\<Sum>bl\<in>#remove1_mset b1 \<B>. 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2) = int (\<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>))) + int (\<v> - 1) * (int \<Lambda>)\<^sup>2

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl))\<^sup>2) - (\<Sum>bl\<in>#remove1_mset b1 \<B>. 2 * int \<Lambda> * int (b1 |\<inter>| bl)) + (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int \<Lambda>)\<^sup>2) = int (\<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>))) + int (\<v> - 1) * (int \<Lambda>)\<^sup>2

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
have "... =  2 * \<Lambda>^2 * (\<v> - 1) - 2 * (int \<Lambda>) *(\<k>* (\<r> - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (\<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>))) + int (\<v> - 1) * (int \<Lambda>)\<^sup>2 = int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<k> * (\<r> - 1))
[PROOF STEP]
using  sym_sum_inter_num assms
[PROOF STATE]
proof (prove)
using this:
?b1.0 \<in># \<B> \<Longrightarrow> \<Sum>\<^sub># (image_mset ((|\<inter>|) ?b1.0) (remove1_mset ?b1.0 \<B>)) = \<k> * (\<r> - 1)
b1 \<in># \<B>

goal (1 subgoal):
 1. int (\<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>))) + int (\<v> - 1) * (int \<Lambda>)\<^sup>2 = int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<k> * (\<r> - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (\<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>))) + int (\<v> - 1) * (int \<Lambda>)\<^sup>2 = int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<k> * (\<r> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int (\<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>))) + int (\<v> - 1) * (int \<Lambda>)\<^sup>2 = int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<k> * (\<r> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
have "... = 2 * \<Lambda>^2 * (\<v> - 1) - 2 * (int \<Lambda>) * (\<Lambda> * (\<v> - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<k> * (\<r> - 1)) = int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Lambda> * (\<v> - 1))
[PROOF STEP]
using rep_value_sym symmetric_condition_2
[PROOF STATE]
proof (prove)
using this:
\<r> = \<k>
\<Lambda> * (\<v> - 1) = \<k> * (\<k> - 1)

goal (1 subgoal):
 1. int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<k> * (\<r> - 1)) = int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Lambda> * (\<v> - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<k> * (\<r> - 1)) = int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Lambda> * (\<v> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Lambda> * (\<v> - 1))
[PROOF STEP]
have "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (int (b1 |\<inter>| bl) - int \<Lambda>)^2) = 0"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = int (2 * \<Lambda>\<^sup>2 * (\<v> - 1)) - 2 * int \<Lambda> * int (\<Lambda> * (\<v> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
by (auto simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (int (b1 |\<inter>| bl) - int \<Lambda>)\<^sup>2) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma surj_Sup_pres_bij_on:
  fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'b::complete_lattice_with_dual"
  assumes "surj f"
  and "Sup_pres f"
  shows "bij_betw f (range (radj f \<circ> f)) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw f (range (radj f \<circ> f)) UNIV
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (range (radj f \<circ> f)) \<and> f ` range (radj f \<circ> f) = UNIV
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. inj_on f (range (radj f \<circ> f))
 2. \<And>x xa xb. xb \<in> UNIV \<Longrightarrow> f ((radj f \<circ> f) xb) \<in> UNIV
 3. \<And>x. x \<in> UNIV \<Longrightarrow> x \<in> f ` range (radj f \<circ> f)
[PROOF STEP]
apply (simp add: assms(1) assms(2) surj_Sup_pres_inj_on cong del: image_cong_simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x xa xb. xb \<in> UNIV \<Longrightarrow> f ((radj f \<circ> f) xb) \<in> UNIV
 2. \<And>x. x \<in> UNIV \<Longrightarrow> x \<in> f ` range (radj f \<circ> f)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> f ` range (\<lambda>x. radj f (f x))
[PROOF STEP]
apply (metis (mono_tags) UNIV_I assms(1) assms(2) comp_apply id_apply image_image surj_Sup_pres_id surj_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cbox_Pair_eq: "cbox (a, c) (b, d) = cbox a b \<times> cbox c d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cbox (a, c) (b, d) = cbox a b \<times> cbox c d
[PROOF STEP]
by (force simp: cbox_def Basis_prod_def)


[STATEMENT]
lemma Borsukian_continuous_logarithm:
  fixes S :: "'a::real_normed_vector set"
  shows "Borsukian S \<longleftrightarrow>
            (\<forall>f. continuous_on S f \<and> f ` S \<subseteq> (- {0::complex})
                 \<longrightarrow> (\<exists>g. continuous_on S g \<and> (\<forall>x \<in> S. f x = exp(g x))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Borsukian S = (\<forall>f. continuous_on S f \<and> f ` S \<subseteq> - {0} \<longrightarrow> (\<exists>g. continuous_on S g \<and> (\<forall>x\<in>S. f x = exp (g x))))
[PROOF STEP]
by (simp add: Borsukian_def inessential_eq_continuous_logarithm)


[STATEMENT]
lemma polynomial_function_cmul [intro]:
  assumes f: "polynomial_function f"
    shows "polynomial_function (\<lambda>x. c *\<^sub>R f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polynomial_function (\<lambda>x. c *\<^sub>R f x)
[PROOF STEP]
by (rule polynomial_function_mult [OF polynomial_function_const f])


[STATEMENT]
lemma Ord_linear_lt:
  assumes "Ord k" "Ord l"
  obtains (lt) "k < l" | (eq) "k=l" | (gt) "l < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k < l \<Longrightarrow> thesis; k = l \<Longrightarrow> thesis; l < k \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
using Ord_linear OrdmemD assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Ord ?k; Ord ?l\<rbrakk> \<Longrightarrow> ?k \<in> elts ?l \<or> ?k = ?l \<or> ?l \<in> elts ?k
\<lbrakk>Ord ?k; ?j \<in> elts ?k\<rbrakk> \<Longrightarrow> ?j < ?k
Ord k
Ord l

goal (1 subgoal):
 1. \<lbrakk>k < l \<Longrightarrow> thesis; k = l \<Longrightarrow> thesis; l < k \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma CompleteLatticeI:
  "\<lbrakk>po \<in> PartialOrder; \<forall>S. S \<subseteq> pset po \<longrightarrow> (\<exists>L. isLub S po L);
     \<forall>S. S \<subseteq> pset po \<longrightarrow> (\<exists>G. isGlb S po G)\<rbrakk>
    \<Longrightarrow> po \<in> CompleteLattice"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>po \<in> PartialOrder; \<forall>S\<subseteq>pset po. \<exists>L. isLub S po L; \<forall>S\<subseteq>pset po. \<exists>G. isGlb S po G\<rbrakk> \<Longrightarrow> po \<in> CompleteLattice
[PROOF STEP]
unfolding CompleteLattice_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>po \<in> PartialOrder; \<forall>S\<subseteq>pset po. \<exists>L. isLub S po L; \<forall>S\<subseteq>pset po. \<exists>G. isGlb S po G\<rbrakk> \<Longrightarrow> po \<in> {cl \<in> PartialOrder. (\<forall>S\<subseteq>pset cl. Ex (isLub S cl)) \<and> (\<forall>S\<subseteq>pset cl. Ex (isGlb S cl))}
[PROOF STEP]
by blast


[STATEMENT]
lemma valuate_opposite_val:
  shows "p \<lbrace> \<lambda> x. - v x \<rbrace> = - (p \<lbrace> v \<rbrace>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<lbrace> \<lambda>x. - v x \<rbrace> = - p \<lbrace> v \<rbrace>
[PROOF STEP]
using valuate_diff[of p "\<lambda> x. 0" v]
[PROOF STATE]
proof (prove)
using this:
p \<lbrace> \<lambda>x. 0::'a \<rbrace> - p \<lbrace> v \<rbrace> = p \<lbrace> \<lambda>x. (0::'a) - v x \<rbrace>

goal (1 subgoal):
 1. p \<lbrace> \<lambda>x. - v x \<rbrace> = - p \<lbrace> v \<rbrace>
[PROOF STEP]
by (auto simp add: valuate_def)


[STATEMENT]
lemma infinite_cars:"infinite {c::cars . True}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite {c. True}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite {c. True}
[PROOF STEP]
have "infinite {n::nat. True}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite {n. True}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
infinite {n. True}

goal (1 subgoal):
 1. infinite {c. True}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite {n. True}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite {n. True}

goal (1 subgoal):
 1. infinite {c. True}
[PROOF STEP]
by (metis UNIV_def finite_imageI type_definition.Rep_range type_definition_cars)
[PROOF STATE]
proof (state)
this:
infinite {c. True}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma openin_topology\<^sub>N_I:
  assumes "\<And>x. x \<in> U \<Longrightarrow> \<exists>e>0. \<forall>y. eNorm N (y-x) < e \<longrightarrow> y \<in> U"
  shows "openin (topology\<^sub>N N) U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (topology\<^sub>N N) U
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> U \<Longrightarrow> \<exists>e>0. \<forall>y. eNorm N (y - ?x) < e \<longrightarrow> y \<in> U

goal (1 subgoal):
 1. openin (topology\<^sub>N N) U
[PROOF STEP]
unfolding openin_topology\<^sub>N
[PROOF STATE]
proof (prove)
using this:
?x \<in> U \<Longrightarrow> \<exists>e>0. \<forall>y. eNorm N (y - ?x) < e \<longrightarrow> y \<in> U

goal (1 subgoal):
 1. \<forall>x\<in>U. \<exists>e>0. \<forall>y. eNorm N (y - x) < e \<longrightarrow> y \<in> U
[PROOF STEP]
by auto


[STATEMENT]
lemma parent_r_child[simp]: "parent l (r_child l n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. parent l (r_child l n) = n
[PROOF STEP]
unfolding parent_def r_child_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l + (2 * n - l + 2 - l - 1) div 2 = n
[PROOF STEP]
by simp


[STATEMENT]
lemma iter_tensor_of_H_rep_is_correct:
  fixes n:: nat
  assumes "n \<ge> 1"
  shows "(H \<otimes>\<^bsup>n\<^esup>) = H^\<^sub>\<otimes> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H \<otimes>\<^bsup>n\<^esup> = 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]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> n

goal (1 subgoal):
 1. H \<otimes>\<^bsup>n\<^esup> = 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]
proof(rule nat_induct_at_least)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. H \<otimes>\<^bsup>1\<^esup> = Matrix.mat (2 ^ 1) (2 ^ 1) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>1\<^esub>  j / sqrt 2 ^ 1))
 2. \<And>n. \<lbrakk>1 \<le> n; H \<otimes>\<^bsup>n\<^esup> = 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))\<rbrakk> \<Longrightarrow> H \<otimes>\<^bsup>Suc n\<^esup> = 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>\<^bsup>1\<^esup>) = H^\<^sub>\<otimes> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H \<otimes>\<^bsup>1\<^esup> = Matrix.mat (2 ^ 1) (2 ^ 1) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>1\<^esub>  j / sqrt 2 ^ 1))
[PROOF STEP]
using one_tensor_is_id one_tensor_of_H_is_H
[PROOF STATE]
proof (prove)
using this:
?A \<otimes>\<^bsup>1\<^esup> = ?A
Matrix.mat (2 ^ 1) (2 ^ 1) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>1\<^esub>  j / sqrt 2 ^ 1)) = H

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

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; H \<otimes>\<^bsup>n\<^esup> = 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))\<rbrakk> \<Longrightarrow> H \<otimes>\<^bsup>Suc n\<^esup> = 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. \<And>n. \<lbrakk>1 \<le> n; H \<otimes>\<^bsup>n\<^esup> = 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))\<rbrakk> \<Longrightarrow> H \<otimes>\<^bsup>Suc n\<^esup> = 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 n:: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; H \<otimes>\<^bsup>n\<^esup> = 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))\<rbrakk> \<Longrightarrow> H \<otimes>\<^bsup>Suc n\<^esup> = 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:"n \<ge> 1" and IH:"(H \<otimes>\<^bsup>n\<^esup>) = H^\<^sub>\<otimes> n"
[PROOF STATE]
proof (state)
this:
1 \<le> n
H \<otimes>\<^bsup>n\<^esup> = 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. \<And>n. \<lbrakk>1 \<le> n; H \<otimes>\<^bsup>n\<^esup> = 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))\<rbrakk> \<Longrightarrow> H \<otimes>\<^bsup>Suc n\<^esup> = 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:
1 \<le> n
H \<otimes>\<^bsup>n\<^esup> = 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]
have "(H \<otimes>\<^bsup>(Suc n)\<^esup>) = H \<Otimes> (H \<otimes>\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
H \<otimes>\<^bsup>n\<^esup> = 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>\<^bsup>Suc n\<^esup> = H \<Otimes> H \<otimes>\<^bsup>n\<^esup>
[PROOF STEP]
using iter_tensor_suc Nat.Suc_eq_plus1
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
H \<otimes>\<^bsup>n\<^esup> = 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 \<le> ?n \<Longrightarrow> ?A \<otimes>\<^bsup>Suc ?n\<^esup> = ?A \<Otimes> ?A \<otimes>\<^bsup>?n\<^esup>
Suc ?n = ?n + 1

goal (1 subgoal):
 1. H \<otimes>\<^bsup>Suc n\<^esup> = H \<Otimes> H \<otimes>\<^bsup>n\<^esup>
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
H \<otimes>\<^bsup>Suc n\<^esup> = H \<Otimes> H \<otimes>\<^bsup>n\<^esup>

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; H \<otimes>\<^bsup>n\<^esup> = 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))\<rbrakk> \<Longrightarrow> H \<otimes>\<^bsup>Suc n\<^esup> = 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]
also
[PROOF STATE]
proof (state)
this:
H \<otimes>\<^bsup>Suc n\<^esup> = H \<Otimes> H \<otimes>\<^bsup>n\<^esup>

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; H \<otimes>\<^bsup>n\<^esup> = 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))\<rbrakk> \<Longrightarrow> H \<otimes>\<^bsup>Suc n\<^esup> = 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 "... = H \<Otimes> (H^\<^sub>\<otimes> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H \<Otimes> H \<otimes>\<^bsup>n\<^esup> = 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))
[PROOF STEP]
using IH
[PROOF STATE]
proof (prove)
using this:
H \<otimes>\<^bsup>n\<^esup> = 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> H \<otimes>\<^bsup>n\<^esup> = 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))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
H \<Otimes> H \<otimes>\<^bsup>n\<^esup> = 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))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; H \<otimes>\<^bsup>n\<^esup> = 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))\<rbrakk> \<Longrightarrow> H \<otimes>\<^bsup>Suc n\<^esup> = 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]
also
[PROOF STATE]
proof (state)
this:
H \<Otimes> H \<otimes>\<^bsup>n\<^esup> = 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))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; H \<otimes>\<^bsup>n\<^esup> = 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))\<rbrakk> \<Longrightarrow> H \<otimes>\<^bsup>Suc n\<^esup> = 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 "... = 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]
using a0 H_tensor_iter_tensor_of_H
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
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))

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]
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)) = 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. \<And>n. \<lbrakk>1 \<le> n; H \<otimes>\<^bsup>n\<^esup> = 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))\<rbrakk> \<Longrightarrow> H \<otimes>\<^bsup>Suc n\<^esup> = 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]
finally
[PROOF STATE]
proof (chain)
picking this:
H \<otimes>\<^bsup>Suc n\<^esup> = 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>\<^bsup>(Suc n)\<^esup>) = H^\<^sub>\<otimes> (Suc n)"
[PROOF STATE]
proof (prove)
using this:
H \<otimes>\<^bsup>Suc n\<^esup> = 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. H \<otimes>\<^bsup>Suc n\<^esup> = 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
[PROOF STATE]
proof (state)
this:
H \<otimes>\<^bsup>Suc n\<^esup> = 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