[STATEMENT]
lemma complex_increasing_LIMSEQ:
  fixes f :: "nat \<Rightarrow> complex"
  assumes inc: "\<And>n. f n \<le> f (Suc n)"
    and bdd: "\<And>n. f n \<le> l"
    and en: "\<And>e. 0 < e \<Longrightarrow> \<exists>n. l \<le> f n + e"
  shows "f \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<longlonglongrightarrow> l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<longlonglongrightarrow> l
[PROOF STEP]
have \<open>(\<lambda>n. Re (f n)) \<longlonglongrightarrow> Re l\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. Re (f n)) \<longlonglongrightarrow> Re l
[PROOF STEP]
apply (rule increasing_LIMSEQ)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n. Re (f n) \<le> Re (f (Suc n))
 2. \<And>n. Re (f n) \<le> Re l
 3. \<And>e. 0 < e \<Longrightarrow> \<exists>n. Re l \<le> Re (f n) + e
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f ?n \<le> f (Suc ?n)
f ?n \<le> l
0 < ?e \<Longrightarrow> \<exists>n. l \<le> f n + ?e

goal (3 subgoals):
 1. \<And>n. Re (f n) \<le> Re (f (Suc n))
 2. \<And>n. Re (f n) \<le> Re l
 3. \<And>e. 0 < e \<Longrightarrow> \<exists>n. Re l \<le> Re (f n) + e
[PROOF STEP]
apply (auto simp: less_eq_complex_def less_complex_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>0 < e; \<And>n. Re (f n) \<le> Re (f (Suc n)); \<And>n. Re (f n) \<le> Re l \<and> Im (f n) = Im l; \<And>e. 0 < Re e \<and> Im e = 0 \<Longrightarrow> \<exists>n. Re l \<le> Re (f n) + Re e\<rbrakk> \<Longrightarrow> \<exists>n. Re l \<le> Re (f n) + e
[PROOF STEP]
by (metis Im_complex_of_real Re_complex_of_real)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. Re (f n)) \<longlonglongrightarrow> Re l

goal (1 subgoal):
 1. f \<longlonglongrightarrow> l
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. Re (f n)) \<longlonglongrightarrow> Re l

goal (1 subgoal):
 1. f \<longlonglongrightarrow> l
[PROOF STEP]
have \<open>Im (f n) = Im l\<close> for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (f n) = Im l
[PROOF STEP]
using bdd
[PROOF STATE]
proof (prove)
using this:
f ?n \<le> l

goal (1 subgoal):
 1. Im (f n) = Im l
[PROOF STEP]
by (auto simp: less_eq_complex_def)
[PROOF STATE]
proof (state)
this:
Im (f ?n) = Im l

goal (1 subgoal):
 1. f \<longlonglongrightarrow> l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Im (f ?n) = Im l
[PROOF STEP]
have \<open>(\<lambda>n. Im (f n)) \<longlonglongrightarrow> Im l\<close>
[PROOF STATE]
proof (prove)
using this:
Im (f ?n) = Im l

goal (1 subgoal):
 1. (\<lambda>n. Im (f n)) \<longlonglongrightarrow> Im l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. Im (f n)) \<longlonglongrightarrow> Im l

goal (1 subgoal):
 1. f \<longlonglongrightarrow> l
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. Re (f n)) \<longlonglongrightarrow> Re l
(\<lambda>n. Im (f n)) \<longlonglongrightarrow> Im l
[PROOF STEP]
show \<open>f \<longlonglongrightarrow> l\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. Re (f n)) \<longlonglongrightarrow> Re l
(\<lambda>n. Im (f n)) \<longlonglongrightarrow> Im l

goal (1 subgoal):
 1. f \<longlonglongrightarrow> l
[PROOF STEP]
by (simp add: tendsto_complex_iff)
[PROOF STATE]
proof (state)
this:
f \<longlonglongrightarrow> l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_le_pos:
  fixes f g :: "nat \<Rightarrow> ereal"
  assumes "\<And>N. f N \<le> g N"
    and "\<And>N. 0 \<le> f N"
  shows "suminf f \<le> suminf g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. suminf f \<le> suminf g
[PROOF STEP]
proof (safe intro!: suminf_bound)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>N. sum f {..<N} \<le> suminf g
 2. \<And>n. 0 \<le> f n
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>N. sum f {..<N} \<le> suminf g
 2. \<And>n. 0 \<le> f n
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>N. sum f {..<N} \<le> suminf g
 2. \<And>n. 0 \<le> f n
[PROOF STEP]
fix N
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>N. sum f {..<N} \<le> suminf g
 2. \<And>n. 0 \<le> f n
[PROOF STEP]
have "0 \<le> g N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> g N
[PROOF STEP]
using assms(2,1)[of N]
[PROOF STATE]
proof (prove)
using this:
0 \<le> f N
f N \<le> g N

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

goal (2 subgoals):
 1. \<And>N. sum f {..<N} \<le> suminf g
 2. \<And>n. 0 \<le> f n
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 \<le> g ?N2

goal (2 subgoals):
 1. \<And>N. sum f {..<N} \<le> suminf g
 2. \<And>n. 0 \<le> f n
[PROOF STEP]
have "sum f {..<n} \<le> sum g {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<n} \<le> sum g {..<n}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f ?N \<le> g ?N
0 \<le> f ?N

goal (1 subgoal):
 1. sum f {..<n} \<le> sum g {..<n}
[PROOF STEP]
by (auto intro: sum_mono)
[PROOF STATE]
proof (state)
this:
sum f {..<n} \<le> sum g {..<n}

goal (2 subgoals):
 1. \<And>N. sum f {..<N} \<le> suminf g
 2. \<And>n. 0 \<le> f n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f {..<n} \<le> sum g {..<n}

goal (2 subgoals):
 1. \<And>N. sum f {..<N} \<le> suminf g
 2. \<And>n. 0 \<le> f n
[PROOF STEP]
have "\<dots> \<le> suminf g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum g {..<n} \<le> suminf g
[PROOF STEP]
using \<open>\<And>N. 0 \<le> g N\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> g ?N

goal (1 subgoal):
 1. sum g {..<n} \<le> suminf g
[PROOF STEP]
by (rule suminf_upper)
[PROOF STATE]
proof (state)
this:
sum g {..<n} \<le> suminf g

goal (2 subgoals):
 1. \<And>N. sum f {..<N} \<le> suminf g
 2. \<And>n. 0 \<le> f n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum f {..<n} \<le> suminf g
[PROOF STEP]
show "sum f {..<n} \<le> suminf g"
[PROOF STATE]
proof (prove)
using this:
sum f {..<n} \<le> suminf g

goal (1 subgoal):
 1. sum f {..<n} \<le> suminf g
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum f {..<n} \<le> suminf g

goal (1 subgoal):
 1. \<And>n. 0 \<le> f n
[PROOF STEP]
qed (rule assms(2))


[STATEMENT]
lemma bdd_above_norm: "bdd_above (norm ` X) \<longleftrightarrow> bounded X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above (norm ` X) = bounded X
[PROOF STEP]
by (simp add: bounded_iff bdd_above_def)


[STATEMENT]
lemma rel_list_all2_update_cong:
  "\<lbrakk> i<size xs; list_all2 (fun_of S) xs ys; (x,y) \<in> S \<rbrakk>
  \<Longrightarrow> list_all2 (fun_of S) (xs[i:=x]) (ys[i:=y])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length xs; list_all2 (fun_of S) xs ys; (x, y) \<in> S\<rbrakk> \<Longrightarrow> list_all2 (fun_of S) (xs[i := x]) (ys[i := y])
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length xs; list_all2 (fun_of S) xs ys; (x, y) \<in> S\<rbrakk> \<Longrightarrow> list_all2 (fun_of S) (xs[i := x]) (ys[i := y])
[PROOF STEP]
by (simp add: list_all2_update_cong)


[STATEMENT]
lemma quotientfun_classrep_equality:
  "\<lbrakk> refl_on A r; f respects r; a\<in>A \<rbrakk> \<Longrightarrow> quotientfun f (r``{a}) = f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>refl_on A r; f respects r; a \<in> A\<rbrakk> \<Longrightarrow> quotientfun f (r `` {a}) = f a
[PROOF STEP]
using refl_onD
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>refl_on ?A ?r; ?a \<in> ?A\<rbrakk> \<Longrightarrow> (?a, ?a) \<in> ?r

goal (1 subgoal):
 1. \<lbrakk>refl_on A r; f respects r; a \<in> A\<rbrakk> \<Longrightarrow> quotientfun f (r `` {a}) = f a
[PROOF STEP]
by (fastforce intro: quotientfun_equality quotientI)


