[STATEMENT]
lemma proots_pcompose:
  fixes p q::"'a::field poly"
  assumes "p\<noteq>0" "degree q=1"
  shows "proots_count (pcompose p q) s = proots_count p (poly q ` s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
obtain a b where ab:"q=[:a,b:]" "b\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = [:a, b:]; b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>degree q=1\<close> degree_eq_oneE
[PROOF STATE]
proof (prove)
using this:
degree q = 1
\<lbrakk>degree ?p = 1; \<And>a b. \<lbrakk>?p = [:a, b:]; b \<noteq> (0::?'a)\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>q = [:a, b:]; b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
q = [:a, b:]
b \<noteq> (0::'a)

goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
define f where "f=(\<lambda>y. (y-a)/b)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>y. (y - a) / b)

goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
have f_eq:"f (poly q x) = x" "poly q (f x) = x" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (poly q x) = x &&& poly q (f x) = x
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly q x - a) / b = x &&& poly q ((x - a) / b) = x
[PROOF STEP]
using ab
[PROOF STATE]
proof (prove)
using this:
q = [:a, b:]
b \<noteq> (0::'a)

goal (1 subgoal):
 1. (poly q x - a) / b = x &&& poly q ((x - a) / b) = x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (poly q ?x) = ?x
poly q (f ?x) = ?x

goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
have "proots_count (p \<circ>\<^sub>p q) s = (\<Sum>r\<in> f ` proots_within p (poly q ` s). order r (p \<circ>\<^sub>p q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = (\<Sum>r\<in>f ` proots_within p (poly q ` s). order r (p \<circ>\<^sub>p q))
[PROOF STEP]
unfolding proots_count_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r\<in>proots_within (p \<circ>\<^sub>p q) s. order r (p \<circ>\<^sub>p q)) = (\<Sum>r\<in>f ` proots_within p (poly q ` s). order r (p \<circ>\<^sub>p q))
[PROOF STEP]
apply (rule arg_cong2[where f =sum])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<lambda>r. order r (p \<circ>\<^sub>p q)) = (\<lambda>r. order r (p \<circ>\<^sub>p q))
 2. proots_within (p \<circ>\<^sub>p q) s = f ` proots_within p (poly q ` s)
[PROOF STEP]
apply (auto simp:poly_pcompose proots_within_def f_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> s; poly p (poly q x) = (0::'a)\<rbrakk> \<Longrightarrow> x \<in> f ` {x \<in> poly q ` s. poly p x = (0::'a)}
[PROOF STEP]
by (metis (mono_tags, lifting) f_eq(1) image_eqI mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
proots_count (p \<circ>\<^sub>p q) s = (\<Sum>r\<in>f ` proots_within p (poly q ` s). order r (p \<circ>\<^sub>p q))

goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proots_count (p \<circ>\<^sub>p q) s = (\<Sum>r\<in>f ` proots_within p (poly q ` s). order r (p \<circ>\<^sub>p q))

goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
have "... = (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r\<in>f ` proots_within p (poly q ` s). order r (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q))
[PROOF STEP]
apply (subst sum.reindex)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on f (proots_within p (poly q ` s))
 2. sum ((\<lambda>r. order r (p \<circ>\<^sub>p q)) \<circ> f) (proots_within p (poly q ` s)) = (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (proots_within p (poly q ` s))
[PROOF STEP]
unfolding f_def inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>proots_within p (poly q ` s). \<forall>y\<in>proots_within p (poly q ` s). (x - a) / b = (y - a) / b \<longrightarrow> x = y
[PROOF STEP]
using \<open>b\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)

goal (1 subgoal):
 1. \<forall>x\<in>proots_within p (poly q ` s). \<forall>y\<in>proots_within p (poly q ` s). (x - a) / b = (y - a) / b \<longrightarrow> x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>r. order r (p \<circ>\<^sub>p q)) \<circ> f) (proots_within p (poly q ` s)) = (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>r\<in>f ` proots_within p (poly q ` s). order r (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q))

goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>r\<in>f ` proots_within p (poly q ` s). order r (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q))

goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
have "... = (\<Sum>x\<in>proots_within p (poly q ` s). order x p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order x p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order x p)
[PROOF STEP]
have "p \<circ>\<^sub>p q \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<circ>\<^sub>p q \<noteq> 0
[PROOF STEP]
using assms(1) assms(2) pcompose_eq_0
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
degree q = 1
\<lbrakk>?p \<circ>\<^sub>p ?q = 0; 0 < degree ?q\<rbrakk> \<Longrightarrow> ?p = 0

