[STATEMENT]
theorem fundamental_theorem_of_calculus_interior:
  fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
  assumes "a \<le> b"
    and contf: "continuous_on {a..b} f"
    and derf: "\<And>x. x \<in> {a <..< b} \<Longrightarrow> (f has_vector_derivative f' x) (at x)"
  shows "(f' has_integral (f b - f a)) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f' has_integral f b - f a) {a..b}
[PROOF STEP]
proof (cases "a = b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = b \<Longrightarrow> (f' has_integral f b - f a) {a..b}
 2. a \<noteq> b \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = b

goal (2 subgoals):
 1. a = b \<Longrightarrow> (f' has_integral f b - f a) {a..b}
 2. a \<noteq> b \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = b
[PROOF STEP]
have *: "cbox a b = {b}" "f b - f a = 0"
[PROOF STATE]
proof (prove)
using this:
a = b

goal (1 subgoal):
 1. cbox a b = {b} &&& f b - f a = (0::'a)
[PROOF STEP]
by (auto simp add:  order_antisym)
[PROOF STATE]
proof (state)
this:
cbox a b = {b}
f b - f a = (0::'a)

goal (2 subgoals):
 1. a = b \<Longrightarrow> (f' has_integral f b - f a) {a..b}
 2. a \<noteq> b \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
a = b
cbox a b = {b}
f b - f a = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = b
cbox a b = {b}
f b - f a = (0::'a)

goal (1 subgoal):
 1. (f' has_integral f b - f a) {a..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(f' has_integral f b - f a) {a..b}

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> b

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
with \<open>a \<le> b\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
a \<noteq> b
[PROOF STEP]
have ab: "a < b"
[PROOF STATE]
proof (prove)
using this:
a \<le> b
a \<noteq> b

goal (1 subgoal):
 1. a < b
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
a < b

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f' has_integral f b - f a) {a..b}
[PROOF STEP]
unfolding has_integral_factor_content_real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e>0. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
proof (intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
fix e :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
assume e: "e > 0"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e
[PROOF STEP]
have eba8: "(e * (b-a)) / 8 > 0"
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. 0 < e * (b - a) / 8
[PROOF STEP]
using ab
[PROOF STATE]
proof (prove)
using this:
0 < e
a < b

goal (1 subgoal):
 1. 0 < e * (b - a) / 8
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
0 < e * (b - a) / 8

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
note derf_exp = derf[unfolded has_vector_derivative_def has_derivative_at_alt, THEN conjunct2, rule_format]
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> {a<..<b}; 0 < ?e\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>y. norm (y - ?x) < d \<longrightarrow> norm (f y - f ?x - (y - ?x) *\<^sub>R f' ?x) \<le> ?e * norm (y - ?x)

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
have bounded: "\<And>x. x \<in> {a<..<b} \<Longrightarrow> bounded_linear (\<lambda>u. u *\<^sub>R f' x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {a<..<b} \<Longrightarrow> bounded_linear (\<lambda>u. u *\<^sub>R f' x)
[PROOF STEP]
by (simp add: bounded_linear_scaleR_left)
[PROOF STATE]
proof (state)
this:
?x \<in> {a<..<b} \<Longrightarrow> bounded_linear (\<lambda>u. u *\<^sub>R f' ?x)

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
have "\<forall>x \<in> box a b. \<exists>d>0. \<forall>y. norm (y-x) < d \<longrightarrow> norm (f y - f x - (y-x) *\<^sub>R f' x) \<le> e/2 * norm (y-x)"
      (is "\<forall>x \<in> box a b. ?Q x") \<comment>\<open>The explicit quantifier is required by the following step\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>box a b. \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> box a b \<Longrightarrow> \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> box a b \<Longrightarrow> \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)
[PROOF STEP]
assume "x \<in> box a b"
[PROOF STATE]
proof (state)
this:
x \<in> box a b

goal (1 subgoal):
 1. \<And>x. x \<in> box a b \<Longrightarrow> \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)
[PROOF STEP]
with e
[PROOF STATE]
proof (chain)
picking this:
0 < e
x \<in> box a b
[PROOF STEP]
show "?Q x"
[PROOF STATE]
proof (prove)
using this:
0 < e
x \<in> box a b

goal (1 subgoal):
 1. \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)
[PROOF STEP]
using derf_exp [of x "e/2"]
[PROOF STATE]
proof (prove)
using this:
0 < e
x \<in> box a b
\<lbrakk>x \<in> {a<..<b}; 0 < e / 2\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>box a b. \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>box a b. \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)
[PROOF STEP]
obtain d where d: "\<And>x. 0 < d x"
      "\<And>x y. \<lbrakk>x \<in> box a b; norm (y-x) < d x\<rbrakk> \<Longrightarrow> norm (f y - f x - (y-x) *\<^sub>R f' x) \<le> e/2 * norm (y-x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>box a b. \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>\<And>x. 0 < d x; \<And>x y. \<lbrakk>x \<in> box a b; norm (y - x) < d x\<rbrakk> \<Longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding bgauge_existence_lemma
[PROOF STATE]
proof (prove)
using this:
\<forall>x. \<exists>d>0. x \<in> box a b \<longrightarrow> (\<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x))

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>\<And>x. 0 < d x; \<And>x y. \<lbrakk>x \<in> box a b; norm (y - x) < d x\<rbrakk> \<Longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
0 < d ?x
\<lbrakk>?x \<in> box a b; norm (?y - ?x) < d ?x\<rbrakk> \<Longrightarrow> norm (f ?y - f ?x - (?y - ?x) *\<^sub>R f' ?x) \<le> e / 2 * norm (?y - ?x)

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
have "bounded (f ` cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (f ` cbox a b)
[PROOF STEP]
using compact_cbox assms
[PROOF STATE]
proof (prove)
using this:
compact (cbox ?a ?b)
a \<le> b
continuous_on {a..b} f
?x \<in> {a<..<b} \<Longrightarrow> (f has_vector_derivative f' ?x) (at ?x)

goal (1 subgoal):
 1. bounded (f ` cbox a b)
[PROOF STEP]
by (auto simp: compact_imp_bounded compact_continuous_image)
[PROOF STATE]
proof (state)
this:
bounded (f ` cbox a b)

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bounded (f ` cbox a b)
[PROOF STEP]
obtain B
      where "0 < B" and B: "\<And>x. x \<in> f ` cbox a b \<Longrightarrow> norm x \<le> B"
[PROOF STATE]
proof (prove)
using this:
bounded (f ` cbox a b)

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>x. x \<in> f ` cbox a b \<Longrightarrow> norm x \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding bounded_pos
[PROOF STATE]
proof (prove)
using this:
\<exists>ba>0. \<forall>x\<in>f ` cbox a b. norm x \<le> ba

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>x. x \<in> f ` cbox a b \<Longrightarrow> norm x \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
0 < B
?x \<in> f ` cbox a b \<Longrightarrow> norm ?x \<le> B

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
obtain da where "0 < da"
      and da: "\<And>c. \<lbrakk>a \<le> c; {a..c} \<subseteq> {a..b}; {a..c} \<subseteq> ball a da\<rbrakk>
                          \<Longrightarrow> norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> (e * (b-a)) / 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>da. \<lbrakk>0 < da; \<And>c. \<lbrakk>a \<le> c; {a..c} \<subseteq> {a..b}; {a..c} \<subseteq> ball a da\<rbrakk> \<Longrightarrow> norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>da. \<lbrakk>0 < da; \<And>c. \<lbrakk>a \<le> c; {a..c} \<subseteq> {a..b}; {a..c} \<subseteq> ball a da\<rbrakk> \<Longrightarrow> norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "continuous (at a within {a..b}) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at a within {a..b}) f
[PROOF STEP]
using contf continuous_on_eq_continuous_within
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..b} f
continuous_on ?s ?f = (\<forall>x\<in>?s. continuous (at x within ?s) ?f)

goal (1 subgoal):
 1. continuous (at a within {a..b}) f
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
continuous (at a within {a..b}) f

goal (1 subgoal):
 1. (\<And>da. \<lbrakk>0 < da; \<And>c. \<lbrakk>a \<le> c; {a..c} \<subseteq> {a..b}; {a..c} \<subseteq> ball a da\<rbrakk> \<Longrightarrow> norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with eba8
[PROOF STATE]
proof (chain)
picking this:
0 < e * (b - a) / 8
continuous (at a within {a..b}) f
[PROOF STEP]
obtain k where "0 < k"
        and k: "\<And>x. \<lbrakk>x \<in> {a..b}; 0 < norm (x-a); norm (x-a) < k\<rbrakk> \<Longrightarrow> norm (f x - f a) < e * (b-a) / 8"
[PROOF STATE]
proof (prove)
using this:
0 < e * (b - a) / 8
continuous (at a within {a..b}) f

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>0 < k; \<And>x. \<lbrakk>x \<in> {a..b}; 0 < norm (x - a); norm (x - a) < k\<rbrakk> \<Longrightarrow> norm (f x - f a) < e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding continuous_within Lim_within dist_norm
[PROOF STATE]
proof (prove)
using this:
0 < e * (b - a) / 8
\<forall>e>0. \<exists>d>0. \<forall>x\<in>{a..b}. 0 < norm (x - a) \<and> norm (x - a) < d \<longrightarrow> norm (f x - f a) < e

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>0 < k; \<And>x. \<lbrakk>x \<in> {a..b}; 0 < norm (x - a); norm (x - a) < k\<rbrakk> \<Longrightarrow> norm (f x - f a) < e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
0 < k
\<lbrakk>?x \<in> {a..b}; 0 < norm (?x - a); norm (?x - a) < k\<rbrakk> \<Longrightarrow> norm (f ?x - f a) < e * (b - a) / 8

goal (1 subgoal):
 1. (\<And>da. \<lbrakk>0 < da; \<And>c. \<lbrakk>a \<le> c; {a..c} \<subseteq> {a..b}; {a..c} \<subseteq> ball a da\<rbrakk> \<Longrightarrow> norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain l where l: "0 < l" "norm (l *\<^sub>R f' a) \<le> e * (b-a) / 8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' a) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (cases "f' a = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' a) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' a = (0::'a)\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' a) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f' a = (0::'a)

goal (2 subgoals):
 1. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' a) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' a = (0::'a)\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' a) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
with ab e that
[PROOF STATE]
proof (chain)
picking this:
a < b
0 < e
\<lbrakk>0 < ?l; norm (?l *\<^sub>R f' a) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis
f' a = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a < b
0 < e
\<lbrakk>0 < ?l; norm (?l *\<^sub>R f' a) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis
f' a = (0::'a)

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

goal (1 subgoal):
 1. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' a) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' a) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f' a \<noteq> (0::'a)

goal (1 subgoal):
 1. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' a) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < ?l
 2. norm (?l *\<^sub>R f' a) \<le> e * (b - a) / 8
[PROOF STEP]
show "norm ((e * (b - a) / 8 / norm (f' a)) *\<^sub>R f' a) \<le> e * (b - a) / 8"
               "0 < e * (b - a) / 8 / norm (f' a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((e * (b - a) / 8 / norm (f' a)) *\<^sub>R f' a) \<le> e * (b - a) / 8 &&& 0 < e * (b - a) / 8 / norm (f' a)
[PROOF STEP]
using False ab e
[PROOF STATE]
proof (prove)
using this:
f' a \<noteq> (0::'a)
a < b
0 < e

goal (1 subgoal):
 1. norm ((e * (b - a) / 8 / norm (f' a)) *\<^sub>R f' a) \<le> e * (b - a) / 8 &&& 0 < e * (b - a) / 8 / norm (f' a)
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
norm ((e * (b - a) / 8 / norm (f' a)) *\<^sub>R f' a) \<le> e * (b - a) / 8
0 < e * (b - a) / 8 / norm (f' a)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < l
norm (l *\<^sub>R f' a) \<le> e * (b - a) / 8

goal (1 subgoal):
 1. (\<And>da. \<lbrakk>0 < da; \<And>c. \<lbrakk>a \<le> c; {a..c} \<subseteq> {a..b}; {a..c} \<subseteq> ball a da\<rbrakk> \<Longrightarrow> norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b-a) / 4"
        if "a \<le> c" "{a..c} \<subseteq> {a..b}" and bmin: "{a..c} \<subseteq> ball a (min k l)" for c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4
[PROOF STEP]
have minkl: "\<bar>a - x\<bar> < min k l" if "x \<in> {a..c}" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>a - x\<bar> < min k l
[PROOF STEP]
using bmin dist_real_def that
[PROOF STATE]
proof (prove)
using this:
{a..c} \<subseteq> ball a (min k l)
dist ?x ?y = \<bar>?x - ?y\<bar>
x \<in> {a..c}

goal (1 subgoal):
 1. \<bar>a - x\<bar> < min k l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> {a..c} \<Longrightarrow> \<bar>a - ?x\<bar> < min k l

goal (1 subgoal):
 1. norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> {a..c} \<Longrightarrow> \<bar>a - ?x\<bar> < min k l
[PROOF STEP]
have lel: "\<bar>c - a\<bar> \<le> \<bar>l\<bar>"
[PROOF STATE]
proof (prove)
using this:
?x \<in> {a..c} \<Longrightarrow> \<bar>a - ?x\<bar> < min k l

goal (1 subgoal):
 1. \<bar>c - a\<bar> \<le> \<bar>l\<bar>
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
?x \<in> {a..c} \<Longrightarrow> \<bar>a - ?x\<bar> < min k l
a \<le> c
{a..c} \<subseteq> {a..b}
{a..c} \<subseteq> ball a (min k l)

goal (1 subgoal):
 1. \<bar>c - a\<bar> \<le> \<bar>l\<bar>
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<bar>c - a\<bar> \<le> \<bar>l\<bar>

goal (1 subgoal):
 1. norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4
[PROOF STEP]
have "norm ((c - a) *\<^sub>R f' a - (f c - f a)) \<le> norm ((c - a) *\<^sub>R f' a) + norm (f c - f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((c - a) *\<^sub>R f' a - (f c - f a)) \<le> norm ((c - a) *\<^sub>R f' a) + norm (f c - f a)
[PROOF STEP]
by (rule norm_triangle_ineq4)
[PROOF STATE]
proof (state)
this:
norm ((c - a) *\<^sub>R f' a - (f c - f a)) \<le> norm ((c - a) *\<^sub>R f' a) + norm (f c - f a)

goal (1 subgoal):
 1. norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm ((c - a) *\<^sub>R f' a - (f c - f a)) \<le> norm ((c - a) *\<^sub>R f' a) + norm (f c - f a)

goal (1 subgoal):
 1. norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4
[PROOF STEP]
have "\<dots> \<le> e * (b-a) / 8 + e * (b-a) / 8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((c - a) *\<^sub>R f' a) + norm (f c - f a) \<le> e * (b - a) / 8 + e * (b - a) / 8
[PROOF STEP]
proof (rule add_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. norm ((c - a) *\<^sub>R f' a) \<le> e * (b - a) / 8
 2. norm (f c - f a) \<le> e * (b - a) / 8
[PROOF STEP]
have "norm ((c - a) *\<^sub>R f' a) \<le> norm (l *\<^sub>R f' a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((c - a) *\<^sub>R f' a) \<le> norm (l *\<^sub>R f' a)
[PROOF STEP]
by (auto intro: mult_right_mono [OF lel])
[PROOF STATE]
proof (state)
this:
norm ((c - a) *\<^sub>R f' a) \<le> norm (l *\<^sub>R f' a)

goal (2 subgoals):
 1. norm ((c - a) *\<^sub>R f' a) \<le> e * (b - a) / 8
 2. norm (f c - f a) \<le> e * (b - a) / 8
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm ((c - a) *\<^sub>R f' a) \<le> norm (l *\<^sub>R f' a)

goal (2 subgoals):
 1. norm ((c - a) *\<^sub>R f' a) \<le> e * (b - a) / 8
 2. norm (f c - f a) \<le> e * (b - a) / 8
[PROOF STEP]
have "... \<le> e * (b-a) / 8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (l *\<^sub>R f' a) \<le> e * (b - a) / 8
[PROOF STEP]
by (rule l)
[PROOF STATE]
proof (state)
this:
norm (l *\<^sub>R f' a) \<le> e * (b - a) / 8

goal (2 subgoals):
 1. norm ((c - a) *\<^sub>R f' a) \<le> e * (b - a) / 8
 2. norm (f c - f a) \<le> e * (b - a) / 8
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm ((c - a) *\<^sub>R f' a) \<le> e * (b - a) / 8
[PROOF STEP]
show "norm ((c - a) *\<^sub>R f' a) \<le> e * (b-a) / 8"
[PROOF STATE]
proof (prove)
using this:
norm ((c - a) *\<^sub>R f' a) \<le> e * (b - a) / 8

goal (1 subgoal):
 1. norm ((c - a) *\<^sub>R f' a) \<le> e * (b - a) / 8
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm ((c - a) *\<^sub>R f' a) \<le> e * (b - a) / 8

goal (1 subgoal):
 1. norm (f c - f a) \<le> e * (b - a) / 8
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (f c - f a) \<le> e * (b - a) / 8
[PROOF STEP]
have "norm (f c - f a) < e * (b-a) / 8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (f c - f a) < e * (b - a) / 8
[PROOF STEP]
proof (cases "a = c")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = c \<Longrightarrow> norm (f c - f a) < e * (b - a) / 8
 2. a \<noteq> c \<Longrightarrow> norm (f c - f a) < e * (b - a) / 8
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = c

goal (2 subgoals):
 1. a = c \<Longrightarrow> norm (f c - f a) < e * (b - a) / 8
 2. a \<noteq> c \<Longrightarrow> norm (f c - f a) < e * (b - a) / 8
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = c

goal (1 subgoal):
 1. norm (f c - f a) < e * (b - a) / 8
[PROOF STEP]
using eba8
[PROOF STATE]
proof (prove)
using this:
a = c
0 < e * (b - a) / 8

goal (1 subgoal):
 1. norm (f c - f a) < e * (b - a) / 8
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (f c - f a) < e * (b - a) / 8

goal (1 subgoal):
 1. a \<noteq> c \<Longrightarrow> norm (f c - f a) < e * (b - a) / 8
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> c \<Longrightarrow> norm (f c - f a) < e * (b - a) / 8
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> c

goal (1 subgoal):
 1. a \<noteq> c \<Longrightarrow> norm (f c - f a) < e * (b - a) / 8
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (f c - f a) < e * (b - a) / 8
[PROOF STEP]
by (rule k) (use minkl \<open>a \<le> c\<close> that False in auto)
[PROOF STATE]
proof (state)
this:
norm (f c - f a) < e * (b - a) / 8

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm (f c - f a) < e * (b - a) / 8

goal (1 subgoal):
 1. norm (f c - f a) \<le> e * (b - a) / 8
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm (f c - f a) < e * (b - a) / 8
[PROOF STEP]
show "norm (f c - f a) \<le> e * (b-a) / 8"
[PROOF STATE]
proof (prove)
using this:
norm (f c - f a) < e * (b - a) / 8

goal (1 subgoal):
 1. norm (f c - f a) \<le> e * (b - a) / 8
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (f c - f a) \<le> e * (b - a) / 8

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm ((c - a) *\<^sub>R f' a) + norm (f c - f a) \<le> e * (b - a) / 8 + e * (b - a) / 8

goal (1 subgoal):
 1. norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm ((c - a) *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 8 + e * (b - a) / 8
[PROOF STEP]
show "norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b-a) / 4"
[PROOF STATE]
proof (prove)
using this:
norm ((c - a) *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 8 + e * (b - a) / 8

goal (1 subgoal):
 1. norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4
[PROOF STEP]
unfolding content_real[OF \<open>a \<le> c\<close>]
[PROOF STATE]
proof (prove)
using this:
norm ((c - a) *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 8 + e * (b - a) / 8

goal (1 subgoal):
 1. norm ((c - a) *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>a \<le> ?c; {a..?c} \<subseteq> {a..b}; {a..?c} \<subseteq> ball a (min k l)\<rbrakk> \<Longrightarrow> norm (content {a..?c} *\<^sub>R f' a - (f ?c - f a)) \<le> e * (b - a) / 4

goal (1 subgoal):
 1. (\<And>da. \<lbrakk>0 < da; \<And>c. \<lbrakk>a \<le> c; {a..c} \<subseteq> {a..b}; {a..c} \<subseteq> ball a da\<rbrakk> \<Longrightarrow> norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>a \<le> ?c; {a..?c} \<subseteq> {a..b}; {a..?c} \<subseteq> ball a (min k l)\<rbrakk> \<Longrightarrow> norm (content {a..?c} *\<^sub>R f' a - (f ?c - f a)) \<le> e * (b - a) / 4
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a \<le> ?c; {a..?c} \<subseteq> {a..b}; {a..?c} \<subseteq> ball a (min k l)\<rbrakk> \<Longrightarrow> norm (content {a..?c} *\<^sub>R f' a - (f ?c - f a)) \<le> e * (b - a) / 4

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (rule_tac da="min k l" in that) (auto simp: l \<open>0 < k\<close>)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < da
\<lbrakk>a \<le> ?c; {a..?c} \<subseteq> {a..b}; {a..?c} \<subseteq> ball a da\<rbrakk> \<Longrightarrow> norm (content {a..?c} *\<^sub>R f' a - (f ?c - f a)) \<le> e * (b - a) / 4

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
obtain db where "0 < db"
      and db: "\<And>c. \<lbrakk>c \<le> b; {c..b} \<subseteq> {a..b}; {c..b} \<subseteq> ball b db\<rbrakk>
                          \<Longrightarrow> norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> (e * (b-a)) / 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>db. \<lbrakk>0 < db; \<And>c. \<lbrakk>c \<le> b; {c..b} \<subseteq> {a..b}; {c..b} \<subseteq> ball b db\<rbrakk> \<Longrightarrow> norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>db. \<lbrakk>0 < db; \<And>c. \<lbrakk>c \<le> b; {c..b} \<subseteq> {a..b}; {c..b} \<subseteq> ball b db\<rbrakk> \<Longrightarrow> norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "continuous (at b within {a..b}) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at b within {a..b}) f
[PROOF STEP]
using contf continuous_on_eq_continuous_within
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..b} f
continuous_on ?s ?f = (\<forall>x\<in>?s. continuous (at x within ?s) ?f)

goal (1 subgoal):
 1. continuous (at b within {a..b}) f
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
continuous (at b within {a..b}) f

goal (1 subgoal):
 1. (\<And>db. \<lbrakk>0 < db; \<And>c. \<lbrakk>c \<le> b; {c..b} \<subseteq> {a..b}; {c..b} \<subseteq> ball b db\<rbrakk> \<Longrightarrow> norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with eba8
[PROOF STATE]
proof (chain)
picking this:
0 < e * (b - a) / 8
continuous (at b within {a..b}) f
[PROOF STEP]
obtain k
        where "0 < k"
          and k: "\<And>x. \<lbrakk>x \<in> {a..b}; 0 < norm(x-b); norm(x-b) < k\<rbrakk>
                     \<Longrightarrow> norm (f b - f x) < e * (b-a) / 8"
[PROOF STATE]
proof (prove)
using this:
0 < e * (b - a) / 8
continuous (at b within {a..b}) f

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>0 < k; \<And>x. \<lbrakk>x \<in> {a..b}; 0 < norm (x - b); norm (x - b) < k\<rbrakk> \<Longrightarrow> norm (f b - f x) < e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding continuous_within Lim_within dist_norm norm_minus_commute
[PROOF STATE]
proof (prove)
using this:
0 < e * (b - a) / 8
\<forall>e>0. \<exists>d>0. \<forall>x\<in>{a..b}. 0 < norm (x - b) \<and> norm (x - b) < d \<longrightarrow> norm (f x - f b) < e

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>0 < k; \<And>x. \<lbrakk>x \<in> {a..b}; 0 < norm (x - b); norm (x - b) < k\<rbrakk> \<Longrightarrow> norm (f x - f b) < e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
0 < k
\<lbrakk>?x \<in> {a..b}; 0 < norm (?x - b); norm (?x - b) < k\<rbrakk> \<Longrightarrow> norm (f b - f ?x) < e * (b - a) / 8

goal (1 subgoal):
 1. (\<And>db. \<lbrakk>0 < db; \<And>c. \<lbrakk>c \<le> b; {c..b} \<subseteq> {a..b}; {c..b} \<subseteq> ball b db\<rbrakk> \<Longrightarrow> norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain l where l: "0 < l" "norm (l *\<^sub>R f' b) \<le> (e * (b-a)) / 8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' b) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (cases "f' b = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' b) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' b = (0::'a)\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' b) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f' b = (0::'a)

goal (2 subgoals):
 1. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' b) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' b = (0::'a)\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' b) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f' b = (0::'a)

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using ab e that
[PROOF STATE]
proof (prove)
using this:
f' b = (0::'a)
a < b
0 < e
\<lbrakk>0 < ?l; norm (?l *\<^sub>R f' b) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis

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

goal (1 subgoal):
 1. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' b) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' b) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f' b \<noteq> (0::'a)

goal (1 subgoal):
 1. \<lbrakk>\<And>l. \<lbrakk>0 < l; norm (l *\<^sub>R f' b) \<le> e * (b - a) / 8\<rbrakk> \<Longrightarrow> thesis; f' b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < ?l
 2. norm (?l *\<^sub>R f' b) \<le> e * (b - a) / 8
[PROOF STEP]
show "norm ((e * (b - a) / 8 / norm (f' b)) *\<^sub>R f' b) \<le> e * (b - a) / 8"
               "0 < e * (b - a) / 8 / norm (f' b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((e * (b - a) / 8 / norm (f' b)) *\<^sub>R f' b) \<le> e * (b - a) / 8 &&& 0 < e * (b - a) / 8 / norm (f' b)
[PROOF STEP]
using False ab e
[PROOF STATE]
proof (prove)
using this:
f' b \<noteq> (0::'a)
a < b
0 < e

goal (1 subgoal):
 1. norm ((e * (b - a) / 8 / norm (f' b)) *\<^sub>R f' b) \<le> e * (b - a) / 8 &&& 0 < e * (b - a) / 8 / norm (f' b)
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
norm ((e * (b - a) / 8 / norm (f' b)) *\<^sub>R f' b) \<le> e * (b - a) / 8
0 < e * (b - a) / 8 / norm (f' b)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < l
norm (l *\<^sub>R f' b) \<le> e * (b - a) / 8

goal (1 subgoal):
 1. (\<And>db. \<lbrakk>0 < db; \<And>c. \<lbrakk>c \<le> b; {c..b} \<subseteq> {a..b}; {c..b} \<subseteq> ball b db\<rbrakk> \<Longrightarrow> norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b-a) / 4"
        if "c \<le> b" "{c..b} \<subseteq> {a..b}" and bmin: "{c..b} \<subseteq> ball b (min k l)" for c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4
[PROOF STEP]
have minkl: "\<bar>b - x\<bar> < min k l" if "x \<in> {c..b}" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>b - x\<bar> < min k l
[PROOF STEP]
using bmin dist_real_def that
[PROOF STATE]
proof (prove)
using this:
{c..b} \<subseteq> ball b (min k l)
dist ?x ?y = \<bar>?x - ?y\<bar>
x \<in> {c..b}

goal (1 subgoal):
 1. \<bar>b - x\<bar> < min k l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> {c..b} \<Longrightarrow> \<bar>b - ?x\<bar> < min k l

goal (1 subgoal):
 1. norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> {c..b} \<Longrightarrow> \<bar>b - ?x\<bar> < min k l
[PROOF STEP]
have lel: "\<bar>b - c\<bar> \<le> \<bar>l\<bar>"
[PROOF STATE]
proof (prove)
using this:
?x \<in> {c..b} \<Longrightarrow> \<bar>b - ?x\<bar> < min k l

goal (1 subgoal):
 1. \<bar>b - c\<bar> \<le> \<bar>l\<bar>
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
?x \<in> {c..b} \<Longrightarrow> \<bar>b - ?x\<bar> < min k l
c \<le> b
{c..b} \<subseteq> {a..b}
{c..b} \<subseteq> ball b (min k l)

goal (1 subgoal):
 1. \<bar>b - c\<bar> \<le> \<bar>l\<bar>
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<bar>b - c\<bar> \<le> \<bar>l\<bar>

goal (1 subgoal):
 1. norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4
[PROOF STEP]
have "norm ((b - c) *\<^sub>R f' b - (f b - f c)) \<le> norm ((b - c) *\<^sub>R f' b) + norm (f b - f c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((b - c) *\<^sub>R f' b - (f b - f c)) \<le> norm ((b - c) *\<^sub>R f' b) + norm (f b - f c)
[PROOF STEP]
by (rule norm_triangle_ineq4)
[PROOF STATE]
proof (state)
this:
norm ((b - c) *\<^sub>R f' b - (f b - f c)) \<le> norm ((b - c) *\<^sub>R f' b) + norm (f b - f c)

goal (1 subgoal):
 1. norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm ((b - c) *\<^sub>R f' b - (f b - f c)) \<le> norm ((b - c) *\<^sub>R f' b) + norm (f b - f c)

goal (1 subgoal):
 1. norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4
[PROOF STEP]
have "\<dots> \<le> e * (b-a) / 8 + e * (b-a) / 8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((b - c) *\<^sub>R f' b) + norm (f b - f c) \<le> e * (b - a) / 8 + e * (b - a) / 8
[PROOF STEP]
proof (rule add_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. norm ((b - c) *\<^sub>R f' b) \<le> e * (b - a) / 8
 2. norm (f b - f c) \<le> e * (b - a) / 8
[PROOF STEP]
have "norm ((b - c) *\<^sub>R f' b) \<le> norm (l *\<^sub>R f' b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((b - c) *\<^sub>R f' b) \<le> norm (l *\<^sub>R f' b)
[PROOF STEP]
by (auto intro: mult_right_mono [OF lel])
[PROOF STATE]
proof (state)
this:
norm ((b - c) *\<^sub>R f' b) \<le> norm (l *\<^sub>R f' b)

goal (2 subgoals):
 1. norm ((b - c) *\<^sub>R f' b) \<le> e * (b - a) / 8
 2. norm (f b - f c) \<le> e * (b - a) / 8
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm ((b - c) *\<^sub>R f' b) \<le> norm (l *\<^sub>R f' b)

goal (2 subgoals):
 1. norm ((b - c) *\<^sub>R f' b) \<le> e * (b - a) / 8
 2. norm (f b - f c) \<le> e * (b - a) / 8
[PROOF STEP]
have "... \<le> e * (b-a) / 8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (l *\<^sub>R f' b) \<le> e * (b - a) / 8
[PROOF STEP]
by (rule l)
[PROOF STATE]
proof (state)
this:
norm (l *\<^sub>R f' b) \<le> e * (b - a) / 8

goal (2 subgoals):
 1. norm ((b - c) *\<^sub>R f' b) \<le> e * (b - a) / 8
 2. norm (f b - f c) \<le> e * (b - a) / 8
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm ((b - c) *\<^sub>R f' b) \<le> e * (b - a) / 8
[PROOF STEP]
show "norm ((b - c) *\<^sub>R f' b) \<le> e * (b-a) / 8"
[PROOF STATE]
proof (prove)
using this:
norm ((b - c) *\<^sub>R f' b) \<le> e * (b - a) / 8

goal (1 subgoal):
 1. norm ((b - c) *\<^sub>R f' b) \<le> e * (b - a) / 8
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm ((b - c) *\<^sub>R f' b) \<le> e * (b - a) / 8

goal (1 subgoal):
 1. norm (f b - f c) \<le> e * (b - a) / 8
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (f b - f c) \<le> e * (b - a) / 8
[PROOF STEP]
have "norm (f b - f c) < e * (b-a) / 8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (f b - f c) < e * (b - a) / 8
[PROOF STEP]
proof (cases "b = c")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b = c \<Longrightarrow> norm (f b - f c) < e * (b - a) / 8
 2. b \<noteq> c \<Longrightarrow> norm (f b - f c) < e * (b - a) / 8
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b = c

goal (2 subgoals):
 1. b = c \<Longrightarrow> norm (f b - f c) < e * (b - a) / 8
 2. b \<noteq> c \<Longrightarrow> norm (f b - f c) < e * (b - a) / 8
[PROOF STEP]
with eba8
[PROOF STATE]
proof (chain)
picking this:
0 < e * (b - a) / 8
b = c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < e * (b - a) / 8
b = c

goal (1 subgoal):
 1. norm (f b - f c) < e * (b - a) / 8
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (f b - f c) < e * (b - a) / 8

goal (1 subgoal):
 1. b \<noteq> c \<Longrightarrow> norm (f b - f c) < e * (b - a) / 8
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<noteq> c \<Longrightarrow> norm (f b - f c) < e * (b - a) / 8
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
b \<noteq> c

goal (1 subgoal):
 1. b \<noteq> c \<Longrightarrow> norm (f b - f c) < e * (b - a) / 8
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (f b - f c) < e * (b - a) / 8
[PROOF STEP]
by (rule k) (use minkl \<open>c \<le> b\<close> that False in auto)
[PROOF STATE]
proof (state)
this:
norm (f b - f c) < e * (b - a) / 8

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm (f b - f c) < e * (b - a) / 8

goal (1 subgoal):
 1. norm (f b - f c) \<le> e * (b - a) / 8
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm (f b - f c) < e * (b - a) / 8
[PROOF STEP]
show "norm (f b - f c) \<le> e * (b-a) / 8"
[PROOF STATE]
proof (prove)
using this:
norm (f b - f c) < e * (b - a) / 8

goal (1 subgoal):
 1. norm (f b - f c) \<le> e * (b - a) / 8
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (f b - f c) \<le> e * (b - a) / 8

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm ((b - c) *\<^sub>R f' b) + norm (f b - f c) \<le> e * (b - a) / 8 + e * (b - a) / 8

goal (1 subgoal):
 1. norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm ((b - c) *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 8 + e * (b - a) / 8
[PROOF STEP]
show "norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b-a) / 4"
[PROOF STATE]
proof (prove)
using this:
norm ((b - c) *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 8 + e * (b - a) / 8

goal (1 subgoal):
 1. norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4
[PROOF STEP]
unfolding content_real[OF \<open>c \<le> b\<close>]
[PROOF STATE]
proof (prove)
using this:
norm ((b - c) *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 8 + e * (b - a) / 8

goal (1 subgoal):
 1. norm ((b - c) *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?c \<le> b; {?c..b} \<subseteq> {a..b}; {?c..b} \<subseteq> ball b (min k l)\<rbrakk> \<Longrightarrow> norm (content {?c..b} *\<^sub>R f' b - (f b - f ?c)) \<le> e * (b - a) / 4

goal (1 subgoal):
 1. (\<And>db. \<lbrakk>0 < db; \<And>c. \<lbrakk>c \<le> b; {c..b} \<subseteq> {a..b}; {c..b} \<subseteq> ball b db\<rbrakk> \<Longrightarrow> norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?c \<le> b; {?c..b} \<subseteq> {a..b}; {?c..b} \<subseteq> ball b (min k l)\<rbrakk> \<Longrightarrow> norm (content {?c..b} *\<^sub>R f' b - (f b - f ?c)) \<le> e * (b - a) / 4
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?c \<le> b; {?c..b} \<subseteq> {a..b}; {?c..b} \<subseteq> ball b (min k l)\<rbrakk> \<Longrightarrow> norm (content {?c..b} *\<^sub>R f' b - (f b - f ?c)) \<le> e * (b - a) / 4

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (rule_tac db="min k l" in that) (auto simp: l \<open>0 < k\<close>)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < db
\<lbrakk>?c \<le> b; {?c..b} \<subseteq> {a..b}; {?c..b} \<subseteq> ball b db\<rbrakk> \<Longrightarrow> norm (content {?c..b} *\<^sub>R f' b - (f b - f ?c)) \<le> e * (b - a) / 4

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
let ?d = "(\<lambda>x. ball x (if x=a then da else if x=b then db else d x))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow>
              norm ((\<Sum>(x,K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})
[PROOF STEP]
proof (rule exI, safe)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. gauge ?d
 2. \<And>p. \<lbrakk>p tagged_division_of {a..b}; ?d fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
show "gauge ?d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauge (\<lambda>x. ball x (if x = a then da else if x = b then db else d x))
[PROOF STEP]
using ab \<open>db > 0\<close> \<open>da > 0\<close> d(1)
[PROOF STATE]
proof (prove)
using this:
a < b
0 < db
0 < da
0 < d ?x

goal (1 subgoal):
 1. gauge (\<lambda>x. ball x (if x = a then da else if x = b then db else d x))
[PROOF STEP]
by (auto intro: gauge_ball_dependent)
[PROOF STATE]
proof (state)
this:
gauge (\<lambda>x. ball x (if x = a then da else if x = b then db else d x))

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
assume ptag: "p tagged_division_of {a..b}" and fine: "?d fine p"
[PROOF STATE]
proof (state)
this:
p tagged_division_of {a..b}
(\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
let ?A = "{t. fst t \<in> {a, b}}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
note p = tagged_division_ofD[OF ptag]
[PROOF STATE]
proof (state)
this:
finite p
(?x, ?K) \<in> p \<Longrightarrow> ?x \<in> ?K
(?x, ?K) \<in> p \<Longrightarrow> ?K \<subseteq> {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 = {}
\<Union> {K. \<exists>x. (x, K) \<in> p} = {a..b}

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
have pA: "p = (p \<inter> ?A) \<union> (p - ?A)" "finite (p \<inter> ?A)" "finite (p - ?A)" "(p \<inter> ?A) \<inter> (p - ?A) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p = p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}) &&& finite (p \<inter> {t. fst t \<in> {a, b}})) &&& finite (p - {t. fst t \<in> {a, b}}) &&& p \<inter> {t. fst t \<in> {a, b}} \<inter> (p - {t. fst t \<in> {a, b}}) = {}
[PROOF STEP]
using ptag fine
[PROOF STATE]
proof (prove)
using this:
p tagged_division_of {a..b}
(\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p

goal (1 subgoal):
 1. (p = p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}) &&& finite (p \<inter> {t. fst t \<in> {a, b}})) &&& finite (p - {t. fst t \<in> {a, b}}) &&& p \<inter> {t. fst t \<in> {a, b}} \<inter> (p - {t. fst t \<in> {a, b}}) = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}})
finite (p \<inter> {t. fst t \<in> {a, b}})
finite (p - {t. fst t \<in> {a, b}})
p \<inter> {t. fst t \<in> {a, b}} \<inter> (p - {t. fst t \<in> {a, b}}) = {}

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
have le_xz: "\<And>w x y z::real. y \<le> z/2 \<Longrightarrow> w - x \<le> z/2 \<Longrightarrow> w + y \<le> x + z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w x y z. \<lbrakk>y \<le> z / 2; w - x \<le> z / 2\<rbrakk> \<Longrightarrow> w + y \<le> x + z
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<lbrakk>?y1 \<le> ?z1 / 2; ?w1 - ?x1 \<le> ?z1 / 2\<rbrakk> \<Longrightarrow> ?w1 + ?y1 \<le> ?x1 + ?z1

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
have non: False if xk: "(x,K) \<in> p" and "x \<noteq> a" "x \<noteq> b"
        and less: "e * (Sup K - Inf K)/2 < norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))"
      for x K
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
obtain u v where k: "K = cbox u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u v. K = cbox u v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using p(4) xk
[PROOF STATE]
proof (prove)
using this:
(?x, ?K) \<in> p \<Longrightarrow> \<exists>a b. ?K = cbox a b
(x, K) \<in> p

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

goal (1 subgoal):
 1. False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
K = cbox u v
[PROOF STEP]
have "u \<le> v" and uv: "{u, v} \<subseteq> cbox u v"
[PROOF STATE]
proof (prove)
using this:
K = cbox u v

goal (1 subgoal):
 1. u \<le> v &&& {u, v} \<subseteq> cbox u v
[PROOF STEP]
using p(2)[OF xk]
[PROOF STATE]
proof (prove)
using this:
K = cbox u v
x \<in> K

goal (1 subgoal):
 1. u \<le> v &&& {u, v} \<subseteq> cbox u v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u \<le> v
{u, v} \<subseteq> cbox u v

goal (1 subgoal):
 1. False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<le> v
{u, v} \<subseteq> cbox u v
[PROOF STEP]
have result: "e * (v - u)/2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))"
[PROOF STATE]
proof (prove)
using this:
u \<le> v
{u, v} \<subseteq> cbox u v

goal (1 subgoal):
 1. e * (v - u) / 2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))
[PROOF STEP]
using less[unfolded k box_real interval_bounds_real content_real]
[PROOF STATE]
proof (prove)
using this:
u \<le> v
{u, v} \<subseteq> cbox u v
e * (Sup {u..v} - Inf {u..v}) / 2 < norm (content {u..v} *\<^sub>R f' x - (f (Sup {u..v}) - f (Inf {u..v})))

goal (1 subgoal):
 1. e * (v - u) / 2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e * (v - u) / 2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))

goal (1 subgoal):
 1. False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e * (v - u) / 2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))
[PROOF STEP]
have "x \<in> box a b"
[PROOF STATE]
proof (prove)
using this:
e * (v - u) / 2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))

goal (1 subgoal):
 1. x \<in> box a b
[PROOF STEP]
using p(2) p(3) \<open>x \<noteq> a\<close> \<open>x \<noteq> b\<close> xk
[PROOF STATE]
proof (prove)
using this:
e * (v - u) / 2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))
(?x, ?K) \<in> p \<Longrightarrow> ?x \<in> ?K
(?x, ?K) \<in> p \<Longrightarrow> ?K \<subseteq> {a..b}
x \<noteq> a
x \<noteq> b
(x, K) \<in> p

goal (1 subgoal):
 1. x \<in> box a b
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<in> box a b

goal (1 subgoal):
 1. False
[PROOF STEP]
with d
[PROOF STATE]
proof (chain)
picking this:
0 < d ?x
\<lbrakk>?x \<in> box a b; norm (?y - ?x) < d ?x\<rbrakk> \<Longrightarrow> norm (f ?y - f ?x - (?y - ?x) *\<^sub>R f' ?x) \<le> e / 2 * norm (?y - ?x)
x \<in> box a b
[PROOF STEP]
have *: "\<And>y. norm (y-x) < d x
                \<Longrightarrow> norm (f y - f x - (y-x) *\<^sub>R f' x) \<le> e/2 * norm (y-x)"
[PROOF STATE]
proof (prove)
using this:
0 < d ?x
\<lbrakk>?x \<in> box a b; norm (?y - ?x) < d ?x\<rbrakk> \<Longrightarrow> norm (f ?y - f ?x - (?y - ?x) *\<^sub>R f' ?x) \<le> e / 2 * norm (?y - ?x)
x \<in> box a b

goal (1 subgoal):
 1. \<And>y. norm (y - x) < d x \<Longrightarrow> norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e / 2 * norm (y - x)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
norm (?y1 - x) < d x \<Longrightarrow> norm (f ?y1 - f x - (?y1 - x) *\<^sub>R f' x) \<le> e / 2 * norm (?y1 - x)

goal (1 subgoal):
 1. False
[PROOF STEP]
have xd: "norm (u - x) < d x" "norm (v - x) < d x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (u - x) < d x &&& norm (v - x) < d x
[PROOF STEP]
using fineD[OF fine xk] \<open>x \<noteq> a\<close> \<open>x \<noteq> b\<close> uv
[PROOF STATE]
proof (prove)
using this:
K \<subseteq> ball x (if x = a then da else if x = b then db else d x)
x \<noteq> a
x \<noteq> b
{u, v} \<subseteq> cbox u v

goal (1 subgoal):
 1. norm (u - x) < d x &&& norm (v - x) < d x
[PROOF STEP]
by (auto simp add: k subset_eq dist_commute dist_real_def)
[PROOF STATE]
proof (state)
this:
norm (u - x) < d x
norm (v - x) < d x

goal (1 subgoal):
 1. False
[PROOF STEP]
have "norm ((v - u) *\<^sub>R f' x - (f v - f u)) =
              norm ((f u - f x - (u - x) *\<^sub>R f' x) - (f v - f x - (v - x) *\<^sub>R f' x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((v - u) *\<^sub>R f' x - (f v - f u)) = norm (f u - f x - (u - x) *\<^sub>R f' x - (f v - f x - (v - x) *\<^sub>R f' x))
[PROOF STEP]
by (rule arg_cong[where f=norm]) (auto simp: scaleR_left.diff)
[PROOF STATE]
proof (state)
this:
norm ((v - u) *\<^sub>R f' x - (f v - f u)) = norm (f u - f x - (u - x) *\<^sub>R f' x - (f v - f x - (v - x) *\<^sub>R f' x))

goal (1 subgoal):
 1. False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm ((v - u) *\<^sub>R f' x - (f v - f u)) = norm (f u - f x - (u - x) *\<^sub>R f' x - (f v - f x - (v - x) *\<^sub>R f' x))

goal (1 subgoal):
 1. False
[PROOF STEP]
have "\<dots> \<le> e/2 * norm (u - x) + e/2 * norm (v - x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (f u - f x - (u - x) *\<^sub>R f' x - (f v - f x - (v - x) *\<^sub>R f' x)) \<le> e / 2 * norm (u - x) + e / 2 * norm (v - x)
[PROOF STEP]
by (metis norm_triangle_le_diff add_mono * xd)
[PROOF STATE]
proof (state)
this:
norm (f u - f x - (u - x) *\<^sub>R f' x - (f v - f x - (v - x) *\<^sub>R f' x)) \<le> e / 2 * norm (u - x) + e / 2 * norm (v - x)

goal (1 subgoal):
 1. False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (f u - f x - (u - x) *\<^sub>R f' x - (f v - f x - (v - x) *\<^sub>R f' x)) \<le> e / 2 * norm (u - x) + e / 2 * norm (v - x)

goal (1 subgoal):
 1. False
[PROOF STEP]
have "\<dots> \<le> e/2 * norm (v - u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e / 2 * norm (u - x) + e / 2 * norm (v - x) \<le> e / 2 * norm (v - u)
[PROOF STEP]
using p(2)[OF xk]
[PROOF STATE]
proof (prove)
using this:
x \<in> K

goal (1 subgoal):
 1. e / 2 * norm (u - x) + e / 2 * norm (v - x) \<le> e / 2 * norm (v - u)
[PROOF STEP]
by (auto simp add: field_simps k)
[PROOF STATE]
proof (state)
this:
e / 2 * norm (u - x) + e / 2 * norm (v - x) \<le> e / 2 * norm (v - u)

goal (1 subgoal):
 1. False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
e / 2 * norm (u - x) + e / 2 * norm (v - x) \<le> e / 2 * norm (v - u)

goal (1 subgoal):
 1. False
[PROOF STEP]
have "\<dots> < norm ((v - u) *\<^sub>R f' x - (f v - f u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e / 2 * norm (v - u) < norm ((v - u) *\<^sub>R f' x - (f v - f u))
[PROOF STEP]
using result
[PROOF STATE]
proof (prove)
using this:
e * (v - u) / 2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))

goal (1 subgoal):
 1. e / 2 * norm (v - u) < norm ((v - u) *\<^sub>R f' x - (f v - f u))
[PROOF STEP]
by (simp add: \<open>u \<le> v\<close>)
[PROOF STATE]
proof (state)
this:
e / 2 * norm (v - u) < norm ((v - u) *\<^sub>R f' x - (f v - f u))

goal (1 subgoal):
 1. False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm ((v - u) *\<^sub>R f' x - (f v - f u)) < norm ((v - u) *\<^sub>R f' x - (f v - f u))
[PROOF STEP]
have "e * (v - u)/2 < e * (v - u)/2"
[PROOF STATE]
proof (prove)
using this:
norm ((v - u) *\<^sub>R f' x - (f v - f u)) < norm ((v - u) *\<^sub>R f' x - (f v - f u))

goal (1 subgoal):
 1. e * (v - u) / 2 < e * (v - u) / 2
[PROOF STEP]
using uv
[PROOF STATE]
proof (prove)
using this:
norm ((v - u) *\<^sub>R f' x - (f v - f u)) < norm ((v - u) *\<^sub>R f' x - (f v - f u))
{u, v} \<subseteq> cbox u v

goal (1 subgoal):
 1. e * (v - u) / 2 < e * (v - u) / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e * (v - u) / 2 < e * (v - u) / 2

goal (1 subgoal):
 1. False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e * (v - u) / 2 < e * (v - u) / 2
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
e * (v - u) / 2 < e * (v - u) / 2

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?x1, ?K1) \<in> p; ?x1 \<noteq> a; ?x1 \<noteq> b; e * (Sup ?K1 - Inf ?K1) / 2 < norm (content ?K1 *\<^sub>R f' ?x1 - (f (Sup ?K1) - f (Inf ?K1)))\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
have "norm (\<Sum>(x, K)\<in>p - ?A. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))
          \<le> (\<Sum>(x, K)\<in>p - ?A. norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))
[PROOF STEP]
by (auto intro: sum_norm_le)
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
have "... \<le> (\<Sum>n\<in>p - ?A. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k) / 2)
[PROOF STEP]
using non
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?x1, ?K1) \<in> p; ?x1 \<noteq> a; ?x1 \<noteq> b; e * (Sup ?K1 - Inf ?K1) / 2 < norm (content ?K1 *\<^sub>R f' ?x1 - (f (Sup ?K1) - f (Inf ?K1)))\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k) / 2)
[PROOF STEP]
by (fastforce intro: sum_mono)
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k) / 2)

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k) / 2)
[PROOF STEP]
have I: "norm (\<Sum>(x, k)\<in>p - ?A.
                  content k *\<^sub>R f' x - (f (Sup k) - f (Inf k)))
             \<le> (\<Sum>n\<in>p - ?A. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))/2"
[PROOF STATE]
proof (prove)
using this:
norm (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k) / 2)

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p - {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
by (simp add: sum_divide_distrib)
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, k)\<in>p - {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
have II: "norm (\<Sum>(x, k)\<in>p \<inter> ?A. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) -
             (\<Sum>n\<in>p \<inter> ?A. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))
             \<le> (\<Sum>n\<in>p - ?A. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
have ge0: "0 \<le> e * (Sup k - Inf k)" if xkp: "(x, k) \<in> p \<inter> ?A" for x k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> e * (Sup k - Inf k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> e * (Sup k - Inf k)
[PROOF STEP]
obtain u v where uv: "k = cbox u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u v. k = cbox u v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson Int_iff xkp p(4))
[PROOF STATE]
proof (state)
this:
k = cbox u v

goal (1 subgoal):
 1. 0 \<le> e * (Sup k - Inf k)
[PROOF STEP]
with p(2) that uv
[PROOF STATE]
proof (chain)
picking this:
(?x, ?K) \<in> p \<Longrightarrow> ?x \<in> ?K
(x, k) \<in> p \<inter> {t. fst t \<in> {a, b}}
k = cbox u v
k = cbox u v
[PROOF STEP]
have "cbox u v \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
(?x, ?K) \<in> p \<Longrightarrow> ?x \<in> ?K
(x, k) \<in> p \<inter> {t. fst t \<in> {a, b}}
k = cbox u v
k = cbox u v

goal (1 subgoal):
 1. cbox u v \<noteq> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cbox u v \<noteq> {}

goal (1 subgoal):
 1. 0 \<le> e * (Sup k - Inf k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cbox u v \<noteq> {}
[PROOF STEP]
show "0 \<le> e * ((Sup k) - (Inf k))"
[PROOF STATE]
proof (prove)
using this:
cbox u v \<noteq> {}

goal (1 subgoal):
 1. 0 \<le> e * (Sup k - Inf k)
[PROOF STEP]
unfolding uv
[PROOF STATE]
proof (prove)
using this:
cbox u v \<noteq> {}

goal (1 subgoal):
 1. 0 \<le> e * (Sup (cbox u v) - Inf (cbox u v))
[PROOF STEP]
using e
[PROOF STATE]
proof (prove)
using this:
cbox u v \<noteq> {}
0 < e

goal (1 subgoal):
 1. 0 \<le> e * (Sup (cbox u v) - Inf (cbox u v))
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> e * (Sup k - Inf k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(?x1, ?k1) \<in> p \<inter> {t. fst t \<in> {a, b}} \<Longrightarrow> 0 \<le> e * (Sup ?k1 - Inf ?k1)

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
let ?B = "\<lambda>x. {t \<in> p. fst t = x \<and> content (snd t) \<noteq> 0}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
let ?C = "{t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
have "norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b-a)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2
[PROOF STEP]
have *: "\<And>S f e. sum f S = sum f (p \<inter> ?C) \<Longrightarrow> norm (sum f (p \<inter> ?C)) \<le> e \<Longrightarrow> norm (sum f S) \<le> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S f e. \<lbrakk>sum f S = sum f (p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}); norm (sum f (p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0})) \<le> e\<rbrakk> \<Longrightarrow> norm (sum f S) \<le> e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>sum ?f1 ?S1 = sum ?f1 (p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}); norm (sum ?f1 (p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0})) \<le> ?e1\<rbrakk> \<Longrightarrow> norm (sum ?f1 ?S1) \<le> ?e1

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2
[PROOF STEP]
have 1: "content K *\<^sub>R (f' x) - (f ((Sup K)) - f ((Inf K))) = 0"
            if "(x,K) \<in> p \<inter> {t. fst t \<in> {a, b}} - p \<inter> ?C" for x K
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)) = (0::'a)
[PROOF STEP]
have xk: "(x,K) \<in> p" and k0: "content K = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, K) \<in> p &&& content K = 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
(x, K) \<in> p \<inter> {t. fst t \<in> {a, b}} - p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}

goal (1 subgoal):
 1. (x, K) \<in> p &&& content K = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x, K) \<in> p
content K = 0

goal (1 subgoal):
 1. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)) = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x, K) \<in> p
content K = 0
[PROOF STEP]
obtain u v where uv: "K = cbox u v"
[PROOF STATE]
proof (prove)
using this:
(x, K) \<in> p
content K = 0

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

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

goal (1 subgoal):
 1. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)) = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
K = cbox u v
[PROOF STEP]
have "u = v"
[PROOF STATE]
proof (prove)
using this:
K = cbox u v

goal (1 subgoal):
 1. u = v
[PROOF STEP]
using xk k0 p(2)
[PROOF STATE]
proof (prove)
using this:
K = cbox u v
(x, K) \<in> p
content K = 0
(?x, ?K) \<in> p \<Longrightarrow> ?x \<in> ?K

goal (1 subgoal):
 1. u = v
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
u = v

goal (1 subgoal):
 1. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)) = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u = v
[PROOF STEP]
show "content K *\<^sub>R (f' x) - (f ((Sup K)) - f ((Inf K))) = 0"
[PROOF STATE]
proof (prove)
using this:
u = v

goal (1 subgoal):
 1. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)) = (0::'a)
[PROOF STEP]
using xk
[PROOF STATE]
proof (prove)
using this:
u = v
(x, K) \<in> p

goal (1 subgoal):
 1. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)) = (0::'a)
[PROOF STEP]
unfolding uv
[PROOF STATE]
proof (prove)
using this:
u = v
(x, cbox u v) \<in> p

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(?x2, ?K2) \<in> p \<inter> {t. fst t \<in> {a, b}} - p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0} \<Longrightarrow> content ?K2 *\<^sub>R f' ?x2 - (f (Sup ?K2) - f (Inf ?K2)) = (0::'a)

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2
[PROOF STEP]
have 2: "norm(\<Sum>(x,K)\<in>p \<inter> ?C. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))  \<le> e * (b-a)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
have norm_le: "norm (sum f S) \<le> e"
              if "\<And>x y. \<lbrakk>x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> x = y" "\<And>x. x \<in> S \<Longrightarrow> norm (f x) \<le> e" "e > 0"
              for S f and e :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (sum f S) \<le> e
[PROOF STEP]
proof (cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> norm (sum f S) \<le> e
 2. S \<noteq> {} \<Longrightarrow> norm (sum f S) \<le> e
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> norm (sum f S) \<le> e
 2. S \<noteq> {} \<Longrightarrow> norm (sum f S) \<le> e
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x2 \<in> S; ?y2 \<in> S\<rbrakk> \<Longrightarrow> ?x2 = ?y2
?x2 \<in> S \<Longrightarrow> norm (f ?x2) \<le> e
0 < e
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x2 \<in> S; ?y2 \<in> S\<rbrakk> \<Longrightarrow> ?x2 = ?y2
?x2 \<in> S \<Longrightarrow> norm (f ?x2) \<le> e
0 < e
S = {}

goal (1 subgoal):
 1. norm (sum f S) \<le> e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (sum f S) \<le> e

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> norm (sum f S) \<le> e
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> norm (sum f S) \<le> e
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> norm (sum f S) \<le> e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
[PROOF STEP]
obtain x where "x \<in> S"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

goal (1 subgoal):
 1. (\<And>x. x \<in> S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> S

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> norm (sum f S) \<le> e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> S
[PROOF STEP]
have "S = {x}"
[PROOF STATE]
proof (prove)
using this:
x \<in> S

goal (1 subgoal):
 1. S = {x}
[PROOF STEP]
using that(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> S
\<lbrakk>?x2 \<in> S; ?y2 \<in> S\<rbrakk> \<Longrightarrow> ?x2 = ?y2

goal (1 subgoal):
 1. S = {x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S = {x}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> norm (sum f S) \<le> e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {x}

goal (1 subgoal):
 1. norm (sum f S) \<le> e
[PROOF STEP]
using \<open>x \<in> S\<close> that(2)
[PROOF STATE]
proof (prove)
using this:
S = {x}
x \<in> S
?x2 \<in> S \<Longrightarrow> norm (f ?x2) \<le> e

goal (1 subgoal):
 1. norm (sum f S) \<le> e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (sum f S) \<le> e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>x y. \<lbrakk>x \<in> ?S3; y \<in> ?S3\<rbrakk> \<Longrightarrow> x = y; \<And>x. x \<in> ?S3 \<Longrightarrow> norm (?f3 x) \<le> ?e3; 0 < ?e3\<rbrakk> \<Longrightarrow> norm (sum ?f3 ?S3) \<le> ?e3

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
have *: "p \<inter> ?C = ?B a \<union> ?B b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0} = {t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0} \<union> {t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0} = {t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0} \<union> {t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0} = {t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0} \<union> {t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}
[PROOF STEP]
have "norm (\<Sum>(x,K)\<in>p \<inter> ?C. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) =
                       norm (\<Sum>(x,K) \<in> ?B a \<union> ?B b. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))"
[PROOF STATE]
proof (prove)
using this:
p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0} = {t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0} \<union> {t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) = norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0} \<union> {t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) = norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0} \<union> {t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) = norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0} \<union> {t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
have "... = norm ((\<Sum>(x,K) \<in> ?B a. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) +
                                   (\<Sum>(x,K) \<in> ?B b. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0} \<union> {t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) = norm ((\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))
[PROOF STEP]
using p(1) ab e
[PROOF STATE]
proof (prove)
using this:
finite p
a < b
0 < e

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0} \<union> {t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) = norm ((\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))
[PROOF STEP]
by (subst sum.union_disjoint) auto
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0} \<union> {t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) = norm ((\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0} \<union> {t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) = norm ((\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
have "... \<le> e * (b - a) / 4 + e * (b - a) / 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))) \<le> e * (b - a) / 4 + e * (b - a) / 4
[PROOF STEP]
proof (rule norm_triangle_le [OF add_mono])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4
 2. norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4
[PROOF STEP]
have pa: "\<exists>v. k = cbox a v \<and> a \<le> v" if "(a, k) \<in> p" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>v. k = cbox a v \<and> a \<le> v
[PROOF STEP]
using p(2) p(3) p(4) that
[PROOF STATE]
proof (prove)
using this:
(?x, ?K) \<in> p \<Longrightarrow> ?x \<in> ?K
(?x, ?K) \<in> p \<Longrightarrow> ?K \<subseteq> {a..b}
(?x, ?K) \<in> p \<Longrightarrow> \<exists>a b. ?K = cbox a b
(a, k) \<in> p

goal (1 subgoal):
 1. \<exists>v. k = cbox a v \<and> a \<le> v
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(a, ?k3) \<in> p \<Longrightarrow> \<exists>v. ?k3 = cbox a v \<and> a \<le> v

goal (2 subgoals):
 1. norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4
 2. norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4
[PROOF STEP]
show "norm (\<Sum>(x,K) \<in> ?B a. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4
[PROOF STEP]
proof (intro norm_le; clarsimp)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>b ba. \<lbrakk>(a, b) \<in> p; (a, ba) \<in> p; content b \<noteq> 0; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> b = ba
 2. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
fix K K'
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>b ba. \<lbrakk>(a, b) \<in> p; (a, ba) \<in> p; content b \<noteq> 0; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> b = ba
 2. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
assume K: "(a, K) \<in> p" "(a, K') \<in> p" and ne0: "content K \<noteq> 0" "content K' \<noteq> 0"
[PROOF STATE]
proof (state)
this:
(a, K) \<in> p
(a, K') \<in> p
content K \<noteq> 0
content K' \<noteq> 0

goal (3 subgoals):
 1. \<And>b ba. \<lbrakk>(a, b) \<in> p; (a, ba) \<in> p; content b \<noteq> 0; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> b = ba
 2. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
with pa
[PROOF STATE]
proof (chain)
picking this:
(a, ?k3) \<in> p \<Longrightarrow> \<exists>v. ?k3 = cbox a v \<and> a \<le> v
(a, K) \<in> p
(a, K') \<in> p
content K \<noteq> 0
content K' \<noteq> 0
[PROOF STEP]
obtain v v' where v: "K = cbox a v" "a \<le> v" and v': "K' = cbox a v'" "a \<le> v'"
[PROOF STATE]
proof (prove)
using this:
(a, ?k3) \<in> p \<Longrightarrow> \<exists>v. ?k3 = cbox a v \<and> a \<le> v
(a, K) \<in> p
(a, K') \<in> p
content K \<noteq> 0
content K' \<noteq> 0

goal (1 subgoal):
 1. (\<And>v v'. \<lbrakk>K = cbox a v; a \<le> v; K' = cbox a v'; a \<le> v'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
K = cbox a v
a \<le> v
K' = cbox a v'
a \<le> v'

goal (3 subgoals):
 1. \<And>b ba. \<lbrakk>(a, b) \<in> p; (a, ba) \<in> p; content b \<noteq> 0; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> b = ba
 2. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
let ?v = "min v v'"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>b ba. \<lbrakk>(a, b) \<in> p; (a, ba) \<in> p; content b \<noteq> 0; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> b = ba
 2. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
have "box a ?v \<subseteq> K \<inter> K'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. box a (min v v') \<subseteq> K \<inter> K'
[PROOF STEP]
unfolding v v'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. box a (min v v') \<subseteq> cbox a v \<inter> cbox a v'
[PROOF STEP]
by (auto simp add: mem_box)
[PROOF STATE]
proof (state)
this:
box a (min v v') \<subseteq> K \<inter> K'

goal (3 subgoals):
 1. \<And>b ba. \<lbrakk>(a, b) \<in> p; (a, ba) \<in> p; content b \<noteq> 0; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> b = ba
 2. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
box a (min v v') \<subseteq> K \<inter> K'
[PROOF STEP]
have "interior (box a (min v v')) \<subseteq> interior K \<inter> interior K'"
[PROOF STATE]
proof (prove)
using this:
box a (min v v') \<subseteq> K \<inter> K'

goal (1 subgoal):
 1. interior (box a (min v v')) \<subseteq> interior K \<inter> interior K'
[PROOF STEP]
using interior_Int interior_mono
[PROOF STATE]
proof (prove)
using this:
box a (min v v') \<subseteq> K \<inter> K'
interior (?S \<inter> ?T) = interior ?S \<inter> interior ?T
?S \<subseteq> ?T \<Longrightarrow> interior ?S \<subseteq> interior ?T

goal (1 subgoal):
 1. interior (box a (min v v')) \<subseteq> interior K \<inter> interior K'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
interior (box a (min v v')) \<subseteq> interior K \<inter> interior K'

goal (3 subgoals):
 1. \<And>b ba. \<lbrakk>(a, b) \<in> p; (a, ba) \<in> p; content b \<noteq> 0; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> b = ba
 2. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
interior (box a (min v v')) \<subseteq> interior K \<inter> interior K'

goal (3 subgoals):
 1. \<And>b ba. \<lbrakk>(a, b) \<in> p; (a, ba) \<in> p; content b \<noteq> 0; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> b = ba
 2. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
have "(a + ?v)/2 \<in> box a ?v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + min v v') / 2 \<in> box a (min v v')
[PROOF STEP]
using ne0
[PROOF STATE]
proof (prove)
using this:
content K \<noteq> 0
content K' \<noteq> 0

goal (1 subgoal):
 1. (a + min v v') / 2 \<in> box a (min v v')
[PROOF STEP]
unfolding v v' content_eq_0 not_le
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>i\<in>Basis. v \<bullet> i \<le> a \<bullet> i)
\<not> (\<exists>i\<in>Basis. v' \<bullet> i \<le> a \<bullet> i)

goal (1 subgoal):
 1. (a + min v v') / 2 \<in> box a (min v v')
[PROOF STEP]
by (auto simp add: mem_box)
[PROOF STATE]
proof (state)
this:
(a + min v v') / 2 \<in> box a (min v v')

goal (3 subgoals):
 1. \<And>b ba. \<lbrakk>(a, b) \<in> p; (a, ba) \<in> p; content b \<noteq> 0; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> b = ba
 2. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
interior (box a (min v v')) \<subseteq> interior K \<inter> interior K'
(a + min v v') / 2 \<in> box a (min v v')
[PROOF STEP]
have "(a + ?v)/2 \<in> interior K \<inter> interior K'"
[PROOF STATE]
proof (prove)
using this:
interior (box a (min v v')) \<subseteq> interior K \<inter> interior K'
(a + min v v') / 2 \<in> box a (min v v')

goal (1 subgoal):
 1. (a + min v v') / 2 \<in> interior K \<inter> interior K'
[PROOF STEP]
unfolding interior_open[OF open_box]
[PROOF STATE]
proof (prove)
using this:
box a (min v v') \<subseteq> interior K \<inter> interior K'
(a + min v v') / 2 \<in> box a (min v v')

goal (1 subgoal):
 1. (a + min v v') / 2 \<in> interior K \<inter> interior K'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a + min v v') / 2 \<in> interior K \<inter> interior K'

goal (3 subgoals):
 1. \<And>b ba. \<lbrakk>(a, b) \<in> p; (a, ba) \<in> p; content b \<noteq> 0; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> b = ba
 2. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(a + min v v') / 2 \<in> interior K \<inter> interior K'
[PROOF STEP]
show "K = K'"
[PROOF STATE]
proof (prove)
using this:
(a + min v v') / 2 \<in> interior K \<inter> interior K'

goal (1 subgoal):
 1. K = K'
[PROOF STEP]
using p(5)[OF K]
[PROOF STATE]
proof (prove)
using this:
(a + min v v') / 2 \<in> interior K \<inter> interior K'
(a, K) \<noteq> (a, K') \<Longrightarrow> interior K \<inter> interior K' = {}

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

goal (2 subgoals):
 1. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 2. 0 < e * (b - a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 2. 0 < e * (b - a)
[PROOF STEP]
fix K
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 2. 0 < e * (b - a)
[PROOF STEP]
assume K: "(a, K) \<in> p" and ne0: "content K \<noteq> 0"
[PROOF STATE]
proof (state)
this:
(a, K) \<in> p
content K \<noteq> 0

goal (2 subgoals):
 1. \<And>ba. \<lbrakk>(a, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' a - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 2. 0 < e * (b - a)
[PROOF STEP]
show "norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b-a)"
                  if "(a, c) \<in> p" and ne0: "content c \<noteq> 0" for c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
obtain v where v: "c = cbox a v" and "a \<le> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v. \<lbrakk>c = cbox a v; a \<le> v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using pa[OF \<open>(a, c) \<in> p\<close>]
[PROOF STATE]
proof (prove)
using this:
\<exists>v. c = cbox a v \<and> a \<le> v

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>c = cbox a v; a \<le> v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
c = cbox a v
a \<le> v

goal (1 subgoal):
 1. norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c = cbox a v
a \<le> v
[PROOF STEP]
have "a \<in> {a..v}" "v \<le> b"
[PROOF STATE]
proof (prove)
using this:
c = cbox a v
a \<le> v

goal (1 subgoal):
 1. a \<in> {a..v} &&& v \<le> b
[PROOF STEP]
using p(3)[OF \<open>(a, c) \<in> p\<close>]
[PROOF STATE]
proof (prove)
using this:
c = cbox a v
a \<le> v
c \<subseteq> {a..b}

goal (1 subgoal):
 1. a \<in> {a..v} &&& v \<le> b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> {a..v}
v \<le> b

goal (1 subgoal):
 1. norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a \<in> {a..v}
v \<le> b

goal (1 subgoal):
 1. norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
have "{a..v} \<subseteq> ball a da"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a..v} \<subseteq> ball a da
[PROOF STEP]
using fineD[OF \<open>?d fine p\<close> \<open>(a, c) \<in> p\<close>]
[PROOF STATE]
proof (prove)
using this:
c \<subseteq> ball a (if a = a then da else if a = b then db else d a)

goal (1 subgoal):
 1. {a..v} \<subseteq> ball a da
[PROOF STEP]
by (simp add: v split: if_split_asm)
[PROOF STATE]
proof (state)
this:
{a..v} \<subseteq> ball a da

goal (1 subgoal):
 1. norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a \<in> {a..v}
v \<le> b
{a..v} \<subseteq> ball a da
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<in> {a..v}
v \<le> b
{a..v} \<subseteq> ball a da

goal (1 subgoal):
 1. norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
unfolding v interval_bounds_real[OF \<open>a \<le> v\<close>] box_real
[PROOF STATE]
proof (prove)
using this:
a \<in> {a..v}
v \<le> b
{a..v} \<subseteq> ball a da

goal (1 subgoal):
 1. norm (content {a..v} *\<^sub>R f' a - (f v - f a)) * 4 \<le> e * (b - a)
[PROOF STEP]
using da \<open>a \<le> v\<close>
[PROOF STATE]
proof (prove)
using this:
a \<in> {a..v}
v \<le> b
{a..v} \<subseteq> ball a da
\<lbrakk>a \<le> ?c; {a..?c} \<subseteq> {a..b}; {a..?c} \<subseteq> ball a da\<rbrakk> \<Longrightarrow> norm (content {a..?c} *\<^sub>R f' a - (f ?c - f a)) \<le> e * (b - a) / 4
a \<le> v

goal (1 subgoal):
 1. norm (content {a..v} *\<^sub>R f' a - (f v - f a)) * 4 \<le> e * (b - a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>(a, ?c3) \<in> p; content ?c3 \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ?c3 *\<^sub>R f' a - (f (Sup ?c3) - f (Inf ?c3))) * 4 \<le> e * (b - a)

goal (1 subgoal):
 1. 0 < e * (b - a)
[PROOF STEP]
qed (use ab e in auto)
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4
[PROOF STEP]
have pb: "\<exists>v. k = cbox v b \<and> b \<ge> v" if "(b, k) \<in> p" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>v. k = cbox v b \<and> v \<le> b
[PROOF STEP]
using p(2) p(3) p(4) that
[PROOF STATE]
proof (prove)
using this:
(?x, ?K) \<in> p \<Longrightarrow> ?x \<in> ?K
(?x, ?K) \<in> p \<Longrightarrow> ?K \<subseteq> {a..b}
(?x, ?K) \<in> p \<Longrightarrow> \<exists>a b. ?K = cbox a b
(b, k) \<in> p

goal (1 subgoal):
 1. \<exists>v. k = cbox v b \<and> v \<le> b
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(b, ?k3) \<in> p \<Longrightarrow> \<exists>v. ?k3 = cbox v b \<and> v \<le> b

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4
[PROOF STEP]
show "norm (\<Sum>(x,K) \<in> ?B b. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4
[PROOF STEP]
proof (intro norm_le; clarsimp)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>ba baa. \<lbrakk>(b, ba) \<in> p; (b, baa) \<in> p; content ba \<noteq> 0; content baa \<noteq> 0\<rbrakk> \<Longrightarrow> ba = baa
 2. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
fix K K'
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>ba baa. \<lbrakk>(b, ba) \<in> p; (b, baa) \<in> p; content ba \<noteq> 0; content baa \<noteq> 0\<rbrakk> \<Longrightarrow> ba = baa
 2. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
assume K: "(b, K) \<in> p" "(b, K') \<in> p" and ne0: "content K \<noteq> 0" "content K' \<noteq> 0"
[PROOF STATE]
proof (state)
this:
(b, K) \<in> p
(b, K') \<in> p
content K \<noteq> 0
content K' \<noteq> 0

goal (3 subgoals):
 1. \<And>ba baa. \<lbrakk>(b, ba) \<in> p; (b, baa) \<in> p; content ba \<noteq> 0; content baa \<noteq> 0\<rbrakk> \<Longrightarrow> ba = baa
 2. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
with pb
[PROOF STATE]
proof (chain)
picking this:
(b, ?k3) \<in> p \<Longrightarrow> \<exists>v. ?k3 = cbox v b \<and> v \<le> b
(b, K) \<in> p
(b, K') \<in> p
content K \<noteq> 0
content K' \<noteq> 0
[PROOF STEP]
obtain v v' where v: "K = cbox v b" "v \<le> b" and v': "K' = cbox v' b" "v' \<le> b"
[PROOF STATE]
proof (prove)
using this:
(b, ?k3) \<in> p \<Longrightarrow> \<exists>v. ?k3 = cbox v b \<and> v \<le> b
(b, K) \<in> p
(b, K') \<in> p
content K \<noteq> 0
content K' \<noteq> 0

goal (1 subgoal):
 1. (\<And>v v'. \<lbrakk>K = cbox v b; v \<le> b; K' = cbox v' b; v' \<le> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
K = cbox v b
v \<le> b
K' = cbox v' b
v' \<le> b

goal (3 subgoals):
 1. \<And>ba baa. \<lbrakk>(b, ba) \<in> p; (b, baa) \<in> p; content ba \<noteq> 0; content baa \<noteq> 0\<rbrakk> \<Longrightarrow> ba = baa
 2. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
let ?v = "max v v'"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>ba baa. \<lbrakk>(b, ba) \<in> p; (b, baa) \<in> p; content ba \<noteq> 0; content baa \<noteq> 0\<rbrakk> \<Longrightarrow> ba = baa
 2. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
have "box ?v b \<subseteq> K \<inter> K'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. box (max v v') b \<subseteq> K \<inter> K'
[PROOF STEP]
unfolding v v'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. box (max v v') b \<subseteq> cbox v b \<inter> cbox v' b
[PROOF STEP]
by (auto simp: mem_box)
[PROOF STATE]
proof (state)
this:
box (max v v') b \<subseteq> K \<inter> K'

goal (3 subgoals):
 1. \<And>ba baa. \<lbrakk>(b, ba) \<in> p; (b, baa) \<in> p; content ba \<noteq> 0; content baa \<noteq> 0\<rbrakk> \<Longrightarrow> ba = baa
 2. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
box (max v v') b \<subseteq> K \<inter> K'
[PROOF STEP]
have "interior (box (max v v') b) \<subseteq> interior K \<inter> interior K'"
[PROOF STATE]
proof (prove)
using this:
box (max v v') b \<subseteq> K \<inter> K'

goal (1 subgoal):
 1. interior (box (max v v') b) \<subseteq> interior K \<inter> interior K'
[PROOF STEP]
using interior_Int interior_mono
[PROOF STATE]
proof (prove)
using this:
box (max v v') b \<subseteq> K \<inter> K'
interior (?S \<inter> ?T) = interior ?S \<inter> interior ?T
?S \<subseteq> ?T \<Longrightarrow> interior ?S \<subseteq> interior ?T

goal (1 subgoal):
 1. interior (box (max v v') b) \<subseteq> interior K \<inter> interior K'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
interior (box (max v v') b) \<subseteq> interior K \<inter> interior K'

goal (3 subgoals):
 1. \<And>ba baa. \<lbrakk>(b, ba) \<in> p; (b, baa) \<in> p; content ba \<noteq> 0; content baa \<noteq> 0\<rbrakk> \<Longrightarrow> ba = baa
 2. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
interior (box (max v v') b) \<subseteq> interior K \<inter> interior K'

goal (3 subgoals):
 1. \<And>ba baa. \<lbrakk>(b, ba) \<in> p; (b, baa) \<in> p; content ba \<noteq> 0; content baa \<noteq> 0\<rbrakk> \<Longrightarrow> ba = baa
 2. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
have " ((b + ?v)/2) \<in> box ?v b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b + max v v') / 2 \<in> box (max v v') b
[PROOF STEP]
using ne0
[PROOF STATE]
proof (prove)
using this:
content K \<noteq> 0
content K' \<noteq> 0

goal (1 subgoal):
 1. (b + max v v') / 2 \<in> box (max v v') b
[PROOF STEP]
unfolding v v' content_eq_0 not_le
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>i\<in>Basis. b \<bullet> i \<le> v \<bullet> i)
\<not> (\<exists>i\<in>Basis. b \<bullet> i \<le> v' \<bullet> i)

goal (1 subgoal):
 1. (b + max v v') / 2 \<in> box (max v v') b
[PROOF STEP]
by (auto simp: mem_box)
[PROOF STATE]
proof (state)
this:
(b + max v v') / 2 \<in> box (max v v') b

goal (3 subgoals):
 1. \<And>ba baa. \<lbrakk>(b, ba) \<in> p; (b, baa) \<in> p; content ba \<noteq> 0; content baa \<noteq> 0\<rbrakk> \<Longrightarrow> ba = baa
 2. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
interior (box (max v v') b) \<subseteq> interior K \<inter> interior K'
(b + max v v') / 2 \<in> box (max v v') b
[PROOF STEP]
have "((b + ?v)/2) \<in> interior K \<inter> interior K'"
[PROOF STATE]
proof (prove)
using this:
interior (box (max v v') b) \<subseteq> interior K \<inter> interior K'
(b + max v v') / 2 \<in> box (max v v') b

goal (1 subgoal):
 1. (b + max v v') / 2 \<in> interior K \<inter> interior K'
[PROOF STEP]
unfolding interior_open[OF open_box]
[PROOF STATE]
proof (prove)
using this:
box (max v v') b \<subseteq> interior K \<inter> interior K'
(b + max v v') / 2 \<in> box (max v v') b

goal (1 subgoal):
 1. (b + max v v') / 2 \<in> interior K \<inter> interior K'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(b + max v v') / 2 \<in> interior K \<inter> interior K'

goal (3 subgoals):
 1. \<And>ba baa. \<lbrakk>(b, ba) \<in> p; (b, baa) \<in> p; content ba \<noteq> 0; content baa \<noteq> 0\<rbrakk> \<Longrightarrow> ba = baa
 2. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 3. 0 < e * (b - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(b + max v v') / 2 \<in> interior K \<inter> interior K'
[PROOF STEP]
show "K = K'"
[PROOF STATE]
proof (prove)
using this:
(b + max v v') / 2 \<in> interior K \<inter> interior K'

goal (1 subgoal):
 1. K = K'
[PROOF STEP]
using p(5)[OF K]
[PROOF STATE]
proof (prove)
using this:
(b + max v v') / 2 \<in> interior K \<inter> interior K'
(b, K) \<noteq> (b, K') \<Longrightarrow> interior K \<inter> interior K' = {}

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

goal (2 subgoals):
 1. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 2. 0 < e * (b - a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 2. 0 < e * (b - a)
[PROOF STEP]
fix K
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 2. 0 < e * (b - a)
[PROOF STEP]
assume K: "(b, K) \<in> p" and ne0: "content K \<noteq> 0"
[PROOF STATE]
proof (state)
this:
(b, K) \<in> p
content K \<noteq> 0

goal (2 subgoals):
 1. \<And>ba. \<lbrakk>(b, ba) \<in> p; content ba \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ba *\<^sub>R f' b - (f (Sup ba) - f (Inf ba))) * 4 \<le> e * (b - a)
 2. 0 < e * (b - a)
[PROOF STEP]
show "norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b-a)"
                  if "(b, c) \<in> p" and ne0: "content c \<noteq> 0" for c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
obtain v where v: "c = cbox v b" and "v \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v. \<lbrakk>c = cbox v b; v \<le> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>(b, c) \<in> p\<close> pb
[PROOF STATE]
proof (prove)
using this:
(b, c) \<in> p
(b, ?k3) \<in> p \<Longrightarrow> \<exists>v. ?k3 = cbox v b \<and> v \<le> b

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>c = cbox v b; v \<le> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
c = cbox v b
v \<le> b

goal (1 subgoal):
 1. norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c = cbox v b
v \<le> b
[PROOF STEP]
have "v \<ge> a""b \<in> {v.. b}"
[PROOF STATE]
proof (prove)
using this:
c = cbox v b
v \<le> b

goal (1 subgoal):
 1. a \<le> v &&& b \<in> {v..b}
[PROOF STEP]
using p(3)[OF \<open>(b, c) \<in> p\<close>]
[PROOF STATE]
proof (prove)
using this:
c = cbox v b
v \<le> b
c \<subseteq> {a..b}

goal (1 subgoal):
 1. a \<le> v &&& b \<in> {v..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<le> v
b \<in> {v..b}

goal (1 subgoal):
 1. norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a \<le> v
b \<in> {v..b}

goal (1 subgoal):
 1. norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
have "{v..b} \<subseteq> ball b db"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {v..b} \<subseteq> ball b db
[PROOF STEP]
using fineD[OF \<open>?d fine p\<close> \<open>(b, c) \<in> p\<close>] box_real(2) v False
[PROOF STATE]
proof (prove)
using this:
c \<subseteq> ball b (if b = a then da else if b = b then db else d b)
cbox ?a ?b = {?a..?b}
c = cbox v b
a \<noteq> b

goal (1 subgoal):
 1. {v..b} \<subseteq> ball b db
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{v..b} \<subseteq> ball b db

goal (1 subgoal):
 1. norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a \<le> v
b \<in> {v..b}
{v..b} \<subseteq> ball b db
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<le> v
b \<in> {v..b}
{v..b} \<subseteq> ball b db

goal (1 subgoal):
 1. norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
using db v
[PROOF STATE]
proof (prove)
using this:
a \<le> v
b \<in> {v..b}
{v..b} \<subseteq> ball b db
\<lbrakk>?c \<le> b; {?c..b} \<subseteq> {a..b}; {?c..b} \<subseteq> ball b db\<rbrakk> \<Longrightarrow> norm (content {?c..b} *\<^sub>R f' b - (f b - f ?c)) \<le> e * (b - a) / 4
c = cbox v b

goal (1 subgoal):
 1. norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \<le> e * (b - a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>(b, ?c3) \<in> p; content ?c3 \<noteq> 0\<rbrakk> \<Longrightarrow> norm (content ?c3 *\<^sub>R f' b - (f (Sup ?c3) - f (Inf ?c3))) * 4 \<le> e * (b - a)

goal (1 subgoal):
 1. 0 < e * (b - a)
[PROOF STEP]
qed (use ab e in auto)
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 4

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))) \<le> e * (b - a) / 4 + e * (b - a) / 4

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>{t \<in> p. fst t = a \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + (\<Sum>(x, K)\<in>{t \<in> p. fst t = b \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))) \<le> e * (b - a) / 4 + e * (b - a) / 4

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
have "... = e * (b-a)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * (b - a) / 4 + e * (b - a) / 4 = e * (b - a) / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
e * (b - a) / 4 + e * (b - a) / 4 = e * (b - a) / 2

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2
[PROOF STEP]
show "norm (\<Sum>(x,k)\<in>p \<inter> ?C.
                        content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b-a)/2"
[PROOF STATE]
proof (prove)
using this:
norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, k)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2
[PROOF STEP]
show "norm (\<Sum>(x, k)\<in>p \<inter> ?A. content k *\<^sub>R f' x - (f ((Sup k)) - f ((Inf k)))) \<le> e * (b-a)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2
[PROOF STEP]
apply (rule * [OF sum.mono_neutral_right[OF pA(2)]])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0} \<subseteq> p \<inter> {t. fst t \<in> {a, b}}
 2. \<forall>i\<in>p \<inter> {t. fst t \<in> {a, b}} - p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. (case i of (x, k) \<Rightarrow> content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) = (0::'a)
 3. norm (\<Sum>(x, k)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
(?x2, ?K2) \<in> p \<inter> {t. fst t \<in> {a, b}} - p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0} \<Longrightarrow> content ?K2 *\<^sub>R f' ?x2 - (f (Sup ?K2) - f (Inf ?K2)) = (0::'a)
norm (\<Sum>(x, K)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (b - a) / 2

goal (3 subgoals):
 1. p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0} \<subseteq> p \<inter> {t. fst t \<in> {a, b}}
 2. \<forall>i\<in>p \<inter> {t. fst t \<in> {a, b}} - p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. (case i of (x, k) \<Rightarrow> content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) = (0::'a)
 3. norm (\<Sum>(x, k)\<in>p \<inter> {t \<in> p. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2
[PROOF STEP]
by (auto simp: split_paired_all)
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> e * (b - a) / 2

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
have "... = (\<Sum>n\<in>p. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * (b - a) / 2 = (\<Sum>n\<in>p. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
unfolding sum_distrib_left[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * (b - a) / 2 = e * (\<Sum>n\<in>p. case n of (x, k) \<Rightarrow> Sup k - Inf k) / 2
[PROOF STEP]
by (subst additive_tagged_division_1[OF \<open>a \<le> b\<close> ptag]) auto
[PROOF STATE]
proof (state)
this:
e * (b - a) / 2 = (\<Sum>n\<in>p. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> (\<Sum>n\<in>p. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
have norm_le: "norm (\<Sum>(x,K)\<in>p \<inter> {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))
                \<le> (\<Sum>n\<in>p. e * (case n of (x, K) \<Rightarrow> Sup K - Inf K))/2"
[PROOF STATE]
proof (prove)
using this:
norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> (\<Sum>n\<in>p. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2

goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> (\<Sum>n\<in>p. e * (case n of (x, K) \<Rightarrow> Sup K - Inf K)) / 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> (\<Sum>n\<in>p. e * (case n of (x, K) \<Rightarrow> Sup K - Inf K)) / 2

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
have le2: "\<And>x s1 s2::real. 0 \<le> s1 \<Longrightarrow> x \<le> (s1 + s2)/2 \<Longrightarrow> x - s1 \<le> s2/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x s1 s2. \<lbrakk>0 \<le> s1; x \<le> (s1 + s2) / 2\<rbrakk> \<Longrightarrow> x - s1 \<le> s2 / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> ?s1.1; ?x1 \<le> (?s1.1 + ?s2.1) / 2\<rbrakk> \<Longrightarrow> ?x1 - ?s1.1 \<le> ?s2.1 / 2

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
[PROOF STEP]
apply (rule le2 [OF sum_nonneg])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> p \<inter> {t. fst t \<in> {a, b}} \<Longrightarrow> 0 \<le> e * (case x of (x, k) \<Rightarrow> Sup k - Inf k)
 2. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> ((\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) + (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))) / 2
[PROOF STEP]
using ge0
[PROOF STATE]
proof (prove)
using this:
(?x1, ?k1) \<in> p \<inter> {t. fst t \<in> {a, b}} \<Longrightarrow> 0 \<le> e * (Sup ?k1 - Inf ?k1)

goal (2 subgoals):
 1. \<And>x. x \<in> p \<inter> {t. fst t \<in> {a, b}} \<Longrightarrow> 0 \<le> e * (case x of (x, k) \<Rightarrow> Sup k - Inf k)
 2. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> ((\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) + (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))) / 2
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> ((\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) + (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k))) / 2
[PROOF STEP]
by (metis (no_types, lifting) Diff_Diff_Int Diff_subset norm_le p(1) sum.subset_diff)
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
note * = additive_tagged_division_1[OF assms(1) ptag, symmetric]
[PROOF STATE]
proof (state)
this:
?f b - ?f a = (\<Sum>(x, k)\<in>p. ?f (Sup k) - ?f (Inf k))

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
have "norm (\<Sum>(x,K)\<in>p \<inter> ?A \<union> (p - ?A). content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))
               \<le> e * (\<Sum>(x,K)\<in>p \<inter> ?A \<union> (p - ?A). Sup K - Inf K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}). content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}). Sup K - Inf K)
[PROOF STEP]
unfolding sum_distrib_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}). content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}). e * (case n of (x, K) \<Rightarrow> Sup K - Inf K))
[PROOF STEP]
unfolding sum.union_disjoint[OF pA(2-)]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))) \<le> (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, K) \<Rightarrow> Sup K - Inf K)) + (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, K) \<Rightarrow> Sup K - Inf K))
[PROOF STEP]
using le_xz norm_triangle_le I II
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y1 \<le> ?z1 / 2; ?w1 - ?x1 \<le> ?z1 / 2\<rbrakk> \<Longrightarrow> ?w1 + ?y1 \<le> ?x1 + ?z1
norm ?x + norm ?y \<le> ?e \<Longrightarrow> norm (?x + ?y) \<le> ?e
norm (\<Sum>(x, k)\<in>p - {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2
norm (\<Sum>(x, k)\<in>p \<inter> {t. fst t \<in> {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) \<le> (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, k) \<Rightarrow> Sup k - Inf k)) / 2

goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + (\<Sum>(x, K)\<in>p - {t. fst t \<in> {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))) \<le> (\<Sum>n\<in>p \<inter> {t. fst t \<in> {a, b}}. e * (case n of (x, K) \<Rightarrow> Sup K - Inf K)) + (\<Sum>n\<in>p - {t. fst t \<in> {a, b}}. e * (case n of (x, K) \<Rightarrow> Sup K - Inf K))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}). content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}). Sup K - Inf K)

goal (1 subgoal):
 1. \<And>p. \<lbrakk>p tagged_division_of {a..b}; (\<lambda>x. ball x (if x = a then da else if x = b then db else d x)) fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm (\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}). content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}). Sup K - Inf K)
[PROOF STEP]
show "norm ((\<Sum>(x,K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}"
[PROOF STATE]
proof (prove)
using this:
norm (\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}). content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \<le> e * (\<Sum>(x, K)\<in>p \<inter> {t. fst t \<in> {a, b}} \<union> (p - {t. fst t \<in> {a, b}}). Sup K - Inf K)

goal (1 subgoal):
 1. norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}
[PROOF STEP]
by (simp only: content_real[OF \<open>a \<le> b\<close>] *[of "\<lambda>x. x"] *[of f] sum_subtractf[symmetric] split_minus pA(1) [symmetric])
[PROOF STATE]
proof (state)
this:
norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a..b} \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, K)\<in>p. content K *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a..b})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f' has_integral f b - f a) {a..b}

goal:
No subgoals!
[PROOF STEP]
qed