[STATEMENT]
lemma outstanding_refs_takeWhile_opposite: "outstanding_refs P (takeWhile (Not \<circ> P) xs) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outstanding_refs P (takeWhile (Not \<circ> P) xs) = {}
[PROOF STEP]
apply (induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. outstanding_refs P (takeWhile (Not \<circ> P) []) = {}
 2. \<And>a xs. outstanding_refs P (takeWhile (Not \<circ> P) xs) = {} \<Longrightarrow> outstanding_refs P (takeWhile (Not \<circ> P) (a # xs)) = {}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma poly_roots_prod:
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<noteq> 0"
  shows   "poly_roots (prod f A) = (\<Sum>x\<in>A. poly_roots (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (prod f A) = (\<Sum>x\<in>A. poly_roots (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> f ?x \<noteq> 0

goal (1 subgoal):
 1. poly_roots (prod f A) = (\<Sum>x\<in>A. poly_roots (f x))
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto simp: poly_roots_mult)


[STATEMENT]
lemma cardOneTheElem:
  assumes "card A = 1"
  shows "the_elem (f`A) = f (the_elem A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. the_elem (f ` A) = f (the_elem A)
[PROOF STEP]
using assms image_empty image_insert the_elem_eq
[PROOF STATE]
proof (prove)
using this:
card A = 1
?f ` {} = {}
?f ` insert ?a ?B = insert (?f ?a) (?f ` ?B)
the_elem {?x} = ?x

goal (1 subgoal):
 1. the_elem (f ` A) = f (the_elem A)
[PROOF STEP]
by (metis cardinalityOneTheElemIdentity)


[STATEMENT]
lemma ordinal_of_nat_of_ordinal:
"x < \<omega> \<Longrightarrow> ordinal_of_nat (inv ordinal_of_nat x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < \<omega> \<Longrightarrow> ordinal_of_nat (inv ordinal_of_nat x) = x
[PROOF STEP]
apply (rule f_inv_into_f)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < \<omega> \<Longrightarrow> x \<in> range ordinal_of_nat
[PROOF STEP]
apply (simp add: image_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < \<omega> \<Longrightarrow> \<exists>xa. x = ordinal_of_nat xa
[PROOF STEP]
apply (erule less_omegaD)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma qc_SN_relto_iff:
  assumes "r O s \<subseteq> s O (s \<union> r)\<^sup>*"
  shows "SN (r\<^sup>* O s O r\<^sup>*) = SN s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SN (r\<^sup>* O s O r\<^sup>*) = SN s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. SN (r\<^sup>* O s O r\<^sup>*) = SN s
[PROOF STEP]
from converse_mono [THEN iffD2 , OF assms]
[PROOF STATE]
proof (chain)
picking this:
(r O s)\<inverse> \<subseteq> (s O (s \<union> r)\<^sup>*)\<inverse>
[PROOF STEP]
have *: "s\<inverse> O r\<inverse> \<subseteq> (s\<inverse> \<union> r\<inverse>)\<^sup>* O s\<inverse>"
[PROOF STATE]
proof (prove)
using this:
(r O s)\<inverse> \<subseteq> (s O (s \<union> r)\<^sup>*)\<inverse>

goal (1 subgoal):
 1. s\<inverse> O r\<inverse> \<subseteq> (s\<inverse> \<union> r\<inverse>)\<^sup>* O s\<inverse>
[PROOF STEP]
unfolding converse_inward
[PROOF STATE]
proof (prove)
using this:
s\<inverse> O r\<inverse> \<subseteq> (s\<inverse> \<union> r\<inverse>)\<^sup>* O s\<inverse>

goal (1 subgoal):
 1. s\<inverse> O r\<inverse> \<subseteq> (s\<inverse> \<union> r\<inverse>)\<^sup>* O s\<inverse>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
s\<inverse> O r\<inverse> \<subseteq> (s\<inverse> \<union> r\<inverse>)\<^sup>* O s\<inverse>

goal (1 subgoal):
 1. SN (r\<^sup>* O s O r\<^sup>*) = SN s
[PROOF STEP]
have "(r\<^sup>* O s O r\<^sup>*)\<inverse> = (r\<inverse>)\<^sup>* O s\<inverse> O (r\<inverse>)\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r\<^sup>* O s O r\<^sup>*)\<inverse> = (r\<inverse>)\<^sup>* O s\<inverse> O (r\<inverse>)\<^sup>*
[PROOF STEP]
by (simp only: converse_relcomp O_assoc rtrancl_converse)
[PROOF STATE]
proof (state)
this:
(r\<^sup>* O s O r\<^sup>*)\<inverse> = (r\<inverse>)\<^sup>* O s\<inverse> O (r\<inverse>)\<^sup>*

goal (1 subgoal):
 1. SN (r\<^sup>* O s O r\<^sup>*) = SN s
[PROOF STEP]
with qc_wf_relto_iff [OF *]
[PROOF STATE]
proof (chain)
picking this:
wf ((r\<inverse>)\<^sup>* O s\<inverse> O (r\<inverse>)\<^sup>*) = wf (s\<inverse>)
(r\<^sup>* O s O r\<^sup>*)\<inverse> = (r\<inverse>)\<^sup>* O s\<inverse> O (r\<inverse>)\<^sup>*
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
wf ((r\<inverse>)\<^sup>* O s\<inverse> O (r\<inverse>)\<^sup>*) = wf (s\<inverse>)
(r\<^sup>* O s O r\<^sup>*)\<inverse> = (r\<inverse>)\<^sup>* O s\<inverse> O (r\<inverse>)\<^sup>*

goal (1 subgoal):
 1. SN (r\<^sup>* O s O r\<^sup>*) = SN s
[PROOF STEP]
by (simp add: SN_iff_wf)
[PROOF STATE]
proof (state)
this:
SN (r\<^sup>* O s O r\<^sup>*) = SN s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma chain_boundary_of:
   "chain_boundary p (frag_of f) =
        (if p = 0 then 0
         else (\<Sum>k\<le>p. frag_cmul ((-1) ^ k) (frag_of(singular_face p k f))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chain_boundary p (frag_of f) = (if p = 0 then 0 else \<Sum>k\<le>p. frag_cmul ((- 1) ^ k) (frag_of (singular_face p k f)))
[PROOF STEP]
by (simp add: chain_boundary_def)


[STATEMENT]
lemma ZFact_zero: "carrier (ZFact 0) = (\<Union>a. {{a}})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (ZFact 0) = (\<Union>a. {{a}})
[PROOF STEP]
by (simp add: ZFact_defs A_RCOSETS_defs r_coset_def int.genideal_zero)


[STATEMENT]
lemma fun_right_inverse:
  fixes f :: "'b \<Rightarrow> 'a::field"
  shows "zero_free f \<Longrightarrow> f * inverse f = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zero_free f \<Longrightarrow> f * inverse f = 1
[PROOF STEP]
by (simp add: fun_eq_iff)


[STATEMENT]
lemma dist_scaleC [simp]: "dist (x *\<^sub>C a) (y *\<^sub>C a) = \<bar>x - y\<bar> * norm a"
  for a :: "'a::complex_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (complex_of_real x *\<^sub>C a) (complex_of_real y *\<^sub>C a) = \<bar>x - y\<bar> * norm a
[PROOF STEP]
by (metis dist_scaleR scaleR_scaleC)


[STATEMENT]
lemma InfinitesimalD: "x \<in> Infinitesimal \<Longrightarrow> \<forall>r \<in> Reals. 0 < r \<longrightarrow> hnorm x < r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> Infinitesimal \<Longrightarrow> \<forall>r\<in>\<real>. 0 < r \<longrightarrow> hnorm x < r
[PROOF STEP]
by (simp add: Infinitesimal_def)


[STATEMENT]
lemma bl_bin_bk_oc[simp]:
  "bl_bin (xs @ [Bk, Oc]) =
  bl_bin xs + 2*2^(length xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bl_bin (xs @ [Bk, Oc]) = bl_bin xs + 2 * 2 ^ length xs
[PROOF STEP]
apply(simp add: bin_wc_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bl2wc (xs @ [Bk, Oc]) = bl2wc xs + 2 * 2 ^ length xs
[PROOF STEP]
using bl2nat_cons_oc[of "xs @ [Bk]"]
[PROOF STATE]
proof (prove)
using this:
bl2nat ((xs @ [Bk]) @ [Oc]) 0 = bl2nat (xs @ [Bk]) 0 + 2 ^ length (xs @ [Bk])

goal (1 subgoal):
 1. bl2wc (xs @ [Bk, Oc]) = bl2wc xs + 2 * 2 ^ length xs
[PROOF STEP]
apply(simp add: bl2nat_cons_bk bl2wc.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma wf_interp_for_formula_FEXISTS:
 "\<lbrakk>wf_formula (length I) (FEXISTS \<phi>); w \<noteq> []\<rbrakk>\<Longrightarrow>
  wf_interp_for_formula (w, I) (FEXISTS \<phi>) \<longleftrightarrow> (\<forall>P \<subseteq> {0 .. length w - 1}. wf_interp_for_formula (w, Inr P # I) \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_formula (length I) (FEXISTS \<phi>); w \<noteq> []\<rbrakk> \<Longrightarrow> wf_interp_for_formula (w, I) (FEXISTS \<phi>) = (\<forall>P\<subseteq>{0..length w - 1}. wf_interp_for_formula (w, Inr P # I) \<phi>)
[PROOF STEP]
by (auto simp: neq_Nil_conv nth_Cons')


[STATEMENT]
lemma frontier_closures: "frontier S = closure S \<inter> closure (- S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier S = closure S \<inter> closure (- S)
[PROOF STEP]
by (auto simp: frontier_def interior_closure)


[STATEMENT]
lemma interval_lebesgue_integral_of_real:
  "interval_lebesgue_integral M a b (\<lambda>x. complex_of_real (f x)) =
    of_real (interval_lebesgue_integral M a b f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x=a..b|M. complex_of_real (f x) = complex_of_real (interval_lebesgue_integral M a b f)
[PROOF STEP]
unfolding interval_lebesgue_integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if a \<le> b then CLINT x:einterval a b|M. complex_of_real (f x) else - (CLINT x:einterval b a|M. complex_of_real (f x))) = complex_of_real (if a \<le> b then set_lebesgue_integral M (einterval a b) f else - set_lebesgue_integral M (einterval b a) f)
[PROOF STEP]
by (auto simp: interval_lebesgue_integral_def set_integral_complex_of_real)


[STATEMENT]
theorem ack: "ack m n = ackloop [n,m]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ack m n = ackloop [n, m]
[PROOF STEP]
by (simp add: ackloop_acklist)


[STATEMENT]
lemma DERIV_divide[derivative_intros]:
  "(f has_field_derivative D) (at x within s) \<Longrightarrow>
    (g has_field_derivative E) (at x within s) \<Longrightarrow> g x \<noteq> 0 \<Longrightarrow>
    ((\<lambda>x. f x / g x) has_field_derivative (D * g x - f x * E) / (g x * g x)) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative D) (at x within s); (g has_field_derivative E) (at x within s); g x \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x / g x) has_field_derivative (D * g x - f x * E) / (g x * g x)) (at x within s)
[PROOF STEP]
by (rule has_derivative_imp_has_field_derivative[OF has_derivative_divide])
     (auto dest: has_field_derivative_imp_has_derivative simp: field_simps)


[STATEMENT]
lemma set_split_bst2: "bst t \<Longrightarrow> set_tree (snd (split_bst x t)) = {y \<in> set_tree t. y > x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bst t \<Longrightarrow> set_tree (snd (split_bst x t)) = {y \<in> set_tree t. x < y}
[PROOF STEP]
by (induction t) (auto split: prod.splits)


[STATEMENT]
lemma concave_on_iff:
  "concave_on S f \<longleftrightarrow>
    (\<forall>x\<in>S. \<forall>y\<in>S. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> f (u *\<^sub>R x + v *\<^sub>R y) \<ge> u * f x + v * f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concave_on S f = (\<forall>x\<in>S. \<forall>y\<in>S. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> u * f x + v * f y \<le> f (u *\<^sub>R x + v *\<^sub>R y))
[PROOF STEP]
by (auto simp: concave_on_def convex_on_def algebra_simps)


[STATEMENT]
lemma sum_disjoint_3:
  assumes "w \<sqinter> x = bot"
      and "w \<sqinter> y = bot"
      and "x \<sqinter> y = bot"
    shows "sum ((w \<squnion> x \<squnion> y) \<sqinter> z) = sum (w \<sqinter> z) + sum (x \<sqinter> z) + sum (y \<sqinter> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_class.sum ((w \<squnion> x \<squnion> y) \<sqinter> z) = sum_class.sum (w \<sqinter> z) + sum_class.sum (x \<sqinter> z) + sum_class.sum (y \<sqinter> z)
[PROOF STEP]
by (metis assms inf_sup_distrib2 sup_idem sum_disjoint)


[STATEMENT]
lemma Re_complex_div_eq_0: "Re (a / b) = 0 \<longleftrightarrow> Re (a * cnj b) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Re (a / b) = 0) = (Re (a * cnj b) = 0)
[PROOF STEP]
by (auto simp add: Re_divide)


[STATEMENT]
lemma prime_imp_power_coprime:
  "prime p \<Longrightarrow> \<not> p dvd a \<Longrightarrow> coprime a (p ^ m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; \<not> p dvd a\<rbrakk> \<Longrightarrow> coprime a (p ^ m)
[PROOF STEP]
by (rule prime_elem_imp_power_coprime) simp_all


[STATEMENT]
lemma Euclid_GCD: "VARS a b
 {0<A \<and> 0<B}
 a := A; b := B;
 WHILE  a \<noteq> b
 INV {0<a \<and> 0<b \<and> gcd A B = gcd a b}
 DO IF a<b THEN b := b-a ELSE a := a-b FI OD
 {a = gcd A B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0 < A \<and> 0 < B}
a := A; b := B; WHILE a \<noteq> b INV {0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b}  VAR {0}
DO IF a < b THEN b := b - a  ELSE a := a - b FI OD
{a = Arith2.gcd A B}
[PROOF STEP]
proof casified_vcg_simp
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. 0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b \<Longrightarrow> (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
 2. \<And>a. 0 < a \<and> Arith2.gcd A B = Arith2.gcd a a \<Longrightarrow> a = Arith2.gcd a a
[PROOF STEP]
case while
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>a b. 0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b \<Longrightarrow> (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
 2. \<And>a. 0 < a \<and> Arith2.gcd A B = Arith2.gcd a a \<Longrightarrow> a = Arith2.gcd a a
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>a b. 0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b \<Longrightarrow> (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
 2. \<And>a. 0 < a \<and> Arith2.gcd A B = Arith2.gcd a a \<Longrightarrow> a = Arith2.gcd a a
[PROOF STEP]
case postcondition
[PROOF STATE]
proof (state)
this:
0 < a \<and> Arith2.gcd A B = Arith2.gcd a a

goal (2 subgoals):
 1. \<And>a b. 0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b \<Longrightarrow> (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
 2. \<And>a. 0 < a \<and> Arith2.gcd A B = Arith2.gcd a a \<Longrightarrow> a = Arith2.gcd a a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < a \<and> Arith2.gcd A B = Arith2.gcd a a
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < a \<and> Arith2.gcd A B = Arith2.gcd a a

goal (1 subgoal):
 1. a = Arith2.gcd a a
[PROOF STEP]
by (auto elim: gcd_nnn)
[PROOF STATE]
proof (state)
this:
a = Arith2.gcd a a

goal (1 subgoal):
 1. \<And>a b. 0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b \<Longrightarrow> (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. 0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b \<Longrightarrow> (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
[PROOF STEP]
case invariant
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>a b. 0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b \<Longrightarrow> (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>a b. 0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b \<Longrightarrow> (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
[PROOF STEP]
case cond
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>a b. 0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b \<Longrightarrow> (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>a b. 0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b \<Longrightarrow> (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
[PROOF STEP]
case vc
[PROOF STATE]
proof (state)
this:
0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b

goal (1 subgoal):
 1. \<And>a b. 0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b \<Longrightarrow> (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < a \<and> 0 < b \<and> Arith2.gcd A B = Arith2.gcd a b \<and> a \<noteq> b

goal (1 subgoal):
 1. (a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)
[PROOF STEP]
by (simp_all add: linorder_not_less gcd_diff_l gcd_diff_r less_imp_le)
[PROOF STATE]
proof (state)
this:
(a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd a (b - a)) \<and> (\<not> a < b \<longrightarrow> Arith2.gcd a b = Arith2.gcd (a - b) b)

goal:
No subgoals!
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 < ?a2 \<and> 0 < ?b2 \<and> Arith2.gcd A B = Arith2.gcd ?a2 ?b2 \<and> ?a2 \<noteq> ?b2 \<Longrightarrow> (?a2 < ?b2 \<longrightarrow> Arith2.gcd ?a2 ?b2 = Arith2.gcd ?a2 (?b2 - ?a2)) \<and> (\<not> ?a2 < ?b2 \<longrightarrow> Arith2.gcd ?a2 ?b2 = Arith2.gcd (?a2 - ?b2) ?b2)

goal:
No subgoals!
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 < ?a2 \<and> 0 < ?b2 \<and> Arith2.gcd A B = Arith2.gcd ?a2 ?b2 \<and> ?a2 \<noteq> ?b2 \<Longrightarrow> (?a2 < ?b2 \<longrightarrow> Arith2.gcd ?a2 ?b2 = Arith2.gcd ?a2 (?b2 - ?a2)) \<and> (\<not> ?a2 < ?b2 \<longrightarrow> Arith2.gcd ?a2 ?b2 = Arith2.gcd (?a2 - ?b2) ?b2)

goal:
No subgoals!
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 < ?a2 \<and> 0 < ?b2 \<and> Arith2.gcd A B = Arith2.gcd ?a2 ?b2 \<and> ?a2 \<noteq> ?b2 \<Longrightarrow> (?a2 < ?b2 \<longrightarrow> Arith2.gcd ?a2 ?b2 = Arith2.gcd ?a2 (?b2 - ?a2)) \<and> (\<not> ?a2 < ?b2 \<longrightarrow> Arith2.gcd ?a2 ?b2 = Arith2.gcd (?a2 - ?b2) ?b2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_closed_under_union:
  "\<forall>\<I>\<in>{CP, TOTAL, CONS, LIM, BC}. U\<^sub>0 \<in> \<I> \<and> V\<^sub>0 \<in> \<I> \<and> U\<^sub>0 \<union> V\<^sub>0 \<notin> \<I>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<I>\<in>{CP, TOTAL, CONS, LIM, BC}. U\<^sub>0 \<in> \<I> \<and> V\<^sub>0 \<in> \<I> \<and> U\<^sub>0 \<union> V\<^sub>0 \<notin> \<I>
[PROOF STEP]
using U0_in_CP U0_in_NUM V0_in_FIN
    FIN_subseteq_CP
    NUM_subseteq_TOTAL
    CP_subseteq_TOTAL
    TOTAL_subseteq_CONS
    CONS_subseteq_Lim
    Lim_subseteq_BC
    U0_V0_not_in_BC
[PROOF STATE]
proof (prove)
using this:
U\<^sub>0 \<in> CP
U\<^sub>0 \<in> NUM
V\<^sub>0 \<in> FIN
FIN \<subseteq> CP
NUM \<subseteq> TOTAL
CP \<subseteq> TOTAL
TOTAL \<subseteq> CONS
CONS \<subseteq> LIM
LIM \<subseteq> BC
U\<^sub>0 \<union> V\<^sub>0 \<notin> BC

goal (1 subgoal):
 1. \<forall>\<I>\<in>{CP, TOTAL, CONS, LIM, BC}. U\<^sub>0 \<in> \<I> \<and> V\<^sub>0 \<in> \<I> \<and> U\<^sub>0 \<union> V\<^sub>0 \<notin> \<I>
[PROOF STEP]
by blast


[STATEMENT]
lemma infinite_UNIV: "infinite (UNIV :: 'a set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
using surj_to_nat
[PROOF STATE]
proof (prove)
using this:
surj to_nat

goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
by (intro infinite_surj[of UNIV to_nat]) auto


[STATEMENT]
lemma smult_smult [simp]: "smult a (smult b p) = smult (a * b) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult a (smult b p) = smult (a * b) p
[PROOF STEP]
by (rule poly_eqI) (simp add: mult.assoc)


[STATEMENT]
lemma list_as_mapping_lookup:
  fixes xs :: "('a \<times> 'c) list"
  shows "(Mapping.lookup (list_as_mapping xs)) = (\<lambda> x . if (\<exists> z . (x,z) \<in> (set xs)) then Some {z . (x,z) \<in> (set xs)} else None)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)
[PROOF STEP]
let ?P = "\<lambda>m :: ('a,'c set) mapping . (Mapping.lookup m) = (\<lambda> x . if (\<exists> z . (x,z) \<in> (set xs)) then Some {z . (x,z) \<in> (set xs)} else None)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)
[PROOF STEP]
have "?P (list_as_mapping xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)
[PROOF STEP]
proof (induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Mapping.lookup (list_as_mapping []) = (\<lambda>x. if \<exists>z. (x, z) \<in> set [] then Some {z. (x, z) \<in> set []} else None)
 2. \<And>a xs. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) \<Longrightarrow> Mapping.lookup (list_as_mapping (a # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (a # xs) then Some {z. (x, z) \<in> set (a # xs)} else None)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. Mapping.lookup (list_as_mapping []) = (\<lambda>x. if \<exists>z. (x, z) \<in> set [] then Some {z. (x, z) \<in> set []} else None)
 2. \<And>a xs. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) \<Longrightarrow> Mapping.lookup (list_as_mapping (a # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (a # xs) then Some {z. (x, z) \<in> set (a # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping []) = (\<lambda>x. if \<exists>z. (x, z) \<in> set [] then Some {z. (x, z) \<in> set []} else None)
[PROOF STEP]
using Mapping.lookup_empty
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup Mapping.empty ?k = None

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping []) = (\<lambda>x. if \<exists>z. (x, z) \<in> set [] then Some {z. (x, z) \<in> set []} else None)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping []) = (\<lambda>x. if \<exists>z. (x, z) \<in> set [] then Some {z. (x, z) \<in> set []} else None)

goal (1 subgoal):
 1. \<And>a xs. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) \<Longrightarrow> Mapping.lookup (list_as_mapping (a # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (a # xs) then Some {z. (x, z) \<in> set (a # xs)} else None)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) \<Longrightarrow> Mapping.lookup (list_as_mapping (a # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (a # xs) then Some {z. (x, z) \<in> set (a # xs)} else None)
[PROOF STEP]
case (Cons xz xs)
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)

goal (1 subgoal):
 1. \<And>a xs. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) \<Longrightarrow> Mapping.lookup (list_as_mapping (a # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (a # xs) then Some {z. (x, z) \<in> set (a # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)
[PROOF STEP]
obtain x z where "xz = (x,z)"
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)

goal (1 subgoal):
 1. (\<And>x z. xz = (x, z) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) surj_pair)
[PROOF STATE]
proof (state)
this:
xz = (x, z)

goal (1 subgoal):
 1. \<And>a xs. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) \<Longrightarrow> Mapping.lookup (list_as_mapping (a # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (a # xs) then Some {z. (x, z) \<in> set (a # xs)} else None)
[PROOF STEP]
have *: "(list_as_mapping ((x,z)#xs)) = (case Mapping.lookup (list_as_mapping xs) x of
                                None \<Rightarrow> Mapping.update x {z} (list_as_mapping xs) |
                                Some zs \<Rightarrow> Mapping.update x (insert z zs) (list_as_mapping xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_as_mapping ((x, z) # xs) = (case Mapping.lookup (list_as_mapping xs) x of None \<Rightarrow> Mapping.update x {z} (list_as_mapping xs) | Some zs \<Rightarrow> Mapping.update x (insert z zs) (list_as_mapping xs))
[PROOF STEP]
unfolding list_as_mapping.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>(x, z) m. case Mapping.lookup m x of None \<Rightarrow> Mapping.update x {z} m | Some zs \<Rightarrow> Mapping.update x (insert z zs) m) ((x, z) # xs) Mapping.empty = (case Mapping.lookup (foldr (\<lambda>(x, z) m. case Mapping.lookup m x of None \<Rightarrow> Mapping.update x {z} m | Some zs \<Rightarrow> Mapping.update x (insert z zs) m) xs Mapping.empty) x of None \<Rightarrow> Mapping.update x {z} (foldr (\<lambda>(x, z) m. case Mapping.lookup m x of None \<Rightarrow> Mapping.update x {z} m | Some zs \<Rightarrow> Mapping.update x (insert z zs) m) xs Mapping.empty) | Some zs \<Rightarrow> Mapping.update x (insert z zs) (foldr (\<lambda>(x, z) m. case Mapping.lookup m x of None \<Rightarrow> Mapping.update x {z} m | Some zs \<Rightarrow> Mapping.update x (insert z zs) m) xs Mapping.empty))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
list_as_mapping ((x, z) # xs) = (case Mapping.lookup (list_as_mapping xs) x of None \<Rightarrow> Mapping.update x {z} (list_as_mapping xs) | Some zs \<Rightarrow> Mapping.update x (insert z zs) (list_as_mapping xs))

goal (1 subgoal):
 1. \<And>a xs. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) \<Longrightarrow> Mapping.lookup (list_as_mapping (a # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (a # xs) then Some {z. (x, z) \<in> set (a # xs)} else None)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
proof (cases "Mapping.lookup (list_as_mapping xs) x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Mapping.lookup (list_as_mapping xs) x = None \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
 2. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
case None
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping xs) x = None

goal (2 subgoals):
 1. Mapping.lookup (list_as_mapping xs) x = None \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
 2. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Mapping.lookup (list_as_mapping xs) x = None
[PROOF STEP]
have **: "Mapping.lookup (list_as_mapping ((x,z)#xs)) = (Mapping.lookup (Mapping.update x {z} (list_as_mapping xs)))"
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping xs) x = None

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping ((x, z) # xs)) = Mapping.lookup (Mapping.update x {z} (list_as_mapping xs))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping xs) x = None
list_as_mapping ((x, z) # xs) = (case Mapping.lookup (list_as_mapping xs) x of None \<Rightarrow> Mapping.update x {z} (list_as_mapping xs) | Some zs \<Rightarrow> Mapping.update x (insert z zs) (list_as_mapping xs))

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping ((x, z) # xs)) = Mapping.lookup (Mapping.update x {z} (list_as_mapping xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = Mapping.lookup (Mapping.update x {z} (list_as_mapping xs))

goal (2 subgoals):
 1. Mapping.lookup (list_as_mapping xs) x = None \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
 2. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = Mapping.lookup (Mapping.update x {z} (list_as_mapping xs))
[PROOF STEP]
have m1: "Mapping.lookup (list_as_mapping ((x,z)#xs)) = (\<lambda> x' . if x' = x then Some {z} else Mapping.lookup (list_as_mapping xs) x')"
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = Mapping.lookup (Mapping.update x {z} (list_as_mapping xs))

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping ((x, z) # xs)) = (\<lambda>x'. if x' = x then Some {z} else Mapping.lookup (list_as_mapping xs) x')
[PROOF STEP]
by (metis (lifting) lookup_update')
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = (\<lambda>x'. if x' = x then Some {z} else Mapping.lookup (list_as_mapping xs) x')

goal (2 subgoals):
 1. Mapping.lookup (list_as_mapping xs) x = None \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
 2. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
have "(\<lambda> x . if (\<exists> z . (x,z) \<in> set xs) then Some {z . (x,z) \<in> set xs} else None) x = None"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = None
[PROOF STEP]
using None Cons
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping xs) x = None
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)

goal (1 subgoal):
 1. (if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = None
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = None

goal (2 subgoals):
 1. Mapping.lookup (list_as_mapping xs) x = None \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
 2. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = None
[PROOF STEP]
have "\<not>(\<exists> z . (x,z) \<in> set xs)"
[PROOF STATE]
proof (prove)
using this:
(if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = None

goal (1 subgoal):
 1. \<nexists>z. (x, z) \<in> set xs
[PROOF STEP]
by (metis (mono_tags, lifting) option.distinct(1))
[PROOF STATE]
proof (state)
this:
\<nexists>z. (x, z) \<in> set xs

goal (2 subgoals):
 1. Mapping.lookup (list_as_mapping xs) x = None \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
 2. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<nexists>z. (x, z) \<in> set xs
[PROOF STEP]
have "(\<exists> z . (x,z) \<in> set ((x,z)#xs))" and "{z' . (x,z') \<in> set ((x,z)#xs)} = {z}"
[PROOF STATE]
proof (prove)
using this:
\<nexists>z. (x, z) \<in> set xs

goal (1 subgoal):
 1. \<exists>z. (x, z) \<in> set ((x, z) # xs) &&& {z'. (x, z') \<in> set ((x, z) # xs)} = {z}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>z. (x, z) \<in> set ((x, z) # xs)
{z'. (x, z') \<in> set ((x, z) # xs)} = {z}

goal (2 subgoals):
 1. Mapping.lookup (list_as_mapping xs) x = None \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
 2. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>z. (x, z) \<in> set ((x, z) # xs)
{z'. (x, z') \<in> set ((x, z) # xs)} = {z}
[PROOF STEP]
have m2: "(\<lambda> x' . if (\<exists> z' . (x',z') \<in> set ((x,z)#xs))
                                then Some {z' . (x',z') \<in> set ((x,z)#xs)}
                                else None)
                   = (\<lambda> x' . if x' = x
                                then Some {z} else (\<lambda> x . if (\<exists> z . (x,z) \<in> set xs)
                                                            then Some {z . (x,z) \<in> set xs}
                                                            else None) x')"
[PROOF STATE]
proof (prove)
using this:
\<exists>z. (x, z) \<in> set ((x, z) # xs)
{z'. (x, z') \<in> set ((x, z) # xs)} = {z}

goal (1 subgoal):
 1. (\<lambda>x'. if \<exists>z'. (x', z') \<in> set ((x, z) # xs) then Some {z'. (x', z') \<in> set ((x, z) # xs)} else None) = (\<lambda>x'. if x' = x then Some {z} else if \<exists>z. (x', z) \<in> set xs then Some {z. (x', z) \<in> set xs} else None)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<lambda>x'. if \<exists>z'. (x', z') \<in> set ((x, z) # xs) then Some {z'. (x', z') \<in> set ((x, z) # xs)} else None) = (\<lambda>x'. if x' = x then Some {z} else if \<exists>z. (x', z) \<in> set xs then Some {z. (x', z) \<in> set xs} else None)

goal (2 subgoals):
 1. Mapping.lookup (list_as_mapping xs) x = None \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
 2. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
using m1 m2 Cons
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = (\<lambda>x'. if x' = x then Some {z} else Mapping.lookup (list_as_mapping xs) x')
(\<lambda>x'. if \<exists>z'. (x', z') \<in> set ((x, z) # xs) then Some {z'. (x', z') \<in> set ((x, z) # xs)} else None) = (\<lambda>x'. if x' = x then Some {z} else if \<exists>z. (x', z) \<in> set xs then Some {z. (x', z) \<in> set xs} else None)
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
using \<open>xz = (x, z)\<close>
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = (\<lambda>x'. if x' = x then Some {z} else Mapping.lookup (list_as_mapping xs) x')
(\<lambda>x'. if \<exists>z'. (x', z') \<in> set ((x, z) # xs) then Some {z'. (x', z') \<in> set ((x, z) # xs)} else None) = (\<lambda>x'. if x' = x then Some {z} else if \<exists>z. (x', z) \<in> set xs then Some {z. (x', z) \<in> set xs} else None)
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)
xz = (x, z)

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)

goal (1 subgoal):
 1. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
case (Some zs)
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping xs) x = Some zs

goal (1 subgoal):
 1. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Mapping.lookup (list_as_mapping xs) x = Some zs
[PROOF STEP]
have **: "Mapping.lookup (list_as_mapping ((x,z)#xs)) = (Mapping.lookup (Mapping.update x (insert z zs) (list_as_mapping xs)))"
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping xs) x = Some zs

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping ((x, z) # xs)) = Mapping.lookup (Mapping.update x (insert z zs) (list_as_mapping xs))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping xs) x = Some zs
list_as_mapping ((x, z) # xs) = (case Mapping.lookup (list_as_mapping xs) x of None \<Rightarrow> Mapping.update x {z} (list_as_mapping xs) | Some zs \<Rightarrow> Mapping.update x (insert z zs) (list_as_mapping xs))

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping ((x, z) # xs)) = Mapping.lookup (Mapping.update x (insert z zs) (list_as_mapping xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = Mapping.lookup (Mapping.update x (insert z zs) (list_as_mapping xs))

goal (1 subgoal):
 1. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = Mapping.lookup (Mapping.update x (insert z zs) (list_as_mapping xs))
[PROOF STEP]
have m1: "Mapping.lookup (list_as_mapping ((x,z)#xs)) = (\<lambda> x' . if x' = x then Some (insert z zs) else Mapping.lookup (list_as_mapping xs) x')"
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = Mapping.lookup (Mapping.update x (insert z zs) (list_as_mapping xs))

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping ((x, z) # xs)) = (\<lambda>x'. if x' = x then Some (insert z zs) else Mapping.lookup (list_as_mapping xs) x')
[PROOF STEP]
by (metis (lifting) lookup_update')
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = (\<lambda>x'. if x' = x then Some (insert z zs) else Mapping.lookup (list_as_mapping xs) x')

goal (1 subgoal):
 1. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
have "(\<lambda> x . if (\<exists> z . (x,z) \<in> set xs) then Some {z . (x,z) \<in> set xs} else None) x = Some zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = Some zs
[PROOF STEP]
using Some Cons
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping xs) x = Some zs
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)

goal (1 subgoal):
 1. (if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = Some zs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = Some zs

goal (1 subgoal):
 1. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = Some zs
[PROOF STEP]
have "(\<exists> z . (x,z) \<in> set xs)"
[PROOF STATE]
proof (prove)
using this:
(if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = Some zs

goal (1 subgoal):
 1. \<exists>z. (x, z) \<in> set xs
[PROOF STEP]
unfolding case_prod_conv
[PROOF STATE]
proof (prove)
using this:
(if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = Some zs

goal (1 subgoal):
 1. \<exists>z. (x, z) \<in> set xs
[PROOF STEP]
using  option.distinct(2)
[PROOF STATE]
proof (prove)
using this:
(if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = Some zs
Some ?x2.0 \<noteq> None

goal (1 subgoal):
 1. \<exists>z. (x, z) \<in> set xs
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>z. (x, z) \<in> set xs

goal (1 subgoal):
 1. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>z. (x, z) \<in> set xs
[PROOF STEP]
have "(\<exists> z . (x,z) \<in> set ((x,z)#xs))"
[PROOF STATE]
proof (prove)
using this:
\<exists>z. (x, z) \<in> set xs

goal (1 subgoal):
 1. \<exists>z. (x, z) \<in> set ((x, z) # xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>z. (x, z) \<in> set ((x, z) # xs)

goal (1 subgoal):
 1. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
have "{z' . (x,z') \<in> set ((x,z)#xs)} = insert z zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {z'. (x, z') \<in> set ((x, z) # xs)} = insert z zs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {z'. (x, z') \<in> set ((x, z) # xs)} = insert z zs
[PROOF STEP]
have "Some {z . (x,z) \<in> set xs} = Some zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Some {z. (x, z) \<in> set xs} = Some zs
[PROOF STEP]
using \<open>(\<lambda> x . if (\<exists> z . (x,z) \<in> set xs) then Some {z . (x,z) \<in> set xs} else None) x
                  = Some zs\<close>
[PROOF STATE]
proof (prove)
using this:
(if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = Some zs

goal (1 subgoal):
 1. Some {z. (x, z) \<in> set xs} = Some zs
[PROOF STEP]
unfolding case_prod_conv
[PROOF STATE]
proof (prove)
using this:
(if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = Some zs

goal (1 subgoal):
 1. Some {z. (x, z) \<in> set xs} = Some zs
[PROOF STEP]
using  option.distinct(2)
[PROOF STATE]
proof (prove)
using this:
(if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None) = Some zs
Some ?x2.0 \<noteq> None

goal (1 subgoal):
 1. Some {z. (x, z) \<in> set xs} = Some zs
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
Some {z. (x, z) \<in> set xs} = Some zs

goal (1 subgoal):
 1. {z'. (x, z') \<in> set ((x, z) # xs)} = insert z zs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Some {z. (x, z) \<in> set xs} = Some zs
[PROOF STEP]
have "{z . (x,z) \<in> set xs} = zs"
[PROOF STATE]
proof (prove)
using this:
Some {z. (x, z) \<in> set xs} = Some zs

goal (1 subgoal):
 1. {z. (x, z) \<in> set xs} = zs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{z. (x, z) \<in> set xs} = zs

goal (1 subgoal):
 1. {z'. (x, z') \<in> set ((x, z) # xs)} = insert z zs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{z. (x, z) \<in> set xs} = zs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{z. (x, z) \<in> set xs} = zs

goal (1 subgoal):
 1. {z'. (x, z') \<in> set ((x, z) # xs)} = insert z zs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{z'. (x, z') \<in> set ((x, z) # xs)} = insert z zs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{z'. (x, z') \<in> set ((x, z) # xs)} = insert z zs

goal (1 subgoal):
 1. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
have "\<And> a  . (\<lambda> x' . if (\<exists> z' . (x',z') \<in> set ((x,z)#xs))
                              then Some {z' . (x',z') \<in> set ((x,z)#xs)} else None) a
                   = (\<lambda> x' . if x' = x
                              then Some (insert z zs)
                              else (\<lambda> x . if (\<exists> z . (x,z) \<in> set xs)
                                            then Some {z . (x,z) \<in> set xs} else None) x') a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. (if \<exists>z'. (a, z') \<in> set ((x, z) # xs) then Some {z'. (a, z') \<in> set ((x, z) # xs)} else None) = (if a = x then Some (insert z zs) else if \<exists>z. (a, z) \<in> set xs then Some {z. (a, z) \<in> set xs} else None)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. (if \<exists>z'. (a, z') \<in> set ((x, z) # xs) then Some {z'. (a, z') \<in> set ((x, z) # xs)} else None) = (if a = x then Some (insert z zs) else if \<exists>z. (a, z) \<in> set xs then Some {z. (a, z) \<in> set xs} else None)
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. (if \<exists>z'. (a, z') \<in> set ((x, z) # xs) then Some {z'. (a, z') \<in> set ((x, z) # xs)} else None) = (if a = x then Some (insert z zs) else if \<exists>z. (a, z) \<in> set xs then Some {z. (a, z) \<in> set xs} else None)
[PROOF STEP]
show "(\<lambda> x' . if (\<exists> z' . (x',z') \<in> set ((x,z)#xs))
                              then Some {z' . (x',z') \<in> set ((x,z)#xs)} else None) a
                   = (\<lambda> x' . if x' = x
                              then Some (insert z zs)
                              else (\<lambda> x . if (\<exists> z . (x,z) \<in> set xs)
                                            then Some {z . (x,z) \<in> set xs} else None) x') a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<exists>z'. (a, z') \<in> set ((x, z) # xs) then Some {z'. (a, z') \<in> set ((x, z) # xs)} else None) = (if a = x then Some (insert z zs) else if \<exists>z. (a, z) \<in> set xs then Some {z. (a, z) \<in> set xs} else None)
[PROOF STEP]
using \<open>{z' . (x,z') \<in> set ((x,z)#xs)} = insert z zs\<close> \<open>(\<exists> z . (x,z) \<in> set ((x,z)#xs))\<close>
[PROOF STATE]
proof (prove)
using this:
{z'. (x, z') \<in> set ((x, z) # xs)} = insert z zs
\<exists>z. (x, z) \<in> set ((x, z) # xs)

goal (1 subgoal):
 1. (if \<exists>z'. (a, z') \<in> set ((x, z) # xs) then Some {z'. (a, z') \<in> set ((x, z) # xs)} else None) = (if a = x then Some (insert z zs) else if \<exists>z. (a, z) \<in> set xs then Some {z. (a, z) \<in> set xs} else None)
[PROOF STEP]
by (cases "a = x"; auto)
[PROOF STATE]
proof (state)
this:
(if \<exists>z'. (a, z') \<in> set ((x, z) # xs) then Some {z'. (a, z') \<in> set ((x, z) # xs)} else None) = (if a = x then Some (insert z zs) else if \<exists>z. (a, z) \<in> set xs then Some {z. (a, z) \<in> set xs} else None)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(if \<exists>z'. (?a, z') \<in> set ((x, z) # xs) then Some {z'. (?a, z') \<in> set ((x, z) # xs)} else None) = (if ?a = x then Some (insert z zs) else if \<exists>z. (?a, z) \<in> set xs then Some {z. (?a, z) \<in> set xs} else None)

goal (1 subgoal):
 1. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(if \<exists>z'. (?a, z') \<in> set ((x, z) # xs) then Some {z'. (?a, z') \<in> set ((x, z) # xs)} else None) = (if ?a = x then Some (insert z zs) else if \<exists>z. (?a, z) \<in> set xs then Some {z. (?a, z) \<in> set xs} else None)
[PROOF STEP]
have m2: "(\<lambda> x' . if (\<exists> z' . (x',z') \<in> set ((x,z)#xs))
                                then Some {z' . (x',z') \<in> set ((x,z)#xs)} else None)
                   = (\<lambda> x' . if x' = x
                                then Some (insert z zs)
                                else (\<lambda> x . if (\<exists> z . (x,z) \<in> set xs)
                                              then Some {z . (x,z) \<in> set xs} else None) x')"
[PROOF STATE]
proof (prove)
using this:
(if \<exists>z'. (?a, z') \<in> set ((x, z) # xs) then Some {z'. (?a, z') \<in> set ((x, z) # xs)} else None) = (if ?a = x then Some (insert z zs) else if \<exists>z. (?a, z) \<in> set xs then Some {z. (?a, z) \<in> set xs} else None)

goal (1 subgoal):
 1. (\<lambda>x'. if \<exists>z'. (x', z') \<in> set ((x, z) # xs) then Some {z'. (x', z') \<in> set ((x, z) # xs)} else None) = (\<lambda>x'. if x' = x then Some (insert z zs) else if \<exists>z. (x', z) \<in> set xs then Some {z. (x', z) \<in> set xs} else None)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x'. if \<exists>z'. (x', z') \<in> set ((x, z) # xs) then Some {z'. (x', z') \<in> set ((x, z) # xs)} else None) = (\<lambda>x'. if x' = x then Some (insert z zs) else if \<exists>z. (x', z) \<in> set xs then Some {z. (x', z) \<in> set xs} else None)

goal (1 subgoal):
 1. \<And>a. Mapping.lookup (list_as_mapping xs) x = Some a \<Longrightarrow> Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
using m1 m2 Cons
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = (\<lambda>x'. if x' = x then Some (insert z zs) else Mapping.lookup (list_as_mapping xs) x')
(\<lambda>x'. if \<exists>z'. (x', z') \<in> set ((x, z) # xs) then Some {z'. (x', z') \<in> set ((x, z) # xs)} else None) = (\<lambda>x'. if x' = x then Some (insert z zs) else if \<exists>z. (x', z) \<in> set xs then Some {z. (x', z) \<in> set xs} else None)
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
using \<open>xz = (x, z)\<close>
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping ((x, z) # xs)) = (\<lambda>x'. if x' = x then Some (insert z zs) else Mapping.lookup (list_as_mapping xs) x')
(\<lambda>x'. if \<exists>z'. (x', z') \<in> set ((x, z) # xs) then Some {z'. (x', z') \<in> set ((x, z) # xs)} else None) = (\<lambda>x'. if x' = x then Some (insert z zs) else if \<exists>z. (x', z) \<in> set xs then Some {z. (x', z) \<in> set xs} else None)
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)
xz = (x, z)

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping (xz # xs)) = (\<lambda>x. if \<exists>z. (x, z) \<in> set (xz # xs) then Some {z. (x, z) \<in> set (xz # xs)} else None)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)

goal (1 subgoal):
 1. Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Mapping.lookup (list_as_mapping xs) = (\<lambda>x. if \<exists>z. (x, z) \<in> set xs then Some {z. (x, z) \<in> set xs} else None)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma swap_param[param]: "\<lbrakk> i<length l; j<length l; (l',l)\<in>\<langle>A\<rangle>list_rel; (i',i)\<in>nat_rel; (j',j)\<in>nat_rel\<rbrakk>
  \<Longrightarrow> (swap l' i' j', swap l i j)\<in>\<langle>A\<rangle>list_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length l; j < length l; (l', l) \<in> \<langle>A\<rangle>list_rel; (i', i) \<in> nat_rel; (j', j) \<in> nat_rel\<rbrakk> \<Longrightarrow> (swap l' i' j', swap l i j) \<in> \<langle>A\<rangle>list_rel
[PROOF STEP]
unfolding swap_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length l; j < length l; (l', l) \<in> \<langle>A\<rangle>list_rel; (i', i) \<in> nat_rel; (j', j) \<in> nat_rel\<rbrakk> \<Longrightarrow> (l'[i' := l' ! j', j' := l' ! i'], l[i := l ! j, j := l ! i]) \<in> \<langle>A\<rangle>list_rel
[PROOF STEP]
by parametricity


[STATEMENT]
theorem valof_skip:
    "((VALOF SKIP RESULTIS e, s) -|-> (v,s'))  =  ((e, s) -|-> (v,s'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((VALOF SKIP RESULTIS e, s) -|-> (v, s')) = ((e, s) -|-> (v, s'))
[PROOF STEP]
by (blast intro: valof_skip1 valof_skip2)


[STATEMENT]
lemma eSuc_mono [simp]: "eSuc n < eSuc m \<longleftrightarrow> n < m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (eSuc n < eSuc m) = (n < m)
[PROOF STEP]
by (simp add: eSuc_def less_enat_def split: enat.splits)


[STATEMENT]
lemma r'': "(\<forall> x. (\<forall> y. ( ((msrFn::'a \<Rightarrow> nat) y) < ((msrFn :: 'a \<Rightarrow> nat) x)) \<longrightarrow> P y) \<longrightarrow> P x) \<Longrightarrow> P a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (\<forall>y. msrFn y < msrFn x \<longrightarrow> P y) \<longrightarrow> P x \<Longrightarrow> P a
[PROOF STEP]
by (blast intro: r' [of _ P])


[STATEMENT]
lemma e_2 [simp]: "e 2 = -1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e 2 = - 1 / 2
[PROOF STEP]
by (subst e_recurrence; simp add: atLeastAtMost_nat_numeral)


[STATEMENT]
lemma stationary_distribution_imp_int_t:
  assumes C: "essential_class C" "countable C" "stationary_distribution N" "N \<subseteq> C"
  assumes x: "x \<in> C" shows "U' x x = 1 / ennreal (pmf N x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U' x x = 1 / ennreal (pmf N x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U' x x = 1 / ennreal (pmf N x)
[PROOF STEP]
from stationary_distributionD[OF C]
[PROOF STATE]
proof (chain)
picking this:
Ball C pos_recurrent
measure_pmf N = stat C
[PROOF STEP]
have "measure_pmf N = stat C" and *: "\<forall>x\<in>C. pos_recurrent x"
[PROOF STATE]
proof (prove)
using this:
Ball C pos_recurrent
measure_pmf N = stat C

goal (1 subgoal):
 1. measure_pmf N = stat C &&& Ball C pos_recurrent
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
measure_pmf N = stat C
Ball C pos_recurrent

goal (1 subgoal):
 1. U' x x = 1 / ennreal (pmf N x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U' x x = 1 / ennreal (pmf N x)
[PROOF STEP]
unfolding \<open>measure_pmf N = stat C\<close> pmf.rep_eq stat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U' x x = 1 / ennreal (Sigma_Algebra.measure (point_measure UNIV (\<lambda>x. indicator C x / U' x x)) {x})
[PROOF STEP]
using *[THEN bspec, OF x] x
[PROOF STATE]
proof (prove)
using this:
pos_recurrent x
x \<in> C

goal (1 subgoal):
 1. U' x x = 1 / ennreal (Sigma_Algebra.measure (point_measure UNIV (\<lambda>x. indicator C x / U' x x)) {x})
[PROOF STEP]
apply (simp add: measure_point_measure_singleton)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pos_recurrent x; x \<in> C\<rbrakk> \<Longrightarrow> U' x x = 1 / ennreal (enn2real (1 / U' x x))
[PROOF STEP]
apply (cases "U' x x")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>r. \<lbrakk>pos_recurrent x; x \<in> C; 0 \<le> r; U' x x = ennreal r\<rbrakk> \<Longrightarrow> U' x x = 1 / ennreal (enn2real (1 / U' x x))
 2. \<lbrakk>pos_recurrent x; x \<in> C; U' x x = \<top>\<rbrakk> \<Longrightarrow> U' x x = 1 / ennreal (enn2real (1 / U' x x))
[PROOF STEP]
subgoal for r
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pos_recurrent x; x \<in> C; 0 \<le> r; U' x x = ennreal r\<rbrakk> \<Longrightarrow> U' x x = 1 / ennreal (enn2real (1 / U' x x))
[PROOF STEP]
by (cases "r = 0")
         (simp_all add: divide_ennreal_def inverse_ennreal)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pos_recurrent x; x \<in> C; U' x x = \<top>\<rbrakk> \<Longrightarrow> U' x x = 1 / ennreal (enn2real (1 / U' x x))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
U' x x = 1 / ennreal (pmf N x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rinss_bst_of_list:
      "distr (rinss xs Leaf A) (tree_sigma (count_space A)) (map_tree fst) =
       distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A))
             (\<lambda>p. bst_of_list (sort_key p xs))" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
have [measurable]: "set xs \<subseteq> space (count_space A)"
    "c \<in> set xs \<Longrightarrow> c \<in> space (count_space A)" for c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set xs \<subseteq> space (count_space A) &&& (c \<in> set xs \<Longrightarrow> c \<in> space (count_space A))
[PROOF STEP]
using con_assms
[PROOF STATE]
proof (prove)
using this:
countable A
set xs \<subseteq> A
distinct xs

goal (1 subgoal):
 1. set xs \<subseteq> space (count_space A) &&& (c \<in> set xs \<Longrightarrow> c \<in> space (count_space A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set xs \<subseteq> space (count_space A)
?c \<in> set xs \<Longrightarrow> ?c \<in> space (count_space A)

goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
have [simp]: "map_tree fst \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs)
                \<in> Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0::real..1}) \<rightarrow>\<^sub>M
                  tree_sigma (count_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_tree fst \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs) \<in> Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1}) \<rightarrow>\<^sub>M tree_sigma (count_space A)
[PROOF STEP]
unfolding \<U>_def map_tree_primrec
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_tree \<langle>\<rangle> (\<lambda>l a r l'. Node l' (fst a)) \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs) \<in> Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1}) \<rightarrow>\<^sub>M tree_sigma (count_space A)
[PROOF STEP]
using con_assms
[PROOF STATE]
proof (prove)
using this:
countable A
set xs \<subseteq> A
distinct xs

goal (1 subgoal):
 1. rec_tree \<langle>\<rangle> (\<lambda>l a r l'. Node l' (fst a)) \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs) \<in> Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1}) \<rightarrow>\<^sub>M tree_sigma (count_space A)
[PROOF STEP]
by measurable
[PROOF STATE]
proof (state)
this:
map_tree fst \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs) \<in> Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1}) \<rightarrow>\<^sub>M tree_sigma (count_space A)

goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
have "AE f in Pi\<^sub>M (set xs) (\<lambda>i. \<U> 0 1). inj_on f (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE f in Pi\<^sub>M (set xs) (\<lambda>i. \<U> 0 1). inj_on f (set xs)
[PROOF STEP]
unfolding \<U>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE f in Pi\<^sub>M (set xs) (\<lambda>i. uniform_measure lborel {0..1}). inj_on f (set xs)
[PROOF STEP]
by (rule almost_everywhere_avoid_finite) auto
[PROOF STATE]
proof (state)
this:
AE f in Pi\<^sub>M (set xs) (\<lambda>i. \<U> 0 1). inj_on f (set xs)

goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
AE f in Pi\<^sub>M (set xs) (\<lambda>i. \<U> 0 1). inj_on f (set xs)
[PROOF STEP]
have "AE f in Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1).
             map_tree fst (foldl (\<lambda>t (k,p). ins k p t) \<langle>\<rangle> (map (\<lambda>x. (x, f x)) xs)) =
             bst_of_list (sort_key f xs)"
[PROOF STATE]
proof (prove)
using this:
AE f in Pi\<^sub>M (set xs) (\<lambda>i. \<U> 0 1). inj_on f (set xs)

goal (1 subgoal):
 1. AE f in Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1). map_tree fst (foldl (\<lambda>t (k, p). ins k p t) \<langle>\<rangle> (map (\<lambda>x. (x, f x)) xs)) = bst_of_list (sort_key f xs)
[PROOF STEP]
by (eventually_elim) (use con_assms in \<open>auto simp add: fold_ins_bst_of_list\<close>)
[PROOF STATE]
proof (state)
this:
AE f in Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1). map_tree fst (foldl (\<lambda>t (k, p). ins k p t) \<langle>\<rangle> (map (\<lambda>x. (x, f x)) xs)) = bst_of_list (sort_key f xs)

goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
AE f in Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1). map_tree fst (foldl (\<lambda>t (k, p). ins k p t) \<langle>\<rangle> (map (\<lambda>x. (x, f x)) xs)) = bst_of_list (sort_key f xs)
[PROOF STEP]
have [simp]: "AE f in Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1).
             map_tree fst (foldl (\<lambda>t k. ins k (f k) t) \<langle>\<rangle> xs) = bst_of_list (sort_key f xs)"
[PROOF STATE]
proof (prove)
using this:
AE f in Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1). map_tree fst (foldl (\<lambda>t (k, p). ins k p t) \<langle>\<rangle> (map (\<lambda>x. (x, f x)) xs)) = bst_of_list (sort_key f xs)

goal (1 subgoal):
 1. AE f in Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1). map_tree fst (foldl (\<lambda>t k. ins k (f k) t) \<langle>\<rangle> xs) = bst_of_list (sort_key f xs)
[PROOF STEP]
by (simp add: foldl_map)
[PROOF STATE]
proof (state)
this:
AE f in Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1). map_tree fst (foldl (\<lambda>t k. ins k (f k) t) \<langle>\<rangle> xs) = bst_of_list (sort_key f xs)

goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
have "?lhs = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A))
                     (map_tree fst \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (map_tree fst \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs))
[PROOF STEP]
unfolding random_treap_fold_Leaf \<U>_def map_tree_primrec
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (tree_sigma (count_space A \<Otimes>\<^sub>M lborel)) (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs)) (tree_sigma (count_space A)) (rec_tree \<langle>\<rangle> (\<lambda>l a r l'. Node l' (fst a))) = distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (tree_sigma (count_space A)) (rec_tree \<langle>\<rangle> (\<lambda>l a r l'. Node l' (fst a)) \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs))
[PROOF STEP]
using con_assms
[PROOF STATE]
proof (prove)
using this:
countable A
set xs \<subseteq> A
distinct xs

goal (1 subgoal):
 1. distr (distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (tree_sigma (count_space A \<Otimes>\<^sub>M lborel)) (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs)) (tree_sigma (count_space A)) (rec_tree \<langle>\<rangle> (\<lambda>l a r l'. Node l' (fst a))) = distr (Pi\<^sub>M (set xs) (\<lambda>x. uniform_measure lborel {0..1})) (tree_sigma (count_space A)) (rec_tree \<langle>\<rangle> (\<lambda>l a r l'. Node l' (fst a)) \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs))
[PROOF STEP]
by (subst distr_distr) measurable
[PROOF STATE]
proof (state)
this:
distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (map_tree fst \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs))

goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (map_tree fst \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs))

goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (map_tree fst \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs)) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
by (intro distr_cong_AE) (auto simp add: \<U>_def)
[PROOF STATE]
proof (state)
this:
distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (map_tree fst \<circ> (\<lambda>p. foldl (\<lambda>t x. ins x (p x) t) \<langle>\<rangle> xs)) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))

goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))

goal (1 subgoal):
 1. distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
distr (rinss xs \<langle>\<rangle> A) (tree_sigma (count_space A)) (map_tree fst) = distr (Pi\<^sub>M (set xs) (\<lambda>x. \<U> 0 1)) (tree_sigma (count_space A)) (\<lambda>p. bst_of_list (sort_key p xs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma if_conj_dist:
  "((if b then w else x) \<and> (if b then y else z) \<and> X) =
  ((if b then w \<and> y else x \<and> z) \<and> X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if b then w else x) \<and> (if b then y else z) \<and> X) = ((if b then w \<and> y else x \<and> z) \<and> X)
[PROOF STEP]
by simp


[STATEMENT]
lemma multiset_induct2[case_names empty addL addR]:
  assumes empty: "P {#} {#}"
    and addL: "\<And>a M N. P M N \<Longrightarrow> P (add_mset a M) N"
    and addR: "\<And>a M N. P M N \<Longrightarrow> P M (add_mset a N)"
  shows "P M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P M N
[PROOF STEP]
apply(induct N rule: multiset_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. P M {#}
 2. \<And>x Ma. P M Ma \<Longrightarrow> P M (add_mset x Ma)
[PROOF STEP]
apply(induct M rule: multiset_induct, rule empty, erule addL)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x Ma. P M Ma \<Longrightarrow> P M (add_mset x Ma)
[PROOF STEP]
apply(induct M rule: multiset_induct, erule addR, erule addR)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma floor_one_divide_eq_div_numeral [simp]:
  "\<lfloor>1 / numeral b::real\<rfloor> = 1 div numeral b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>1 / numeral b\<rfloor> = 1 div numeral b
[PROOF STEP]
by (metis floor_divide_of_int_eq of_int_1 of_int_numeral)


[STATEMENT]
lemma contour_integral_eq_0:
    "(\<And>z. z \<in> path_image g \<Longrightarrow> f z = 0) \<Longrightarrow> contour_integral g f = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z. z \<in> path_image g \<Longrightarrow> f z = 0) \<Longrightarrow> contour_integral g f = 0
[PROOF STEP]
by (simp add: has_contour_integral_is_0 contour_integral_unique)


[STATEMENT]
lemma fv_flat_Disj: "(\<Union>Q' \<in> flat_Disj Q. fv Q') = fv Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (fv ` flat_Disj Q) = fv Q
[PROOF STEP]
by (induct Q rule: flat_Disj.induct) auto


[STATEMENT]
lemma degree_scaleR_pdevs[simp]: "degree (scaleR_pdevs r x) = (if r = 0 then 0 else degree x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (scaleR_pdevs r x) = (if r = 0 then 0 else degree x)
[PROOF STEP]
unfolding degree_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST i. \<forall>j\<ge>i. pdevs_apply (scaleR_pdevs r x) j = (0::'a)) = (if r = 0 then 0 else LEAST i. \<forall>j\<ge>i. pdevs_apply x j = (0::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma set_permutations_of_list_impl:
  "set (permutations_of_list_impl xs) = permutations_of_multiset (mset xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (permutations_of_list_impl xs) = permutations_of_multiset (mset xs)
[PROOF STEP]
by (induction xs rule: permutations_of_list_impl.induct)
     (subst permutations_of_list_impl.simps,
      simp_all add: permutations_of_multiset_nonempty set_list_bind)


[STATEMENT]
lemma order_antisym: "\<lbrakk> order r; x \<sqsubseteq>\<^sub>r y; y \<sqsubseteq>\<^sub>r x \<rbrakk> \<Longrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order r; x \<sqsubseteq>\<^bsub>r\<^esub> y; y \<sqsubseteq>\<^bsub>r\<^esub> x\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
by (unfold order_def) (simp (no_asm_simp))


[STATEMENT]
lemma append_fun_equiv: "\<lbrakk> t1' \<sim> t1; t2' \<sim> t2 \<rbrakk> \<Longrightarrow> t1' @ t2' \<sim> t1 @ t2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t1' \<sim> t1; t2' \<sim> t2\<rbrakk> \<Longrightarrow> t1' @ t2' \<sim> t1 @ t2
[PROOF STEP]
apply (simp add: val_eq_def fun_eq_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t1' \<lesssim> t1 \<and> t1 \<lesssim> t1'; t2' \<lesssim> t2 \<and> t2 \<lesssim> t2'\<rbrakk> \<Longrightarrow> t1' @ t2' \<lesssim> t1 @ t2 \<and> t1 @ t2 \<lesssim> t1' @ t2'
[PROOF STEP]
using append_fun_le
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t1' \<lesssim> ?t1.0; ?t2' \<lesssim> ?t2.0\<rbrakk> \<Longrightarrow> ?t1' @ ?t2' \<lesssim> ?t1.0 @ ?t2.0

goal (1 subgoal):
 1. \<lbrakk>t1' \<lesssim> t1 \<and> t1 \<lesssim> t1'; t2' \<lesssim> t2 \<and> t2 \<lesssim> t2'\<rbrakk> \<Longrightarrow> t1' @ t2' \<lesssim> t1 @ t2 \<and> t1 @ t2 \<lesssim> t1' @ t2'
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem difference_closure: "(\<exists>w. P w x \<and> \<not> O w y) \<Longrightarrow>
  (\<exists>z. \<forall>w. P w z \<longleftrightarrow> P w x \<and> \<not> O w y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>w. P w x \<and> \<not> O w y \<Longrightarrow> \<exists>z. \<forall>w. P w z = (P w x \<and> \<not> O w y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>w. P w x \<and> \<not> O w y \<Longrightarrow> \<exists>z. \<forall>w. P w z = (P w x \<and> \<not> O w y)
[PROOF STEP]
assume "\<exists>w. P w x \<and> \<not> O w y"
[PROOF STATE]
proof (state)
this:
\<exists>w. P w x \<and> \<not> O w y

goal (1 subgoal):
 1. \<exists>w. P w x \<and> \<not> O w y \<Longrightarrow> \<exists>z. \<forall>w. P w z = (P w x \<and> \<not> O w y)
[PROOF STEP]
hence "\<forall>w. P w (x \<otimes> (\<midarrow>y)) \<longleftrightarrow> P w x \<and> \<not> O w y"
[PROOF STATE]
proof (prove)
using this:
\<exists>w. P w x \<and> \<not> O w y

goal (1 subgoal):
 1. \<forall>w. P w (x \<otimes> \<midarrow> y) = (P w x \<and> \<not> O w y)
[PROOF STEP]
by (rule product_complement_character)
[PROOF STATE]
proof (state)
this:
\<forall>w. P w (x \<otimes> \<midarrow> y) = (P w x \<and> \<not> O w y)

goal (1 subgoal):
 1. \<exists>w. P w x \<and> \<not> O w y \<Longrightarrow> \<exists>z. \<forall>w. P w z = (P w x \<and> \<not> O w y)
[PROOF STEP]
thus "(\<exists>z. \<forall>w. P w z \<longleftrightarrow> P w x \<and> \<not> O w y)"
[PROOF STATE]
proof (prove)
using this:
\<forall>w. P w (x \<otimes> \<midarrow> y) = (P w x \<and> \<not> O w y)

goal (1 subgoal):
 1. \<exists>z. \<forall>w. P w z = (P w x \<and> \<not> O w y)
[PROOF STEP]
by (rule exI)
[PROOF STATE]
proof (state)
this:
\<exists>z. \<forall>w. P w z = (P w x \<and> \<not> O w y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iff_4k:
  assumes "r = real k" "odd k"
    shows "(4 * real m + r) / (2 * 2^n) = (4 * real m' + r) / (2 * 2 ^ n') \<longleftrightarrow> m=m' \<and> n=n'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')
[PROOF STEP]
assume "(4 * real m + r) / (2 * 2^n) = (4 * real m' + r) / (2 * 2 ^ n')"
[PROOF STATE]
proof (state)
this:
(4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')

goal (1 subgoal):
 1. ((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')
[PROOF STEP]
have "real ((4 * m + k) * (2 * 2 ^ n')) = real ((4 * m' + k) * (2 * 2^n))"
[PROOF STATE]
proof (prove)
using this:
(4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')

goal (1 subgoal):
 1. real ((4 * m + k) * (2 * 2 ^ n')) = real ((4 * m' + k) * (2 * 2 ^ n))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')
r = real k
odd k

goal (1 subgoal):
 1. real ((4 * m + k) * (2 * 2 ^ n')) = real ((4 * m' + k) * (2 * 2 ^ n))
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
real ((4 * m + k) * (2 * 2 ^ n')) = real ((4 * m' + k) * (2 * 2 ^ n))

goal (1 subgoal):
 1. ((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real ((4 * m + k) * (2 * 2 ^ n')) = real ((4 * m' + k) * (2 * 2 ^ n))
[PROOF STEP]
have "(4 * m + k) * (2 * 2 ^ n') = (4 * m' + k) * (2 * 2^n)"
[PROOF STATE]
proof (prove)
using this:
real ((4 * m + k) * (2 * 2 ^ n')) = real ((4 * m' + k) * (2 * 2 ^ n))

goal (1 subgoal):
 1. (4 * m + k) * (2 * 2 ^ n') = (4 * m' + k) * (2 * 2 ^ n)
[PROOF STEP]
using of_nat_eq_iff
[PROOF STATE]
proof (prove)
using this:
real ((4 * m + k) * (2 * 2 ^ n')) = real ((4 * m' + k) * (2 * 2 ^ n))
(of_nat ?m = of_nat ?n) = (?m = ?n)

goal (1 subgoal):
 1. (4 * m + k) * (2 * 2 ^ n') = (4 * m' + k) * (2 * 2 ^ n)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(4 * m + k) * (2 * 2 ^ n') = (4 * m' + k) * (2 * 2 ^ n)

goal (1 subgoal):
 1. ((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(4 * m + k) * (2 * 2 ^ n') = (4 * m' + k) * (2 * 2 ^ n)
[PROOF STEP]
have "(4 * m + k) * (2 ^ n') = (4 * m' + k) * (2^n)"
[PROOF STATE]
proof (prove)
using this:
(4 * m + k) * (2 * 2 ^ n') = (4 * m' + k) * (2 * 2 ^ n)

goal (1 subgoal):
 1. (4 * m + k) * 2 ^ n' = (4 * m' + k) * 2 ^ n
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(4 * m + k) * 2 ^ n' = (4 * m' + k) * 2 ^ n

goal (1 subgoal):
 1. ((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(4 * m + k) * 2 ^ n' = (4 * m' + k) * 2 ^ n
[PROOF STEP]
obtain "4*m + k = 4*m' + k" "n=n'"
[PROOF STATE]
proof (prove)
using this:
(4 * m + k) * 2 ^ n' = (4 * m' + k) * 2 ^ n

goal (1 subgoal):
 1. (\<lbrakk>4 * m + k = 4 * m' + k; n = n'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using prime_power_cancel2 [OF two_is_prime_nat] assms
[PROOF STATE]
proof (prove)
using this:
(4 * m + k) * 2 ^ n' = (4 * m' + k) * 2 ^ n
\<lbrakk>?m * 2 ^ ?k = ?m' * 2 ^ ?k'; odd ?m; odd ?m'; \<lbrakk>?m = ?m'; ?k = ?k'\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
r = real k
odd k

goal (1 subgoal):
 1. (\<lbrakk>4 * m + k = 4 * m' + k; n = n'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis even_mult_iff even_numeral odd_add)
[PROOF STATE]
proof (state)
this:
4 * m + k = 4 * m' + k
n = n'

goal (1 subgoal):
 1. ((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
4 * m + k = 4 * m' + k
n = n'
[PROOF STEP]
have "m=m'" "n=n'"
[PROOF STATE]
proof (prove)
using this:
4 * m + k = 4 * m' + k
n = n'

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

goal (1 subgoal):
 1. ((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n') \<Longrightarrow> m = m'
(4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n') \<Longrightarrow> n = n'

goal (1 subgoal):
 1. ((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n') \<Longrightarrow> m = m'
(4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n') \<Longrightarrow> n = n'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n') \<Longrightarrow> m = m'
(4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n') \<Longrightarrow> n = n'

goal (1 subgoal):
 1. ((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((4 * real m + r) / (2 * 2 ^ n) = (4 * real m' + r) / (2 * 2 ^ n')) = (m = m' \<and> n = n')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cblinfun_extension_exists_hilbert:
  fixes f :: \<open>'a::chilbert_space \<Rightarrow> 'b::cbanach\<close>
  assumes \<open>csubspace S\<close>
  assumes f_add: \<open>\<And>x y. x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> f (x + y) = f x + f y\<close>
  assumes f_scale: \<open>\<And>c x y. x \<in> S \<Longrightarrow> f (c *\<^sub>C x) = c *\<^sub>C f x\<close>
  assumes bounded: \<open>\<And>x. x \<in> S \<Longrightarrow> norm (f x) \<le> B * norm x\<close>
  shows \<open>cblinfun_extension_exists S f\<close>
    \<comment> \<open>We cannot give a statement about the norm. While there is an extension with norm \<^term>\<open>B\<close>,
        there is no guarantee that \<^term>\<open>cblinfun_extension S f\<close> returns that specific extension since
        the extension is only determined on \<^term>\<open>ccspan S\<close>.\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cblinfun_extension_exists S f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cblinfun_extension_exists S f
[PROOF STEP]
have \<open>\<exists>P. is_Proj P \<and> range ((*\<^sub>V) P) = closure S\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. is_Proj P \<and> range ((*\<^sub>V) P) = closure S
[PROOF STEP]
apply (rule exI[of _ \<open>Proj (ccspan S)\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Proj (Proj (ccspan S)) \<and> range ((*\<^sub>V) (Proj (ccspan S))) = closure S
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. is_Proj (Proj (ccspan S))
 2. range ((*\<^sub>V) (Proj (ccspan S))) = closure S
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range ((*\<^sub>V) (Proj (ccspan S))) = closure S
[PROOF STEP]
by (metis Proj_is_Proj Proj_range Proj_range_closed assms(1) cblinfun_image.rep_eq ccspan.rep_eq closure_closed complex_vector.span_eq_iff space_as_set_top)
[PROOF STATE]
proof (state)
this:
\<exists>P. is_Proj P \<and> range ((*\<^sub>V) P) = closure S

goal (1 subgoal):
 1. cblinfun_extension_exists S f
[PROOF STEP]
from assms(1) this assms(2-4)
[PROOF STATE]
proof (chain)
picking this:
csubspace S
\<exists>P. is_Proj P \<and> range ((*\<^sub>V) P) = closure S
\<lbrakk>?x \<in> S; ?y \<in> S\<rbrakk> \<Longrightarrow> f (?x + ?y) = f ?x + f ?y
?x \<in> S \<Longrightarrow> f (?c *\<^sub>C ?x) = ?c *\<^sub>C f ?x
?x \<in> S \<Longrightarrow> norm (f ?x) \<le> B * norm ?x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
csubspace S
\<exists>P. is_Proj P \<and> range ((*\<^sub>V) P) = closure S
\<lbrakk>?x \<in> S; ?y \<in> S\<rbrakk> \<Longrightarrow> f (?x + ?y) = f ?x + f ?y
?x \<in> S \<Longrightarrow> f (?c *\<^sub>C ?x) = ?c *\<^sub>C f ?x
?x \<in> S \<Longrightarrow> norm (f ?x) \<le> B * norm ?x

goal (1 subgoal):
 1. cblinfun_extension_exists S f
[PROOF STEP]
by (rule cblinfun_extension_exists_proj)
[PROOF STATE]
proof (state)
this:
cblinfun_extension_exists S f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complex_cnj_cnj [simp]: "cnj (cnj z) = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (cnj z) = z
[PROOF STEP]
by (simp add: complex_eq_iff)


[STATEMENT]
lemma rel_interior_real_box [simp]:
  fixes a b :: real
  assumes "a < b"
  shows "rel_interior {a .. b} = {a <..< b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior {a..b} = {a<..<b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_interior {a..b} = {a<..<b}
[PROOF STEP]
have "box a b \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. box a b \<noteq> {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. box a b \<noteq> {}
[PROOF STEP]
unfolding set_eq_iff
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. \<not> (\<forall>x. (x \<in> box a b) = (x \<in> {}))
[PROOF STEP]
by (auto intro!: exI[of _ "(a + b) / 2"] simp: box_def)
[PROOF STATE]
proof (state)
this:
box a b \<noteq> {}

goal (1 subgoal):
 1. rel_interior {a..b} = {a<..<b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
box a b \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
box a b \<noteq> {}

goal (1 subgoal):
 1. rel_interior {a..b} = {a<..<b}
[PROOF STEP]
using interior_rel_interior_gen[of "cbox a b", symmetric]
[PROOF STATE]
proof (prove)
using this:
box a b \<noteq> {}
(if aff_dim (cbox a b) = int DIM(real) then rel_interior (cbox a b) else {}) = interior (cbox a b)

goal (1 subgoal):
 1. rel_interior {a..b} = {a<..<b}
[PROOF STEP]
by (simp split: if_split_asm del: box_real add: box_real[symmetric])
[PROOF STATE]
proof (state)
this:
rel_interior {a..b} = {a<..<b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_all2_bisim_composeI:
  "\<lbrakk> list_all2 A xs ys; list_all2 B ys zs \<rbrakk>
  \<Longrightarrow> list_all2 (A \<circ>\<^sub>B B) xs zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all2 A xs ys; list_all2 B ys zs\<rbrakk> \<Longrightarrow> list_all2 (A \<circ>\<^sub>B B) xs zs
[PROOF STEP]
by(rule list_all2_trans) auto+


[STATEMENT]
lemma (in information_space) conditional_entropy_less_eq_entropy:
  assumes X: "simple_function M X" and Z: "simple_function M Z"
  shows "\<H>(X | Z) \<le> \<H>(X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<H>(X | Z) \<le> \<H>(X)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<H>(X | Z) \<le> \<H>(X)
[PROOF STEP]
have "0 \<le> \<I>(X ; Z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<I>(X ; Z)
[PROOF STEP]
using X Z
[PROOF STATE]
proof (prove)
using this:
simple_function M X
simple_function M Z

goal (1 subgoal):
 1. 0 \<le> \<I>(X ; Z)
[PROOF STEP]
by (rule mutual_information_nonneg_simple)
[PROOF STATE]
proof (state)
this:
0 \<le> \<I>(X ; Z)

goal (1 subgoal):
 1. \<H>(X | Z) \<le> \<H>(X)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 \<le> \<I>(X ; Z)

goal (1 subgoal):
 1. \<H>(X | Z) \<le> \<H>(X)
[PROOF STEP]
have "\<I>(X ; Z) = \<H>(X) - \<H>(X | Z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<I>(X ; Z) = \<H>(X) - \<H>(X | Z)
[PROOF STEP]
using mutual_information_eq_entropy_conditional_entropy[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<I>(X ; Z) = \<H>(X) - \<H>(X | Z)

goal (1 subgoal):
 1. \<I>(X ; Z) = \<H>(X) - \<H>(X | Z)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<I>(X ; Z) = \<H>(X) - \<H>(X | Z)

goal (1 subgoal):
 1. \<H>(X | Z) \<le> \<H>(X)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 \<le> \<H>(X) - \<H>(X | Z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<H>(X) - \<H>(X | Z)

goal (1 subgoal):
 1. \<H>(X | Z) \<le> \<H>(X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<H>(X | Z) \<le> \<H>(X)

goal:
No subgoals!
[PROOF STEP]
qed