[STATEMENT]
lemma Henstock_lemma_part1:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  assumes intf: "f integrable_on cbox a b"
    and "e > 0"
    and "gauge d"
    and less_e: "\<And>p. \<lbrakk>p tagged_division_of (cbox a b); d fine p\<rbrakk> \<Longrightarrow>
                     norm (sum (\<lambda>(x,K). content K *\<^sub>R f x) p - integral(cbox a b) f) < e"
    and p: "p tagged_partial_division_of (cbox a b)" "d fine p"
  shows "norm (sum (\<lambda>(x,K). content K *\<^sub>R f x - integral K f) p) \<le> e" (is "?lhs \<le> e")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e
[PROOF STEP]
proof (rule field_le_epsilon)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
fix k :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
assume "k > 0"
[PROOF STATE]
proof (state)
this:
0 < k

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
let ?SUM = "\<lambda>p. (\<Sum>(x,K) \<in> p. content K *\<^sub>R f x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
note p' = tagged_partial_division_ofD[OF p(1)]
[PROOF STATE]
proof (state)
this:
finite p
(?x, ?K) \<in> p \<Longrightarrow> ?x \<in> ?K
(?x, ?K) \<in> p \<Longrightarrow> ?K \<subseteq> cbox a b
(?x, ?K) \<in> p \<Longrightarrow> \<exists>a b. ?K = cbox a b
\<lbrakk>(?x1.0, ?K1.0) \<in> p; (?x2.0, ?K2.0) \<in> p; (?x1.0, ?K1.0) \<noteq> (?x2.0, ?K2.0)\<rbrakk> \<Longrightarrow> interior ?K1.0 \<inter> interior ?K2.0 = {}

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
have "\<Union>(snd ` p) \<subseteq> cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (snd ` p) \<subseteq> cbox a b
[PROOF STEP]
using p'(3)
[PROOF STATE]
proof (prove)
using this:
(?x, ?K) \<in> p \<Longrightarrow> ?K \<subseteq> cbox a b

goal (1 subgoal):
 1. \<Union> (snd ` p) \<subseteq> cbox a b
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<Union> (snd ` p) \<subseteq> cbox a b

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<Union> (snd ` p) \<subseteq> cbox a b
[PROOF STEP]
obtain q where q: "snd ` p \<subseteq> q" and qdiv: "q division_of cbox a b"
[PROOF STATE]
proof (prove)
using this:
\<Union> (snd ` p) \<subseteq> cbox a b

goal (1 subgoal):
 1. (\<And>q. \<lbrakk>snd ` p \<subseteq> q; q division_of cbox a b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson p(1) partial_division_extend_interval partial_division_of_tagged_division)
[PROOF STATE]
proof (state)
this:
snd ` p \<subseteq> q
q division_of cbox a b

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
note q' = division_ofD[OF qdiv]
[PROOF STATE]
proof (state)
this:
finite q
?K \<in> q \<Longrightarrow> ?K \<subseteq> cbox a b
?K \<in> q \<Longrightarrow> ?K \<noteq> {}
?K \<in> q \<Longrightarrow> \<exists>a b. ?K = cbox a b
\<lbrakk>?K1.0 \<in> q; ?K2.0 \<in> q; ?K1.0 \<noteq> ?K2.0\<rbrakk> \<Longrightarrow> interior ?K1.0 \<inter> interior ?K2.0 = {}
\<Union> q = cbox a b

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
define r where "r = q - snd ` p"
[PROOF STATE]
proof (state)
this:
r = q - snd ` p

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
have "snd ` p \<inter> r = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd ` p \<inter> r = {}
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd ` p \<inter> (q - snd ` p) = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
snd ` p \<inter> r = {}

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
have "finite r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite r
[PROOF STEP]
using q'
[PROOF STATE]
proof (prove)
using this:
finite q
?K \<in> q \<Longrightarrow> ?K \<subseteq> cbox a b
?K \<in> q \<Longrightarrow> ?K \<noteq> {}
?K \<in> q \<Longrightarrow> \<exists>a b. ?K = cbox a b
\<lbrakk>?K1.0 \<in> q; ?K2.0 \<in> q; ?K1.0 \<noteq> ?K2.0\<rbrakk> \<Longrightarrow> interior ?K1.0 \<inter> interior ?K2.0 = {}
\<Union> q = cbox a b

goal (1 subgoal):
 1. finite r
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
using this:
finite q
?K \<in> q \<Longrightarrow> ?K \<subseteq> cbox a b
?K \<in> q \<Longrightarrow> ?K \<noteq> {}
?K \<in> q \<Longrightarrow> \<exists>a b. ?K = cbox a b
\<lbrakk>?K1.0 \<in> q; ?K2.0 \<in> q; ?K1.0 \<noteq> ?K2.0\<rbrakk> \<Longrightarrow> interior ?K1.0 \<inter> interior ?K2.0 = {}
\<Union> q = cbox a b

goal (1 subgoal):
 1. finite (q - snd ` p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite r

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
have "\<exists>p. p tagged_division_of i \<and> d fine p \<and>
        norm (?SUM p - integral i f) < k / (real (card r) + 1)"
    if "i\<in>r" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. p tagged_division_of i \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>p. p tagged_division_of i \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)
[PROOF STEP]
have gt0: "k / (real (card r) + 1) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k / (real (card r) + 1)
[PROOF STEP]
using \<open>k > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. 0 < k / (real (card r) + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < k / (real (card r) + 1)

goal (1 subgoal):
 1. \<exists>p. p tagged_division_of i \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)
[PROOF STEP]
have i: "i \<in> q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> q
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
i \<in> r

goal (1 subgoal):
 1. i \<in> q
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
using this:
i \<in> q - snd ` p

goal (1 subgoal):
 1. i \<in> q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i \<in> q

goal (1 subgoal):
 1. \<exists>p. p tagged_division_of i \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> q
[PROOF STEP]
obtain u v where uv: "i = cbox u v"
[PROOF STATE]
proof (prove)
using this:
i \<in> q

goal (1 subgoal):
 1. (\<And>u v. i = cbox u v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using q'(4)
[PROOF STATE]
proof (prove)
using this:
i \<in> q
?K \<in> q \<Longrightarrow> \<exists>a b. ?K = cbox a b

goal (1 subgoal):
 1. (\<And>u v. i = cbox u v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i = cbox u v

goal (1 subgoal):
 1. \<exists>p. p tagged_division_of i \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i = cbox u v
[PROOF STEP]
have "cbox u v \<subseteq> cbox a b"
[PROOF STATE]
proof (prove)
using this:
i = cbox u v

goal (1 subgoal):
 1. cbox u v \<subseteq> cbox a b
[PROOF STEP]
using i q'(2)
[PROOF STATE]
proof (prove)
using this:
i = cbox u v
i \<in> q
?K \<in> q \<Longrightarrow> ?K \<subseteq> cbox a b

goal (1 subgoal):
 1. cbox u v \<subseteq> cbox a b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cbox u v \<subseteq> cbox a b

goal (1 subgoal):
 1. \<exists>p. p tagged_division_of i \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cbox u v \<subseteq> cbox a b
[PROOF STEP]
have "f integrable_on cbox u v"
[PROOF STATE]
proof (prove)
using this:
cbox u v \<subseteq> cbox a b

goal (1 subgoal):
 1. f integrable_on cbox u v
[PROOF STEP]
by (rule integrable_subinterval[OF intf])
[PROOF STATE]
proof (state)
this:
f integrable_on cbox u v

goal (1 subgoal):
 1. \<exists>p. p tagged_division_of i \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)
[PROOF STEP]
with integrable_integral[OF this, unfolded has_integral[of f]]
[PROOF STATE]
proof (chain)
picking this:
\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox u v \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R f x) - integral (cbox u v) f) < e)
f integrable_on cbox u v
[PROOF STEP]
obtain dd where "gauge dd" and dd:
      "\<And>\<D>. \<lbrakk>\<D> tagged_division_of cbox u v; dd fine \<D>\<rbrakk> \<Longrightarrow>
    norm (?SUM \<D> - integral (cbox u v) f) < k / (real (card r) + 1)"
[PROOF STATE]
proof (prove)
using this:
\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox u v \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R f x) - integral (cbox u v) f) < e)
f integrable_on cbox u v

goal (1 subgoal):
 1. (\<And>dd. \<lbrakk>gauge dd; \<And>\<D>. \<lbrakk>\<D> tagged_division_of cbox u v; dd fine \<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral (cbox u v) f) < k / (real (card r) + 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using gt0
[PROOF STATE]
proof (prove)
using this:
\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>\<D>. \<D> tagged_division_of cbox u v \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, k)\<in>\<D>. content k *\<^sub>R f x) - integral (cbox u v) f) < e)
f integrable_on cbox u v
0 < k / (real (card r) + 1)

goal (1 subgoal):
 1. (\<And>dd. \<lbrakk>gauge dd; \<And>\<D>. \<lbrakk>\<D> tagged_division_of cbox u v; dd fine \<D>\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral (cbox u v) f) < k / (real (card r) + 1)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gauge dd
\<lbrakk>?\<D>1 tagged_division_of cbox u v; dd fine ?\<D>1\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>1. content K *\<^sub>R f x) - integral (cbox u v) f) < k / (real (card r) + 1)

goal (1 subgoal):
 1. \<exists>p. p tagged_division_of i \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)
[PROOF STEP]
with gauge_Int[OF \<open>gauge d\<close> \<open>gauge dd\<close>]
[PROOF STATE]
proof (chain)
picking this:
gauge (\<lambda>x. d x \<inter> dd x)
gauge dd
\<lbrakk>?\<D>1 tagged_division_of cbox u v; dd fine ?\<D>1\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>1. content K *\<^sub>R f x) - integral (cbox u v) f) < k / (real (card r) + 1)
[PROOF STEP]
obtain qq where qq: "qq tagged_division_of cbox u v" "(\<lambda>x. d x \<inter> dd x) fine qq"
[PROOF STATE]
proof (prove)
using this:
gauge (\<lambda>x. d x \<inter> dd x)
gauge dd
\<lbrakk>?\<D>1 tagged_division_of cbox u v; dd fine ?\<D>1\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>1. content K *\<^sub>R f x) - integral (cbox u v) f) < k / (real (card r) + 1)

goal (1 subgoal):
 1. (\<And>qq. \<lbrakk>qq tagged_division_of cbox u v; (\<lambda>x. d x \<inter> dd x) fine qq\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using fine_division_exists
[PROOF STATE]
proof (prove)
using this:
gauge (\<lambda>x. d x \<inter> dd x)
gauge dd
\<lbrakk>?\<D>1 tagged_division_of cbox u v; dd fine ?\<D>1\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>1. content K *\<^sub>R f x) - integral (cbox u v) f) < k / (real (card r) + 1)
\<lbrakk>gauge ?g; \<And>p. \<lbrakk>p tagged_division_of cbox ?a ?b; ?g fine p\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>qq. \<lbrakk>qq tagged_division_of cbox u v; (\<lambda>x. d x \<inter> dd x) fine qq\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
qq tagged_division_of cbox u v
(\<lambda>x. d x \<inter> dd x) fine qq

goal (1 subgoal):
 1. \<exists>p. p tagged_division_of i \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)
[PROOF STEP]
with dd[of qq]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>qq tagged_division_of cbox u v; dd fine qq\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>qq. content K *\<^sub>R f x) - integral (cbox u v) f) < k / (real (card r) + 1)
qq tagged_division_of cbox u v
(\<lambda>x. d x \<inter> dd x) fine qq
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>qq tagged_division_of cbox u v; dd fine qq\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>qq. content K *\<^sub>R f x) - integral (cbox u v) f) < k / (real (card r) + 1)
qq tagged_division_of cbox u v
(\<lambda>x. d x \<inter> dd x) fine qq

