# HG changeset patch # User paulson # Date 1503924063 -3600 # Node ID 9cbe0084b94174a4cf23f199b3248ce786a42c42 # Parent 322120e880c592b244e4b152f7b36e5801a2ea2c# Parent c485474cd91dff8915d6d4a83fb55777bf842865 merged diff -r 322120e880c5 -r 9cbe0084b941 src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Sat Aug 26 18:58:40 2017 +0200 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Mon Aug 28 13:41:03 2017 +0100 @@ -324,7 +324,7 @@ assumes "(f has_integral k1) i" "(f has_integral k2) i" shows "k1 = k2" proof (rule ccontr) - let ?e = "norm (k1 - k2) / 2" + let ?e = "norm (k1 - k2)/2" let ?F = "(\x. if x \ i then f x else 0)" assume "k1 \ k2" then have e: "?e > 0" @@ -334,25 +334,25 @@ obtain B1 where B1: "0 < B1" "\a b. ball 0 B1 \ cbox a b \ - \z. (?F has_integral z) (cbox a b) \ norm (z - k1) < norm (k1 - k2) / 2" + \z. (?F has_integral z) (cbox a b) \ norm (z - k1) < norm (k1 - k2)/2" by (rule has_integral_altD[OF assms(1) nonbox,OF e]) blast obtain B2 where B2: "0 < B2" "\a b. ball 0 B2 \ cbox a b \ - \z. (?F has_integral z) (cbox a b) \ norm (z - k2) < norm (k1 - k2) / 2" + \z. (?F has_integral z) (cbox a b) \ norm (z - k2) < norm (k1 - k2)/2" by (rule has_integral_altD[OF assms(2) nonbox,OF e]) blast obtain a b :: 'n where ab: "ball 0 B1 \ cbox a b" "ball 0 B2 \ cbox a b" by (metis Un_subset_iff bounded_Un bounded_ball bounded_subset_cbox) - obtain w where w: "(?F has_integral w) (cbox a b)" "norm (w - k1) < norm (k1 - k2) / 2" + obtain w where w: "(?F has_integral w) (cbox a b)" "norm (w - k1) < norm (k1 - k2)/2" using B1(2)[OF ab(1)] by blast - obtain z where z: "(?F has_integral z) (cbox a b)" "norm (z - k2) < norm (k1 - k2) / 2" + obtain z where z: "(?F has_integral z) (cbox a b)" "norm (z - k2) < norm (k1 - k2)/2" using B2(2)[OF ab(2)] by blast have "z = w" using has_integral_unique_cbox[OF w(1) z(1)] by auto then have "norm (k1 - k2) \ norm (z - k2) + norm (w - k1)" using norm_triangle_ineq4 [of "k1 - w" "k2 - z"] by (auto simp add: norm_minus_commute) - also have "\ < norm (k1 - k2) / 2 + norm (k1 - k2) / 2" + also have "\ < norm (k1 - k2)/2 + norm (k1 - k2)/2" by (metis add_strict_mono z(2) w(2)) finally show False by auto qed @@ -1290,10 +1290,10 @@ using mem_interior by metis have x: "x\k = c" using x interior_subset by fastforce - have *: "\i. i \ Basis \ \(x - (x + (\ / 2) *\<^sub>R k)) \ i\ = (if i = k then \/2 else 0)" + have *: "\i. i \ Basis \ \(x - (x + (\/2) *\<^sub>R k)) \ i\ = (if i = k then \/2 else 0)" using \0 < \\ k by (auto simp: inner_simps inner_not_same_Basis) - have "(\i\Basis. \(x - (x + (\ / 2 ) *\<^sub>R k)) \ i\) = - (\i\Basis. (if i = k then \ / 2 else 0))" + have "(\i\Basis. \(x - (x + (\/2 ) *\<^sub>R k)) \ i\) = + (\i\Basis. (if i = k then \/2 else 0))" using "*" by (blast intro: sum.cong) also have "\ < \" by (subst sum.delta) (use \0 < \\ in auto) @@ -1964,17 +1964,17 @@ assume c: "c < a \ k" moreover have "x \ cbox a b \ c \ x \ k" for x using k c by (auto simp: cbox_def) - ultimately have "cbox a b \ {x. \x \ k - c\ \ (a \ k - c) / 2} = {}" + ultimately have "cbox a b \ {x. \x \ k - c\ \ (a \ k - c)/2} = {}" using k by (auto simp: cbox_def) - with \0 c that[of "(a \ k - c) / 2"] show ?thesis + with \0 c that[of "(a \ k - c)/2"] show ?thesis by auto next assume c: "b \ k < c" moreover have "x \ cbox a b \ x \ k \ c" for x using k c by (auto simp: cbox_def) - ultimately have "cbox a b \ {x. \x \ k - c\ \ (c - b \ k) / 2} = {}" + ultimately have "cbox a b \ {x. \x \ k - c\ \ (c - b \ k)/2} = {}" using k by (auto simp: cbox_def) - with \0 c that[of "(c - b \ k) / 2"] show ?thesis + with \0 c that[of "(c - b \ k)/2"] show ?thesis by auto qed qed @@ -2194,21 +2194,21 @@ done also have "... \ (\i\N + 1. (real i + 1) * \\(x,K) \ q i. content K *\<^sub>R indicator S x\)" by (rule sum_mono) (simp add: sum_distrib_left [symmetric]) - also have "... \ (\i\N + 1. e/2 / 2 ^ i)" + also have "... \ (\i\N + 1. e/2/2 ^ i)" proof (rule sum_mono) - show "(real i + 1) * \\(x,K) \ q i. content K *\<^sub>R indicator S x\ \ e/2 / 2 ^ i" + show "(real i + 1) * \\(x,K) \ q i. content K *\<^sub>R indicator S x\ \ e/2/2 ^ i" if "i \ {..N + 1}" for i using \[of "q i" i] q by (simp add: divide_simps mult.left_commute) qed - also have "... = e/2 * (\i\N + 1. (1 / 2) ^ i)" + also have "... = e/2 * (\i\N + 1. (1/2) ^ i)" unfolding sum_distrib_left by (metis divide_inverse inverse_eq_divide power_one_over) also have "\ < e/2 * 2" proof (rule mult_strict_left_mono) - have "sum (op ^ (1 / 2)) {..N + 1} = sum (op ^ (1 / 2::real)) {..0 < e\ in auto) finally show ?thesis by auto qed @@ -2727,7 +2727,7 @@ lemma ident_has_integral: fixes a::real assumes "a \ b" - shows "((\x. x) has_integral (b\<^sup>2 - a\<^sup>2) / 2) {a..b}" + shows "((\x. x) has_integral (b\<^sup>2 - a\<^sup>2)/2) {a..b}" proof - have "((\x. x) has_integral inverse 2 * b\<^sup>2 - inverse 2 * a\<^sup>2) {a..b}" apply (rule fundamental_theorem_of_calculus [OF assms], clarify) @@ -2740,7 +2740,7 @@ lemma integral_ident [simp]: fixes a::real assumes "a \ b" - shows "integral {a..b} (\x. x) = (if a \ b then (b\<^sup>2 - a\<^sup>2) / 2 else 0)" + shows "integral {a..b} (\x. x) = (if a \ b then (b\<^sup>2 - a\<^sup>2)/2 else 0)" by (metis assms ident_has_integral integral_unique) lemma ident_integrable_on: @@ -2798,9 +2798,9 @@ and ivl: "a \ b" defines "i \ \x. ((b - x) ^ (p - 1) / fact (p - 1)) *\<^sub>R Df p x" shows taylor_has_integral: - "(i has_integral f b - (\iR Df i a)) {a..b}" + "(i has_integral f b - (\iR Df i a)) {a..b}" and taylor_integral: - "f b = (\iR Df i a) + integral {a..b} i" + "f b = (\iR Df i a) + integral {a..b} i" and taylor_integrable: "i integrable_on {a..b}" proof goal_cases @@ -2855,7 +2855,7 @@ by (auto intro!: image_eqI[where x = "p - x - 1"]) qed simp from _ this - have "?sum a = (\iR Df i a)" + have "?sum a = (\iR Df i a)" by (rule sum.reindex_cong) (auto simp add: inj_on_def Dg_def one) finally show c: ?case . case 2 show ?case using c integral_unique @@ -2900,8 +2900,8 @@ by (meson content_eq_0 dual_order.antisym) then have xi: "x\i = d\i" using \x \ K\ unfolding keq mem_box by (metis antisym) - define y where "y = (\j\Basis. (if j = i then if c\i \ (a\i + b\i) / 2 then c\i + - min e (b\i - c\i) / 2 else c\i - min e (c\i - a\i) / 2 else x\j) *\<^sub>R j)" + define y where "y = (\j\Basis. (if j = i then if c\i \ (a\i + b\i)/2 then c\i + + min e (b\i - c\i)/2 else c\i - min e (c\i - a\i)/2 else x\j) *\<^sub>R j)" show "\x'\\(\ - {K}). x' \ x \ dist x' x < e" proof (intro bexI conjI) have "d \ cbox c d" @@ -3414,7 +3414,7 @@ apply (erule_tac x=i in ballE) apply (auto simp: inner_simps mult_left_mono) done - moreover from True have *: "\i. (m *\<^sub>R b + c) \ i - (m *\<^sub>R a + c) \ i = m *\<^sub>R (b - a) \ i" + moreover from True have *: "\i. (m *\<^sub>R b + c) \ i - (m *\<^sub>R a + c) \ i = m *\<^sub>R (b-a) \ i" by (simp add: inner_simps field_simps) ultimately show ?thesis by (simp add: image_affinity_cbox True content_cbox' @@ -3427,7 +3427,7 @@ apply (erule_tac x=i in ballE) apply (auto simp: inner_simps mult_left_mono) done - moreover from False have *: "\i. (m *\<^sub>R a + c) \ i - (m *\<^sub>R b + c) \ i = (-m) *\<^sub>R (b - a) \ i" + moreover from False have *: "\i. (m *\<^sub>R a + c) \ i - (m *\<^sub>R b + c) \ i = (-m) *\<^sub>R (b-a) \ i" by (simp add: inner_simps field_simps) ultimately show ?thesis using False by (simp add: image_affinity_cbox content_cbox' @@ -3543,7 +3543,7 @@ fixes f :: "real \ 'a::real_normed_vector" assumes "a \ b" and contf: "continuous_on {a..b} f" - and derf: "\x. x \ {a <..< b} \ (f has_vector_derivative f'(x)) (at x)" + and derf: "\x. x \ {a <..< b} \ (f has_vector_derivative f' x) (at x)" shows "(f' has_integral (f b - f a)) {a..b}" proof (cases "a = b") case True @@ -3553,165 +3553,163 @@ next case False with \a \ b\ have ab: "a < b" by arith - let ?P = "\e. \d. gauge d \ (\p. p tagged_division_of {a..b} \ d fine p \ - norm ((\(x, k)\p. content k *\<^sub>R f' x) - (f b - f a)) \ e * content {a..b})" - { presume "\e. e > 0 \ ?P e" then show ?thesis unfolding has_integral_factor_content_real by force } - fix e :: real - assume e: "e > 0" - then have eba8: "(e * (b - a)) / 8 > 0" - using ab by (auto simp add: field_simps) - note derf_exp = derf[unfolded has_vector_derivative_def has_derivative_at_alt] - have bounded: "\x. x \ {a<.. bounded_linear (\u. u *\<^sub>R f' x)" - using derf_exp by simp - have "\x \ box a b. \d>0. \y. norm (y-x) < d \ norm (f y - f x - (y-x) *\<^sub>R f' x) \ e/2 * norm (y-x)" - (is "\x \ box a b. ?Q x") - proof - fix x assume x: "x \ box a b" - show "?Q x" - apply (rule allE [where x="e/2", OF derf_exp [THEN conjunct2, of x]]) - using x e by auto - qed - from this [unfolded bgauge_existence_lemma] - obtain d where d: "\x. 0 < d x" - "\x y. \x \ box a b; norm (y-x) < d x\ + show ?thesis + unfolding has_integral_factor_content_real + proof (intro allI impI) + fix e :: real + assume e: "e > 0" + then have eba8: "(e * (b-a)) / 8 > 0" + using ab by (auto simp add: field_simps) + note derf_exp = derf[unfolded has_vector_derivative_def has_derivative_at_alt] + have bounded: "\x. x \ {a<.. bounded_linear (\u. u *\<^sub>R f' x)" + using derf_exp by simp + have "\x \ box a b. \d>0. \y. norm (y-x) < d \ norm (f y - f x - (y-x) *\<^sub>R f' x) \ e/2 * norm (y-x)" + (is "\x \ box a b. ?Q x") + proof + fix x assume x: "x \ box a b" + show "?Q x" + apply (rule allE [where x="e/2", OF derf_exp [THEN conjunct2, of x]]) + using x e by auto + qed + from this [unfolded bgauge_existence_lemma] + obtain d where d: "\x. 0 < d x" + "\x y. \x \ box a b; norm (y-x) < d x\ \ norm (f y - f x - (y-x) *\<^sub>R f' x) \ e/2 * norm (y-x)" - by metis - have "bounded (f ` cbox a b)" - apply (rule compact_imp_bounded compact_continuous_image)+ - using compact_cbox assms by auto - then obtain B - where "0 < B" and B: "\x. x \ f ` cbox a b \ norm x \ B" - unfolding bounded_pos by metis - obtain da where "0 < da" - and da: "\c. \a \ c; {a..c} \ {a..b}; {a..c} \ ball a da\ - \ norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \ (e * (b - a)) / 4" - proof - - have "continuous (at a within {a..b}) f" - using contf continuous_on_eq_continuous_within by force - with eba8 obtain k where "0 < k" - and k: "\x. \x \ {a..b}; 0 < norm (x-a); norm (x-a) < k\ - \ norm (f x - f a) < e * (b - a) / 8" - unfolding continuous_within Lim_within dist_norm by metis - obtain l where l: "0 < l" "norm (l *\<^sub>R f' a) \ e * (b - a) / 8" - proof (cases "f' a = 0") - case True with ab e that show ?thesis by auto - next - case False - then show ?thesis - apply (rule_tac l="(e * (b - a)) / 8 / norm (f' a)" in that) - using ab e apply (auto simp add: field_simps) - done - qed - have "norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \ e * (b - a) / 4" - if "a \ c" "{a..c} \ {a..b}" and bmin: "{a..c} \ ball a (min k l)" for c + by metis + have "bounded (f ` cbox a b)" + using compact_cbox assms by (auto simp: compact_imp_bounded compact_continuous_image) + then obtain B + where "0 < B" and B: "\x. x \ f ` cbox a b \ norm x \ B" + unfolding bounded_pos by metis + obtain da where "0 < da" + and da: "\c. \a \ c; {a..c} \ {a..b}; {a..c} \ ball a da\ + \ norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \ (e * (b-a)) / 4" proof - - have minkl: "\a - x\ < min k l" if "x \ {a..c}" for x - using bmin dist_real_def that by auto - then have lel: "\c - a\ \ \l\" - using that by force - have "norm ((c - a) *\<^sub>R f' a - (f c - f a)) \ norm ((c - a) *\<^sub>R f' a) + norm (f c - f a)" - by (rule norm_triangle_ineq4) - also have "\ \ e * (b - a) / 8 + e * (b - a) / 8" - proof (rule add_mono) - have "norm ((c - a) *\<^sub>R f' a) \ norm (l *\<^sub>R f' a)" - by (auto intro: mult_right_mono [OF lel]) - also have "... \ e * (b - a) / 8" - by (rule l) - finally show "norm ((c - a) *\<^sub>R f' a) \ e * (b - a) / 8" . + have "continuous (at a within {a..b}) f" + using contf continuous_on_eq_continuous_within by force + with eba8 obtain k where "0 < k" + and k: "\x. \x \ {a..b}; 0 < norm (x-a); norm (x-a) < k\ \ norm (f x - f a) < e * (b-a) / 8" + unfolding continuous_within Lim_within dist_norm by metis + obtain l where l: "0 < l" "norm (l *\<^sub>R f' a) \ e * (b-a) / 8" + proof (cases "f' a = 0") + case True with ab e that show ?thesis by auto next - have "norm (f c - f a) < e * (b - a) / 8" - proof (cases "a = c") - case True then show ?thesis - using eba8 by auto - next - case False show ?thesis - by (rule k) (use minkl \a \ c\ that False in auto) - qed - then show "norm (f c - f a) \ e * (b - a) / 8" by simp + case False + then show ?thesis + apply (rule_tac l="(e * (b-a)) / 8 / norm (f' a)" in that) + using ab e apply (auto simp add: field_simps) + done qed - finally show "norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \ e * (b - a) / 4" - unfolding content_real[OF \a \ c\] by auto + have "norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \ e * (b-a) / 4" + if "a \ c" "{a..c} \ {a..b}" and bmin: "{a..c} \ ball a (min k l)" for c + proof - + have minkl: "\a - x\ < min k l" if "x \ {a..c}" for x + using bmin dist_real_def that by auto + then have lel: "\c - a\ \ \l\" + using that by force + have "norm ((c - a) *\<^sub>R f' a - (f c - f a)) \ norm ((c - a) *\<^sub>R f' a) + norm (f c - f a)" + by (rule norm_triangle_ineq4) + also have "\ \ e * (b-a) / 8 + e * (b-a) / 8" + proof (rule add_mono) + have "norm ((c - a) *\<^sub>R f' a) \ norm (l *\<^sub>R f' a)" + by (auto intro: mult_right_mono [OF lel]) + also have "... \ e * (b-a) / 8" + by (rule l) + finally show "norm ((c - a) *\<^sub>R f' a) \ e * (b-a) / 8" . + next + have "norm (f c - f a) < e * (b-a) / 8" + proof (cases "a = c") + case True then show ?thesis + using eba8 by auto + next + case False show ?thesis + by (rule k) (use minkl \a \ c\ that False in auto) + qed + then show "norm (f c - f a) \ e * (b-a) / 8" by simp + qed + finally show "norm (content {a..c} *\<^sub>R f' a - (f c - f a)) \ e * (b-a) / 4" + unfolding content_real[OF \a \ c\] by auto + qed + then show ?thesis + by (rule_tac da="min k l" in that) (auto simp: l \0 < k\) qed - then show ?thesis - by (rule_tac da="min k l" in that) (auto simp: l \0 < k\) - qed - obtain db where "0 < db" - and db: "\c. \c \ b; {c..b} \ {a..b}; {c..b} \ ball b db\ - \ norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \ (e * (b - a)) / 4" - proof - - have "continuous (at b within {a..b}) f" - using contf continuous_on_eq_continuous_within by force - with eba8 obtain k - where "0 < k" - and k: "\x. \x \ {a..b}; 0 < norm(x-b); norm(x-b) < k\ - \ norm (f b - f x) < e * (b - a) / 8" - unfolding continuous_within Lim_within dist_norm norm_minus_commute by metis - obtain l where l: "0 < l" "norm (l *\<^sub>R f' b) \ (e * (b - a)) / 8" - proof (cases "f' b = 0") - case True thus ?thesis - using ab e that by auto - next - case False then show ?thesis - apply (rule_tac l="(e * (b - a)) / 8 / norm (f' b)" in that) - using ab e by (auto simp add: field_simps) - qed - have "norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \ e * (b - a) / 4" - if "c \ b" "{c..b} \ {a..b}" and bmin: "{c..b} \ ball b (min k l)" for c + obtain db where "0 < db" + and db: "\c. \c \ b; {c..b} \ {a..b}; {c..b} \ ball b db\ + \ norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \ (e * (b-a)) / 4" proof - - have minkl: "\b - x\ < min k l" if "x \ {c..b}" for x - using bmin dist_real_def that by auto - then have lel: "\b - c\ \ \l\" - using that by force - have "norm ((b - c) *\<^sub>R f' b - (f b - f c)) \ norm ((b - c) *\<^sub>R f' b) + norm (f b - f c)" - by (rule norm_triangle_ineq4) - also have "\ \ e * (b - a) / 8 + e * (b - a) / 8" - proof (rule add_mono) - have "norm ((b - c) *\<^sub>R f' b) \ norm (l *\<^sub>R f' b)" - by (auto intro: mult_right_mono [OF lel]) - also have "... \ e * (b - a) / 8" - by (rule l) - finally show "norm ((b - c) *\<^sub>R f' b) \ e * (b - a) / 8" . + have "continuous (at b within {a..b}) f" + using contf continuous_on_eq_continuous_within by force + with eba8 obtain k + where "0 < k" + and k: "\x. \x \ {a..b}; 0 < norm(x-b); norm(x-b) < k\ + \ norm (f b - f x) < e * (b-a) / 8" + unfolding continuous_within Lim_within dist_norm norm_minus_commute by metis + obtain l where l: "0 < l" "norm (l *\<^sub>R f' b) \ (e * (b-a)) / 8" + proof (cases "f' b = 0") + case True thus ?thesis + using ab e that by auto next - have "norm (f b - f c) < e * (b - a) / 8" - proof (cases "b = c") - case True with eba8 show ?thesis - by auto - next - case False show ?thesis - by (rule k) (use minkl \c \ b\ that False in auto) - qed - then show "norm (f b - f c) \ e * (b - a) / 8" by simp + case False then show ?thesis + apply (rule_tac l="(e * (b-a)) / 8 / norm (f' b)" in that) + using ab e by (auto simp add: field_simps) qed - finally show "norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \ e * (b - a) / 4" - unfolding content_real[OF \c \ b\] by auto + have "norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \ e * (b-a) / 4" + if "c \ b" "{c..b} \ {a..b}" and bmin: "{c..b} \ ball b (min k l)" for c + proof - + have minkl: "\b - x\ < min k l" if "x \ {c..b}" for x + using bmin dist_real_def that by auto + then have lel: "\b - c\ \ \l\" + using that by force + have "norm ((b - c) *\<^sub>R f' b - (f b - f c)) \ norm ((b - c) *\<^sub>R f' b) + norm (f b - f c)" + by (rule norm_triangle_ineq4) + also have "\ \ e * (b-a) / 8 + e * (b-a) / 8" + proof (rule add_mono) + have "norm ((b - c) *\<^sub>R f' b) \ norm (l *\<^sub>R f' b)" + by (auto intro: mult_right_mono [OF lel]) + also have "... \ e * (b-a) / 8" + by (rule l) + finally show "norm ((b - c) *\<^sub>R f' b) \ e * (b-a) / 8" . + next + have "norm (f b - f c) < e * (b-a) / 8" + proof (cases "b = c") + case True with eba8 show ?thesis + by auto + next + case False show ?thesis + by (rule k) (use minkl \c \ b\ that False in auto) + qed + then show "norm (f b - f c) \ e * (b-a) / 8" by simp + qed + finally show "norm (content {c..b} *\<^sub>R f' b - (f b - f c)) \ e * (b-a) / 4" + unfolding content_real[OF \c \ b\] by auto + qed + then show ?thesis + by (rule_tac db="min k l" in that) (auto simp: l \0 < k\) qed - then show ?thesis - by (rule_tac db="min k l" in that) (auto simp: l \0 < k\) - qed - let ?d = "(\x. ball x (if x=a then da else if x=b then db else d x))" - show "?P e" - proof (intro exI conjI allI impI) - show "gauge ?d" - using ab \db > 0\ \da > 0\ d(1) by (auto intro: gauge_ball_dependent) - next - fix p - assume ptag: "p tagged_division_of {a..b}" and fine: "?d fine p" - let ?A = "{t. fst t \ {a, b}}" - note p = tagged_division_ofD[OF ptag] - have pA: "p = (p \ ?A) \ (p - ?A)" "finite (p \ ?A)" "finite (p - ?A)" "(p \ ?A) \ (p - ?A) = {}" - using ptag fine by auto - note * = additive_tagged_division_1[OF assms(1) ptag, symmetric] - have **: "\n1 s1 n2 s2::real. n2 \ s2 / 2 \ n1 - s1 \ s2 / 2 \ n1 + n2 \ s1 + s2" - by arith - have non: False if xk: "(x,K) \ p" and "x \ a" "x \ 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 + let ?d = "(\x. ball x (if x=a then da else if x=b then db else d x))" + show "\d. gauge d \ (\p. p tagged_division_of {a..b} \ d fine p \ + norm ((\(x,K)\p. content K *\<^sub>R f' x) - (f b - f a)) \ e * content {a..b})" + proof (rule exI, safe) + show "gauge ?d" + using ab \db > 0\ \da > 0\ d(1) by (auto intro: gauge_ball_dependent) + next + fix p + assume ptag: "p tagged_division_of {a..b}" and fine: "?d fine p" + let ?A = "{t. fst t \ {a, b}}" + note p = tagged_division_ofD[OF ptag] + have pA: "p = (p \ ?A) \ (p - ?A)" "finite (p \ ?A)" "finite (p - ?A)" "(p \ ?A) \ (p - ?A) = {}" + using ptag fine by auto + have le_xz: "\w x y z::real. y \ z/2 \ w - x \ z/2 \ w + y \ x + z" + by arith + have non: False if xk: "(x,K) \ p" and "x \ a" "x \ 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 - obtain u v where k: "K = cbox u v" using p(4) xk by blast then have "u \ v" and uv: "{u, v} \ cbox u v" using p(2)[OF xk] by auto - then have result: "e * (v - u) / 2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))" + then have result: "e * (v - u)/2 < norm ((v - u) *\<^sub>R f' x - (f v - f u))" using less[unfolded k box_real interval_bounds_real content_real] by auto then have "x \ box a b" using p(2) p(3) \x \ a\ \x \ b\ xk by fastforce @@ -3721,8 +3719,8 @@ have xd: "norm (u - x) < d x" "norm (v - x) < d x" using fineD[OF fine xk] \x \ a\ \x \ b\ uv by (auto simp add: k subset_eq dist_commute dist_real_def) - 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)))" + 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))" by (rule arg_cong[where f=norm]) (auto simp: scaleR_left.diff) also have "\ \ e/2 * norm (u - x) + e/2 * norm (v - x)" by (metis norm_triangle_le_diff add_mono * xd) @@ -3730,211 +3728,184 @@ using p(2)[OF xk] by (auto simp add: field_simps k) also have "\ < norm ((v - u) *\<^sub>R f' x - (f v - f u))" using result by (simp add: \u \ v\) - finally have "e * (v - u) / 2 < e * (v - u) / 2" + finally have "e * (v - u)/2 < e * (v - u)/2" using uv by auto then show False by auto qed - have "norm (\(x, K)\p - ?A. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + have "norm (\(x, K)\p - ?A. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \ (\(x, K)\p - ?A. norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))" - by (auto intro: sum_norm_le) - also have "... \ (\n\p - ?A. e * (case n of (x, k) \ Sup k - Inf k) / 2)" - using non by (force intro: sum_mono) - finally have I: "norm (\(x, k)\p - ?A. + by (auto intro: sum_norm_le) + also have "... \ (\n\p - ?A. e * (case n of (x, k) \ Sup k - Inf k)/2)" + using non by (fastforce intro: sum_mono) + finally have I: "norm (\(x, k)\p - ?A. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - \ (\n\p - ?A. e * (case n of (x, k) \ Sup k - Inf k)) / 2" - by (simp add: sum_divide_distrib) - have II: "norm (\(x, k)\p \ ?A. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - + \ (\n\p - ?A. e * (case n of (x, k) \ Sup k - Inf k))/2" + by (simp add: sum_divide_distrib) + have II: "norm (\(x, k)\p \ ?A. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - (\n\p \ ?A. e * (case n of (x, k) \ Sup k - Inf k)) - \ (\n\p - ?A. e * (case n of (x, k) \ Sup k - Inf k)) / 2" - proof - - have ge0: "0 \ e * (Sup k - Inf k)" if xkp: "(x, k) \ p \ ?A" for x k + \ (\n\p - ?A. e * (case n of (x, k) \ Sup k - Inf k))/2" proof - - obtain u v where uv: "k = cbox u v" - by (meson Int_iff xkp p(4)) - with p(2) that uv have "cbox u v \ {}" - by blast - then show "0 \ e * ((Sup k) - (Inf k))" - unfolding uv using e by (auto simp add: field_simps) - qed - let ?B = "\x. {t \ p. fst t = x \ content (snd t) \ 0}" - let ?C = "{t \ p. fst t \ {a, b} \ content (snd t) \ 0}" - have "norm (\(x, k)\p \ {t. fst t \ {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \ e * (b-a) / 2" - proof - - have *: "\s f e. sum f s = sum f (p \ ?C) \ norm (sum f (p \ ?C)) \ e \ norm (sum f s) \ e" - by auto - have 1: "content K *\<^sub>R (f' (x)) - (f ((Sup K)) - f ((Inf K))) = 0" - if "(x,K) \ p \ {t. fst t \ {a, b}} - p \ ?C" for x K + have ge0: "0 \ e * (Sup k - Inf k)" if xkp: "(x, k) \ p \ ?A" for x k proof - - have xk: "(x, K) \ p" and k0: "content K = 0" - using that by auto - then obtain u v where uv: "K = cbox u v" - using p(4) by blast - then have "u = v" - using xk k0 p(2) by force - then show "content K *\<^sub>R (f' (x)) - (f ((Sup K)) - f ((Inf K))) = 0" - using xk unfolding uv by auto - qed - have 2: "norm(\(x,k)\p \ ?C. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - \ e * (b - a) / 2" - proof - - have *: "p \ ?C = ?B a \ ?B b" + obtain u v where uv: "k = cbox u v" + by (meson Int_iff xkp p(4)) + with p(2) that uv have "cbox u v \ {}" by blast - have **: "norm (sum f s) \ e" - if "\x y. x \ s \ y \ s \ x = y" "\x. x \ s \ norm (f x) \ e" "e > 0" - for s f and e :: real - proof (cases "s = {}") - case True - with that show ?thesis by auto - next - case False - then obtain x where "x \ s" - by auto - then have "s = {x}" - using that(1) by auto - then show ?thesis - using \x \ s\ that(2) by auto + then show "0 \ e * ((Sup k) - (Inf k))" + unfolding uv using e by (auto simp add: field_simps) + qed + let ?B = "\x. {t \ p. fst t = x \ content (snd t) \ 0}" + let ?C = "{t \ p. fst t \ {a, b} \ content (snd t) \ 0}" + have "norm (\(x, k)\p \ {t. fst t \ {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \ e * (b-a)/2" + proof - + have *: "\S f e. sum f S = sum f (p \ ?C) \ norm (sum f (p \ ?C)) \ e \ norm (sum f S) \ e" + by auto + have 1: "content K *\<^sub>R (f' x) - (f ((Sup K)) - f ((Inf K))) = 0" + if "(x,K) \ p \ {t. fst t \ {a, b}} - p \ ?C" for x K + proof - + have xk: "(x,K) \ p" and k0: "content K = 0" + using that by auto + then obtain u v where uv: "K = cbox u v" + using p(4) by blast + then have "u = v" + using xk k0 p(2) by force + then show "content K *\<^sub>R (f' x) - (f ((Sup K)) - f ((Inf K))) = 0" + using xk unfolding uv by auto qed - show "norm (\(x,k)\p \ ?C. - content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \ e * (b - a) / 2" - apply (subst *) - apply (subst sum.union_disjoint) - prefer 4 - apply (rule order_trans[of _ "e * (b - a)/4 + e * (b - a)/4"]) - apply (rule norm_triangle_le,rule add_mono) - apply (rule_tac[1-2] **) - + have 2: "norm(\(x,K)\p \ ?C. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \ e * (b-a)/2" proof - - have pa: "\v. k = cbox a v \ a \ v" if "(a, k) \ p" for k - proof - - obtain u v where uv: "k = cbox u v" - using \(a, k) \ p\ p(4) by blast - moreover have "u \ v" - using uv p(2)[OF that] by auto - moreover have "u = a" - using p(2) p(3) that uv by force - ultimately show ?thesis - by blast - qed - have pb: "\v. k = cbox v b \ b \ v" if "(b, k) \ p" for k - proof - - obtain u v where uv: "k = cbox u v" - using \(b, k) \ p\ p(4) by blast - moreover have "u \ v" - using p(2)[OF that] unfolding uv by auto - moreover have "v = b" - using p(2) p(3) that uv by force - ultimately show ?thesis - by blast + have norm_le: "norm (sum f S) \ e" + if "\x y. \x \ S; y \ S\ \ x = y" "\x. x \ S \ norm (f x) \ e" "e > 0" + for S f and e :: real + proof (cases "S = {}") + case True + with that show ?thesis by auto + next + case False then obtain x where "x \ S" + by auto + then have "S = {x}" + using that(1) by auto + then show ?thesis + using \x \ S\ that(2) by auto qed - show "\x y. x \ ?B a \ y \ ?B a \ x = y" - proof (safe; clarsimp) - fix x k k' - assume k: "(a, k) \ p" "(a, k') \ p" "content k \ 0" "content k' \ 0" - obtain v where v: "k = cbox a v" "a \ v" - using pa[OF k(1)] by blast - obtain v' where v': "k' = cbox a v'" "a \ v'" - using pa[OF k(2)] by blast - let ?v = "min v v'" - have "box a ?v \ k \ k'" - unfolding v v' by (auto simp add: mem_box) - then have "interior (box a (min v v')) \ interior k \ interior k'" - using interior_Int interior_mono by blast - moreover have "(a + ?v)/2 \ box a ?v" - using k(3-) - unfolding v v' content_eq_0 not_le - by (auto simp add: mem_box) - ultimately have "(a + ?v)/2 \ interior k \ interior k'" - unfolding interior_open[OF open_box] by auto - then have eq: "k = k'" - using p(5)[OF k(1-2)] by auto - { assume "x \ k" then show "x \ k'" unfolding eq . } - { assume "x \ k'" then show "x \ k" unfolding eq . } - qed - - show "\x y. x \ ?B b \ y \ ?B b \ x = y" - proof (safe; clarsimp) - fix x K K' - assume k: "(b, K) \ p" "(b, K') \ p" "content K \ 0" "content K' \ 0" - obtain v where v: "K = cbox v b" "v \ b" - using pb[OF k(1)] by blast - obtain v' where v': "K' = cbox v' b" "v' \ b" - using pb[OF k(2)] by blast - let ?v = "max v v'" - have "box ?v b \ K \ K'" - unfolding v v' by (auto simp: mem_box) - then have "interior (box (max v v') b) \ interior K \ interior K'" - using interior_Int interior_mono by blast - moreover have " ((b + ?v)/2) \ box ?v b" - using k(3-) unfolding v v' content_eq_0 not_le by (auto simp: mem_box) - ultimately have " ((b + ?v)/2) \ interior K \ interior K'" - unfolding interior_open[OF open_box] by auto - then have eq: "K = K'" - using p(5)[OF k(1-2)] by auto - { assume "x \ K" then show "x \ K'" unfolding eq . } - { assume "x \ K'" then show "x \ K" unfolding eq . } + have *: "p \ ?C = ?B a \ ?B b" + by blast + then have "norm (\(x,K)\p \ ?C. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) = + norm (\(x,K) \ ?B a \ ?B b. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K)))" + by simp + also have "... = norm ((\(x,K) \ ?B a. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + + (\(x,K) \ ?B b. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))))" + apply (subst sum.union_disjoint) + using p(1) ab e by auto + also have "... \ e * (b - a) / 4 + e * (b - a) / 4" + proof (rule norm_triangle_le [OF add_mono]) + have pa: "\v. k = cbox a v \ a \ v" if "(a, k) \ p" for k + using p(2) p(3) p(4) that by fastforce + show "norm (\(x,K) \ ?B a. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \ e * (b - a) / 4" + proof (intro norm_le; clarsimp) + fix K K' + assume K: "(a, K) \ p" "(a, K') \ p" and ne0: "content K \ 0" "content K' \ 0" + with pa obtain v v' where v: "K = cbox a v" "a \ v" and v': "K' = cbox a v'" "a \ v'" + by blast + let ?v = "min v v'" + have "box a ?v \ K \ K'" + unfolding v v' by (auto simp add: mem_box) + then have "interior (box a (min v v')) \ interior K \ interior K'" + using interior_Int interior_mono by blast + moreover have "(a + ?v)/2 \ box a ?v" + using ne0 unfolding v v' content_eq_0 not_le + by (auto simp add: mem_box) + ultimately have "(a + ?v)/2 \ interior K \ interior K'" + unfolding interior_open[OF open_box] by auto + then show "K = K'" + using p(5)[OF K] by auto + next + fix K + assume K: "(a, K) \ p" and ne0: "content K \ 0" + show "norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) * 4 \ e * (b-a)" + if "(a, c) \ p" and ne0: "content c \ 0" for c + proof - + obtain v where v: "c = cbox a v" and "a \ v" + using pa[OF \(a, c) \ p\] by metis + then have "a \ {a..v}" "v \ b" + using p(3)[OF \(a, c) \ p\] by auto + moreover have "{a..v} \ ball a da" + using fineD[OF \?d fine p\ \(a, c) \ p\] by (simp add: v split: if_split_asm) + ultimately show ?thesis + unfolding v interval_bounds_real[OF \a \ v\] box_real + using da \a \ v\ by auto + qed + qed (use ab e in auto) + next + have pb: "\v. k = cbox v b \ b \ v" if "(b, k) \ p" for k + using p(2) p(3) p(4) that by fastforce + show "norm (\(x,K) \ ?B b. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \ e * (b - a) / 4" + proof (intro norm_le; clarsimp) + fix K K' + assume K: "(b, K) \ p" "(b, K') \ p" and ne0: "content K \ 0" "content K' \ 0" + with pb obtain v v' where v: "K = cbox v b" "v \ b" and v': "K' = cbox v' b" "v' \ b" + by blast + let ?v = "max v v'" + have "box ?v b \ K \ K'" + unfolding v v' by (auto simp: mem_box) + then have "interior (box (max v v') b) \ interior K \ interior K'" + using interior_Int interior_mono by blast + moreover have " ((b + ?v)/2) \ box ?v b" + using ne0 unfolding v v' content_eq_0 not_le by (auto simp: mem_box) + ultimately have "((b + ?v)/2) \ interior K \ interior K'" + unfolding interior_open[OF open_box] by auto + then show "K = K'" + using p(5)[OF K] by auto + next + fix K + assume K: "(b, K) \ p" and ne0: "content K \ 0" + show "norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) * 4 \ e * (b-a)" + if "(b, c) \ p" and ne0: "content c \ 0" for c + proof - + obtain v where v: "c = cbox v b" and "v \ b" + using \(b, c) \ p\ pb by blast + then have "v \ a""b \ {v.. b}" + using p(3)[OF \(b, c) \ p\] by auto + moreover have "{v..b} \ ball b db" + using fineD[OF \?d fine p\ \(b, c) \ p\] box_real(2) v False by force + ultimately show ?thesis + using db v by auto + qed + qed (use ab e in auto) qed - - have "norm (content c *\<^sub>R f' a - (f (Sup c) - f (Inf c))) \ e * (b - a) / 4" - if "(a, c) \ p" and ne0: "content c \ 0" for c - proof - - obtain v where v: "c = cbox a v" and "a \ v" - using pa[OF \(a, c) \ p\] by metis - then have "a \ {a..v}" "v \ b" - using p(3)[OF \(a, c) \ p\] by auto - moreover have "{a..v} \ ball a da" - using fineD[OF \?d fine p\ \(a, c) \ p\] by (simp add: v split: if_split_asm) - ultimately show ?thesis - unfolding v interval_bounds_real[OF \a \ v\] box_real - using da \a \ v\ by auto - qed - then show "\x. x \ ?B a \ norm ((\(x, k). content k *\<^sub>R f' x - (f (Sup k) - - f (Inf k))) x) \ e * (b - a) / 4" - by auto - - have "norm (content c *\<^sub>R f' b - (f (Sup c) - f (Inf c))) \ e * (b - a) / 4" - if "(b, c) \ p" and ne0: "content c \ 0" for c - proof - - obtain v where v: "c = cbox v b" and "v \ b" - using \(b, c) \ p\ pb by blast - then have "v \ a""b \ {v.. b}" - using p(3)[OF \(b, c) \ p\] by auto - moreover have "{v..b} \ ball b db" - using fineD[OF \?d fine p\ \(b, c) \ p\] box_real(2) v False by force - ultimately show ?thesis - using db v by auto - qed - then show "\x. x \ ?B b \ - norm ((\(x, k). content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) x) - \ e * (b - a) / 4" - by auto - qed (insert p(1) ab e, auto simp add: field_simps) + also have "... = e * (b-a)/2" + by simp + finally show "norm (\(x,k)\p \ ?C. + content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \ e * (b-a)/2" . + qed + show "norm (\(x, k)\p \ ?A. content k *\<^sub>R f' x - (f ((Sup k)) - f ((Inf k)))) \ e * (b-a)/2" + apply (rule * [OF sum.mono_neutral_right[OF pA(2)]]) + using 1 2 by (auto simp: split_paired_all) qed - show "norm (\(x, k)\p \ ?A. content k *\<^sub>R f' x - (f ((Sup k)) - f ((Inf k)))) \ e * (b - a) / 2" - apply (rule * [OF sum.mono_neutral_right[OF pA(2)]]) - using 1 2 by (auto simp: split_paired_all) + also have "... = (\n\p. e * (case n of (x, k) \ Sup k - Inf k))/2" + unfolding sum_distrib_left[symmetric] + apply (subst additive_tagged_division_1[OF \a \ b\ ptag]) + by auto + finally have norm_le: "norm (\(x,K)\p \ {t. fst t \ {a, b}}. content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + \ (\n\p. e * (case n of (x, K) \ Sup K - Inf K))/2" . + have le2: "\x s1 s2::real. 0 \ s1 \ x \ (s1 + s2)/2 \ x - s1 \ s2/2" + by auto + show ?thesis + apply (rule le2 [OF sum_nonneg]) + using ge0 apply force + unfolding sum.union_disjoint[OF pA(2-), symmetric] pA(1)[symmetric] + by (metis norm_le) qed - also have "... = (\n\p. e * (case n of (x, k) \ Sup k - Inf k)) / 2" - unfolding sum_distrib_left[symmetric] - apply (subst additive_tagged_division_1[OF \a \ b\ ptag]) - by auto - finally have norm_le: "norm (\(x, k)\p \ {t. fst t \ {a, b}}. content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) - \ (\n\p. e * (case n of (x, k) \ Sup k - Inf k)) / 2" . - have *: "\x s1 s2::real. 0 \ s1 \ x \ (s1 + s2) / 2 \ x - s1 \ s2 / 2" - by auto - show ?thesis - apply (rule * [OF sum_nonneg]) - using ge0 apply force - unfolding sum.union_disjoint[OF pA(2-), symmetric] pA(1)[symmetric] - by (metis norm_le) + note * = additive_tagged_division_1[OF assms(1) ptag, symmetric] + have "norm (\(x,K)\p \ ?A \ (p - ?A). content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) + \ e * (\(x,K)\p \ ?A \ (p - ?A). Sup K - Inf K)" + unfolding sum_distrib_left + unfolding sum.union_disjoint[OF pA(2-)] + using le_xz norm_triangle_le I II by blast + then + show "norm ((\(x,K)\p. content K *\<^sub>R f' x) - (f b - f a)) \ e * content {a..b}" + by (simp only: content_real[OF \a \ b\] *[of "\x. x"] *[of f] sum_subtractf[symmetric] split_minus pA(1) [symmetric]) qed - have "norm (\(x,K)\p \ ?A \ (p - ?A). content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) - \ e * (\(x,K)\p \ ?A \ (p - ?A). Sup K - Inf K)" - unfolding sum_distrib_left - unfolding sum.union_disjoint[OF pA(2-)] - using ** norm_triangle_le I II by blast - then - show "norm ((\(x,K)\p. content K *\<^sub>R f' x) - (f b - f a)) \ e * content {a..b}" - by (simp only: content_real[OF \a \ b\] *[of "\x. x"] *[of f] sum_subtractf[symmetric] split_minus pA(1) [symmetric]) qed qed @@ -3992,12 +3963,9 @@ using vec apply (auto simp: mem_box) done -lemma indefinite_integral_continuous_left: +proposition indefinite_integral_continuous_left: fixes f:: "real \ 'a::banach" - assumes intf: "f integrable_on {a..b}" - and "a < c" - and "c \ b" - and "e > 0" + assumes intf: "f integrable_on {a..b}" and "a < c" "c \ b" "e > 0" obtains d where "d > 0" and "\t. c - d < t \ t \ c \ norm (integral {a..c} f - integral {a..t} f) < e" proof - @@ -4020,14 +3988,14 @@ using \e > 0\ that by auto qed + let ?SUM = "\p. (\(x,K) \ p. content K *\<^sub>R f x)" have e3: "e/3 > 0" using \e > 0\ by auto have "f integrable_on {a..c}" apply (rule integrable_subinterval_real[OF intf]) using \a < c\ \c \ b\ by auto then obtain d1 where "gauge d1" and d1: - "\p. \p tagged_division_of {a..c}; d1 fine p\ \ - norm ((\(x,K)\p. content K *\<^sub>R f x) - integral {a..c} f) < e/3" + "\p. \p tagged_division_of {a..c}; d1 fine p\ \ norm (?SUM p - integral {a..c} f) < e/3" using integrable_integral has_integral_real e3 by metis define d where [abs_def]: "d x = ball x w \ d1 x" for x have "gauge d" @@ -4035,132 +4003,102 @@ then obtain k where "0 < k" and k: "ball c k \ d c" by (meson gauge_def open_contains_ball) - let ?d = "min k (c - a) / 2" - show ?thesis - apply (rule that[of ?d]) - apply safe - proof - + let ?d = "min k (c - a)/2" + show thesis + proof (intro that[of ?d] allI impI, safe) show "?d > 0" - using \0 < k\ using assms(2) by auto + using \0 < k\ \a < c\ by auto + next fix t - assume as: "c - ?d < t" "t \ c" - let ?thesis = "norm (integral ({a..c}) f - integral ({a..t}) f) < e" - { - presume *: "t < c \ ?thesis" - show ?thesis - proof (cases "t = c") - case True - then show ?thesis - by (simp add: \e > 0\) - next - case False - then show ?thesis - using "*" \t \ c\ by linarith - qed - } - assume "t < c" - - have "f integrable_on {a..t}" - apply (rule integrable_subinterval_real[OF intf]) - using \t < c\ \c \ b\ by auto - then obtain d2 where d2: "gauge d2" - "\p. p tagged_division_of {a..t} \ d2 fine p \ - norm ((\(x,K)\p. content K *\<^sub>R f x) - integral {a..t} f) < e/3" - using integrable_integral has_integral_real e3 by metis - define d3 where "d3 x = (if x \ t then d1 x \ d2 x else d1 x)" for x - have "gauge d3" - using \gauge d1\ \gauge d2\ unfolding d3_def gauge_def by auto - then obtain p where ptag: "p tagged_division_of {a..t}" and pfine: "d3 fine p" - by (metis box_real(2) fine_division_exists) - note p'=tagged_division_ofD[OF ptag] - have pt: "(x,k)\p \ x \ t" for x k - by (meson atLeastAtMost_iff p'(2) p'(3) subsetCE) - with pfine have "d2 fine p" - unfolding fine_def d3_def by fastforce - then have d2_fin: "norm ((\(x, K)\p. content K *\<^sub>R f x) - integral {a..t} f) < e/3" - using d2(2) ptag by auto - have *: "{a..c} \ {x. x \ t} = {a..t}" "{a..c} \ {x. x \ t} = {t..c}" - using as by (auto simp add: field_simps) - - have "p \ {(c, {t..c})} tagged_division_of {a..c}" - apply (rule tagged_division_Un_interval_real[of _ _ _ 1 "t"]) - using \t \ c\ by (auto simp: * ptag tagged_division_of_self_real) - moreover - have "d1 fine p \ {(c, {t..c})}" - unfolding fine_def - proof safe - fix x K y - assume "(x,K) \ p" and "y \ K" then show "y \ d1 x" - by (metis Int_iff d3_def subsetD fineD pfine) + assume t: "c - ?d < t" "t \ c" + show "norm (integral ({a..c}) f - integral ({a..t}) f) < e" + proof (cases "t < c") + case False with \t \ c\ show ?thesis + by (simp add: \e > 0\) next - fix x assume "x \ {t..c}" - then have "dist c x < k" - using as(1) - by (auto simp add: field_simps dist_real_def) - with k show "x \ d1 c" - unfolding d_def by auto - qed - ultimately have d1_fin: "norm ((\(x,K) \ p \ {(c, {t..c})}. content K *\<^sub>R f x) - integral {a..c} f) < e/3" - using d1 by metis - - have *: "integral {a..c} f - integral {a..t} f = -(((c - t) *\<^sub>R f c + (\(x, k)\p. content k *\<^sub>R f x)) - - integral {a..c} f) + ((\(x, k)\p. content k *\<^sub>R f x) - integral {a..t} f) + (c - t) *\<^sub>R f c" - "e = (e/3 + e/3) + e/3" - by auto - have **: "(\(x, k)\p \ {(c, {t..c})}. content k *\<^sub>R f x) = - (c - t) *\<^sub>R f c + (\(x, k)\p. content k *\<^sub>R f x)" - proof - - have **: "\x F. F \ {x} = insert x F" - by auto - have "(c, cbox t c) \ p" - proof (safe, goal_cases) - case prems: 1 - from p'(2-3)[OF prems] have "c \ cbox a t" - by auto - then show False using \t < c\ - by auto + case True + have "f integrable_on {a..t}" + apply (rule integrable_subinterval_real[OF intf]) + using \t < c\ \c \ b\ by auto + then obtain d2 where d2: "gauge d2" + "\p. p tagged_division_of {a..t} \ d2 fine p \ norm (?SUM p - integral {a..t} f) < e/3" + using integrable_integral has_integral_real e3 by metis + define d3 where "d3 x = (if x \ t then d1 x \ d2 x else d1 x)" for x + have "gauge d3" + using \gauge d1\ \gauge d2\ unfolding d3_def gauge_def by auto + then obtain p where ptag: "p tagged_division_of {a..t}" and pfine: "d3 fine p" + by (metis box_real(2) fine_division_exists) + note p' = tagged_division_ofD[OF ptag] + have pt: "(x,K)\p \ x \ t" for x K + by (meson atLeastAtMost_iff p'(2) p'(3) subsetCE) + with pfine have "d2 fine p" + unfolding fine_def d3_def by fastforce + then have d2_fin: "norm (?SUM p - integral {a..t} f) < e/3" + using d2(2) ptag by auto + have eqs: "{a..c} \ {x. x \ t} = {a..t}" "{a..c} \ {x. x \ t} = {t..c}" + using t by (auto simp add: field_simps) + have "p \ {(c, {t..c})} tagged_division_of {a..c}" + apply (rule tagged_division_Un_interval_real[of _ _ _ 1 "t"]) + using \t \ c\ by (auto simp: eqs ptag tagged_division_of_self_real) + moreover + have "d1 fine p \ {(c, {t..c})}" + unfolding fine_def + proof safe + fix x K y + assume "(x,K) \ p" and "y \ K" then show "y \ d1 x" + by (metis Int_iff d3_def subsetD fineD pfine) + next + fix x assume "x \ {t..c}" + then have "dist c x < k" + using t(1) by (auto simp add: field_simps dist_real_def) + with k show "x \ d1 c" + unfolding d_def by auto + qed + ultimately have d1_fin: "norm (?SUM(p \ {(c, {t..c})}) - integral {a..c} f) < e/3" + using d1 by metis + have SUMEQ: "?SUM(p \ {(c, {t..c})}) = (c - t) *\<^sub>R f c + ?SUM p" + proof - + have "?SUM(p \ {(c, {t..c})}) = (content{t..c} *\<^sub>R f c) + ?SUM p" + proof (subst sum.union_disjoint) + show "p \ {(c, {t..c})} = {}" + using \t < c\ pt by force + qed (use p'(1) in auto) + also have "... = (c - t) *\<^sub>R f c + ?SUM p" + using \t \ c\ by auto + finally show ?thesis . qed - then show ?thesis - unfolding ** box_real - apply - - apply (subst sum.insert) - apply (rule p') - unfolding split_conv - defer - apply (subst content_real) - using as(2) - apply auto - done - qed - have ***: "c - w < t \ t < c" - proof - have "c - k < t" - using \k>0\ as(1) by (auto simp add: field_simps) + using \k>0\ t(1) by (auto simp add: field_simps) moreover have "k \ w" - apply (rule ccontr) - using k - unfolding subset_eq - apply (erule_tac x="c + ((k + w)/2)" in ballE) - unfolding d_def - using \k > 0\ \w > 0\ - apply (auto simp add: field_simps not_le not_less dist_real_def) - done - ultimately show ?thesis using \t < c\ + proof (rule ccontr) + assume "\ k \ w" + then have "c + (k + w) / 2 \ d c" + by (auto simp add: field_simps not_le not_less dist_real_def d_def) + then have "c + (k + w) / 2 \ ball c k" + using k by blast + then show False + using \0 < w\ \\ k \ w\ dist_real_def by auto + qed + ultimately have cwt: "c - w < t" by (auto simp add: field_simps) + have eq: "integral {a..c} f - integral {a..t} f = -(((c - t) *\<^sub>R f c + ?SUM p) - + integral {a..c} f) + (?SUM p - integral {a..t} f) + (c - t) *\<^sub>R f c" + by auto + have "norm (integral {a..c} f - integral {a..t} f) < e/3 + e/3 + e/3" + unfolding eq + proof (intro norm_triangle_lt add_strict_mono) + show "norm (- ((c - t) *\<^sub>R f c + ?SUM p - integral {a..c} f)) < e/3" + by (metis SUMEQ d1_fin norm_minus_cancel) + show "norm (?SUM p - integral {a..t} f) < e/3" + using d2_fin by blast + show "norm ((c - t) *\<^sub>R f c) < e/3" + using w cwt \t < c\ by (auto simp add: field_simps) + qed + then show ?thesis by simp qed - show ?thesis - unfolding *(1) - apply (subst *(2)) - apply (rule norm_triangle_lt add_strict_mono)+ - apply (metis "**" d1_fin norm_minus_cancel) - using d2_fin apply blast - using w *** - apply (auto simp add: field_simps) - done qed qed - lemma indefinite_integral_continuous_right: fixes f :: "real \ 'a::banach" assumes "f integrable_on {a..b}" @@ -4672,10 +4610,9 @@ lemma integral_nonneg: fixes f :: "'n::euclidean_space \ real" - assumes "f integrable_on S" - and "\x. x \ S \ 0 \ f x" + assumes f: "f integrable_on S" and 0: "\x. x \ S \ 0 \ f x" shows "0 \ integral S f" - by (rule has_integral_nonneg[OF assms(1)[unfolded has_integral_integral] assms(2)]) + by (rule has_integral_nonneg[OF f[unfolded has_integral_integral] 0]) text \Hence a general restriction property.\ @@ -5033,11 +4970,11 @@ if "e > 0" for e proof - have *: "e/2 > 0" using that by auto - then obtain N where N: "\n. N \ n \ norm (i - integral (?cube n) ?F) < e / 2" + then obtain N where N: "\n. N \ n \ norm (i - integral (?cube n) ?F) < e/2" using i[THEN LIMSEQ_D, simplified norm_minus_commute] by meson obtain B where "0 < B" and B: "\a b c d. \ball 0 B \ cbox a b; ball 0 B \ cbox c d\ \ - norm (integral (cbox a b) ?F - integral (cbox c d) ?F) < e / 2" + norm (integral (cbox a b) ?F - integral (cbox c d) ?F) < e/2" using rhs * by meson let ?B = "max (real N) B" show ?thesis @@ -6017,9 +5954,9 @@ proof (rule *) show "\integral (cbox a b) (?f N) - i\ < e/2" proof (rule abs_triangle_half_l) - show "\integral (cbox a b) (?f N) - integral S (f N)\ < e/2 / 2" + show "\integral (cbox a b) (?f N) - integral S (f N)\ < e/2/2" using B[OF ab] by simp - show "abs (i - integral S (f N)) < e/2 / 2" + show "abs (i - integral S (f N)) < e/2/2" using N by (simp add: abs_minus_commute) qed show "\integral (cbox a b) (?f (M + N)) - integral (cbox a b) ?g\ < e/2" @@ -6953,7 +6890,7 @@ also have "norm (t1 - x1, t2 - x2) < k" using xuvwz ls uwvz_sub unfolding ball_def by (force simp add: cbox_Pair_eq dist_norm ) - finally have "norm (f (x1,x2) - f (t1,t2)) \ e/content ?CBOX / 2" + finally have "norm (f (x1,x2) - f (t1,t2)) \ e/content ?CBOX/2" using nf [OF t x] by simp } note nf' = this have f_int_uwvz: "f integrable_on cbox (u,w) (v,z)" @@ -6962,9 +6899,9 @@ using assms continuous_on_subset uwvz_sub by (blast intro: continuous_on_imp_integrable_on_Pair1) have 1: "norm (integral (cbox (u,w) (v,z)) f - integral (cbox (u,w) (v,z)) (\x. f (t1,t2))) - \ e * content (cbox (u,w) (v,z)) / content ?CBOX / 2" + \ e * content (cbox (u,w) (v,z)) / content ?CBOX/2" apply (simp only: integral_diff [symmetric] f_int_uwvz integrable_const) - apply (rule order_trans [OF integrable_bound [of "e/content ?CBOX / 2"]]) + apply (rule order_trans [OF integrable_bound [of "e/content ?CBOX/2"]]) using cbp \0 < e/content ?CBOX\ nf' apply (auto simp: integrable_diff f_int_uwvz integrable_const) done @@ -6973,24 +6910,24 @@ have normint_wz: "\x. x \ cbox u v \ norm (integral (cbox w z) (\y. f (x, y)) - integral (cbox w z) (\y. f (t1, t2))) - \ e * content (cbox w z) / content (cbox (a, c) (b, d)) / 2" + \ e * content (cbox w z) / content (cbox (a, c) (b, d))/2" apply (simp only: integral_diff [symmetric] f_int_uv integrable_const) - apply (rule order_trans [OF integrable_bound [of "e/content ?CBOX / 2"]]) + apply (rule order_trans [OF integrable_bound [of "e/content ?CBOX/2"]]) using cbp \0 < e/content ?CBOX\ nf' apply (auto simp: integrable_diff f_int_uv integrable_const) done have "norm (integral (cbox u v) (\x. integral (cbox w z) (\y. f (x,y)) - integral (cbox w z) (\y. f (t1,t2)))) - \ e * content (cbox w z) / content ?CBOX / 2 * content (cbox u v)" + \ e * content (cbox w z) / content ?CBOX/2 * content (cbox u v)" apply (rule integrable_bound [OF _ _ normint_wz]) using cbp \0 < e/content ?CBOX\ apply (auto simp: divide_simps content_pos_le integrable_diff int_integrable integrable_const) done - also have "... \ e * content (cbox (u,w) (v,z)) / content ?CBOX / 2" + also have "... \ e * content (cbox (u,w) (v,z)) / content ?CBOX/2" by (simp add: content_Pair divide_simps) finally have 2: "norm (integral (cbox u v) (\x. integral (cbox w z) (\y. f (x,y))) - integral (cbox u v) (\x. integral (cbox w z) (\y. f (t1,t2)))) - \ e * content (cbox (u,w) (v,z)) / content ?CBOX / 2" + \ e * content (cbox (u,w) (v,z)) / content ?CBOX/2" by (simp only: integral_diff [symmetric] int_integrable integrable_const) have norm_xx: "\x' = y'; norm(x - x') \ e/2; norm(y - y') \ e/2\ \ norm(x - y) \ e" for x::'c and y x' y' e using norm_triangle_mono [of "x-y'" "e/2" "y'-y" "e/2"] real_sum_of_halves