goal (1 subgoal):
 1. p \<circ>\<^sub>p q \<noteq> 0
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
p \<circ>\<^sub>p q \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order x p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p \<circ>\<^sub>p q \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order x p)
[PROOF STEP]
have "order (f x) (q - [:x:]) = 1" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (f x) (q - [:x:]) = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. order (f x) (q - [:x:]) = 1
[PROOF STEP]
have "order (f x) (q - [:x:]) = order (f x) (smult b [:-((x - a) / b),1:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (f x) (q - [:x:]) = order (f x) (smult b [:- ((x - a) / b), 1::'a:])
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order ((x - a) / b) (q - [:x:]) = order ((x - a) / b) (smult b [:- ((x - a) / b), 1::'a:])
[PROOF STEP]
using ab
[PROOF STATE]
proof (prove)
using this:
q = [:a, b:]
b \<noteq> (0::'a)

goal (1 subgoal):
 1. order ((x - a) / b) (q - [:x:]) = order ((x - a) / b) (smult b [:- ((x - a) / b), 1::'a:])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
order (f x) (q - [:x:]) = order (f x) (smult b [:- ((x - a) / b), 1::'a:])

goal (1 subgoal):
 1. order (f x) (q - [:x:]) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
order (f x) (q - [:x:]) = order (f x) (smult b [:- ((x - a) / b), 1::'a:])

goal (1 subgoal):
 1. order (f x) (q - [:x:]) = 1
[PROOF STEP]
have "... = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (f x) (smult b [:- ((x - a) / b), 1::'a:]) = 1
[PROOF STEP]
apply (subst order_smult)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. b \<noteq> (0::'a)
 2. order (f x) [:- ((x - a) / b), 1::'a:] = 1
[PROOF STEP]
using \<open>b\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)

goal (2 subgoals):
 1. b \<noteq> (0::'a)
 2. order (f x) [:- ((x - a) / b), 1::'a:] = 1
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)

goal (2 subgoals):
 1. b \<noteq> (0::'a)
 2. order ((x - a) / b) [:- ((x - a) / b), 1::'a:] = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
order (f x) (smult b [:- ((x - a) / b), 1::'a:]) = 1

goal (1 subgoal):
 1. order (f x) (q - [:x:]) = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
order (f x) (q - [:x:]) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
order (f x) (q - [:x:]) = 1

goal (1 subgoal):
 1. order (f x) (q - [:x:]) = 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
order (f x) (q - [:x:]) = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
order (f ?x) (q - [:?x:]) = 1

goal (1 subgoal):
 1. (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order x p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p \<circ>\<^sub>p q \<noteq> 0
order (f ?x) (q - [:?x:]) = 1
[PROOF STEP]
have "order (f x) (p \<circ>\<^sub>p q) = order x p" for x
[PROOF STATE]
proof (prove)
using this:
p \<circ>\<^sub>p q \<noteq> 0
order (f ?x) (q - [:?x:]) = 1

goal (1 subgoal):
 1. order (f x) (p \<circ>\<^sub>p q) = order x p
[PROOF STEP]
apply (subst order_pcompose)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>p \<circ>\<^sub>p q \<noteq> 0; \<And>x. order (f x) (q - [:x:]) = 1\<rbrakk> \<Longrightarrow> p \<circ>\<^sub>p q \<noteq> 0
 2. \<lbrakk>p \<circ>\<^sub>p q \<noteq> 0; \<And>x. order (f x) (q - [:x:]) = 1\<rbrakk> \<Longrightarrow> order (f x) (q - [:poly q (f x):]) * order (poly q (f x)) p = order x p
[PROOF STEP]
using f_eq
[PROOF STATE]
proof (prove)
using this:
f (poly q ?x) = ?x
poly q (f ?x) = ?x

goal (2 subgoals):
 1. \<lbrakk>p \<circ>\<^sub>p q \<noteq> 0; \<And>x. order (f x) (q - [:x:]) = 1\<rbrakk> \<Longrightarrow> p \<circ>\<^sub>p q \<noteq> 0
 2. \<lbrakk>p \<circ>\<^sub>p q \<noteq> 0; \<And>x. order (f x) (q - [:x:]) = 1\<rbrakk> \<Longrightarrow> order (f x) (q - [:poly q (f x):]) * order (poly q (f x)) p = order x p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
order (f ?x) (p \<circ>\<^sub>p q) = order ?x p

goal (1 subgoal):
 1. (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order x p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
order (f ?x) (p \<circ>\<^sub>p q) = order ?x p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
order (f ?x) (p \<circ>\<^sub>p q) = order ?x p

goal (1 subgoal):
 1. (\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order x p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order x p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order x p)

goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>proots_within p (poly q ` s). order (f x) (p \<circ>\<^sub>p q)) = (\<Sum>x\<in>proots_within p (poly q ` s). order x p)

goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
have "... =  proots_count p (poly q ` s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>proots_within p (poly q ` s). order x p) = proots_count p (poly q ` s)
[PROOF STEP]
unfolding proots_count_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>proots_within p (poly q ` s). order x p) = (\<Sum>r\<in>proots_within p (poly q ` s). order r p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>proots_within p (poly q ` s). order x p) = proots_count p (poly q ` s)

goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)

goal (1 subgoal):
 1. proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
proots_count (p \<circ>\<^sub>p q) s = proots_count p (poly q ` s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma the_riesz_rep_add: \<open>the_riesz_rep (f + g) = the_riesz_rep f + the_riesz_rep g\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. the_riesz_rep (f + g) = the_riesz_rep f + the_riesz_rep g
[PROOF STEP]
apply (rule the_riesz_rep_unique[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (f + g) *\<^sub>V x = (the_riesz_rep f + the_riesz_rep g) \<bullet>\<^sub>C x
[PROOF STEP]
by (auto simp: cinner_add_left cblinfun.add_left)


[STATEMENT]
lemma path_set_induct:
  assumes "path E u p v" and "u\<in>I" and "E``I \<subseteq> I"
  shows "set p \<subseteq> I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set p \<subseteq> I
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
path E u p v
u \<in> I
E `` I \<subseteq> I

goal (1 subgoal):
 1. set p \<subseteq> I
[PROOF STEP]
by (induction rule: path.induct) auto


[STATEMENT]
lemma nth_fibs:
  assumes "defined i" and "\<lbrakk> i \<rbrakk> \<ge> 0" shows "defined (fibs !! i)" and "\<lbrakk> fibs !! i \<rbrakk> = fib \<lbrakk> i \<rbrakk>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. defined (fibs !! i) &&& \<lbrakk>fibs !! i\<rbrakk> = fib \<lbrakk>i\<rbrakk>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
defined i
0 \<le> \<lbrakk>i\<rbrakk>

goal (1 subgoal):
 1. defined (fibs !! i) &&& \<lbrakk>fibs !! i\<rbrakk> = fib \<lbrakk>i\<rbrakk>
[PROOF STEP]
proof(induction i rule:nonneg_full_Int_induct)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>i. \<lbrakk>defined i; \<lbrakk>i\<rbrakk> < 0; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! i)
 2. \<And>i. \<lbrakk>defined i; \<lbrakk>i\<rbrakk> < 0; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! i\<rbrakk> = fib \<lbrakk>i\<rbrakk>
 3. \<And>i. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! i)
 4. \<And>i. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! i\<rbrakk> = fib \<lbrakk>i\<rbrakk>
[PROOF STEP]
case (Suc i)
[PROOF STATE]
proof (state)
this:
defined i
0 \<le> \<lbrakk>i\<rbrakk>
\<lbrakk>defined ?j; \<lbrakk>?j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>?j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! ?j)
\<lbrakk>defined ?j; \<lbrakk>?j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>?j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! ?j\<rbrakk> = fib \<lbrakk>?j\<rbrakk>

goal (4 subgoals):
 1. \<And>i. \<lbrakk>defined i; \<lbrakk>i\<rbrakk> < 0; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! i)
 2. \<And>i. \<lbrakk>defined i; \<lbrakk>i\<rbrakk> < 0; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! i\<rbrakk> = fib \<lbrakk>i\<rbrakk>
 3. \<And>i. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! i)
 4. \<And>i. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! i\<rbrakk> = fib \<lbrakk>i\<rbrakk>
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
0 \<le> \<lbrakk>i\<rbrakk>

goal (4 subgoals):
 1. \<And>i. \<lbrakk>defined i; \<lbrakk>i\<rbrakk> < 0; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! i)
 2. \<And>i. \<lbrakk>defined i; \<lbrakk>i\<rbrakk> < 0; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! i\<rbrakk> = fib \<lbrakk>i\<rbrakk>
 3. \<And>i. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! i)
 4. \<And>i. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! i\<rbrakk> = fib \<lbrakk>i\<rbrakk>
[PROOF STEP]
with Suc
[PROOF STATE]
proof (chain)
picking this:
defined i
0 \<le> \<lbrakk>i\<rbrakk>
\<lbrakk>defined ?j; \<lbrakk>?j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>?j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! ?j)
\<lbrakk>defined ?j; \<lbrakk>?j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>?j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! ?j\<rbrakk> = fib \<lbrakk>?j\<rbrakk>
0 \<le> \<lbrakk>i\<rbrakk>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
defined i
0 \<le> \<lbrakk>i\<rbrakk>
\<lbrakk>defined ?j; \<lbrakk>?j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>?j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! ?j)
\<lbrakk>defined ?j; \<lbrakk>?j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>?j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! ?j\<rbrakk> = fib \<lbrakk>?j\<rbrakk>
0 \<le> \<lbrakk>i\<rbrakk>

goal (1 subgoal):
 1. defined (fibs !! i)
[PROOF STEP]
apply (cases "\<lbrakk>i\<rbrakk> = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>; \<lbrakk>i\<rbrakk> = 0\<rbrakk> \<Longrightarrow> defined (fibs !! i)
 2. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>; \<lbrakk>i\<rbrakk> \<noteq> 0\<rbrakk> \<Longrightarrow> defined (fibs !! i)
[PROOF STEP]
apply (subst fibs.simps, (subst fib.simps)?, simp add: nth_zipWith nth_tail)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>; \<lbrakk>i\<rbrakk> \<noteq> 0\<rbrakk> \<Longrightarrow> defined (fibs !! i)
[PROOF STEP]
apply (cases "\<lbrakk>i\<rbrakk> = 1")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>; \<lbrakk>i\<rbrakk> \<noteq> 0; \<lbrakk>i\<rbrakk> = 1\<rbrakk> \<Longrightarrow> defined (fibs !! i)
 2. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>; \<lbrakk>i\<rbrakk> \<noteq> 0; \<lbrakk>i\<rbrakk> \<noteq> 1\<rbrakk> \<Longrightarrow> defined (fibs !! i)
[PROOF STEP]
apply (subst fibs.simps, (subst fib.simps)?, simp add: nth_zipWith nth_tail)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>; \<lbrakk>i\<rbrakk> \<noteq> 0; \<lbrakk>i\<rbrakk> \<noteq> 1\<rbrakk> \<Longrightarrow> defined (fibs !! i)
[PROOF STEP]
apply (subst fibs.simps, (subst fib.simps)?, simp add: nth_zipWith nth_tail)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
defined (fibs !! i)

goal (3 subgoals):
 1. \<And>i. \<lbrakk>defined i; \<lbrakk>i\<rbrakk> < 0; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! i)
 2. \<And>i. \<lbrakk>defined i; \<lbrakk>i\<rbrakk> < 0; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! i\<rbrakk> = fib \<lbrakk>i\<rbrakk>
 3. \<And>i. \<lbrakk>defined i; 0 \<le> \<lbrakk>i\<rbrakk>; \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> defined (fibs !! j); \<And>j. \<lbrakk>defined j; \<lbrakk>j\<rbrakk> < \<lbrakk>i\<rbrakk>; 0 \<le> \<lbrakk>j\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! j\<rbrakk> = fib \<lbrakk>j\<rbrakk>; 0 \<le> \<lbrakk>i\<rbrakk>\<rbrakk> \<Longrightarrow> \<lbrakk>fibs !! i\<rbrakk> = fib \<lbrakk>i\<rbrakk>
[PROOF STEP]
qed (subst fibs.simps, (subst fib.simps)?, simp add: nth_zipWith nth_tail)+


[STATEMENT]
lemma map_shuffle:
  assumes "length xs = length ys"
  shows "[xs[\<mapsto>]ys,x\<mapsto>y] = [(xs@[x])[\<mapsto>](ys@[y])]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [xs [\<mapsto>] ys, x \<mapsto> y] = [xs @ [x] [\<mapsto>] ys @ [y]]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = length ys

goal (1 subgoal):
 1. [xs [\<mapsto>] ys, x \<mapsto> y] = [xs @ [x] [\<mapsto>] ys @ [y]]
[PROOF STEP]
by (induct "xs" "ys" rule:list_induct2) (auto simp add:map_upds_append1)


[STATEMENT]
lemma scale_piecewise_C1_differentiable_on:
  assumes "f piecewise_C1_differentiable_on s"
  shows "(\<lambda>x. (c::real) * (f x)) piecewise_C1_differentiable_on s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c * f x) piecewise_C1_differentiable_on s
[PROOF STEP]
proof (simp add: piecewise_C1_differentiable_on_def, intro conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. continuous_on s (\<lambda>x. c * f x)
 2. \<exists>S. finite S \<and> (\<lambda>x. c * f x) C1_differentiable_on s - S
[PROOF STEP]
show "continuous_on s (\<lambda>x. c * f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s (\<lambda>x. c * f x)
[PROOF STEP]
using assms continuous_on_mult_left
[PROOF STATE]
proof (prove)
using this:
f piecewise_C1_differentiable_on s
continuous_on ?s ?f \<Longrightarrow> continuous_on ?s (\<lambda>x. ?c * ?f x)

goal (1 subgoal):
 1. continuous_on s (\<lambda>x. c * f x)
[PROOF STEP]
by (auto simp add: piecewise_C1_differentiable_on_def)
[PROOF STATE]
proof (state)
this:
continuous_on s (\<lambda>x. c * f x)

goal (1 subgoal):
 1. \<exists>S. finite S \<and> (\<lambda>x. c * f x) C1_differentiable_on s - S
[PROOF STEP]
show "\<exists>t. finite t \<and> (\<lambda>x. c * f x) C1_differentiable_on s - t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t. finite t \<and> (\<lambda>x. c * f x) C1_differentiable_on s - t
[PROOF STEP]
using assms continuous_on_mult_left
[PROOF STATE]
proof (prove)
using this:
f piecewise_C1_differentiable_on s
continuous_on ?s ?f \<Longrightarrow> continuous_on ?s (\<lambda>x. ?c * ?f x)

goal (1 subgoal):
 1. \<exists>t. finite t \<and> (\<lambda>x. c * f x) C1_differentiable_on s - t
[PROOF STEP]
by (auto simp add: piecewise_C1_differentiable_on_def)
[PROOF STATE]
proof (state)
this:
\<exists>t. finite t \<and> (\<lambda>x. c * f x) C1_differentiable_on s - t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_less_le_imp_less:
  assumes t1: "a < b" and t2: "c \<le> d" and t3: "0 \<le> a" and t4: "0 < c"
  shows "a * c < b * d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * c < b * d
[PROOF STEP]
using local.mult_strict_mono' local.mult_strict_right_mono local.order.order_iff_strict
    t1 t2 t3 t4
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a < ?b; ?c < ?d; (0::'a) \<le> ?a; (0::'a) \<le> ?c\<rbrakk> \<Longrightarrow> ?a * ?c < ?b * ?d
\<lbrakk>?a < ?b; (0::'a) < ?c\<rbrakk> \<Longrightarrow> ?a * ?c < ?b * ?c
(?a \<le> ?b) = (?a < ?b \<or> ?a = ?b)
a < b
c \<le> d
(0::'a) \<le> a
(0::'a) < c

goal (1 subgoal):
 1. a * c < b * d
[PROOF STEP]
by auto


[STATEMENT]
lemma i_f_join_union: "
  \<lbrakk> finite A; finite B; Max A < iMin B \<rbrakk> \<Longrightarrow>
  f \<Join>\<^bsub>i-f\<^esub> (A \<union> B) = f \<Join>\<^bsub>i-f\<^esub> A @ f \<Join>\<^bsub>i-f\<^esub> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; Max A < iMin B\<rbrakk> \<Longrightarrow> f \<Join>\<^sub> (A \<union> B) = f \<Join>\<^sub> A @ f \<Join>\<^sub> B
[PROOF STEP]
apply (case_tac "A = {}", simp add: i_f_join_empty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; Max A < iMin B; A \<noteq> {}\<rbrakk> \<Longrightarrow> f \<Join>\<^sub> (A \<union> B) = f \<Join>\<^sub> A @ f \<Join>\<^sub> B
[PROOF STEP]
apply (case_tac "B = {}", simp add: i_f_join_empty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; Max A < iMin B; A \<noteq> {}; B \<noteq> {}\<rbrakk> \<Longrightarrow> f \<Join>\<^sub> (A \<union> B) = f \<Join>\<^sub> A @ f \<Join>\<^sub> B
[PROOF STEP]
apply (simp add: i_f_join_def f_join_union del: Max_less_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; Max A < iMin B; A \<noteq> {}; B \<noteq> {}\<rbrakk> \<Longrightarrow> f \<Down> Suc (Max (A \<union> B)) \<Join>\<^sub> A @ f \<Down> Suc (Max (A \<union> B)) \<Join>\<^sub> B = f \<Down> Suc (Max A) \<Join>\<^sub> A @ f \<Down> Suc (Max B) \<Join>\<^sub> B
[PROOF STEP]
apply (subgoal_tac "Max A < Max B")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite A; finite B; Max A < iMin B; A \<noteq> {}; B \<noteq> {}; Max A < Max B\<rbrakk> \<Longrightarrow> f \<Down> Suc (Max (A \<union> B)) \<Join>\<^sub> A @ f \<Down> Suc (Max (A \<union> B)) \<Join>\<^sub> B = f \<Down> Suc (Max A) \<Join>\<^sub> A @ f \<Down> Suc (Max B) \<Join>\<^sub> B
 2. \<lbrakk>finite A; finite B; Max A < iMin B; A \<noteq> {}; B \<noteq> {}\<rbrakk> \<Longrightarrow> Max A < Max B
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite A; finite B; Max A < iMin B; A \<noteq> {}; B \<noteq> {}\<rbrakk> \<Longrightarrow> Max A < Max B
 2. \<lbrakk>finite A; finite B; Max A < iMin B; A \<noteq> {}; B \<noteq> {}; Max A < Max B\<rbrakk> \<Longrightarrow> f \<Down> Suc (Max (A \<union> B)) \<Join>\<^sub> A @ f \<Down> Suc (Max (A \<union> B)) \<Join>\<^sub> B = f \<Down> Suc (Max A) \<Join>\<^sub> A @ f \<Down> Suc (Max B) \<Join>\<^sub> B
[PROOF STEP]
apply (rule order_less_le_trans[OF _ iMin_le_Max], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; Max A < iMin B; A \<noteq> {}; B \<noteq> {}; Max A < Max B\<rbrakk> \<Longrightarrow> f \<Down> Suc (Max (A \<union> B)) \<Join>\<^sub> A @ f \<Down> Suc (Max (A \<union> B)) \<Join>\<^sub> B = f \<Down> Suc (Max A) \<Join>\<^sub> A @ f \<Down> Suc (Max B) \<Join>\<^sub> B
[PROOF STEP]
apply (simp add: Max_Un max_eqR[OF less_imp_le])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; \<forall>a\<in>A. a < iMin B; A \<noteq> {}; B \<noteq> {}; \<forall>a\<in>A. a < Max B\<rbrakk> \<Longrightarrow> f \<Down> Suc (Max B) \<Join>\<^sub> A = f \<Down> Suc (Max A) \<Join>\<^sub> A
[PROOF STEP]
apply (rule take_Suc_Max_eq_imp_f_join_eq, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; \<forall>a\<in>A. a < iMin B; A \<noteq> {}; B \<noteq> {}; \<forall>a\<in>A. a < Max B\<rbrakk> \<Longrightarrow> f \<Down> Suc (Max B) \<down> Suc (Max A) = f \<Down> Suc (Max A) \<down> Suc (Max A)
[PROOF STEP]
apply (simp add: min_eqR[OF less_imp_le])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem Hbd_regularCard: "regularCard Hbd"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. regularCard Hbd
[PROOF STEP]
by (tactic \<open>BNF_Comp_Tactics.mk_comp_bd_regularCard_tac @{context}
  @{thms F1.bd_regularCard F2.bd_regularCard F3.bd_regularCard} @{thm G.bd_regularCard}
  @{thms F1.bd_Cinfinite F2.bd_Cinfinite F3.bd_Cinfinite} @{thm G.bd_Cinfinite}\<close>)


[STATEMENT]
lemma a_zdz:"(ant m) - (ant n) = ant (m - n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ant m - ant n = ant (m - n)
[PROOF STEP]
apply (simp add:diff_ant_def minus_ant_def ant_def,
       cut_tac ant_z_in_Ainteg[of "n"],
       simp add:Abs_Ainteg_inverse)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n, 0) \<in> Ainteg \<Longrightarrow> Abs_Ainteg (m, 0) + Abs_Ainteg (- n, 0) = Abs_Ainteg (m - n, 0)
[PROOF STEP]
apply (simp add:add_ant_def,
       cut_tac ant_z_in_Ainteg[of "m"],
       cut_tac ant_z_in_Ainteg[of "-n"],
       simp add:Abs_Ainteg_inverse zag_pl_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sets_PiF_singleton:
  "sets (PiF {I} M) = sigma_sets (\<Pi>' j\<in>I. space (M j))
    {(\<Pi>' j\<in>I. X j) |X. X \<in> (\<Pi> j\<in>I. sets (M j))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (Pi\<^sub>F {I} M) = sigma_sets (\<Pi>' j\<in>I. space (M j)) {Pi' I X |X. X \<in> (\<Pi> j\<in>I. sets (M j))}
[PROOF STEP]
unfolding sets_PiF
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_sets (\<Union>J\<in>{I}. \<Pi>' j\<in>J. space (M j)) {Pi' J X |X J. J \<in> {I} \<and> X \<in> (\<Pi> j\<in>J. sets (M j))} = sigma_sets (\<Pi>' j\<in>I. space (M j)) {Pi' I X |X. X \<in> (\<Pi> j\<in>I. sets (M j))}
[PROOF STEP]
by simp


[STATEMENT]
lemma SetNonSingleton:
  "\<lbrakk>G \<noteq> {A}; A \<in> G\<rbrakk> \<Longrightarrow> \<exists>B. B \<noteq> A \<and> B \<in> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<noteq> {A}; A \<in> G\<rbrakk> \<Longrightarrow> \<exists>B. B \<noteq> A \<and> B \<in> G
[PROOF STEP]
by auto


[STATEMENT]
lemma polytope_Int:
  fixes S :: "'a :: euclidean_space set"
  shows "\<lbrakk>polytope S; polytope T\<rbrakk> \<Longrightarrow> polytope(S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>polytope S; polytope T\<rbrakk> \<Longrightarrow> polytope (S \<inter> T)
[PROOF STEP]
by (simp add: polytope_eq_bounded_polyhedron bounded_Int)


[STATEMENT]
lemma nat_nonzero_pos:"(a::nat) \<noteq> 0 \<Longrightarrow> 0 < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> 0 < a
[PROOF STEP]
by simp


[STATEMENT]
lemma capped_omega_omega:
  "y \<le> u \<Longrightarrow> u * v \<le> v \<Longrightarrow> (y\<^sup>\<omega>\<^sub>u)\<^sup>\<omega>\<^sub>v \<le> y\<^sup>\<omega>\<^sub>v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<le> u; u * v \<le> v\<rbrakk> \<Longrightarrow> y\<^sup>\<omega>\<^sub>u\<^sup>\<omega>\<^sub>v \<le> y\<^sup>\<omega>\<^sub>v
[PROOF STEP]
by (metis capped_omega_below capped_omega_sub_vector unfold_capped_omega)


[STATEMENT]
lemma finite_measure_lebesgue_on: "S \<in> lmeasurable \<Longrightarrow> finite_measure (lebesgue_on S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<in> lmeasurable \<Longrightarrow> finite_measure (lebesgue_on S)
[PROOF STEP]
by (auto simp: finite_measureI fmeasurable_def emeasure_restrict_space)


[STATEMENT]
lemma epsilon_squares [simp]:
  "(e1 :: ('a :: ring_1) hyperdual) * e1 = 0"
  "(e2 :: ('a :: ring_1) hyperdual) * e2 = 0"
  "(e12 :: ('a :: ring_1) hyperdual) * e12 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e1 * e1 = 0 &&& e2 * e2 = 0 &&& e12 * e12 = 0
[PROOF STEP]
by (simp_all add: hyperdual_bases)


[STATEMENT]
lemma count_image_mset_eq_card_vimage:
  assumes "finite A"
  shows "count (image_mset f (mset_set A)) b = card {a \<in> A. f a = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (image_mset f (mset_set A)) b = card {a \<in> A. f a = b}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. count (image_mset f (mset_set A)) b = card {a \<in> A. f a = b}
[PROOF STEP]
proof (induct A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. count (image_mset f (mset_set {})) b = card {a \<in> {}. f a = b}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; count (image_mset f (mset_set F)) b = card {a \<in> F. f a = b}\<rbrakk> \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. count (image_mset f (mset_set {})) b = card {a \<in> {}. f a = b}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; count (image_mset f (mset_set F)) b = card {a \<in> F. f a = b}\<rbrakk> \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (image_mset f (mset_set {})) b = card {a \<in> {}. f a = b}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count (image_mset f (mset_set {})) b = card {a \<in> {}. f a = b}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; count (image_mset f (mset_set F)) b = card {a \<in> F. f a = b}\<rbrakk> \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; count (image_mset f (mset_set F)) b = card {a \<in> F. f a = b}\<rbrakk> \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
count (image_mset f (mset_set F)) b = card {a \<in> F. f a = b}

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; count (image_mset f (mset_set F)) b = card {a \<in> F. f a = b}\<rbrakk> \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
proof (cases "f x = b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f x = b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
 2. f x \<noteq> b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f x = b

goal (2 subgoals):
 1. f x = b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
 2. f x \<noteq> b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
with insert.hyps
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
count (image_mset f (mset_set F)) b = card {a \<in> F. f a = b}
f x = b
[PROOF STEP]
have "count (image_mset f (mset_set (insert x F))) b = Suc (card {a \<in> F. f a = f x})"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
count (image_mset f (mset_set F)) b = card {a \<in> F. f a = b}
f x = b

goal (1 subgoal):
 1. count (image_mset f (mset_set (insert x F))) b = Suc (card {a \<in> F. f a = f x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
count (image_mset f (mset_set (insert x F))) b = Suc (card {a \<in> F. f a = f x})

goal (2 subgoals):
 1. f x = b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
 2. f x \<noteq> b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count (image_mset f (mset_set (insert x F))) b = Suc (card {a \<in> F. f a = f x})

goal (2 subgoals):
 1. f x = b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
 2. f x \<noteq> b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
from insert.hyps(1,2)
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
[PROOF STEP]
have "\<dots> = card (insert x {a \<in> F. f a = f x})"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F

goal (1 subgoal):
 1. Suc (card {a \<in> F. f a = f x}) = card (insert x {a \<in> F. f a = f x})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc (card {a \<in> F. f a = f x}) = card (insert x {a \<in> F. f a = f x})

goal (2 subgoals):
 1. f x = b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
 2. f x \<noteq> b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc (card {a \<in> F. f a = f x}) = card (insert x {a \<in> F. f a = f x})

goal (2 subgoals):
 1. f x = b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
 2. f x \<noteq> b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
from \<open>f x = b\<close>
[PROOF STATE]
proof (chain)
picking this:
f x = b
[PROOF STEP]
have "card (insert x {a \<in> F. f a = f x}) = card {a \<in> insert x F. f a = b}"
[PROOF STATE]
proof (prove)
using this:
f x = b

goal (1 subgoal):
 1. card (insert x {a \<in> F. f a = f x}) = card {a \<in> insert x F. f a = b}
[PROOF STEP]
by (auto intro: arg_cong[where f="card"])
[PROOF STATE]
proof (state)
this:
card (insert x {a \<in> F. f a = f x}) = card {a \<in> insert x F. f a = b}

goal (2 subgoals):
 1. f x = b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
 2. f x \<noteq> b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}

goal (1 subgoal):
 1. count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
finite F
x \<notin> F
count (image_mset f (mset_set F)) b = card {a \<in> F. f a = b}

goal (1 subgoal):
 1. count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}

goal (1 subgoal):
 1. f x \<noteq> b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f x \<noteq> b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f x \<noteq> b

goal (1 subgoal):
 1. f x \<noteq> b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f x \<noteq> b
[PROOF STEP]
have "{a \<in> F. f a = b} = {a \<in> insert x F. f a = b}"
[PROOF STATE]
proof (prove)
using this:
f x \<noteq> b

goal (1 subgoal):
 1. {a \<in> F. f a = b} = {a \<in> insert x F. f a = b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a \<in> F. f a = b} = {a \<in> insert x F. f a = b}

goal (1 subgoal):
 1. f x \<noteq> b \<Longrightarrow> count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
with insert False
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
count (image_mset f (mset_set F)) b = card {a \<in> F. f a = b}
f x \<noteq> b
{a \<in> F. f a = b} = {a \<in> insert x F. f a = b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
count (image_mset f (mset_set F)) b = card {a \<in> F. f a = b}
f x \<noteq> b
{a \<in> F. f a = b} = {a \<in> insert x F. f a = b}

goal (1 subgoal):
 1. count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
count (image_mset f (mset_set (insert x F))) b = card {a \<in> insert x F. f a = b}

goal:
No subgoals!
[PROOF STEP]
qed

\<comment> \<open>Prove \<open>image_mset_eq_implies_permutes\<close> ...\<close>


[STATEMENT]
lemma "p \<sqinter> p' = \<bottom> \<Longrightarrow> ({.p.} o [:r:]) \<squnion> ({.p'.} o [:r':]) = {.p \<squnion> p'.} o [:(\<lambda> x y . p x \<longrightarrow> r x y) \<sqinter> ((\<lambda> x y . p' x \<longrightarrow> r' x y)):]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<sqinter> p' = \<bottom> \<Longrightarrow> ({. p .} \<circ> [: r :]) \<squnion> ({. p' .} \<circ> [: r' :]) = {. p \<squnion> p' .} \<circ> [: (\<lambda>x y. p x \<longrightarrow> r x y) \<sqinter> (\<lambda>x y. p' x \<longrightarrow> r' x y) :]
[PROOF STEP]
by (simp add: fun_eq_iff assert_def demonic_def, auto)


[STATEMENT]
lemma isom_gch_unitsTr1_7_7:"\<lbrakk>Ugp E; Gchain (Suc n) h; k \<noteq> Suc n;
      k \<le> (Suc n); h (Suc n) \<cong> E; \<not> h k \<cong> E\<rbrakk> \<Longrightarrow>
      {i. i \<le> (Suc n) \<and>  h i \<cong> E} =
       insert (Suc n) ({i. i \<le> (Suc n) \<and> h i \<cong> E} - {k, Suc n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ugp E; Gchain (Suc n) h; k \<noteq> Suc n; k \<le> Suc n; h (Suc n) \<cong> E; \<not> h k \<cong> E\<rbrakk> \<Longrightarrow> {i. i \<le> Suc n \<and> h i \<cong> E} = insert (Suc n) ({i. i \<le> Suc n \<and> h i \<cong> E} - {k, Suc n})
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in infinite_cts_filtration) F_n_integral_pos:
  fixes f::"bool stream\<Rightarrow>real"
  assumes "f\<in> borel_measurable (F n)"
  and "\<forall>w. 0 \<le> f w"
  shows "has_bochner_integral M f
    (\<Sum> w\<in> range (pseudo_proj_True n). (measure M ((pseudo_proj_True n) -`{w} \<inter> space M)) *   (f w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
have "integral\<^sup>N M f = (\<Sum> w\<in> range (pseudo_proj_True n). (emeasure M ((pseudo_proj_True n) -`{w} \<inter> space M)) *   (f w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (F n)
\<forall>w. 0 \<le> f w

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))
[PROOF STEP]
by (simp add: F_n_nn_integral_pos)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M = (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
have "integral\<^sup>L M f = enn2real (integral\<^sup>N M f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
proof (rule integral_eq_nn_integral)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. random_variable borel f
 2. AE x in M. 0 \<le> f x
[PROOF STEP]
show "AE x in M. 0\<le> f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. 0 \<le> f x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (F n)
\<forall>w. 0 \<le> f w

goal (1 subgoal):
 1. AE x in M. 0 \<le> f x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
AE x in M. 0 \<le> f x

goal (1 subgoal):
 1. random_variable borel f
[PROOF STEP]
show "random_variable borel f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_variable borel f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (F n)
\<forall>w. 0 \<le> f w

goal (1 subgoal):
 1. random_variable borel f
[PROOF STEP]
using measurable_from_subalg nat_filtration_subalgebra natural_filtration
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (F n)
\<forall>w. 0 \<le> f w
\<lbrakk>subalgebra ?M ?F; ?f \<in> ?F \<rightarrow>\<^sub>M ?N\<rbrakk> \<Longrightarrow> ?f \<in> ?M \<rightarrow>\<^sub>M ?N
subalgebra M (nat_filtration ?n)
F = nat_filtration

goal (1 subgoal):
 1. random_variable borel f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
random_variable borel f

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
expectation f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
expectation f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
have "... = enn2real (\<Sum> w\<in> range (pseudo_proj_True n). (emeasure M ((pseudo_proj_True n) -`{w} \<inter> space M)) *   (f w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) = enn2real (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (F n)
\<forall>w. 0 \<le> f w

goal (1 subgoal):
 1. enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) = enn2real (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))
[PROOF STEP]
by (simp add: F_n_nn_integral_pos)
[PROOF STATE]
proof (state)
this:
enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) = enn2real (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) = enn2real (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
have "... = (\<Sum> w\<in> range (pseudo_proj_True n). enn2real ((emeasure M ((pseudo_proj_True n) -`{w} \<inter> space M)) *   (f w)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2real (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w)) = (\<Sum>w\<in>range (pseudo_proj_True n). enn2real (emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w)))
[PROOF STEP]
proof (rule enn2real_sum)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (range (pseudo_proj_True n))
 2. \<And>w. w \<in> range (pseudo_proj_True n) \<Longrightarrow> emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w) < \<top>
[PROOF STEP]
show "finite (range (pseudo_proj_True n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (range (pseudo_proj_True n))
[PROOF STEP]
by (simp add: pseudo_proj_True_finite_image)
[PROOF STATE]
proof (state)
this:
finite (range (pseudo_proj_True n))

goal (1 subgoal):
 1. \<And>w. w \<in> range (pseudo_proj_True n) \<Longrightarrow> emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w) < \<top>
[PROOF STEP]
show "\<And>w. w \<in> range (pseudo_proj_True n) \<Longrightarrow> emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w) < \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. w \<in> range (pseudo_proj_True n) \<Longrightarrow> emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w) < \<top>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w. w \<in> range (pseudo_proj_True n) \<Longrightarrow> emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w) < \<top>
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w. w \<in> range (pseudo_proj_True n) \<Longrightarrow> emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w) < \<top>
[PROOF STEP]
assume "w\<in> range (pseudo_proj_True n)"
[PROOF STATE]
proof (state)
this:
w \<in> range (pseudo_proj_True n)

goal (1 subgoal):
 1. \<And>w. w \<in> range (pseudo_proj_True n) \<Longrightarrow> emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w) < \<top>
[PROOF STEP]
show "emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w) < \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w) < \<top>
[PROOF STEP]
by (simp add: emeasure_eq_measure ennreal_mult_less_top)
[PROOF STATE]
proof (state)
this:
emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w) < \<top>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?w1 \<in> range (pseudo_proj_True n) \<Longrightarrow> emeasure M (pseudo_proj_True n -` {?w1} \<inter> space M) * ennreal (f ?w1) < \<top>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
enn2real (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w)) = (\<Sum>w\<in>range (pseudo_proj_True n). enn2real (emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w)))

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
enn2real (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w)) = (\<Sum>w\<in>range (pseudo_proj_True n). enn2real (emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w)))

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
have "... = (\<Sum> w\<in> range (pseudo_proj_True n).  ((measure M ((pseudo_proj_True n) -`{w} \<inter> space M)) *   (f w)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>w\<in>range (pseudo_proj_True n). enn2real (emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))) = (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
by (simp add: Sigma_Algebra.measure_def assms(2) enn2real_mult)
[PROOF STATE]
proof (state)
this:
(\<Sum>w\<in>range (pseudo_proj_True n). enn2real (emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))) = (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
expectation f = (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
have "integral\<^sup>L M f =(\<Sum> w\<in> range (pseudo_proj_True n).  ((measure M ((pseudo_proj_True n) -`{w} \<inter> space M)) *   (f w)))"
[PROOF STATE]
proof (prove)
using this:
expectation f = (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)

goal (1 subgoal):
 1. expectation f = (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
expectation f = (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
expectation f = (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
have "integrable M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M f
[PROOF STEP]
proof (rule integrableI_nn_integral_finite)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. random_variable borel f
 2. AE x in M. 0 \<le> f x
 3. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal ?x
[PROOF STEP]
show "random_variable borel f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_variable borel f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (F n)
\<forall>w. 0 \<le> f w

goal (1 subgoal):
 1. random_variable borel f
[PROOF STEP]
using measurable_from_subalg nat_filtration_subalgebra natural_filtration
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (F n)
\<forall>w. 0 \<le> f w
\<lbrakk>subalgebra ?M ?F; ?f \<in> ?F \<rightarrow>\<^sub>M ?N\<rbrakk> \<Longrightarrow> ?f \<in> ?M \<rightarrow>\<^sub>M ?N
subalgebra M (nat_filtration ?n)
F = nat_filtration

goal (1 subgoal):
 1. random_variable borel f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
random_variable borel f

goal (2 subgoals):
 1. AE x in M. 0 \<le> f x
 2. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal ?x
[PROOF STEP]
show "AE x in M. 0 \<le> f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. 0 \<le> f x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (F n)
\<forall>w. 0 \<le> f w

goal (1 subgoal):
 1. AE x in M. 0 \<le> f x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
AE x in M. 0 \<le> f x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal ?x
[PROOF STEP]
have "(\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) = (\<Sum> w\<in> range (pseudo_proj_True n). (emeasure M ((pseudo_proj_True n) -`{w} \<inter> space M)) *   (f w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (F n)
\<forall>w. 0 \<le> f w

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))
[PROOF STEP]
by (simp add: F_n_nn_integral_pos)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M = (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal ?x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M = (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal ?x
[PROOF STEP]
have "... = (\<Sum> w\<in> range (pseudo_proj_True n). ennreal (measure M ((pseudo_proj_True n) -`{w} \<inter> space M) *   (f w)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w)) = (\<Sum>w\<in>range (pseudo_proj_True n). ennreal (prob (pseudo_proj_True n -` {w} \<inter> space M) * f w))
[PROOF STEP]
proof (rule sum.cong, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> range (pseudo_proj_True n) \<Longrightarrow> emeasure M (pseudo_proj_True n -` {x} \<inter> space M) * ennreal (f x) = ennreal (prob (pseudo_proj_True n -` {x} \<inter> space M) * f x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> range (pseudo_proj_True n) \<Longrightarrow> emeasure M (pseudo_proj_True n -` {x} \<inter> space M) * ennreal (f x) = ennreal (prob (pseudo_proj_True n -` {x} \<inter> space M) * f x)
[PROOF STEP]
assume "x\<in> range (pseudo_proj_True n)"
[PROOF STATE]
proof (state)
this:
x \<in> range (pseudo_proj_True n)

goal (1 subgoal):
 1. \<And>x. x \<in> range (pseudo_proj_True n) \<Longrightarrow> emeasure M (pseudo_proj_True n -` {x} \<inter> space M) * ennreal (f x) = ennreal (prob (pseudo_proj_True n -` {x} \<inter> space M) * f x)
[PROOF STEP]
thus "emeasure M (pseudo_proj_True n -` {x} \<inter> space M) * ennreal (f x) =
         ennreal (prob (pseudo_proj_True n -` {x} \<inter> space M) * f x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> range (pseudo_proj_True n)

goal (1 subgoal):
 1. emeasure M (pseudo_proj_True n -` {x} \<inter> space M) * ennreal (f x) = ennreal (prob (pseudo_proj_True n -` {x} \<inter> space M) * f x)
[PROOF STEP]
using assms(2) emeasure_eq_measure ennreal_mult''
[PROOF STATE]
proof (prove)
using this:
x \<in> range (pseudo_proj_True n)
\<forall>w. 0 \<le> f w
emeasure M ?A = ennreal (prob ?A)
0 \<le> ?b \<Longrightarrow> ennreal (?a * ?b) = ennreal ?a * ennreal ?b

goal (1 subgoal):
 1. emeasure M (pseudo_proj_True n -` {x} \<inter> space M) * ennreal (f x) = ennreal (prob (pseudo_proj_True n -` {x} \<inter> space M) * f x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
emeasure M (pseudo_proj_True n -` {x} \<inter> space M) * ennreal (f x) = ennreal (prob (pseudo_proj_True n -` {x} \<inter> space M) * f x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w)) = (\<Sum>w\<in>range (pseudo_proj_True n). ennreal (prob (pseudo_proj_True n -` {w} \<inter> space M) * f w))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal ?x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>w\<in>range (pseudo_proj_True n). emeasure M (pseudo_proj_True n -` {w} \<inter> space M) * ennreal (f w)) = (\<Sum>w\<in>range (pseudo_proj_True n). ennreal (prob (pseudo_proj_True n -` {w} \<inter> space M) * f w))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal ?x
[PROOF STEP]
have "... = ennreal (\<Sum> w\<in> range (pseudo_proj_True n). (measure M ((pseudo_proj_True n) -`{w} \<inter> space M) *   (f w)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>w\<in>range (pseudo_proj_True n). ennreal (prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)) = ennreal (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
proof (rule ennreal_sum)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (range (pseudo_proj_True n))
 2. \<And>w. 0 \<le> prob (pseudo_proj_True n -` {w} \<inter> space M) * f w
[PROOF STEP]
show "finite (range (pseudo_proj_True n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (range (pseudo_proj_True n))
[PROOF STEP]
by (simp add: pseudo_proj_True_finite_image)
[PROOF STATE]
proof (state)
this:
finite (range (pseudo_proj_True n))

goal (1 subgoal):
 1. \<And>w. 0 \<le> prob (pseudo_proj_True n -` {w} \<inter> space M) * f w
[PROOF STEP]
show "\<And>w. 0 \<le> prob (pseudo_proj_True n -` {w} \<inter> space M) * f w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. 0 \<le> prob (pseudo_proj_True n -` {w} \<inter> space M) * f w
[PROOF STEP]
using assms(2) measure_nonneg zero_le_mult_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>w. 0 \<le> f w
0 \<le> Sigma_Algebra.measure ?M ?A
((0::?'a) \<le> ?a * ?b) = ((0::?'a) \<le> ?a \<and> (0::?'a) \<le> ?b \<or> ?a \<le> (0::?'a) \<and> ?b \<le> (0::?'a))

goal (1 subgoal):
 1. \<And>w. 0 \<le> prob (pseudo_proj_True n -` {w} \<inter> space M) * f w
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 \<le> prob (pseudo_proj_True n -` {?w1} \<inter> space M) * f ?w1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>w\<in>range (pseudo_proj_True n). ennreal (prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)) = ennreal (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal ?x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
show "(\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) =
      ennreal (\<Sum> w\<in> range (pseudo_proj_True n). (measure M ((pseudo_proj_True n) -`{w} \<inter> space M) *   (f w)))"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
integrable M f

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
expectation f = (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
integrable M f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
expectation f = (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
integrable M f

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
using has_bochner_integral_iff
[PROOF STATE]
proof (prove)
using this:
expectation f = (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
integrable M f
has_bochner_integral ?M ?f ?x = (integrable ?M ?f \<and> integral\<^sup>L ?M ?f = ?x)

goal (1 subgoal):
 1. has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
has_bochner_integral M f (\<Sum>w\<in>range (pseudo_proj_True n). prob (pseudo_proj_True n -` {w} \<inter> space M) * f w)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_refinement_thm:
     "[| strict_ex_prop X;
         \<forall>H. F ok H & G ok H & F\<squnion>H \<in> welldef \<inter> X --> G\<squnion>H \<in> welldef |]
      ==> (G refines F wrt X) = (G iso_refines F wrt X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>strict_ex_prop X; \<forall>H. F ok H \<and> G ok H \<and> F \<squnion> H \<in> welldef \<inter> X \<longrightarrow> G \<squnion> H \<in> welldef\<rbrakk> \<Longrightarrow> (G refines F wrt X) = (G iso_refines F wrt X)
[PROOF STEP]
apply (rule_tac x = SKIP in allE, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>strict_ex_prop X; \<forall>H. F ok H \<and> G ok H \<and> F \<squnion> H \<in> welldef \<inter> X \<longrightarrow> G \<squnion> H \<in> welldef; F ok \<bottom> \<and> G ok \<bottom> \<and> F \<squnion> \<bottom> \<in> welldef \<inter> X \<longrightarrow> G \<squnion> \<bottom> \<in> welldef\<rbrakk> \<Longrightarrow> (G refines F wrt X) = (G iso_refines F wrt X)
[PROOF STEP]
apply (simp add: refines_def iso_refines_def strict_ex_refine_lemma_v)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma measurable_convergent[measurable (raw)]:
  fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::{complete_linorder, second_countable_topology, linorder_topology}"
  assumes [measurable]: "\<And>i. f i \<in> borel_measurable M"
  shows "Measurable.pred M (\<lambda>x. convergent (\<lambda>i. f i x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Measurable.pred M (\<lambda>x. convergent (\<lambda>i. f i x))
[PROOF STEP]
unfolding convergent_ereal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Measurable.pred M (\<lambda>x. limsup (\<lambda>i. f i x) = liminf (\<lambda>i. f i x))
[PROOF STEP]
by measurable


[STATEMENT]
lemma merge0_inv:
  "\<forall>I I'. oneone I \<and> oneone I' \<longrightarrow> compat I' I \<longrightarrow> oneone (merge0 I' I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>I I'. oneone I \<and> oneone I' \<longrightarrow> PlaneGraphIso.compat I' I \<longrightarrow> oneone (merge0 I' I)
[PROOF STEP]
apply(auto simp add:merge0_def distinct_map compat_def split_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>I I'. \<lbrakk>inj_on fst (set I); distinct I; inj_on snd (set I); inj_on fst (set I'); distinct I'; inj_on snd (set I'); \<forall>x\<in>set I'. \<forall>xa\<in>set I. (fst x = fst xa) = (snd x = snd xa)\<rbrakk> \<Longrightarrow> inj_on fst {x \<in> set I'. fst x \<notin> fst ` set I}
 2. \<And>I I'. \<lbrakk>inj_on fst (set I); distinct I; inj_on snd (set I); inj_on fst (set I'); distinct I'; inj_on snd (set I'); \<forall>x\<in>set I'. \<forall>xa\<in>set I. (fst x = fst xa) = (snd x = snd xa)\<rbrakk> \<Longrightarrow> inj_on snd {x \<in> set I'. fst x \<notin> fst ` set I}
[PROOF STEP]
apply(blast intro:subset_inj_on)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma remainderexplemma: "(y mod (a::nat) = z mod a) \<Longrightarrow> (x*y) mod a = (x*z) mod a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y mod a = z mod a \<Longrightarrow> x * y mod a = x * z mod a
[PROOF STEP]
by (rule mod_mult_cong [OF refl])


[STATEMENT]
lemma not_simple_elim:
  assumes "\<not>simple S"
  shows "(\<exists>A B ts. S = A@Send ts#B \<and> (\<nexists>x. ts = [Var x]) \<and> simple A) \<or>
         (\<exists>A B a t t'. S = A@Equality a t t'#B \<and> simple A) \<or>
         (\<exists>A B X F. S = A@Inequality X F#B \<and> (\<nexists>\<I>. ineq_model \<I> X F) \<and> simple A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>A B ts. S = A @ send\<langle>ts\<rangle>\<^sub>s\<^sub>t # B \<and> (\<nexists>x. ts = [Var x]) \<and> simple A) \<or> (\<exists>A B a t t'. S = A @ \<langle>a: t \<doteq> t'\<rangle>\<^sub>s\<^sub>t # B \<and> simple A) \<or> (\<exists>A B X F. S = A @ \<forall>X\<langle>\<or>\<noteq>: F\<rangle>\<^sub>s\<^sub>t # B \<and> (\<nexists>\<I>. ineq_model \<I> X F) \<and> simple A)
[PROOF STEP]
by (metis assms not_list_all_elim not_simple\<^sub>s\<^sub>t\<^sub>p_elim simple_def)


[STATEMENT]
lemma stable_nat: "stable |UNIV::nat set|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stable |UNIV|
[PROOF STEP]
using stable_natLeq card_of_nat stable_ordIso
[PROOF STATE]
proof (prove)
using this:
stable natLeq
|UNIV| =o natLeq
?r =o ?r' \<Longrightarrow> stable ?r = stable ?r'

goal (1 subgoal):
 1. stable |UNIV|
[PROOF STEP]
by auto


[STATEMENT]
lemma integral_trans:
  "proper (fst cf) \<Longrightarrow>
    (\<integral>x. f x \<partial>trans cf) = (\<Sum>i<brn (fst cf). wt (fst cf) (snd cf) i * f (cont_eff cf i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proper (fst cf) \<Longrightarrow> measure_pmf.expectation (local.trans cf) f = (\<Sum>i<brn (fst cf). wt (fst cf) (snd cf) i * f (cont_eff cf i))
[PROOF STEP]
unfolding trans_def map_pmf_rep_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proper (fst cf) \<Longrightarrow> integral\<^sup>L (distr (measure_pmf (wt_pmf cf)) (count_space UNIV) (\<lambda>i. if proper (fst cf) then cont_eff cf i else cf)) f = (\<Sum>i<brn (fst cf). wt (fst cf) (snd cf) i * f (cont_eff cf i))
[PROOF STEP]
apply (simp add: integral_distr)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proper (fst cf) \<Longrightarrow> measure_pmf.expectation (wt_pmf cf) (\<lambda>x. f (cont_eff cf x)) = (\<Sum>i<brn (fst cf). wt (fst cf) (snd cf) i * f (cont_eff cf i))
[PROOF STEP]
apply (subst integral_measure_pmf[of "{..< brn (fst cf)}"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. proper (fst cf) \<Longrightarrow> finite {..<brn (fst cf)}
 2. \<And>a. \<lbrakk>proper (fst cf); a \<in> set_pmf (wt_pmf cf); f (cont_eff cf a) \<noteq> 0\<rbrakk> \<Longrightarrow> a \<in> {..<brn (fst cf)}
 3. proper (fst cf) \<Longrightarrow> (\<Sum>a<brn (fst cf). pmf (wt_pmf cf) a *\<^sub>R f (cont_eff cf a)) = (\<Sum>i<brn (fst cf). wt (fst cf) (snd cf) i * f (cont_eff cf i))
[PROOF STEP]
apply (auto simp: set_pmf_wt mult_ac wt_pmf.rep_eq split: prod.split)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma conga_right_comm:
  assumes "A B C CongA D E F"
  shows "A B C CongA F E D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A B C CongA F E D
[PROOF STEP]
by (metis Tarski_neutral_dimensionless.conga_diff45 Tarski_neutral_dimensionless.conga_sym Tarski_neutral_dimensionless.conga_trans Tarski_neutral_dimensionless_axioms assms conga_diff56 conga_pseudo_refl)


[STATEMENT]
lemma is_poincare_line_not_trough_zero_not_trough_infty [simp]:
  assumes "is_poincare_line l"
  assumes "0\<^sub>h \<notin> circline_set l"
  shows "\<infinity>\<^sub>h \<notin> circline_set l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<infinity>\<^sub>h \<notin> circline_set l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_poincare_line l
0\<^sub>h \<notin> circline_set l

goal (1 subgoal):
 1. \<infinity>\<^sub>h \<notin> circline_set l
[PROOF STEP]
using is_poincare_line_inverse_point[OF assms(1), of "\<infinity>\<^sub>h"]
[PROOF STATE]
proof (prove)
using this:
is_poincare_line l
0\<^sub>h \<notin> circline_set l
\<infinity>\<^sub>h \<in> circline_set l \<Longrightarrow> inversion \<infinity>\<^sub>h \<in> circline_set l

goal (1 subgoal):
 1. \<infinity>\<^sub>h \<notin> circline_set l
[PROOF STEP]
by auto


[STATEMENT]
lemma (in complete_measure) fmeasurable_measure_inner_outer:
   "(S \<in> fmeasurable M \<and> m = measure M S) \<longleftrightarrow>
      (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < measure M T) \<and>
      (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> measure M U < m + e)"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S) = ((\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S \<Longrightarrow> (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)
 2. (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e) \<Longrightarrow> S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S
[PROOF STEP]
assume RHS: ?rhs
[PROOF STATE]
proof (state)
this:
(\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)

goal (2 subgoals):
 1. S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S \<Longrightarrow> (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)
 2. (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e) \<Longrightarrow> S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)
[PROOF STEP]
have T: "\<And>e. 0 < e \<longrightarrow> (\<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < measure M T)"
        and U: "\<And>e. 0 < e \<longrightarrow> (\<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> measure M U < m + e)"
[PROOF STATE]
proof (prove)
using this:
(\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)

goal (1 subgoal):
 1. (\<And>e. 0 < e \<longrightarrow> (\<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T)) &&& (\<And>e. 0 < e \<longrightarrow> (\<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < ?e \<longrightarrow> (\<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - ?e < Sigma_Algebra.measure M T)
0 < ?e \<longrightarrow> (\<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + ?e)

goal (2 subgoals):
 1. S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S \<Longrightarrow> (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)
 2. (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e) \<Longrightarrow> S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S
[PROOF STEP]
have "S \<in> fmeasurable M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<in> fmeasurable M
[PROOF STEP]
proof (subst fmeasurable_inner_outer, safe)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>T\<in>fmeasurable M. \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e
[PROOF STEP]
fix e::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>T\<in>fmeasurable M. \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e
[PROOF STEP]
assume "0 < e"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>T\<in>fmeasurable M. \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e
[PROOF STEP]
with RHS
[PROOF STATE]
proof (chain)
picking this:
(\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)
0 < e
[PROOF STEP]
obtain T U where T: "T \<in> fmeasurable M" "T \<subseteq> S" "m - e/2 < measure M T"
                          and U: "U \<in> fmeasurable M" "S \<subseteq> U" "measure M U < m + e/2"
[PROOF STATE]
proof (prove)
using this:
(\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)
0 < e

goal (1 subgoal):
 1. (\<And>T U. \<lbrakk>T \<in> fmeasurable M; T \<subseteq> S; m - e / 2 < Sigma_Algebra.measure M T; U \<in> fmeasurable M; S \<subseteq> U; Sigma_Algebra.measure M U < m + e / 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson half_gt_zero)+
[PROOF STATE]
proof (state)
this:
T \<in> fmeasurable M
T \<subseteq> S
m - e / 2 < Sigma_Algebra.measure M T
U \<in> fmeasurable M
S \<subseteq> U
Sigma_Algebra.measure M U < m + e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>T\<in>fmeasurable M. \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
T \<in> fmeasurable M
T \<subseteq> S
m - e / 2 < Sigma_Algebra.measure M T
U \<in> fmeasurable M
S \<subseteq> U
Sigma_Algebra.measure M U < m + e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>T\<in>fmeasurable M. \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e
[PROOF STEP]
have "measure M U - measure M T < (m + e/2) - (m - e/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M U - Sigma_Algebra.measure M T < m + e / 2 - (m - e / 2)
[PROOF STEP]
by (intro diff_strict_mono) fact+
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M U - Sigma_Algebra.measure M T < m + e / 2 - (m - e / 2)

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>T\<in>fmeasurable M. \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M U - Sigma_Algebra.measure M T < m + e / 2 - (m - e / 2)

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>T\<in>fmeasurable M. \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e
[PROOF STEP]
have "measure M T \<le> measure M U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M T \<le> Sigma_Algebra.measure M U
[PROOF STEP]
using T U
[PROOF STATE]
proof (prove)
using this:
T \<in> fmeasurable M
T \<subseteq> S
m - e / 2 < Sigma_Algebra.measure M T
U \<in> fmeasurable M
S \<subseteq> U
Sigma_Algebra.measure M U < m + e / 2

goal (1 subgoal):
 1. Sigma_Algebra.measure M T \<le> Sigma_Algebra.measure M U
[PROOF STEP]
by (intro measure_mono_fmeasurable) auto
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M T \<le> Sigma_Algebra.measure M U

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>T\<in>fmeasurable M. \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
T \<in> fmeasurable M
T \<subseteq> S
m - e / 2 < Sigma_Algebra.measure M T
U \<in> fmeasurable M
S \<subseteq> U
Sigma_Algebra.measure M U < m + e / 2
Sigma_Algebra.measure M U - Sigma_Algebra.measure M T < m + e / 2 - (m - e / 2)
Sigma_Algebra.measure M T \<le> Sigma_Algebra.measure M U
[PROOF STEP]
show "\<exists>T\<in>fmeasurable M. \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>measure M T - measure M U\<bar> < e"
[PROOF STATE]
proof (prove)
using this:
T \<in> fmeasurable M
T \<subseteq> S
m - e / 2 < Sigma_Algebra.measure M T
U \<in> fmeasurable M
S \<subseteq> U
Sigma_Algebra.measure M U < m + e / 2
Sigma_Algebra.measure M U - Sigma_Algebra.measure M T < m + e / 2 - (m - e / 2)
Sigma_Algebra.measure M T \<le> Sigma_Algebra.measure M U

goal (1 subgoal):
 1. \<exists>T\<in>fmeasurable M. \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e
[PROOF STEP]
apply (rule_tac bexI[OF _ \<open>T \<in> fmeasurable M\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T \<in> fmeasurable M; T \<subseteq> S; m - e / 2 < Sigma_Algebra.measure M T; U \<in> fmeasurable M; S \<subseteq> U; Sigma_Algebra.measure M U < m + e / 2; Sigma_Algebra.measure M U - Sigma_Algebra.measure M T < m + e / 2 - (m - e / 2); Sigma_Algebra.measure M T \<le> Sigma_Algebra.measure M U\<rbrakk> \<Longrightarrow> \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e
[PROOF STEP]
apply (rule_tac bexI[OF _ \<open>U \<in> fmeasurable M\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T \<in> fmeasurable M; T \<subseteq> S; m - e / 2 < Sigma_Algebra.measure M T; U \<in> fmeasurable M; S \<subseteq> U; Sigma_Algebra.measure M U < m + e / 2; Sigma_Algebra.measure M U - Sigma_Algebra.measure M T < m + e / 2 - (m - e / 2); Sigma_Algebra.measure M T \<le> Sigma_Algebra.measure M U\<rbrakk> \<Longrightarrow> T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>T\<in>fmeasurable M. \<exists>U\<in>fmeasurable M. T \<subseteq> S \<and> S \<subseteq> U \<and> \<bar>Sigma_Algebra.measure M T - Sigma_Algebra.measure M U\<bar> < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
S \<in> fmeasurable M

goal (2 subgoals):
 1. S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S \<Longrightarrow> (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)
 2. (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e) \<Longrightarrow> S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
S \<in> fmeasurable M

goal (2 subgoals):
 1. S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S \<Longrightarrow> (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)
 2. (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e) \<Longrightarrow> S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S
[PROOF STEP]
have "m = measure M S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = Sigma_Algebra.measure M S
[PROOF STEP]
using \<open>S \<in> fmeasurable M\<close> U[of "measure M S - m"] T[of "m - measure M S"]
[PROOF STATE]
proof (prove)
using this:
S \<in> fmeasurable M
0 < Sigma_Algebra.measure M S - m \<longrightarrow> (\<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + (Sigma_Algebra.measure M S - m))
0 < m - Sigma_Algebra.measure M S \<longrightarrow> (\<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - (m - Sigma_Algebra.measure M S) < Sigma_Algebra.measure M T)

goal (1 subgoal):
 1. m = Sigma_Algebra.measure M S
[PROOF STEP]
by (cases m "measure M S" rule: linorder_cases)
       (auto simp: not_le[symmetric] measure_mono_fmeasurable)
[PROOF STATE]
proof (state)
this:
m = Sigma_Algebra.measure M S

goal (2 subgoals):
 1. S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S \<Longrightarrow> (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)
 2. (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e) \<Longrightarrow> S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
S \<in> fmeasurable M
m = Sigma_Algebra.measure M S
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
S \<in> fmeasurable M
m = Sigma_Algebra.measure M S

goal (1 subgoal):
 1. S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S

goal (1 subgoal):
 1. S \<in> fmeasurable M \<and> m = Sigma_Algebra.measure M S \<Longrightarrow> (\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> m - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < m + e)
[PROOF STEP]
qed (auto intro!: bexI[of _ S])


[STATEMENT]
lemma Fvars_fm_simps[simp]:
  "Fvars (x IN y) = Fvars x \<union> Fvars y"
  "Fvars (x EQ y) = Fvars x \<union> Fvars y"
  "Fvars (A OR B) = Fvars A \<union> Fvars B"
  "Fvars (A AND B) = Fvars A \<union> Fvars B"
  "Fvars (A IMP B) = Fvars A \<union> Fvars B"
  "Fvars Fls = {}"
  "Fvars (Neg A) = Fvars A"
  "Fvars (Ex a A) = Fvars A - {a}"
  "Fvars (All a A) = Fvars A - {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((Fvars (x IN y) = Fvars x \<union> Fvars y &&& Fvars (x EQ y) = Fvars x \<union> Fvars y) &&& Fvars (A OR B) = Fvars A \<union> Fvars B &&& Fvars (A AND B) = Fvars A \<union> Fvars B) &&& (Fvars (A IMP B) = Fvars A \<union> Fvars B &&& Fvars Fls = {}) &&& Fvars (Neg A) = Fvars A &&& Fvars (SyntaxN.Ex a A) = Fvars A - {a} &&& Fvars (SyntaxN.All a A) = Fvars A - {a}
[PROOF STEP]
by (auto simp: Fvars_def fresh_at_base(2))


[STATEMENT]
lemma val_ineq_cancel_leq:
  assumes "a \<in> nonzero Q\<^sub>p"
  assumes "b \<in> carrier Q\<^sub>p"
  assumes "c \<in> carrier Q\<^sub>p"
  assumes "val (a \<otimes> b) \<le> val (a \<otimes> c)"
  shows "val b \<le> val c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val b \<le> val c
[PROOF STEP]
using Units_eq_nonzero assms(1) assms(2) assms(3) assms(4) times_cfs_val_mono
[PROOF STATE]
proof (prove)
using this:
Units Q\<^sub>p = nonzero Q\<^sub>p
a \<in> nonzero Q\<^sub>p
b \<in> carrier Q\<^sub>p
c \<in> carrier Q\<^sub>p
val (a \<otimes> b) \<le> val (a \<otimes> c)
\<lbrakk>?u \<in> Units Q\<^sub>p; ?a \<in> carrier Q\<^sub>p; ?b \<in> carrier Q\<^sub>p; val (?u \<otimes> ?a) \<le> val (?u \<otimes> ?b)\<rbrakk> \<Longrightarrow> val ?a \<le> val ?b

goal (1 subgoal):
 1. val b \<le> val c
[PROOF STEP]
by blast


[STATEMENT]
theorem invpst_mkNode[simp]: "invpst (mkNode c l a r) \<longleftrightarrow> invpst l \<and> invpst r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invpst (mkNode c l a r) = (invpst l \<and> invpst r)
[PROOF STEP]
apply (cases l rule: invpst.cases;
       cases r rule: invpst.cases;
       simp add: mkNode_def min_kp_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>la x uu_ mkp ra. \<lbrakk>l = \<langle>\<rangle>; r = \<langle>la, (x, uu_, mkp), ra\<rangle>\<rbrakk> \<Longrightarrow> (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)) \<and> is_min2 (min2 a mkp) (insert a (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)))) = (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)))
 2. \<And>la x uu_ mkp ra. \<lbrakk>l = \<langle>la, (x, uu_, mkp), ra\<rangle>; r = \<langle>\<rangle>\<rbrakk> \<Longrightarrow> (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)) \<and> is_min2 (min2 a mkp) (insert x (insert a (Tree2.set_tree la \<union> Tree2.set_tree ra)))) = (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)))
 3. \<And>la x uu_ mkp ra laa xa uua_ mkpa raa. \<lbrakk>l = \<langle>la, (x, uu_, mkp), ra\<rangle>; r = \<langle>laa, (xa, uua_, mkpa), raa\<rangle>\<rbrakk> \<Longrightarrow> (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)) \<and> invpst laa \<and> invpst raa \<and> is_min2 mkpa (insert xa (Tree2.set_tree laa \<union> Tree2.set_tree raa)) \<and> is_min2 (min2 a (min2 mkp mkpa)) (insert x (insert a (insert xa (Tree2.set_tree la \<union> (Tree2.set_tree ra \<union> (Tree2.set_tree laa \<union> Tree2.set_tree raa))))))) = (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)) \<and> invpst laa \<and> invpst raa \<and> is_min2 mkpa (insert xa (Tree2.set_tree laa \<union> Tree2.set_tree raa)))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>l = \<langle>\<rangle>; r = \<langle>la_, (x_, uu_, mkp_), ra_\<rangle>\<rbrakk> \<Longrightarrow> (invpst la_ \<and> invpst ra_ \<and> is_min2 mkp_ (insert x_ (Tree2.set_tree la_ \<union> Tree2.set_tree ra_)) \<and> is_min2 (min2 a mkp_) (insert a (insert x_ (Tree2.set_tree la_ \<union> Tree2.set_tree ra_)))) = (invpst la_ \<and> invpst ra_ \<and> is_min2 mkp_ (insert x_ (Tree2.set_tree la_ \<union> Tree2.set_tree ra_)))
[PROOF STEP]
using is_min2_min2_insI
[PROOF STATE]
proof (prove)
using this:
is_min2 ?y ?ys \<Longrightarrow> is_min2 (min2 ?x ?y) (insert ?x ?ys)

goal (1 subgoal):
 1. \<lbrakk>l = \<langle>\<rangle>; r = \<langle>la_, (x_, uu_, mkp_), ra_\<rangle>\<rbrakk> \<Longrightarrow> (invpst la_ \<and> invpst ra_ \<and> is_min2 mkp_ (insert x_ (Tree2.set_tree la_ \<union> Tree2.set_tree ra_)) \<and> is_min2 (min2 a mkp_) (insert a (insert x_ (Tree2.set_tree la_ \<union> Tree2.set_tree ra_)))) = (invpst la_ \<and> invpst ra_ \<and> is_min2 mkp_ (insert x_ (Tree2.set_tree la_ \<union> Tree2.set_tree ra_)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>la x uu_ mkp ra. \<lbrakk>l = \<langle>la, (x, uu_, mkp), ra\<rangle>; r = \<langle>\<rangle>\<rbrakk> \<Longrightarrow> (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)) \<and> is_min2 (min2 a mkp) (insert x (insert a (Tree2.set_tree la \<union> Tree2.set_tree ra)))) = (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)))
 2. \<And>la x uu_ mkp ra laa xa uua_ mkpa raa. \<lbrakk>l = \<langle>la, (x, uu_, mkp), ra\<rangle>; r = \<langle>laa, (xa, uua_, mkpa), raa\<rangle>\<rbrakk> \<Longrightarrow> (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)) \<and> invpst laa \<and> invpst raa \<and> is_min2 mkpa (insert xa (Tree2.set_tree laa \<union> Tree2.set_tree raa)) \<and> is_min2 (min2 a (min2 mkp mkpa)) (insert x (insert a (insert xa (Tree2.set_tree la \<union> (Tree2.set_tree ra \<union> (Tree2.set_tree laa \<union> Tree2.set_tree raa))))))) = (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)) \<and> invpst laa \<and> invpst raa \<and> is_min2 mkpa (insert xa (Tree2.set_tree laa \<union> Tree2.set_tree raa)))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>l = \<langle>la_, (x_, uu_, mkp_), ra_\<rangle>; r = \<langle>\<rangle>\<rbrakk> \<Longrightarrow> (invpst la_ \<and> invpst ra_ \<and> is_min2 mkp_ (insert x_ (Tree2.set_tree la_ \<union> Tree2.set_tree ra_)) \<and> is_min2 (min2 a mkp_) (insert x_ (insert a (Tree2.set_tree la_ \<union> Tree2.set_tree ra_)))) = (invpst la_ \<and> invpst ra_ \<and> is_min2 mkp_ (insert x_ (Tree2.set_tree la_ \<union> Tree2.set_tree ra_)))
[PROOF STEP]
by (auto intro!: is_min2_min2_insI simp: insert_commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>la x uu_ mkp ra laa xa uua_ mkpa raa. \<lbrakk>l = \<langle>la, (x, uu_, mkp), ra\<rangle>; r = \<langle>laa, (xa, uua_, mkpa), raa\<rangle>\<rbrakk> \<Longrightarrow> (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)) \<and> invpst laa \<and> invpst raa \<and> is_min2 mkpa (insert xa (Tree2.set_tree laa \<union> Tree2.set_tree raa)) \<and> is_min2 (min2 a (min2 mkp mkpa)) (insert x (insert a (insert xa (Tree2.set_tree la \<union> (Tree2.set_tree ra \<union> (Tree2.set_tree laa \<union> Tree2.set_tree raa))))))) = (invpst la \<and> invpst ra \<and> is_min2 mkp (insert x (Tree2.set_tree la \<union> Tree2.set_tree ra)) \<and> invpst laa \<and> invpst raa \<and> is_min2 mkpa (insert xa (Tree2.set_tree laa \<union> Tree2.set_tree raa)))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>l = \<langle>la_, (x_, uu_, mkp_), ra_\<rangle>; r = \<langle>laa_, (xa_, uua_, mkpa_), raa_\<rangle>\<rbrakk> \<Longrightarrow> (invpst la_ \<and> invpst ra_ \<and> is_min2 mkp_ (insert x_ (Tree2.set_tree la_ \<union> Tree2.set_tree ra_)) \<and> invpst laa_ \<and> invpst raa_ \<and> is_min2 mkpa_ (insert xa_ (Tree2.set_tree laa_ \<union> Tree2.set_tree raa_)) \<and> is_min2 (min2 a (min2 mkp_ mkpa_)) (insert x_ (insert a (insert xa_ (Tree2.set_tree la_ \<union> (Tree2.set_tree ra_ \<union> (Tree2.set_tree laa_ \<union> Tree2.set_tree raa_))))))) = (invpst la_ \<and> invpst ra_ \<and> is_min2 mkp_ (insert x_ (Tree2.set_tree la_ \<union> Tree2.set_tree ra_)) \<and> invpst laa_ \<and> invpst raa_ \<and> is_min2 mkpa_ (insert xa_ (Tree2.set_tree laa_ \<union> Tree2.set_tree raa_)))
[PROOF STEP]
by (smt Un_insert_left Un_insert_right is_min2_mergeI is_min2_min2_insI
                sup_assoc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eucl_ivals[measurable]:
  fixes a b :: "'a::ordered_euclidean_space"
  shows "{x. x <e a} \<in> sets borel"
    and "{x. a <e x} \<in> sets borel"
    and "{..a} \<in> sets borel"
    and "{a..} \<in> sets borel"
    and "{a..b} \<in> sets borel"
    and  "{x. a <e x \<and> x \<le> b} \<in> sets borel"
    and "{x. a \<le> x \<and>  x <e b} \<in> sets borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({x. x <e a} \<in> sets borel &&& {x. a <e x} \<in> sets borel &&& {..a} \<in> sets borel) &&& ({a..} \<in> sets borel &&& {a..b} \<in> sets borel) &&& {x. a <e x \<and> x \<le> b} \<in> sets borel &&& {x. a \<le> x \<and> x <e b} \<in> sets borel
[PROOF STEP]
unfolding box_oc box_co
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({x. x <e a} \<in> sets borel &&& {x. a <e x} \<in> sets borel &&& {..a} \<in> sets borel) &&& ({a..} \<in> sets borel &&& {a..b} \<in> sets borel) &&& Collect ((<e) a) \<inter> {..b} \<in> sets borel &&& {a..} \<inter> {x. x <e b} \<in> sets borel
[PROOF STEP]
by (auto intro: borel_open borel_closed)