goal (1 subgoal):
 1. \<exists>p. p tagged_division_of i \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)
[PROOF STEP]
by (auto simp: fine_Int uv)
[PROOF STATE]
proof (state)
this:
\<exists>p. p tagged_division_of i \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i1 \<in> r \<Longrightarrow> \<exists>p. p tagged_division_of ?i1 \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral ?i1 f) < k / (real (card r) + 1)

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i1 \<in> r \<Longrightarrow> \<exists>p. p tagged_division_of ?i1 \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral ?i1 f) < k / (real (card r) + 1)
[PROOF STEP]
obtain qq where qq: "\<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i \<and>
      d fine qq i \<and> norm (?SUM (qq i) - integral i f) < k / (real (card r) + 1)"
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> r \<Longrightarrow> \<exists>p. p tagged_division_of ?i1 \<and> d fine p \<and> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - integral ?i1 f) < k / (real (card r) + 1)

goal (1 subgoal):
 1. (\<And>qq. (\<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i \<and> d fine qq i \<and> norm ((\<Sum>(x, K)\<in>qq i. content K *\<^sub>R f x) - integral i f) < k / (real (card r) + 1)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
?i1 \<in> r \<Longrightarrow> qq ?i1 tagged_division_of ?i1 \<and> d fine qq ?i1 \<and> norm ((\<Sum>(x, K)\<in>qq ?i1. content K *\<^sub>R f x) - integral ?i1 f) < k / (real (card r) + 1)

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
let ?p = "p \<union> \<Union>(qq ` r)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
have "norm (?SUM ?p - integral (cbox a b) f) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>p \<union> \<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e
[PROOF STEP]
proof (rule less_e)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<union> \<Union> (qq ` r) tagged_division_of cbox a b
 2. d fine p \<union> \<Union> (qq ` r)
[PROOF STEP]
show "d fine ?p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d fine p \<union> \<Union> (qq ` r)
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) qq fine_Un fine_Union imageE p(2))
[PROOF STATE]
proof (state)
this:
d fine p \<union> \<Union> (qq ` r)

goal (1 subgoal):
 1. p \<union> \<Union> (qq ` r) tagged_division_of cbox a b
[PROOF STEP]
note ptag = tagged_partial_division_of_Union_self[OF p(1)]
[PROOF STATE]
proof (state)
this:
p tagged_division_of \<Union> (snd ` p)

goal (1 subgoal):
 1. p \<union> \<Union> (qq ` r) tagged_division_of cbox a b
[PROOF STEP]
have "p \<union> \<Union>(qq ` r) tagged_division_of \<Union>(snd ` p) \<union> \<Union>r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<union> \<Union> (qq ` r) tagged_division_of \<Union> (snd ` p) \<union> \<Union> r
[PROOF STEP]
proof (rule tagged_division_Un[OF ptag tagged_division_Union [OF \<open>finite r\<close>]])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i
 2. \<And>i1 i2. \<lbrakk>i1 \<in> r; i2 \<in> r; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> interior i1 \<inter> interior i2 = {}
 3. interior (\<Union> (snd ` p)) \<inter> interior (\<Union> r) = {}
[PROOF STEP]
show "\<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i
[PROOF STEP]
using qq
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> r \<Longrightarrow> qq ?i1 tagged_division_of ?i1 \<and> d fine qq ?i1 \<and> norm ((\<Sum>(x, K)\<in>qq ?i1. content K *\<^sub>R f x) - integral ?i1 f) < k / (real (card r) + 1)

goal (1 subgoal):
 1. \<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i1 \<in> r \<Longrightarrow> qq ?i1 tagged_division_of ?i1

goal (2 subgoals):
 1. \<And>i1 i2. \<lbrakk>i1 \<in> r; i2 \<in> r; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> interior i1 \<inter> interior i2 = {}
 2. interior (\<Union> (snd ` p)) \<inter> interior (\<Union> r) = {}
[PROOF STEP]
show "\<And>i1 i2. \<lbrakk>i1 \<in> r; i2 \<in> r; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> interior i1 \<inter> interior i2 = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i1 i2. \<lbrakk>i1 \<in> r; i2 \<in> r; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> interior i1 \<inter> interior i2 = {}
[PROOF STEP]
by (simp add: q'(5) r_def)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i1.1 \<in> r; ?i2.1 \<in> r; ?i1.1 \<noteq> ?i2.1\<rbrakk> \<Longrightarrow> interior ?i1.1 \<inter> interior ?i2.1 = {}

goal (1 subgoal):
 1. interior (\<Union> (snd ` p)) \<inter> interior (\<Union> r) = {}
[PROOF STEP]
show "interior (\<Union>(snd ` p)) \<inter> interior (\<Union>r) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior (\<Union> (snd ` p)) \<inter> interior (\<Union> r) = {}
[PROOF STEP]
proof (rule Int_interior_Union_intervals [OF \<open>finite r\<close>])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. open (interior (\<Union> (snd ` p)))
 2. \<And>T. T \<in> r \<Longrightarrow> \<exists>a b. T = cbox a b
 3. \<And>T. T \<in> r \<Longrightarrow> interior (\<Union> (snd ` p)) \<inter> interior T = {}
[PROOF STEP]
show "open (interior (\<Union>(snd ` p)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (interior (\<Union> (snd ` p)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
open (interior (\<Union> (snd ` p)))

goal (2 subgoals):
 1. \<And>T. T \<in> r \<Longrightarrow> \<exists>a b. T = cbox a b
 2. \<And>T. T \<in> r \<Longrightarrow> interior (\<Union> (snd ` p)) \<inter> interior T = {}
[PROOF STEP]
show "\<And>T. T \<in> r \<Longrightarrow> \<exists>a b. T = cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>T. T \<in> r \<Longrightarrow> \<exists>a b. T = cbox a b
[PROOF STEP]
by (simp add: q'(4) r_def)
[PROOF STATE]
proof (state)
this:
?T1 \<in> r \<Longrightarrow> \<exists>a b. ?T1 = cbox a b

goal (1 subgoal):
 1. \<And>T. T \<in> r \<Longrightarrow> interior (\<Union> (snd ` p)) \<inter> interior T = {}
[PROOF STEP]
have "interior T \<inter> interior (\<Union>(snd ` p)) = {}" if "T \<in> r" for T
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior T \<inter> interior (\<Union> (snd ` p)) = {}
[PROOF STEP]
proof (rule Int_interior_Union_intervals)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. finite (snd ` p)
 2. open (interior T)
 3. \<And>T. T \<in> snd ` p \<Longrightarrow> \<exists>a b. T = cbox a b
 4. \<And>Ta. Ta \<in> snd ` p \<Longrightarrow> interior T \<inter> interior Ta = {}
[PROOF STEP]
show "\<And>U. U \<in> snd ` p \<Longrightarrow> \<exists>a b. U = cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>U. U \<in> snd ` p \<Longrightarrow> \<exists>a b. U = cbox a b
[PROOF STEP]
using q q'(4)
[PROOF STATE]
proof (prove)
using this:
snd ` p \<subseteq> q
?K \<in> q \<Longrightarrow> \<exists>a b. ?K = cbox a b

goal (1 subgoal):
 1. \<And>U. U \<in> snd ` p \<Longrightarrow> \<exists>a b. U = cbox a b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?U1 \<in> snd ` p \<Longrightarrow> \<exists>a b. ?U1 = cbox a b

goal (3 subgoals):
 1. finite (snd ` p)
 2. open (interior T)
 3. \<And>Ta. Ta \<in> snd ` p \<Longrightarrow> interior T \<inter> interior Ta = {}
[PROOF STEP]
show "\<And>U. U \<in> snd ` p \<Longrightarrow> interior T \<inter> interior U = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>U. U \<in> snd ` p \<Longrightarrow> interior T \<inter> interior U = {}
[PROOF STEP]
by (metis DiffE q q'(5) r_def subsetD that)
[PROOF STATE]
proof (state)
this:
?U1 \<in> snd ` p \<Longrightarrow> interior T \<inter> interior ?U1 = {}

goal (2 subgoals):
 1. finite (snd ` p)
 2. open (interior T)
[PROOF STEP]
qed (use p' in auto)
[PROOF STATE]
proof (state)
this:
?T1 \<in> r \<Longrightarrow> interior ?T1 \<inter> interior (\<Union> (snd ` p)) = {}

goal (1 subgoal):
 1. \<And>T. T \<in> r \<Longrightarrow> interior (\<Union> (snd ` p)) \<inter> interior T = {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?T1 \<in> r \<Longrightarrow> interior ?T1 \<inter> interior (\<Union> (snd ` p)) = {}
[PROOF STEP]
show "\<And>T. T \<in> r \<Longrightarrow> interior (\<Union>(snd ` p)) \<inter> interior T = {}"
[PROOF STATE]
proof (prove)
using this:
?T1 \<in> r \<Longrightarrow> interior ?T1 \<inter> interior (\<Union> (snd ` p)) = {}

goal (1 subgoal):
 1. \<And>T. T \<in> r \<Longrightarrow> interior (\<Union> (snd ` p)) \<inter> interior T = {}
[PROOF STEP]
by (metis Int_commute)
[PROOF STATE]
proof (state)
this:
?T1 \<in> r \<Longrightarrow> interior (\<Union> (snd ` p)) \<inter> interior ?T1 = {}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
interior (\<Union> (snd ` p)) \<inter> interior (\<Union> r) = {}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p \<union> \<Union> (qq ` r) tagged_division_of \<Union> (snd ` p) \<union> \<Union> r

goal (1 subgoal):
 1. p \<union> \<Union> (qq ` r) tagged_division_of cbox a b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p \<union> \<Union> (qq ` r) tagged_division_of \<Union> (snd ` p) \<union> \<Union> r

goal (1 subgoal):
 1. p \<union> \<Union> (qq ` r) tagged_division_of cbox a b
[PROOF STEP]
have "\<Union>(snd ` p) \<union> \<Union>r = cbox a b" and "{qq i |i. i \<in> r} = qq ` r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (snd ` p) \<union> \<Union> r = cbox a b &&& {qq i |i. i \<in> r} = qq ` r
[PROOF STEP]
using qdiv q
[PROOF STATE]
proof (prove)
using this:
q division_of cbox a b
snd ` p \<subseteq> q

goal (1 subgoal):
 1. \<Union> (snd ` p) \<union> \<Union> r = cbox a b &&& {qq i |i. i \<in> r} = qq ` r
[PROOF STEP]
unfolding Union_Un_distrib[symmetric] r_def
[PROOF STATE]
proof (prove)
using this:
q division_of cbox a b
snd ` p \<subseteq> q

goal (1 subgoal):
 1. \<Union> (snd ` p \<union> (q - snd ` p)) = cbox a b &&& {qq i |i. i \<in> q - snd ` p} = qq ` (q - snd ` p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> (snd ` p) \<union> \<Union> r = cbox a b
{qq i |i. i \<in> r} = qq ` r

goal (1 subgoal):
 1. p \<union> \<Union> (qq ` r) tagged_division_of cbox a b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p \<union> \<Union> (qq ` r) tagged_division_of \<Union> (snd ` p) \<union> \<Union> r
\<Union> (snd ` p) \<union> \<Union> r = cbox a b
{qq i |i. i \<in> r} = qq ` r
[PROOF STEP]
show "?p tagged_division_of (cbox a b)"
[PROOF STATE]
proof (prove)
using this:
p \<union> \<Union> (qq ` r) tagged_division_of \<Union> (snd ` p) \<union> \<Union> r
\<Union> (snd ` p) \<union> \<Union> r = cbox a b
{qq i |i. i \<in> r} = qq ` r

goal (1 subgoal):
 1. p \<union> \<Union> (qq ` r) tagged_division_of cbox a b
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
p \<union> \<Union> (qq ` r) tagged_division_of cbox a b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>p \<union> \<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm ((\<Sum>(x, K)\<in>p \<union> \<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e
[PROOF STEP]
have "norm (?SUM p + (?SUM (\<Union>(qq ` r))) - integral (cbox a b) f) < e"
[PROOF STATE]
proof (prove)
using this:
norm ((\<Sum>(x, K)\<in>p \<union> \<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e

goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + (\<Sum>(x, K)\<in>\<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e
[PROOF STEP]
proof (subst sum.union_inter_neutral[symmetric, OF \<open>finite p\<close>], safe)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>norm ((\<Sum>(x, K)\<in>p \<union> \<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e; norm ((\<Sum>(x, K)\<in>p \<union> \<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e\<rbrakk> \<Longrightarrow> finite (\<Union> (qq ` r))
 2. \<And>aa ba x. \<lbrakk>norm ((\<Sum>(x, K)\<in>p \<union> \<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e; norm ((\<Sum>(x, K)\<in>p \<union> \<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e; (aa, ba) \<in> p; x \<in> r; (aa, ba) \<in> qq x\<rbrakk> \<Longrightarrow> content ba *\<^sub>R f aa = (0::'a)
[PROOF STEP]
show "content L *\<^sub>R f x = 0" if "(x, L) \<in> p" "(x, L) \<in> qq K" "K \<in> r" for x K L
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content L *\<^sub>R f x = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. content L *\<^sub>R f x = (0::'a)
[PROOF STEP]
obtain u v where uv: "L = cbox u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u v. L = cbox u v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>(x,L) \<in> p\<close> p'(4)
[PROOF STATE]
proof (prove)
using this:
(x, L) \<in> p
(?x, ?K) \<in> p \<Longrightarrow> \<exists>a b. ?K = cbox a b

goal (1 subgoal):
 1. (\<And>u v. L = cbox u v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
L = cbox u v

goal (1 subgoal):
 1. content L *\<^sub>R f x = (0::'a)
[PROOF STEP]
have "L \<subseteq> K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L \<subseteq> K
[PROOF STEP]
using  qq[OF that(3)] tagged_division_ofD(3) \<open>(x,L) \<in> qq K\<close>
[PROOF STATE]
proof (prove)
using this:
qq K tagged_division_of K \<and> d fine qq K \<and> norm ((\<Sum>(x, K)\<in>qq K. content K *\<^sub>R f x) - integral K f) < k / (real (card r) + 1)
\<lbrakk>?s tagged_division_of ?i; (?x, ?K) \<in> ?s\<rbrakk> \<Longrightarrow> ?K \<subseteq> ?i
(x, L) \<in> qq K

goal (1 subgoal):
 1. L \<subseteq> K
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
L \<subseteq> K

goal (1 subgoal):
 1. content L *\<^sub>R f x = (0::'a)
[PROOF STEP]
have "L \<in> snd ` p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L \<in> snd ` p
[PROOF STEP]
using \<open>(x,L) \<in> p\<close> image_iff
[PROOF STATE]
proof (prove)
using this:
(x, L) \<in> p
(?z \<in> ?f ` ?A) = (\<exists>x\<in>?A. ?z = ?f x)

goal (1 subgoal):
 1. L \<in> snd ` p
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
L \<in> snd ` p

goal (1 subgoal):
 1. content L *\<^sub>R f x = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
L \<in> snd ` p
[PROOF STEP]
have "L \<in> q" "K \<in> q" "L \<noteq> K"
[PROOF STATE]
proof (prove)
using this:
L \<in> snd ` p

goal (1 subgoal):
 1. L \<in> q &&& K \<in> q &&& L \<noteq> K
[PROOF STEP]
using that(1,3) q(1)
[PROOF STATE]
proof (prove)
using this:
L \<in> snd ` p
(x, L) \<in> p
K \<in> r
snd ` p \<subseteq> q

goal (1 subgoal):
 1. L \<in> q &&& K \<in> q &&& L \<noteq> K
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
using this:
L \<in> snd ` p
(x, L) \<in> p
K \<in> q - snd ` p
snd ` p \<subseteq> q

goal (1 subgoal):
 1. L \<in> q &&& K \<in> q &&& L \<noteq> K
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
L \<in> q
K \<in> q
L \<noteq> K

goal (1 subgoal):
 1. content L *\<^sub>R f x = (0::'a)
[PROOF STEP]
with q'(5)
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?K1.0 \<in> q; ?K2.0 \<in> q; ?K1.0 \<noteq> ?K2.0\<rbrakk> \<Longrightarrow> interior ?K1.0 \<inter> interior ?K2.0 = {}
L \<in> q
K \<in> q
L \<noteq> K
[PROOF STEP]
have "interior L = {}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?K1.0 \<in> q; ?K2.0 \<in> q; ?K1.0 \<noteq> ?K2.0\<rbrakk> \<Longrightarrow> interior ?K1.0 \<inter> interior ?K2.0 = {}
L \<in> q
K \<in> q
L \<noteq> K

goal (1 subgoal):
 1. interior L = {}
[PROOF STEP]
using interior_mono[OF \<open>L \<subseteq> K\<close>]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?K1.0 \<in> q; ?K2.0 \<in> q; ?K1.0 \<noteq> ?K2.0\<rbrakk> \<Longrightarrow> interior ?K1.0 \<inter> interior ?K2.0 = {}
L \<in> q
K \<in> q
L \<noteq> K
interior L \<subseteq> interior K

goal (1 subgoal):
 1. interior L = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
interior L = {}

goal (1 subgoal):
 1. content L *\<^sub>R f x = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
interior L = {}
[PROOF STEP]
show "content L *\<^sub>R f x = 0"
[PROOF STATE]
proof (prove)
using this:
interior L = {}

goal (1 subgoal):
 1. content L *\<^sub>R f x = (0::'a)
[PROOF STEP]
unfolding uv content_eq_0_interior[symmetric]
[PROOF STATE]
proof (prove)
using this:
content (cbox u v) = 0

goal (1 subgoal):
 1. content (cbox u v) *\<^sub>R f x = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
content L *\<^sub>R f x = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?x1, ?L1) \<in> p; (?x1, ?L1) \<in> qq ?K1; ?K1 \<in> r\<rbrakk> \<Longrightarrow> content ?L1 *\<^sub>R f ?x1 = (0::'a)

goal (1 subgoal):
 1. \<lbrakk>norm ((\<Sum>(x, K)\<in>p \<union> \<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e; norm ((\<Sum>(x, K)\<in>p \<union> \<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e\<rbrakk> \<Longrightarrow> finite (\<Union> (qq ` r))
[PROOF STEP]
show "finite (\<Union>(qq ` r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union> (qq ` r))
[PROOF STEP]
by (meson finite_UN qq \<open>finite r\<close> tagged_division_of_finite)
[PROOF STATE]
proof (state)
this:
finite (\<Union> (qq ` r))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + (\<Sum>(x, K)\<in>\<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + (\<Sum>(x, K)\<in>\<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
have "content M *\<^sub>R f x = 0"
      if x: "(x,M) \<in> qq K" "(x,M) \<in> qq L" and KL: "qq K \<noteq> qq L" and r: "K \<in> r" "L \<in> r"
    for x M K L
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content M *\<^sub>R f x = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. content M *\<^sub>R f x = (0::'a)
[PROOF STEP]
note kl = tagged_division_ofD(3,4)[OF qq[THEN conjunct1]]
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i \<in> r; (?x, ?K) \<in> qq ?i\<rbrakk> \<Longrightarrow> ?K \<subseteq> ?i
\<lbrakk>?i \<in> r; (?x, ?K) \<in> qq ?i\<rbrakk> \<Longrightarrow> \<exists>a b. ?K = cbox a b

goal (1 subgoal):
 1. content M *\<^sub>R f x = (0::'a)
[PROOF STEP]
obtain u v where uv: "M = cbox u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u v. M = cbox u v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>(x, M) \<in> qq L\<close> \<open>L \<in> r\<close> kl(2)
[PROOF STATE]
proof (prove)
using this:
(x, M) \<in> qq L
L \<in> r
\<lbrakk>?i \<in> r; (?x, ?K) \<in> qq ?i\<rbrakk> \<Longrightarrow> \<exists>a b. ?K = cbox a b

goal (1 subgoal):
 1. (\<And>u v. M = cbox u v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M = cbox u v

goal (1 subgoal):
 1. content M *\<^sub>R f x = (0::'a)
[PROOF STEP]
have empty: "interior (K \<inter> L) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior (K \<inter> L) = {}
[PROOF STEP]
by (metis DiffD1 interior_Int q'(5) r_def KL r)
[PROOF STATE]
proof (state)
this:
interior (K \<inter> L) = {}

goal (1 subgoal):
 1. content M *\<^sub>R f x = (0::'a)
[PROOF STEP]
have "interior M = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior M = {}
[PROOF STEP]
by (metis (no_types, lifting) Int_assoc empty inf.absorb_iff2 interior_Int kl(1) subset_empty x r)
[PROOF STATE]
proof (state)
this:
interior M = {}

goal (1 subgoal):
 1. content M *\<^sub>R f x = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
interior M = {}
[PROOF STEP]
show "content M *\<^sub>R f x = 0"
[PROOF STATE]
proof (prove)
using this:
interior M = {}

goal (1 subgoal):
 1. content M *\<^sub>R f x = (0::'a)
[PROOF STEP]
unfolding uv content_eq_0_interior[symmetric]
[PROOF STATE]
proof (prove)
using this:
content (cbox u v) = 0

goal (1 subgoal):
 1. content (cbox u v) *\<^sub>R f x = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
content M *\<^sub>R f x = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?x1, ?M1) \<in> qq ?K1; (?x1, ?M1) \<in> qq ?L1; qq ?K1 \<noteq> qq ?L1; ?K1 \<in> r; ?L1 \<in> r\<rbrakk> \<Longrightarrow> content ?M1 *\<^sub>R f ?x1 = (0::'a)

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + (\<Sum>(x, K)\<in>\<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e
\<lbrakk>(?x1, ?M1) \<in> qq ?K1; (?x1, ?M1) \<in> qq ?L1; qq ?K1 \<noteq> qq ?L1; ?K1 \<in> r; ?L1 \<in> r\<rbrakk> \<Longrightarrow> content ?M1 *\<^sub>R f ?x1 = (0::'a)
[PROOF STEP]
have "norm (?SUM p + sum ?SUM (qq ` r) - integral (cbox a b) f) < e"
[PROOF STATE]
proof (prove)
using this:
norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + (\<Sum>(x, K)\<in>\<Union> (qq ` r). content K *\<^sub>R f x) - integral (cbox a b) f) < e
\<lbrakk>(?x1, ?M1) \<in> qq ?K1; (?x1, ?M1) \<in> qq ?L1; qq ?K1 \<noteq> qq ?L1; ?K1 \<in> r; ?L1 \<in> r\<rbrakk> \<Longrightarrow> content ?M1 *\<^sub>R f ?x1 = (0::'a)

goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + sum (sum (\<lambda>(x, K). content K *\<^sub>R f x)) (qq ` r) - integral (cbox a b) f) < e
[PROOF STEP]
apply (subst (asm) sum.Union_comp)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<And>x M K L. \<lbrakk>(x, M) \<in> qq K; (x, M) \<in> qq L; qq K \<noteq> qq L; K \<in> r; L \<in> r\<rbrakk> \<Longrightarrow> content M *\<^sub>R f x = (0::'a)) \<Longrightarrow> Ball (qq ` r) finite
 2. \<And>A1 A2 x. \<lbrakk>\<And>x M K L. \<lbrakk>(x, M) \<in> qq K; (x, M) \<in> qq L; qq K \<noteq> qq L; K \<in> r; L \<in> r\<rbrakk> \<Longrightarrow> content M *\<^sub>R f x = (0::'a); A1 \<in> qq ` r; A2 \<in> qq ` r; A1 \<noteq> A2; x \<in> A1; x \<in> A2\<rbrakk> \<Longrightarrow> (case x of (x, K) \<Rightarrow> content K *\<^sub>R f x) = (0::'a)
 3. \<lbrakk>norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + (sum \<circ> sum) (\<lambda>(x, K). content K *\<^sub>R f x) (qq ` r) - integral (cbox a b) f) < e; \<And>x M K L. \<lbrakk>(x, M) \<in> qq K; (x, M) \<in> qq L; qq K \<noteq> qq L; K \<in> r; L \<in> r\<rbrakk> \<Longrightarrow> content M *\<^sub>R f x = (0::'a)\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + sum (sum (\<lambda>(x, K). content K *\<^sub>R f x)) (qq ` r) - integral (cbox a b) f) < e
[PROOF STEP]
using qq
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> r \<Longrightarrow> qq ?i1 tagged_division_of ?i1 \<and> d fine qq ?i1 \<and> norm ((\<Sum>(x, K)\<in>qq ?i1. content K *\<^sub>R f x) - integral ?i1 f) < k / (real (card r) + 1)

goal (3 subgoals):
 1. (\<And>x M K L. \<lbrakk>(x, M) \<in> qq K; (x, M) \<in> qq L; qq K \<noteq> qq L; K \<in> r; L \<in> r\<rbrakk> \<Longrightarrow> content M *\<^sub>R f x = (0::'a)) \<Longrightarrow> Ball (qq ` r) finite
 2. \<And>A1 A2 x. \<lbrakk>\<And>x M K L. \<lbrakk>(x, M) \<in> qq K; (x, M) \<in> qq L; qq K \<noteq> qq L; K \<in> r; L \<in> r\<rbrakk> \<Longrightarrow> content M *\<^sub>R f x = (0::'a); A1 \<in> qq ` r; A2 \<in> qq ` r; A1 \<noteq> A2; x \<in> A1; x \<in> A2\<rbrakk> \<Longrightarrow> (case x of (x, K) \<Rightarrow> content K *\<^sub>R f x) = (0::'a)
 3. \<lbrakk>norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + (sum \<circ> sum) (\<lambda>(x, K). content K *\<^sub>R f x) (qq ` r) - integral (cbox a b) f) < e; \<And>x M K L. \<lbrakk>(x, M) \<in> qq K; (x, M) \<in> qq L; qq K \<noteq> qq L; K \<in> r; L \<in> r\<rbrakk> \<Longrightarrow> content M *\<^sub>R f x = (0::'a)\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + sum (sum (\<lambda>(x, K). content K *\<^sub>R f x)) (qq ` r) - integral (cbox a b) f) < e
[PROOF STEP]
by (force simp: split_paired_all)+
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + sum (sum (\<lambda>(x, K). content K *\<^sub>R f x)) (qq ` r) - integral (cbox a b) f) < e

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + sum (sum (\<lambda>(x, K). content K *\<^sub>R f x)) (qq ` r) - integral (cbox a b) f) < e

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
have "content M *\<^sub>R f x = 0"
       if "K \<in> r" "L \<in> r" "K \<noteq> L" "qq K = qq L" "(x, M) \<in> qq K" for K L x M
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content M *\<^sub>R f x = (0::'a)
[PROOF STEP]
using tagged_division_ofD(6) qq that
[PROOF STATE]
proof (prove)
using this:
?s tagged_division_of ?i \<Longrightarrow> \<Union> {K. \<exists>x. (x, K) \<in> ?s} = ?i
?i1 \<in> r \<Longrightarrow> qq ?i1 tagged_division_of ?i1 \<and> d fine qq ?i1 \<and> norm ((\<Sum>(x, K)\<in>qq ?i1. content K *\<^sub>R f x) - integral ?i1 f) < k / (real (card r) + 1)
K \<in> r
L \<in> r
K \<noteq> L
qq K = qq L
(x, M) \<in> qq K

goal (1 subgoal):
 1. content M *\<^sub>R f x = (0::'a)
[PROOF STEP]
by (metis (no_types, lifting))
[PROOF STATE]
proof (state)
this:
\<lbrakk>?K1 \<in> r; ?L1 \<in> r; ?K1 \<noteq> ?L1; qq ?K1 = qq ?L1; (?x1, ?M1) \<in> qq ?K1\<rbrakk> \<Longrightarrow> content ?M1 *\<^sub>R f ?x1 = (0::'a)

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + sum (sum (\<lambda>(x, K). content K *\<^sub>R f x)) (qq ` r) - integral (cbox a b) f) < e
\<lbrakk>?K1 \<in> r; ?L1 \<in> r; ?K1 \<noteq> ?L1; qq ?K1 = qq ?L1; (?x1, ?M1) \<in> qq ?K1\<rbrakk> \<Longrightarrow> content ?M1 *\<^sub>R f ?x1 = (0::'a)
[PROOF STEP]
have less_e: "norm (?SUM p + sum (?SUM \<circ> qq) r - integral (cbox a b) f) < e"
[PROOF STATE]
proof (prove)
using this:
norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + sum (sum (\<lambda>(x, K). content K *\<^sub>R f x)) (qq ` r) - integral (cbox a b) f) < e
\<lbrakk>?K1 \<in> r; ?L1 \<in> r; ?K1 \<noteq> ?L1; qq ?K1 = qq ?L1; (?x1, ?M1) \<in> qq ?K1\<rbrakk> \<Longrightarrow> content ?M1 *\<^sub>R f ?x1 = (0::'a)

goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - integral (cbox a b) f) < e
[PROOF STEP]
proof (subst (asm) sum.reindex_nontrivial [OF \<open>finite r\<close>])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>\<And>K L x M. \<lbrakk>K \<in> r; L \<in> r; K \<noteq> L; qq K = qq L; (x, M) \<in> qq K\<rbrakk> \<Longrightarrow> content M *\<^sub>R f x = (0::'a); x \<in> r; y \<in> r; x \<noteq> y; qq x = qq y\<rbrakk> \<Longrightarrow> (\<Sum>(x, K)\<in>qq x. content K *\<^sub>R f x) = (0::'a)
 2. \<lbrakk>norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - integral (cbox a b) f) < e; \<And>K L x M. \<lbrakk>K \<in> r; L \<in> r; K \<noteq> L; qq K = qq L; (x, M) \<in> qq K\<rbrakk> \<Longrightarrow> content M *\<^sub>R f x = (0::'a)\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - integral (cbox a b) f) < e
[PROOF STEP]
qed (auto simp: split_paired_all sum.neutral)
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) + sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - integral (cbox a b) f) < e

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
have norm_le: "norm (cp - ip) \<le> e + k"
                  if "norm ((cp + cr) - i) < e" "norm (cr - ir) < k" "ip + ir = i"
                  for ir ip i cr cp::'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (cp - ip) \<le> e + k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (cp - ip) \<le> e + k
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
norm (cp + cr - i) < e
norm (cr - ir) < k
ip + ir = i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (cp + cr - i) < e
norm (cr - ir) < k
ip + ir = i

goal (1 subgoal):
 1. norm (cp - ip) \<le> e + k
[PROOF STEP]
using norm_triangle_le[of "cp + cr - i" "- (cr - ir)"]
[PROOF STATE]
proof (prove)
using this:
norm (cp + cr - i) < e
norm (cr - ir) < k
ip + ir = i
norm (cp + cr - i) + norm (- (cr - ir)) \<le> ?e \<Longrightarrow> norm (cp + cr - i + - (cr - ir)) \<le> ?e

goal (1 subgoal):
 1. norm (cp - ip) \<le> e + k
[PROOF STEP]
unfolding that(3)[symmetric] norm_minus_cancel
[PROOF STATE]
proof (prove)
using this:
norm (cp + cr - (ip + ir)) < e
norm (cr - ir) < k
ip + ir = ip + ir
norm (cp + cr - (ip + ir)) + norm (cr - ir) \<le> ?e \<Longrightarrow> norm (cp + cr - (ip + ir) + - (cr - ir)) \<le> ?e

goal (1 subgoal):
 1. norm (cp - ip) \<le> e + k
[PROOF STEP]
by (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
norm (cp - ip) \<le> e + k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>norm (?cp1 + ?cr1 - ?i1) < e; norm (?cr1 - ?ir1) < k; ?ip1 + ?ir1 = ?i1\<rbrakk> \<Longrightarrow> norm (?cp1 - ?ip1) \<le> e + k

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
have "?lhs =  norm (?SUM p - (\<Sum>(x, k)\<in>p. integral k f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) = norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f))
[PROOF STEP]
unfolding split_def sum_subtractf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((\<Sum>p\<in>p. content (snd p) *\<^sub>R f (fst p)) - (\<Sum>p\<in>p. integral (snd p) f)) = norm ((\<Sum>p\<in>p. content (snd p) *\<^sub>R f (fst p)) - (\<Sum>p\<in>p. integral (snd p) f))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) = norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f))

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) = norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f))

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
have "\<dots> \<le> e + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f)) \<le> e + k
[PROOF STEP]
proof (rule norm_le[OF less_e])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - ?ir1) < k
 2. (\<Sum>(x, k)\<in>p. integral k f) + ?ir1 = integral (cbox a b) f
[PROOF STEP]
have lessk: "k * real (card r) / (1 + real (card r)) < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * real (card r) / (1 + real (card r)) < k
[PROOF STEP]
using \<open>k>0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. k * real (card r) / (1 + real (card r)) < k
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
k * real (card r) / (1 + real (card r)) < k

goal (2 subgoals):
 1. norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - ?ir1) < k
 2. (\<Sum>(x, k)\<in>p. integral k f) + ?ir1 = integral (cbox a b) f
[PROOF STEP]
have "norm (sum (?SUM \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) \<le> (\<Sum>x\<in>r. k / (real (card r) + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) \<le> (\<Sum>x\<in>r. k / (real (card r) + 1))
[PROOF STEP]
unfolding sum_subtractf[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>x\<in>r. (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) x - integral x f) \<le> (\<Sum>x\<in>r. k / (real (card r) + 1))
[PROOF STEP]
by (force dest: qq intro!: sum_norm_le)
[PROOF STATE]
proof (state)
this:
norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) \<le> (\<Sum>x\<in>r. k / (real (card r) + 1))

goal (2 subgoals):
 1. norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - ?ir1) < k
 2. (\<Sum>(x, k)\<in>p. integral k f) + ?ir1 = integral (cbox a b) f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) \<le> (\<Sum>x\<in>r. k / (real (card r) + 1))

goal (2 subgoals):
 1. norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - ?ir1) < k
 2. (\<Sum>(x, k)\<in>p. integral k f) + ?ir1 = integral (cbox a b) f
[PROOF STEP]
have "... < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>r. k / (real (card r) + 1)) < k
[PROOF STEP]
by (simp add: lessk add.commute mult.commute)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>r. k / (real (card r) + 1)) < k

goal (2 subgoals):
 1. norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - ?ir1) < k
 2. (\<Sum>(x, k)\<in>p. integral k f) + ?ir1 = integral (cbox a b) f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) < k
[PROOF STEP]
show "norm (sum (?SUM \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) < k"
[PROOF STATE]
proof (prove)
using this:
norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) < k

goal (1 subgoal):
 1. norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) < k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (sum (sum (\<lambda>(x, K). content K *\<^sub>R f x) \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) < k

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>r. integral k f) = integral (cbox a b) f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>r. integral k f) = integral (cbox a b) f
[PROOF STEP]
from q(1)
[PROOF STATE]
proof (chain)
picking this:
snd ` p \<subseteq> q
[PROOF STEP]
have [simp]: "snd ` p \<union> q = q"
[PROOF STATE]
proof (prove)
using this:
snd ` p \<subseteq> q

goal (1 subgoal):
 1. snd ` p \<union> q = q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
snd ` p \<union> q = q

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>r. integral k f) = integral (cbox a b) f
[PROOF STEP]
have "integral l f = 0"
      if inp: "(x, l) \<in> p" "(y, m) \<in> p" and ne: "(x, l) \<noteq> (y, m)" and "l = m" for x l y m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral l f = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral l f = (0::'a)
[PROOF STEP]
obtain u v where uv: "l = cbox u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u v. l = cbox u v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using inp p'(4)
[PROOF STATE]
proof (prove)
using this:
(x, l) \<in> p
(y, m) \<in> p
(?x, ?K) \<in> p \<Longrightarrow> \<exists>a b. ?K = cbox a b

goal (1 subgoal):
 1. (\<And>u v. l = cbox u v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
l = cbox u v

goal (1 subgoal):
 1. integral l f = (0::'a)
[PROOF STEP]
have "content (cbox u v) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (cbox u v) = 0
[PROOF STEP]
unfolding content_eq_0_interior
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior (cbox u v) = {}
[PROOF STEP]
using that p(1) uv
[PROOF STATE]
proof (prove)
using this:
(x, l) \<in> p
(y, m) \<in> p
(x, l) \<noteq> (y, m)
l = m
p tagged_partial_division_of cbox a b
l = cbox u v

goal (1 subgoal):
 1. interior (cbox u v) = {}
[PROOF STEP]
by (auto dest: tagged_partial_division_ofD)
[PROOF STATE]
proof (state)
this:
content (cbox u v) = 0

goal (1 subgoal):
 1. integral l f = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
content (cbox u v) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
content (cbox u v) = 0

goal (1 subgoal):
 1. integral l f = (0::'a)
[PROOF STEP]
using uv
[PROOF STATE]
proof (prove)
using this:
content (cbox u v) = 0
l = cbox u v

goal (1 subgoal):
 1. integral l f = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
integral l f = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?x1, ?l1) \<in> p; (?y1, ?m1) \<in> p; (?x1, ?l1) \<noteq> (?y1, ?m1); ?l1 = ?m1\<rbrakk> \<Longrightarrow> integral ?l1 f = (0::'a)

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>r. integral k f) = integral (cbox a b) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>(?x1, ?l1) \<in> p; (?y1, ?m1) \<in> p; (?x1, ?l1) \<noteq> (?y1, ?m1); ?l1 = ?m1\<rbrakk> \<Longrightarrow> integral ?l1 f = (0::'a)
[PROOF STEP]
have "(\<Sum>(x, K)\<in>p. integral K f) = (\<Sum>K\<in>snd ` p. integral K f)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?x1, ?l1) \<in> p; (?y1, ?m1) \<in> p; (?x1, ?l1) \<noteq> (?y1, ?m1); ?l1 = ?m1\<rbrakk> \<Longrightarrow> integral ?l1 f = (0::'a)

goal (1 subgoal):
 1. (\<Sum>(x, K)\<in>p. integral K f) = (\<Sum>K\<in>snd ` p. integral K f)
[PROOF STEP]
apply (subst sum.reindex_nontrivial [OF \<open>finite p\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>\<And>x l y m. \<lbrakk>(x, l) \<in> p; (y, m) \<in> p; (x, l) \<noteq> (y, m); l = m\<rbrakk> \<Longrightarrow> integral l f = (0::'a); x \<in> p; y \<in> p; x \<noteq> y; snd x = snd y\<rbrakk> \<Longrightarrow> integral (snd x) f = (0::'a)
 2. (\<And>x l y m. \<lbrakk>(x, l) \<in> p; (y, m) \<in> p; (x, l) \<noteq> (y, m); l = m\<rbrakk> \<Longrightarrow> integral l f = (0::'a)) \<Longrightarrow> (\<Sum>(x, K)\<in>p. integral K f) = sum ((\<lambda>K. integral K f) \<circ> snd) p
[PROOF STEP]
unfolding split_paired_all split_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b aa ba. \<lbrakk>\<And>x l y m. \<lbrakk>(x, l) \<in> p; (y, m) \<in> p; (x, l) \<noteq> (y, m); l = m\<rbrakk> \<Longrightarrow> integral l f = (0::'a); (a, b) \<in> p; (aa, ba) \<in> p; (a, b) \<noteq> (aa, ba); snd (a, b) = snd (aa, ba)\<rbrakk> \<Longrightarrow> integral (snd (a, b)) f = (0::'a)
 2. (\<And>x l y m. \<lbrakk>(x, l) \<in> p; (y, m) \<in> p; (x, l) \<noteq> (y, m); l = m\<rbrakk> \<Longrightarrow> integral l f = (0::'a)) \<Longrightarrow> (\<Sum>p\<in>p. integral (snd p) f) = sum ((\<lambda>K. integral K f) \<circ> snd) p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, K)\<in>p. integral K f) = (\<Sum>K\<in>snd ` p. integral K f)

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>r. integral k f) = integral (cbox a b) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>(x, K)\<in>p. integral K f) = (\<Sum>K\<in>snd ` p. integral K f)
[PROOF STEP]
show "(\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>r. integral k f) = integral (cbox a b) f"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(x, K)\<in>p. integral K f) = (\<Sum>K\<in>snd ` p. integral K f)

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>r. integral k f) = integral (cbox a b) f
[PROOF STEP]
unfolding integral_combine_division_topdown[OF intf qdiv] r_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(x, K)\<in>p. integral K f) = (\<Sum>K\<in>snd ` p. integral K f)

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>q - snd ` p. integral k f) = (\<Sum>i\<in>q. integral i f)
[PROOF STEP]
using q'(1) p'(1) sum.union_disjoint [of "snd ` p" "q - snd ` p", symmetric]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(x, K)\<in>p. integral K f) = (\<Sum>K\<in>snd ` p. integral K f)
finite q
finite p
\<lbrakk>finite (snd ` p); finite (q - snd ` p); snd ` p \<inter> (q - snd ` p) = {}\<rbrakk> \<Longrightarrow> sum ?g (snd ` p) + sum ?g (q - snd ` p) = sum ?g (snd ` p \<union> (q - snd ` p))

goal (1 subgoal):
 1. (\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>q - snd ` p. integral k f) = (\<Sum>i\<in>q. integral i f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>r. integral k f) = integral (cbox a b) f

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f)) \<le> e + k

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + ea
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + k
[PROOF STEP]
show "?lhs \<le> e + k"
[PROOF STATE]
proof (prove)
using this:
norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + k

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x - integral K f) \<le> e + k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma strict_sorted_imp_sorted: "sorted_wrt (<) xs \<Longrightarrow> sorted xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (<) xs \<Longrightarrow> sorted xs
[PROOF STEP]
by (auto simp: strict_sorted_iff)


[STATEMENT]
lemma joinable_components_eq:
  "connected t \<and> t \<subseteq> s \<and> c1 \<in> components s \<and> c2 \<in> components s \<and> c1 \<inter> t \<noteq> {} \<and> c2 \<inter> t \<noteq> {} \<Longrightarrow> c1 = c2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected t \<and> t \<subseteq> s \<and> c1 \<in> components s \<and> c2 \<in> components s \<and> c1 \<inter> t \<noteq> {} \<and> c2 \<inter> t \<noteq> {} \<Longrightarrow> c1 = c2
[PROOF STEP]
by (metis (full_types) components_iff joinable_connected_component_eq)


[STATEMENT]
lemma rdvd_left1_int: "real_of_int \<lfloor>t\<rfloor> = t \<Longrightarrow> 1 rdvd t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lfloor>t\<rfloor> = t \<Longrightarrow> 1 rdvd t
[PROOF STEP]
by (simp add: rdvd_def,rule_tac x="\<lfloor>t\<rfloor>" in exI) simp


[STATEMENT]
lemma sphere_1D_doubleton:
  fixes a :: "'a :: euclidean_space"
  assumes "DIM('a) = 1" and "r > 0"
  obtains x y where "sphere a r = {x,y} \<and> dist x y = 2*r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. sphere a r = {x, y} \<and> dist x y = 2 * r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>x y. sphere a r = {x, y} \<and> dist x y = 2 * r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "sphere a r = (+) a ` sphere 0 r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sphere a r = (+) a ` sphere (0::'a) r
[PROOF STEP]
by (metis add.right_neutral sphere_translation)
[PROOF STATE]
proof (state)
this:
sphere a r = (+) a ` sphere (0::'a) r

goal (1 subgoal):
 1. (\<And>x y. sphere a r = {x, y} \<and> dist x y = 2 * r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sphere a r = (+) a ` sphere (0::'a) r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sphere a r = (+) a ` sphere (0::'a) r

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using sphere_1D_doubleton_zero [OF assms]
[PROOF STATE]
proof (prove)
using this:
sphere a r = (+) a ` sphere (0::'a) r
(\<And>x y. sphere (0::'a) r = {x, y} \<and> dist x y = 2 * r \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (metis (mono_tags, lifting) dist_add_cancel image_empty image_insert that)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lookup_present_eq_key'': "distinct (map fst al) \<Longrightarrow> lookup (\<lambda>x. x=k) al = Some v \<longleftrightarrow> (k, v) \<in> set al "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map fst al) \<Longrightarrow> (lookup (\<lambda>x. x = k) al = Some v) = ((k, v) \<in> set al)
[PROOF STEP]
by (induction al) (auto simp add: rev_image_eqI split: if_splits)


[STATEMENT]
lemma Fejer_kernel:
     "Fejer_kernel n x =
        (if n = 0 then 0
         else if x = 0 then n/2
         else sin(n / 2 * x) ^ 2 / (2 * n * sin(x/2) ^ 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
proof (cases "x=0 \<or> sin(x/2) = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<or> sin (x / 2) = 0 \<Longrightarrow> Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
 2. \<not> (x = 0 \<or> sin (x / 2) = 0) \<Longrightarrow> Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = 0 \<or> sin (x / 2) = 0

goal (2 subgoals):
 1. x = 0 \<or> sin (x / 2) = 0 \<Longrightarrow> Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
 2. \<not> (x = 0 \<or> sin (x / 2) = 0) \<Longrightarrow> Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
have "(\<Sum>r<n. (1 + real r * 2)) = real n * real n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r<n. 1 + real r * 2) = real n * real n
[PROOF STEP]
by (induction n) (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>r<n. 1 + real r * 2) = real n * real n

goal (2 subgoals):
 1. x = 0 \<or> sin (x / 2) = 0 \<Longrightarrow> Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
 2. \<not> (x = 0 \<or> sin (x / 2) = 0) \<Longrightarrow> Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
x = 0 \<or> sin (x / 2) = 0
(\<Sum>r<n. 1 + real r * 2) = real n * real n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = 0 \<or> sin (x / 2) = 0
(\<Sum>r<n. 1 + real r * 2) = real n * real n

goal (1 subgoal):
 1. Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
by (auto simp: Fejer_kernel_def Dirichlet_kernel_def field_simps simp flip: sum_divide_distrib)
[PROOF STATE]
proof (state)
this:
Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))

goal (1 subgoal):
 1. \<not> (x = 0 \<or> sin (x / 2) = 0) \<Longrightarrow> Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (x = 0 \<or> sin (x / 2) = 0) \<Longrightarrow> Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (x = 0 \<or> sin (x / 2) = 0)

goal (1 subgoal):
 1. \<not> (x = 0 \<or> sin (x / 2) = 0) \<Longrightarrow> Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
have "sin (x/2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) =
        sin (real n * x / 2) * sin (real n * x / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2)
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sin (x / 2) * (\<Sum>r<0. sin ((real r * 2 + 1) * x / 2)) = sin (real 0 * x / 2) * sin (real 0 * x / 2)
 2. \<And>n. sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2) \<Longrightarrow> sin (x / 2) * (\<Sum>r<Suc n. sin ((real r * 2 + 1) * x / 2)) = sin (real (Suc n) * x / 2) * sin (real (Suc n) * x / 2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sin (x / 2) * (\<Sum>r<0. sin ((real r * 2 + 1) * x / 2)) = sin (real 0 * x / 2) * sin (real 0 * x / 2)
 2. \<And>n. sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2) \<Longrightarrow> sin (x / 2) * (\<Sum>r<Suc n. sin ((real r * 2 + 1) * x / 2)) = sin (real (Suc n) * x / 2) * sin (real (Suc n) * x / 2)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2)

goal (2 subgoals):
 1. sin (x / 2) * (\<Sum>r<0. sin ((real r * 2 + 1) * x / 2)) = sin (real 0 * x / 2) * sin (real 0 * x / 2)
 2. \<And>n. sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2) \<Longrightarrow> sin (x / 2) * (\<Sum>r<Suc n. sin ((real r * 2 + 1) * x / 2)) = sin (real (Suc n) * x / 2) * sin (real (Suc n) * x / 2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2)

goal (1 subgoal):
 1. sin (x / 2) * (\<Sum>r<Suc n. sin ((real r * 2 + 1) * x / 2)) = sin (real (Suc n) * x / 2) * sin (real (Suc n) * x / 2)
[PROOF STEP]
apply (simp add: field_simps sin_times_sin)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x * real n) + 2 * (sin (x / 2) * (\<Sum>r<n. sin ((x + x * (real r * 2)) / 2))) = 1 \<Longrightarrow> cos ((x * 2 + x * (real n * 2)) / 2) = cos ((x * 4 + x * (real n * 4)) / 4)
[PROOF STEP]
apply (simp add: add_divide_distrib)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
sin (x / 2) * (\<Sum>r<Suc n. sin ((real r * 2 + 1) * x / 2)) = sin (real (Suc n) * x / 2) * sin (real (Suc n) * x / 2)

goal (1 subgoal):
 1. sin (x / 2) * (\<Sum>r<0. sin ((real r * 2 + 1) * x / 2)) = sin (real 0 * x / 2) * sin (real 0 * x / 2)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2)

goal (1 subgoal):
 1. \<not> (x = 0 \<or> sin (x / 2) = 0) \<Longrightarrow> Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2)

goal (1 subgoal):
 1. Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2)
\<not> (x = 0 \<or> sin (x / 2) = 0)

goal (1 subgoal):
 1. Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
unfolding Fejer_kernel_def Dirichlet_kernel_def
[PROOF STATE]
proof (prove)
using this:
sin (x / 2) * (\<Sum>r<n. sin ((real r * 2 + 1) * x / 2)) = sin (real n * x / 2) * sin (real n * x / 2)
\<not> (x = 0 \<or> sin (x / 2) = 0)

goal (1 subgoal):
 1. (if n = 0 then 0 else (\<Sum>r<n. if x = 0 then real r + 1 / 2 else sin ((real r + 1 / 2) * x) / (2 * sin (x / 2))) / real n) = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))
[PROOF STEP]
by (simp add: divide_simps power2_eq_square mult.commute flip: sum_divide_distrib)
[PROOF STATE]
proof (state)
this:
Fejer_kernel n x = (if n = 0 then 0 else if x = 0 then real n / 2 else (sin (real n / 2 * x))\<^sup>2 / (2 * real n * (sin (x / 2))\<^sup>2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lerch_lemma:
  fixes h::"real \<Rightarrow> 'a::euclidean_space"
  assumes [continuous_intros]: "continuous_on {0 .. 1} h"
  assumes int_0: "\<And>n. ((\<lambda>u. u ^ n *\<^sub>R h u) has_integral 0) {0 .. 1}"
  assumes u: "0 \<le> u" "u \<le> 1"
  shows "h u = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h u = (0::'a)
[PROOF STEP]
proof (rule euclidean_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> h u \<bullet> b = (0::'a) \<bullet> b
[PROOF STEP]
fix b::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> h u \<bullet> b = (0::'a) \<bullet> b
[PROOF STEP]
assume "b \<in> Basis"
[PROOF STATE]
proof (state)
this:
b \<in> Basis

goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> h u \<bullet> b = (0::'a) \<bullet> b
[PROOF STEP]
have "continuous_on {0 .. 1} (\<lambda>x. h x \<bullet> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>x. h x \<bullet> b)
[PROOF STEP]
by (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>x. h x \<bullet> b)

goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> h u \<bullet> b = (0::'a) \<bullet> b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>x. h x \<bullet> b)

goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> h u \<bullet> b = (0::'a) \<bullet> b
[PROOF STEP]
from \<open>b \<in> Basis\<close>
[PROOF STATE]
proof (chain)
picking this:
b \<in> Basis
[PROOF STEP]
have "((\<lambda>u. u ^ n * (h u \<bullet> b)) has_integral 0) {0 .. 1}" for n
[PROOF STATE]
proof (prove)
using this:
b \<in> Basis

goal (1 subgoal):
 1. ((\<lambda>u. u ^ n * (h u \<bullet> b)) has_integral 0) {0..1}
[PROOF STEP]
using int_0[of n] has_integral_componentwise_iff[of "\<lambda>u. u ^ n *\<^sub>R h u" 0 "{0 .. 1}"]
[PROOF STATE]
proof (prove)
using this:
b \<in> Basis
((\<lambda>u. u ^ n *\<^sub>R h u) has_integral (0::'a)) {0..1}
((\<lambda>u. u ^ n *\<^sub>R h u) has_integral (0::'a)) {0..1} = (\<forall>b\<in>Basis. ((\<lambda>x. x ^ n *\<^sub>R h x \<bullet> b) has_integral (0::'a) \<bullet> b) {0..1})

goal (1 subgoal):
 1. ((\<lambda>u. u ^ n * (h u \<bullet> b)) has_integral 0) {0..1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>u. u ^ ?n * (h u \<bullet> b)) has_integral 0) {0..1}

goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> h u \<bullet> b = (0::'a) \<bullet> b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>u. u ^ ?n * (h u \<bullet> b)) has_integral 0) {0..1}

goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> h u \<bullet> b = (0::'a) \<bullet> b
[PROOF STEP]
note u
[PROOF STATE]
proof (state)
this:
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> h u \<bullet> b = (0::'a) \<bullet> b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
continuous_on {0..1} (\<lambda>x. h x \<bullet> b)
((\<lambda>u. u ^ ?n * (h u \<bullet> b)) has_integral 0) {0..1}
0 \<le> u
u \<le> 1
[PROOF STEP]
show "h u \<bullet> b = 0 \<bullet> b"
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} (\<lambda>x. h x \<bullet> b)
((\<lambda>u. u ^ ?n * (h u \<bullet> b)) has_integral 0) {0..1}
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. h u \<bullet> b = (0::'a) \<bullet> b
[PROOF STEP]
unfolding inner_zero_left
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} (\<lambda>x. h x \<bullet> b)
((\<lambda>u. u ^ ?n * (h u \<bullet> b)) has_integral 0) {0..1}
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. h u \<bullet> b = 0
[PROOF STEP]
by (rule lerch_lemma_real)
[PROOF STATE]
proof (state)
this:
h u \<bullet> b = (0::'a) \<bullet> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_list: "finite A \<Longrightarrow> \<exists>l. set l = A \<and> distinct l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> \<exists>l. set l = A \<and> distinct l
[PROOF STEP]
proof(induct rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>l. set l = {} \<and> distinct l
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<exists>l. set l = F \<and> distinct l\<rbrakk> \<Longrightarrow> \<exists>l. set l = insert x F \<and> distinct l
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
\<exists>l. set l = F \<and> distinct l

goal (2 subgoals):
 1. \<exists>l. set l = {} \<and> distinct l
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<exists>l. set l = F \<and> distinct l\<rbrakk> \<Longrightarrow> \<exists>l. set l = insert x F \<and> distinct l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
\<exists>l. set l = F \<and> distinct l
[PROOF STEP]
obtain l where "set l = F \<and> distinct l"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<exists>l. set l = F \<and> distinct l

goal (1 subgoal):
 1. (\<And>l. set l = F \<and> distinct l \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set l = F \<and> distinct l

goal (2 subgoals):
 1. \<exists>l. set l = {} \<and> distinct l
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<exists>l. set l = F \<and> distinct l\<rbrakk> \<Longrightarrow> \<exists>l. set l = insert x F \<and> distinct l
[PROOF STEP]
with insert
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
\<exists>l. set l = F \<and> distinct l
set l = F \<and> distinct l
[PROOF STEP]
have "set (x#l) = insert x F \<and> distinct (x#l)"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<exists>l. set l = F \<and> distinct l
set l = F \<and> distinct l

goal (1 subgoal):
 1. set (x # l) = insert x F \<and> distinct (x # l)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (x # l) = insert x F \<and> distinct (x # l)

goal (2 subgoals):
 1. \<exists>l. set l = {} \<and> distinct l
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<exists>l. set l = F \<and> distinct l\<rbrakk> \<Longrightarrow> \<exists>l. set l = insert x F \<and> distinct l
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
set (x # l) = insert x F \<and> distinct (x # l)

goal (1 subgoal):
 1. \<exists>l. set l = insert x F \<and> distinct l
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>l. set l = insert x F \<and> distinct l

goal (1 subgoal):
 1. \<exists>l. set l = {} \<and> distinct l
[PROOF STEP]
qed auto


[STATEMENT]
theorem p_prime: "prime p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
assume "\<not>prime p"
[PROOF STATE]
proof (state)
this:
\<not> prime p

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> prime p
[PROOF STEP]
obtain a b where ab: "p = a * b" "a > 1" "b > 1"
[PROOF STATE]
proof (prove)
using this:
\<not> prime p

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>p = a * b; 1 < a; 1 < b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using p_gt_2 not_prime_imp_ex_prod_nat[of p]
[PROOF STATE]
proof (prove)
using this:
\<not> prime p
2 < p
\<lbrakk>1 < p; \<not> prime p\<rbrakk> \<Longrightarrow> \<exists>n k. p = n * k \<and> 1 < n \<and> n < p \<and> 1 < k \<and> k < p

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

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
have geometric_sum_aux: "(x - (1 :: int)) * (\<Sum>k<a. x ^ k) = x ^ a - 1" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - 1) * sum ((^) x) {..<a} = x ^ a - 1
[PROOF STEP]
by (induction a) (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
(?x - 1) * sum ((^) ?x) {..<a} = ?x ^ a - 1

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
have "(2 ^ b - 1 :: int) * (\<Sum>k<a. (2 ^ b) ^ k) = (2 ^ b) ^ a - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ b - 1) * sum ((^) (2 ^ b)) {..<a} = (2 ^ b) ^ a - 1
[PROOF STEP]
by (rule geometric_sum_aux)
[PROOF STATE]
proof (state)
this:
(2 ^ b - 1) * sum ((^) (2 ^ b)) {..<a} = (2 ^ b) ^ a - 1

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
hence "2 ^ (a*b) - 1 = (2 ^ b - 1 :: int) * (\<Sum>k<a. 2 ^ (k*b))"
[PROOF STATE]
proof (prove)
using this:
(2 ^ b - 1) * sum ((^) (2 ^ b)) {..<a} = (2 ^ b) ^ a - 1

goal (1 subgoal):
 1. 2 ^ (a * b) - 1 = (2 ^ b - 1) * (\<Sum>k<a. 2 ^ (k * b))
[PROOF STEP]
by (simp flip: power_mult add: algebra_simps)
[PROOF STATE]
proof (state)
this:
2 ^ (a * b) - 1 = (2 ^ b - 1) * (\<Sum>k<a. 2 ^ (k * b))

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
hence "(2 ^ b - 1) dvd (2 ^ (a*b) - 1 :: int)"
[PROOF STATE]
proof (prove)
using this:
2 ^ (a * b) - 1 = (2 ^ b - 1) * (\<Sum>k<a. 2 ^ (k * b))

goal (1 subgoal):
 1. 2 ^ b - 1 dvd 2 ^ (a * b) - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ b - 1 dvd 2 ^ (a * b) - 1

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
hence "int (2 ^ b - 1) dvd int (2 ^ (a * b) - 1)"
[PROOF STATE]
proof (prove)
using this:
2 ^ b - 1 dvd 2 ^ (a * b) - 1

goal (1 subgoal):
 1. int (2 ^ b - 1) dvd int (2 ^ (a * b) - 1)
[PROOF STEP]
by (subst of_nat_diff) (auto simp: of_nat_diff)
[PROOF STATE]
proof (state)
this:
int (2 ^ b - 1) dvd int (2 ^ (a * b) - 1)

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
hence "(2 ^ b - 1) dvd (2 ^ (a * b) - 1 :: nat)"
[PROOF STATE]
proof (prove)
using this:
int (2 ^ b - 1) dvd int (2 ^ (a * b) - 1)

goal (1 subgoal):
 1. 2 ^ b - 1 dvd 2 ^ (a * b) - 1
[PROOF STEP]
by (subst (asm) int_dvd_int_iff)
[PROOF STATE]
proof (state)
this:
2 ^ b - 1 dvd 2 ^ (a * b) - 1

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
with prime
[PROOF STATE]
proof (chain)
picking this:
prime M
2 ^ b - 1 dvd 2 ^ (a * b) - 1
[PROOF STEP]
have "2 ^ b - 1 = (1 :: nat) \<or> 2 ^ b - 1 = (2 ^ p - 1 :: nat)"
[PROOF STATE]
proof (prove)
using this:
prime M
2 ^ b - 1 dvd 2 ^ (a * b) - 1

goal (1 subgoal):
 1. 2 ^ b - 1 = 1 \<or> 2 ^ b - 1 = 2 ^ p - 1
[PROOF STEP]
unfolding ab M_def
[PROOF STATE]
proof (prove)
using this:
prime (2 ^ (a * b) - 1)
2 ^ b - 1 dvd 2 ^ (a * b) - 1

goal (1 subgoal):
 1. 2 ^ b - 1 = 1 \<or> 2 ^ b - 1 = 2 ^ (a * b) - 1
[PROOF STEP]
by (intro prime_natD) auto
[PROOF STATE]
proof (state)
this:
2 ^ b - 1 = 1 \<or> 2 ^ b - 1 = 2 ^ p - 1

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
2 ^ b - 1 = 1 \<or> 2 ^ b - 1 = 2 ^ p - 1

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
have "2 ^ b > (2 ^ 1 :: nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ 1 < 2 ^ b
[PROOF STEP]
using ab
[PROOF STATE]
proof (prove)
using this:
p = a * b
1 < a
1 < b

goal (1 subgoal):
 1. 2 ^ 1 < 2 ^ b
[PROOF STEP]
by (intro power_strict_increasing) auto
[PROOF STATE]
proof (state)
this:
2 ^ 1 < 2 ^ b

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
2 ^ 1 < 2 ^ b

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
have "2 ^ b < (2 ^ p :: nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ b < 2 ^ p
[PROOF STEP]
using ab
[PROOF STATE]
proof (prove)
using this:
p = a * b
1 < a
1 < b

goal (1 subgoal):
 1. 2 ^ b < 2 ^ p
[PROOF STEP]
by (intro power_strict_increasing) auto
[PROOF STATE]
proof (state)
this:
2 ^ b < 2 ^ p

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
hence "2 ^ b - 1 < (2 ^ p - 1 :: nat)"
[PROOF STATE]
proof (prove)
using this:
2 ^ b < 2 ^ p

goal (1 subgoal):
 1. 2 ^ b - 1 < 2 ^ p - 1
[PROOF STEP]
by (subst less_diff_iff) auto
[PROOF STATE]
proof (state)
this:
2 ^ b - 1 < 2 ^ p - 1

goal (1 subgoal):
 1. \<not> prime p \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
2 ^ b - 1 = 1 \<or> 2 ^ b - 1 = 2 ^ p - 1
2 ^ 1 < 2 ^ b
2 ^ b - 1 < 2 ^ p - 1
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
2 ^ b - 1 = 1 \<or> 2 ^ b - 1 = 2 ^ p - 1
2 ^ 1 < 2 ^ b
2 ^ b - 1 < 2 ^ p - 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma same_LFP:
  assumes "monotonic f"
  shows "complete_lattice_class.lfp f = LFP f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complete_lattice_class.lfp f = LFP f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. complete_lattice_class.lfp f = LFP f
[PROOF STEP]
have "f (LFP f) = LFP f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (LFP f) = LFP f
[PROOF STEP]
using LFP_is_FP assms
[PROOF STATE]
proof (prove)
using this:
monotonic ?f \<Longrightarrow> ?f (LFP ?f) = LFP ?f
monotonic f

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

goal (1 subgoal):
 1. complete_lattice_class.lfp f = LFP f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (LFP f) = LFP f
[PROOF STEP]
have "smaller_interp (complete_lattice_class.lfp f) (LFP f)"
[PROOF STATE]
proof (prove)
using this:
f (LFP f) = LFP f

goal (1 subgoal):
 1. smaller_interp (complete_lattice_class.lfp f) (LFP f)
[PROOF STEP]
by (metis complete_lattice_class.lfp_lowerbound le_funE preorder_class.order_refl smaller_interp_def)
[PROOF STATE]
proof (state)
this:
smaller_interp (complete_lattice_class.lfp f) (LFP f)

goal (1 subgoal):
 1. complete_lattice_class.lfp f = LFP f
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
smaller_interp (complete_lattice_class.lfp f) (LFP f)

goal (1 subgoal):
 1. complete_lattice_class.lfp f = LFP f
[PROOF STEP]
have "f (complete_lattice_class.gfp f) = complete_lattice_class.gfp f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (complete_lattice_class.gfp f) = complete_lattice_class.gfp f
[PROOF STEP]
using assms gfp_fixpoint mono_same
[PROOF STATE]
proof (prove)
using this:
monotonic f
order_class.mono ?f \<Longrightarrow> ?f (complete_lattice_class.gfp ?f) = complete_lattice_class.gfp ?f
monotonic ?f = order_class.mono ?f

goal (1 subgoal):
 1. f (complete_lattice_class.gfp f) = complete_lattice_class.gfp f
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f (complete_lattice_class.gfp f) = complete_lattice_class.gfp f

goal (1 subgoal):
 1. complete_lattice_class.lfp f = LFP f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (complete_lattice_class.gfp f) = complete_lattice_class.gfp f
[PROOF STEP]
have "smaller_interp (LFP f) (complete_lattice_class.lfp f)"
[PROOF STATE]
proof (prove)
using this:
f (complete_lattice_class.gfp f) = complete_lattice_class.gfp f

goal (1 subgoal):
 1. smaller_interp (LFP f) (complete_lattice_class.lfp f)
[PROOF STEP]
by (meson LFP_least assms lfp_fixpoint mono_same)
[PROOF STATE]
proof (state)
this:
smaller_interp (LFP f) (complete_lattice_class.lfp f)

goal (1 subgoal):
 1. complete_lattice_class.lfp f = LFP f
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
smaller_interp (complete_lattice_class.lfp f) (LFP f)
smaller_interp (LFP f) (complete_lattice_class.lfp f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
smaller_interp (complete_lattice_class.lfp f) (LFP f)
smaller_interp (LFP f) (complete_lattice_class.lfp f)

goal (1 subgoal):
 1. complete_lattice_class.lfp f = LFP f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
complete_lattice_class.lfp f = LFP f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diagonal_2x2_admits_SNF_iff_bezout_ring:
  shows "OFCLASS('a::comm_ring_1, bezout_ring_class)
    \<equiv> (\<And>A::'a mat. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A)" (is "?lhs \<equiv> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OFCLASS('a, bezout_ring_class) \<equiv> (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. OFCLASS('a, bezout_ring_class) \<Longrightarrow> A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A
 2. (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A) \<Longrightarrow> OFCLASS('a, bezout_ring_class)
[PROOF STEP]
fix A::"'a mat"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. OFCLASS('a, bezout_ring_class) \<Longrightarrow> A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A
 2. (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A) \<Longrightarrow> OFCLASS('a, bezout_ring_class)
[PROOF STEP]
assume c: "OFCLASS('a, bezout_ring_class)"
[PROOF STATE]
proof (state)
this:
OFCLASS('a, bezout_ring_class)

goal (2 subgoals):
 1. \<And>A. OFCLASS('a, bezout_ring_class) \<Longrightarrow> A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A
 2. (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A) \<Longrightarrow> OFCLASS('a, bezout_ring_class)
[PROOF STEP]
show "A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A
[PROOF STEP]
using bezout_ring_imp_diagonal_admits_SNF_JNF
          [OF OFCLASS_bezout_ring_imp_class_bezout_ring[where ?'a='a, OF c]]
[PROOF STATE]
proof (prove)
using this:
\<forall>A. admits_SNF_JNF A

goal (1 subgoal):
 1. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A
[PROOF STEP]
unfolding admits_SNF_JNF_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. square_mat A \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_row A) (dim_row A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))

goal (1 subgoal):
 1. A \<in> carrier_mat 2 2 \<longrightarrow> square_mat A \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_row A) (dim_row A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A

goal (1 subgoal):
 1. (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A) \<Longrightarrow> OFCLASS('a, bezout_ring_class)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A) \<Longrightarrow> OFCLASS('a, bezout_ring_class)
[PROOF STEP]
assume rhs: "(\<And>A::'a mat. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A)"
[PROOF STATE]
proof (state)
this:
?A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF ?A

goal (1 subgoal):
 1. (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A) \<Longrightarrow> OFCLASS('a, bezout_ring_class)
[PROOF STEP]
show "OFCLASS('a::comm_ring_1, bezout_ring_class)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OFCLASS('a, bezout_ring_class)
[PROOF STEP]
by (rule diagonal_2x2_admits_SNF_imp_bezout_ring_JNF, insert rhs, simp add: admits_SNF_JNF_def)
[PROOF STATE]
proof (state)
this:
OFCLASS('a, bezout_ring_class)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma star_denest: "(x + y)\<^sup>\<star> = (x\<^sup>\<star> \<cdot> y\<^sup>\<star>)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y)\<^sup>\<star> = (x\<^sup>\<star> \<cdot> y\<^sup>\<star>)\<^sup>\<star>
[PROOF STEP]
by (metis R_lemma add.commute star_denest_var_0 star_plus_one star_prod_unfold star_slide star_trans_eq)


[STATEMENT]
lemma of_rat_add: "of_rat (a + b) = of_rat a + of_rat b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (a + b) = of_rat a + of_rat b
[PROOF STEP]
by transfer (simp add: add_frac_eq)


[STATEMENT]
lemma st_diff: "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> st (x - y) = st x - st y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> st (x - y) = st x - st y
[PROOF STEP]
by (simp add: st_unique st_SReal st_approx_self approx_diff)


[STATEMENT]
lemma comp_sym_tuple [simp]:
    assumes "\<guillemotleft>f0 : a \<rightarrow> b0\<guillemotright>" and "\<guillemotleft>f1 : a \<rightarrow> b1\<guillemotright>"
    shows "\<s>[b0, b1] \<cdot> \<langle>f0, f1\<rangle> = \<langle>f1, f0\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<s>[b0, b1] \<cdot> \<langle>f0, f1\<rangle> = \<langle>f1, f0\<rangle>
[PROOF STEP]
using assms sym_def comp_tuple_arr
[PROOF STATE]
proof (prove)
using this:
\<guillemotleft>f0 : a \<rightarrow> b0\<guillemotright>
\<guillemotleft>f1 : a \<rightarrow> b1\<guillemotright>
\<s>[?a1.0, ?a0.0] \<equiv> if ide ?a0.0 \<and> ide ?a1.0 then \<langle>\<pp>\<^sub>0[?a1.0, ?a0.0], \<pp>\<^sub>1[?a1.0, ?a0.0]\<rangle> else null
\<lbrakk>span ?f ?g; arr ?h; local.dom ?f = cod ?h\<rbrakk> \<Longrightarrow> \<langle>?f, ?g\<rangle> \<cdot> ?h = \<langle>?f \<cdot> ?h, ?g \<cdot> ?h\<rangle>

goal (1 subgoal):
 1. \<s>[b0, b1] \<cdot> \<langle>f0, f1\<rangle> = \<langle>f1, f0\<rangle>
[PROOF STEP]
by fastforce


[STATEMENT]
lemma degree_less_sum' : "MPoly_Type.degree (p::real mpoly) var = n \<Longrightarrow> MPoly_Type.degree (q::real mpoly) var = m \<Longrightarrow> n < m \<Longrightarrow> MPoly_Type.degree (p + q) var = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>MPoly_Type.degree p var = n; MPoly_Type.degree q var = m; n < m\<rbrakk> \<Longrightarrow> MPoly_Type.degree (p + q) var = m
[PROOF STEP]
using degree_less_sum[of q var m p n]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>MPoly_Type.degree q var = m; MPoly_Type.degree p var = n; n < m\<rbrakk> \<Longrightarrow> MPoly_Type.degree (q + p) var = m

goal (1 subgoal):
 1. \<lbrakk>MPoly_Type.degree p var = n; MPoly_Type.degree q var = m; n < m\<rbrakk> \<Longrightarrow> MPoly_Type.degree (p + q) var = m
[PROOF STEP]
by (simp add: add.commute)


[STATEMENT]
lemma unat_numeral: "unat (numeral b :: 'a::len word) = numeral b mod 2 ^ LENGTH('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unat (numeral b) = numeral b mod 2 ^ LENGTH('a)
[PROOF STEP]
by transfer (simp add: take_bit_eq_mod nat_mod_distrib nat_power_eq)


[STATEMENT]
lemma disjoint_dverts_if_wf_sucs:
  "wf_dverts t
    \<Longrightarrow> \<forall>(x,e1) \<in> fset (sucs t). \<forall>(y,e2) \<in> fset (sucs t).
          (dverts x \<inter> dverts y = {} \<or> (x,e1)=(y,e2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_dverts t \<Longrightarrow> \<forall>(x, e1)\<in>fset (sucs t). \<forall>(y, e2)\<in>fset (sucs t). dverts x \<inter> dverts y = {} \<or> (x, e1) = (y, e2)
[PROOF STEP]
using disjoint_dverts_if_wf[of "root t" "sucs t"]
[PROOF STATE]
proof (prove)
using this:
wf_dverts (Node (dtree.root t) (sucs t)) \<Longrightarrow> \<forall>(x, e1)\<in>fset (sucs t). \<forall>(y, e2)\<in>fset (sucs t). dverts x \<inter> dverts y = {} \<or> (x, e1) = (y, e2)

goal (1 subgoal):
 1. wf_dverts t \<Longrightarrow> \<forall>(x, e1)\<in>fset (sucs t). \<forall>(y, e2)\<in>fset (sucs t). dverts x \<inter> dverts y = {} \<or> (x, e1) = (y, e2)
[PROOF STEP]
by simp


[STATEMENT]
lemma face_ofD: "\<lbrakk>T face_of S; x \<in> open_segment a b; a \<in> S; b \<in> S; x \<in> T\<rbrakk> \<Longrightarrow> a \<in> T \<and> b \<in> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T face_of S; x \<in> open_segment a b; a \<in> S; b \<in> S; x \<in> T\<rbrakk> \<Longrightarrow> a \<in> T \<and> b \<in> T
[PROOF STEP]
unfolding face_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T \<subseteq> S \<and> convex T \<and> (\<forall>a\<in>S. \<forall>b\<in>S. \<forall>x\<in>T. x \<in> open_segment a b \<longrightarrow> a \<in> T \<and> b \<in> T); x \<in> open_segment a b; a \<in> S; b \<in> S; x \<in> T\<rbrakk> \<Longrightarrow> a \<in> T \<and> b \<in> T
[PROOF STEP]
by blast


[STATEMENT]
lemma l9_18_R2:
  assumes "Col X Y P" and
    "Col A B P" and
    "Bet A P B" and
    "\<not> Col X Y A" and
    "\<not> Col X Y B"
  shows "X Y TS A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X Y TS A B
[PROOF STEP]
using Col_perm TS_def assms(1) assms(3) assms(4) assms(5)
[PROOF STATE]
proof (prove)
using this:
Col ?A ?B ?C \<Longrightarrow> Col ?A ?B ?C \<and> Col ?A ?C ?B \<and> Col ?B ?A ?C \<and> Col ?B ?C ?A \<and> Col ?C ?A ?B \<and> Col ?C ?B ?A
?A ?B TS ?P ?Q \<equiv> \<not> Col ?P ?A ?B \<and> \<not> Col ?Q ?A ?B \<and> (\<exists>T. Col T ?A ?B \<and> Bet ?P T ?Q)
Col X Y P
Bet A P B
\<not> Col X Y A
\<not> Col X Y B

goal (1 subgoal):
 1. X Y TS A B
[PROOF STEP]
by blast


[STATEMENT]
lemma (in \<Z>) vfst_arrow_is_cat_Par_arr'[cat_rel_Par_set_cs_intros]:
  assumes "A \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>"
    and "B \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>"
    and "AB = A \<times>\<^sub>\<circ> B"
    and "A' = A"
    and "\<CC>' = cat_Par \<alpha>"
  shows "vfst_arrow A B : AB \<mapsto>\<^bsub>\<CC>'\<^esub> A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vfst_arrow A B : AB \<mapsto>\<^bsub>\<CC>'\<^esub> A'
[PROOF STEP]
using assms(1-2)
[PROOF STATE]
proof (prove)
using this:
A \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>
B \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. vfst_arrow A B : AB \<mapsto>\<^bsub>\<CC>'\<^esub> A'
[PROOF STEP]
unfolding assms(3-5)
[PROOF STATE]
proof (prove)
using this:
A \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>
B \<in>\<^sub>\<circ> cat_Par \<alpha>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. vfst_arrow A B : A \<times>\<^sub>\<circ> B \<mapsto>\<^bsub>cat_Par \<alpha>\<^esub> A
[PROOF STEP]
by (rule vfst_arrow_is_cat_Par_arr)


[STATEMENT]
lemma add_left:
  assumes "\<And>x y. x \<succeq>[relation] y \<Longrightarrow> f x \<ge> f y"
  shows "ordinal_utility carrier relation (\<lambda>x. f x + u x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. f x + u x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. f x + u x)
[PROOF STEP]
have "ordinal_utility carrier relation (\<lambda>x. u x + f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. u x + f x)
[PROOF STEP]
by (simp add: add_right assms)
[PROOF STATE]
proof (state)
this:
ordinal_utility carrier relation (\<lambda>x. u x + f x)

goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. f x + u x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ordinal_utility carrier relation (\<lambda>x. u x + f x)

goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. f x + u x)
[PROOF STEP]
using Groups.ab_semigroup_add_class.add.commute
[PROOF STATE]
proof (prove)
using this:
ordinal_utility carrier relation (\<lambda>x. u x + f x)
?a + ?b = ?b + ?a

goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. f x + u x)
[PROOF STEP]
by (simp add: add.commute)
[PROOF STATE]
proof (state)
this:
ordinal_utility carrier relation (\<lambda>x. f x + u x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ball_insert: "(\<forall>x\<in>insert a B. P x) = (P a \<and> (\<forall>x\<in>B. P x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>insert a B. P x) = (P a \<and> (\<forall>x\<in>B. P x))
[PROOF STEP]
by blast


[STATEMENT]
lemma prime_elem_imp_power_coprime:
  "prime_elem p \<Longrightarrow> \<not> p dvd a \<Longrightarrow> coprime a (p ^ m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime_elem p; \<not> p dvd a\<rbrakk> \<Longrightarrow> coprime a (p ^ m)
[PROOF STEP]
by (cases "m > 0") (auto dest: prime_elem_imp_coprime simp add: ac_simps)


[STATEMENT]
lemma Nset_img0:"\<lbrakk>f \<in> {j. j \<le> Suc n} \<rightarrow> B; (f (Suc n)) \<in> f ` {j. j \<le> n}\<rbrakk> \<Longrightarrow>
                   f ` {j. j \<le> Suc n} = f ` {j. j \<le> n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {j. j \<le> Suc n} \<rightarrow> B; f (Suc n) \<in> f ` {j. j \<le> n}\<rbrakk> \<Longrightarrow> f ` {j. j \<le> Suc n} = f ` {j. j \<le> n}
[PROOF STEP]
by (auto simp add: le_Suc_eq)


[STATEMENT]
lemma n_eq_INF_v: "s \<in> S \<Longrightarrow> n s = (\<Sqinter>cfg\<in>cfg_on s. v cfg)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<in> S \<Longrightarrow> n s = \<Sqinter> (v ` cfg_on s)
[PROOF STEP]
by (auto simp add: n_def v_def P_inf_def T.emeasure_eq_measure valid_cfgI intro!: INF_cong)


[STATEMENT]
lemma indep_sets_vimage_algebra:
  "P.indep_sets (\<lambda>i. sets (vimage_algebra (space P) (\<lambda>f. f i) M)) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.P.indep_sets (\<lambda>i. sets (vimage_algebra (space P) (\<lambda>f. f i) M)) UNIV
[PROOF STEP]
using indep_vars
[PROOF STATE]
proof (prove)
using this:
local.P.indep_vars (\<lambda>_. M) (\<lambda>i f. f i) UNIV

goal (1 subgoal):
 1. local.P.indep_sets (\<lambda>i. sets (vimage_algebra (space P) (\<lambda>f. f i) M)) UNIV
[PROOF STEP]
unfolding P.indep_vars_def sets_vimage_algebra
[PROOF STATE]
proof (prove)
using this:
(\<forall>i\<in>UNIV. local.P.random_variable M (\<lambda>f. f i)) \<and> local.P.indep_sets (\<lambda>i. sigma_sets (space P) {(\<lambda>f. f i) -` A \<inter> space P |A. A \<in> events}) UNIV

goal (1 subgoal):
 1. local.P.indep_sets (\<lambda>i. sigma_sets (space P) {(\<lambda>f. f i) -` A \<inter> space P |A. A \<in> events}) UNIV
[PROOF STEP]
by blast