diff -r d91108ba9474 -r e5b84854baa4 src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Sat Jun 24 21:23:48 2017 +0200 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Mon Jun 26 14:26:03 2017 +0100 @@ -890,103 +890,103 @@ subsection \Cauchy-type criterion for integrability.\ -(* XXXXXXX *) -lemma integrable_cauchy: +lemma integrable_Cauchy: fixes f :: "'n::euclidean_space \ 'a::{real_normed_vector,complete_space}" shows "f integrable_on cbox a b \ - (\e>0. \d. gauge d \ - (\p1 p2. p1 tagged_division_of (cbox a b) \ d fine p1 \ - p2 tagged_division_of (cbox a b) \ d fine p2 \ - norm ((\(x,k)\p1. content k *\<^sub>R f x) - (\(x,k)\p2. content k *\<^sub>R f x)) < e))" - (is "?l = (\e>0. \d. ?P e d)") -proof + (\e>0. \\. gauge \ \ + (\p1 p2. p1 tagged_division_of (cbox a b) \ \ fine p1 \ + p2 tagged_division_of (cbox a b) \ \ fine p2 \ + norm ((\(x,K)\p1. content K *\<^sub>R f x) - (\(x,K)\p2. content K *\<^sub>R f x)) < e))" + (is "?l = (\e>0. \\. ?P e \)") +proof (intro iffI allI impI) assume ?l - then guess y unfolding integrable_on_def has_integral .. note y=this - show "\e>0. \d. ?P e d" - proof (clarify, goal_cases) - case (1 e) - then have "e/2 > 0" by auto - then guess d - apply - - apply (drule y[rule_format]) - apply (elim exE conjE) - done - note d=this[rule_format] - show ?case - proof (rule_tac x=d in exI, clarsimp simp: d) - fix p1 p2 - assume as: "p1 tagged_division_of (cbox a b)" "d fine p1" - "p2 tagged_division_of (cbox a b)" "d fine p2" - show "norm ((\(x, k)\p1. content k *\<^sub>R f x) - (\(x, k)\p2. content k *\<^sub>R f x)) < e" - apply (rule dist_triangle_half_l[where y=y,unfolded dist_norm]) - using d(2)[OF conjI[OF as(1-2)]] d(2)[OF conjI[OF as(3-4)]] . + then obtain y + where y: "\e. e > 0 \ + \\. gauge \ \ + (\p. p tagged_division_of cbox a b \ \ fine p \ + norm ((\(x,K) \ p. content K *\<^sub>R f x) - y) < e)" + by (auto simp: integrable_on_def has_integral) + show "\\. ?P e \" if "e > 0" for e + proof - + have "e/2 > 0" using that by auto + with y obtain \ where "gauge \" + and \: "\p. p tagged_division_of cbox a b \ \ fine p \ + norm ((\(x,K)\p. content K *\<^sub>R f x) - y) < e / 2" + by meson + show ?thesis + apply (rule_tac x=\ in exI, clarsimp simp: \gauge \\) + by (blast intro!: \ dist_triangle_half_l[where y=y,unfolded dist_norm]) + qed +next + assume "\e>0. \\. ?P e \" + then have "\n::nat. \\. ?P (1 / (n + 1)) \" + by auto + then obtain \ :: "nat \ 'n \ 'n set" where \: + "\m. gauge (\ m)" + "\m p1 p2. \p1 tagged_division_of cbox a b; + \ m fine p1; p2 tagged_division_of cbox a b; \ m fine p2\ + \ norm ((\(x,K) \ p1. content K *\<^sub>R f x) - (\(x,K) \ p2. content K *\<^sub>R f x)) + < 1 / (m + 1)" + by metis + have "\n. gauge (\x. \{\ i x |i. i \ {0..n}})" + apply (rule gauge_Inter) + using \ by auto + then have "\n. \p. p tagged_division_of (cbox a b) \ (\x. \{\ i x |i. i \ {0..n}}) fine p" + by (meson fine_division_exists) + then obtain p where p: "\z. p z tagged_division_of cbox a b" + "\z. (\x. \{\ i x |i. i \ {0..z}}) fine p z" + by meson + have dp: "\i n. i\n \ \ i fine p n" + using p unfolding fine_Inter + using atLeastAtMost_iff by blast + have "Cauchy (\n. sum (\(x,K). content K *\<^sub>R (f x)) (p n))" + proof (rule CauchyI) + fix e::real + assume "0 < e" + then obtain N where "N \ 0" and N: "inverse (real N) < e" + using real_arch_inverse[of e] by blast + show "\M. \m\M. \n\M. norm ((\(x,K) \ p m. content K *\<^sub>R f x) - (\(x,K) \ p n. content K *\<^sub>R f x)) < e" + proof (intro exI allI impI) + fix m n + assume mn: "N \ m" "N \ n" + have "norm ((\(x,K) \ p m. content K *\<^sub>R f x) - (\(x,K) \ p n. content K *\<^sub>R f x)) < 1 / (real N + 1)" + by (simp add: p(1) dp mn \) + also have "... < e" + using N \N \ 0\ \0 < e\ by (auto simp: field_simps) + finally show "norm ((\(x,K) \ p m. content K *\<^sub>R f x) - (\(x,K) \ p n. content K *\<^sub>R f x)) < e" . qed qed -next - assume "\e>0. \d. ?P e d" - then have "\n::nat. \d. ?P (inverse(of_nat (n + 1))) d" - by auto - from choice[OF this] guess d .. note d=conjunctD2[OF this[rule_format],rule_format] - have "\n. gauge (\x. \{d i x |i. i \ {0..n}})" - apply (rule gauge_Inter) - using d(1) - apply auto - done - then have "\n. \p. p tagged_division_of (cbox a b) \ (\x. \{d i x |i. i \ {0..n}}) fine p" - by (meson fine_division_exists) - from choice[OF this] guess p .. note p = conjunctD2[OF this[rule_format]] - have dp: "\i n. i\n \ d i fine p n" - using p(2) unfolding fine_inters by auto - have "Cauchy (\n. sum (\(x,k). content k *\<^sub>R (f x)) (p n))" - proof (rule CauchyI, goal_cases) - case (1 e) - then guess N unfolding real_arch_inverse[of e] .. note N=this - show ?case - apply (rule_tac x=N in exI) - proof clarify - fix m n - assume mn: "N \ m" "N \ n" - have *: "N = (N - 1) + 1" using N by auto - show "norm ((\(x, k)\p m. content k *\<^sub>R f x) - (\(x, k)\p n. content k *\<^sub>R f x)) < e" - apply (rule less_trans[OF _ N[THEN conjunct2,THEN conjunct2]]) - apply(subst *) - using dp p(1) mn d(2) by auto - qed - qed - then guess y unfolding convergent_eq_Cauchy[symmetric] .. note y=this[THEN LIMSEQ_D] + then obtain y where y: "\no. \n\no. norm ((\(x,K) \ p n. content K *\<^sub>R f x) - y) < r" if "r > 0" for r + by (auto simp: convergent_eq_Cauchy[symmetric] dest: LIMSEQ_D) show ?l unfolding integrable_on_def has_integral proof (rule_tac x=y in exI, clarify) fix e :: real assume "e>0" - then have *:"e/2 > 0" by auto - then guess N1 unfolding real_arch_inverse[of "e/2"] .. note N1=this - then have N1': "N1 = N1 - 1 + 1" - by auto - guess N2 using y[OF *] .. note N2=this - have "gauge (d (N1 + N2))" - using d by auto - moreover - { - fix q - assume as: "q tagged_division_of (cbox a b)" "d (N1 + N2) fine q" - have *: "inverse (of_nat (N1 + N2 + 1)) < e / 2" - apply (rule less_trans) - using N1 - apply auto - done - have "norm ((\(x, k)\q. content k *\<^sub>R f x) - y) < e" - apply (rule norm_triangle_half_r) - apply (rule less_trans[OF _ *]) - apply (subst N1', rule d(2)[of "p (N1+N2)"]) - using N1' as(1) as(2) dp - apply (simp add: \\x. p x tagged_division_of cbox a b \ (\xa. \{d i xa |i. i \ {0..x}}) fine p x\) - using N2 le_add2 by blast - } - ultimately show "\d. gauge d \ - (\p. p tagged_division_of (cbox a b) \ d fine p \ - norm ((\(x, k)\p. content k *\<^sub>R f x) - y) < e)" - by (rule_tac x="d (N1 + N2)" in exI) auto + then have e2: "e/2 > 0" by auto + then obtain N1::nat where N1: "N1 \ 0" "inverse (real N1) < e / 2" + using real_arch_inverse by blast + obtain N2::nat where N2: "\n. n \ N2 \ norm ((\(x,K) \ p n. content K *\<^sub>R f x) - y) < e / 2" + using y[OF e2] by metis + show "\\. gauge \ \ + (\p. p tagged_division_of (cbox a b) \ \ fine p \ + norm ((\(x,K) \ p. content K *\<^sub>R f x) - y) < e)" + proof (intro exI conjI allI impI) + show "gauge (\ (N1+N2))" + using \ by auto + show "norm ((\(x,K) \ q. content K *\<^sub>R f x) - y) < e" + if "q tagged_division_of cbox a b \ \ (N1+N2) fine q" for q + proof (rule norm_triangle_half_r) + have "norm ((\(x,K) \ p (N1+N2). content K *\<^sub>R f x) - (\(x,K) \ q. content K *\<^sub>R f x)) + < 1 / (real (N1+N2) + 1)" + by (rule \; simp add: dp p that) + also have "... < e/2" + using N1 \0 < e\ by (auto simp: field_simps intro: less_le_trans) + finally show "norm ((\(x,K) \ p (N1+N2). content K *\<^sub>R f x) - (\(x,K) \ q. content K *\<^sub>R f x)) < e / 2" . + show "norm ((\(x,K) \ p (N1+N2). content K *\<^sub>R f x) - y) < e/2" + using N2 le_add_same_cancel2 by blast + qed + qed qed qed @@ -1021,221 +1021,220 @@ qed -lemma has_integral_split: +proposition has_integral_split: fixes f :: "'a::euclidean_space \ 'b::real_normed_vector" assumes fi: "(f has_integral i) (cbox a b \ {x. x\k \ c})" and fj: "(f has_integral j) (cbox a b \ {x. x\k \ c})" and k: "k \ Basis" - shows "(f has_integral (i + j)) (cbox a b)" -proof (unfold has_integral, rule, rule, goal_cases) - case (1 e) +shows "(f has_integral (i + j)) (cbox a b)" + unfolding has_integral +proof clarify + fix e::real + assume "0 < e" then have e: "e/2 > 0" by auto - obtain d1 - where d1: "gauge d1" - and d1norm: - "\p. \p tagged_division_of cbox a b \ {x. x \ k \ c}; - d1 fine p\ \ norm ((\(x, k) \ p. content k *\<^sub>R f x) - i) < e / 2" + obtain \1 where \1: "gauge \1" + and \1norm: + "\p. \p tagged_division_of cbox a b \ {x. x \ k \ c}; \1 fine p\ + \ norm ((\(x,K) \ p. content K *\<^sub>R f x) - i) < e / 2" apply (rule has_integralD[OF fi[unfolded interval_split[OF k]] e]) apply (simp add: interval_split[symmetric] k) - done - obtain d2 - where d2: "gauge d2" - and d2norm: - "\p. \p tagged_division_of cbox a b \ {x. c \ x \ k}; - d2 fine p\ \ norm ((\(x, k) \ p. content k *\<^sub>R f x) - j) < e / 2" + done + obtain \2 where \2: "gauge \2" + and \2norm: + "\p. \p tagged_division_of cbox a b \ {x. c \ x \ k}; \2 fine p\ + \ norm ((\(x, k) \ p. content k *\<^sub>R f x) - j) < e / 2" apply (rule has_integralD[OF fj[unfolded interval_split[OF k]] e]) apply (simp add: interval_split[symmetric] k) done - let ?d = "\x. if x\k = c then (d1 x \ d2 x) else ball x \x\k - c\ \ d1 x \ d2 x" - have "gauge ?d" - using d1 d2 unfolding gauge_def by auto - then show ?case - proof (rule_tac x="?d" in exI, safe) + let ?\ = "\x. if x\k = c then (\1 x \ \2 x) else ball x \x\k - c\ \ \1 x \ \2 x" + have "gauge ?\" + using \1 \2 unfolding gauge_def by auto + then show "\\. gauge \ \ + (\p. p tagged_division_of cbox a b \ \ fine p \ + norm ((\(x, k)\p. content k *\<^sub>R f x) - (i + j)) < e)" + proof (rule_tac x="?\" in exI, safe) fix p - assume "p tagged_division_of (cbox a b)" "?d fine p" - note p = this tagged_division_ofD[OF this(1)] - have xk_le_c: "\x kk. (x, kk) \ p \ kk \ {x. x\k \ c} \ {} \ x\k \ c" - proof - - fix x kk - assume as: "(x, kk) \ p" and kk: "kk \ {x. x\k \ c} \ {}" - show "x\k \ c" - proof (rule ccontr) - assume **: "\ ?thesis" - from this[unfolded not_le] - have "kk \ ball x \x \ k - c\" - using p(2)[unfolded fine_def, rule_format,OF as] by auto - with kk obtain y where y: "y \ ball x \x \ k - c\" "y\k \ c" - by blast - then have "\x \ k - y \ k\ < \x \ k - c\" - using Basis_le_norm[OF k, of "x - y"] - by (auto simp add: dist_norm inner_diff_left intro: le_less_trans) - with y show False - using ** by (auto simp add: field_simps) - qed + assume p: "p tagged_division_of (cbox a b)" and "?\ fine p" + have ab_eqp: "cbox a b = \{K. \x. (x, K) \ p}" + using p by blast + have xk_le_c: "x\k \ c" if as: "(x,K) \ p" and K: "K \ {x. x\k \ c} \ {}" for x K + proof (rule ccontr) + assume **: "\ x \ k \ c" + then have "K \ ball x \x \ k - c\" + using \?\ fine p\ as by (fastforce simp: not_le algebra_simps) + with K obtain y where y: "y \ ball x \x \ k - c\" "y\k \ c" + by blast + then have "\x \ k - y \ k\ < \x \ k - c\" + using Basis_le_norm[OF k, of "x - y"] + by (auto simp add: dist_norm inner_diff_left intro: le_less_trans) + with y show False + using ** by (auto simp add: field_simps) qed - have xk_ge_c: "\x kk. (x, kk) \ p \ kk \ {x. x\k \ c} \ {} \ x\k \ c" - proof - - fix x kk - assume as: "(x, kk) \ p" and kk: "kk \ {x. x\k \ c} \ {}" - show "x\k \ c" - proof (rule ccontr) - assume **: "\ ?thesis" - from this[unfolded not_le] have "kk \ ball x \x \ k - c\" - using p(2)[unfolded fine_def,rule_format,OF as,unfolded split_conv] by auto - with kk obtain y where y: "y \ ball x \x \ k - c\" "y\k \ c" - by blast - then have "\x \ k - y \ k\ < \x \ k - c\" - using Basis_le_norm[OF k, of "x - y"] - by (auto simp add: dist_norm inner_diff_left intro: le_less_trans) - with y show False - using ** by (auto simp add: field_simps) - qed + have xk_ge_c: "x\k \ c" if as: "(x,K) \ p" and K: "K \ {x. x\k \ c} \ {}" for x K + proof (rule ccontr) + assume **: "\ x \ k \ c" + then have "K \ ball x \x \ k - c\" + using \?\ fine p\ as by (fastforce simp: not_le algebra_simps) + with K obtain y where y: "y \ ball x \x \ k - c\" "y\k \ c" + by blast + then have "\x \ k - y \ k\ < \x \ k - c\" + using Basis_le_norm[OF k, of "x - y"] + by (auto simp add: dist_norm inner_diff_left intro: le_less_trans) + with y show False + using ** by (auto simp add: field_simps) qed - - have lem1: "\f P Q. (\x k. (x, k) \ {(x, f k) | x k. P x k} \ Q x k) \ - (\x k. P x k \ Q x (f k))" - by auto - have fin_finite: "finite {(x,f k) | x k. (x,k) \ s \ P x k}" + have fin_finite: "finite {(x,f K) | x K. (x,K) \ s \ P x K}" if "finite s" for s and f :: "'a set \ 'a set" and P :: "'a \ 'a set \ bool" proof - - from that have "finite ((\(x, k). (x, f k)) ` s)" + from that have "finite ((\(x,K). (x, f K)) ` s)" by auto then show ?thesis by (rule rev_finite_subset) auto qed - { fix g :: "'a set \ 'a set" + { fix \ :: "'a set \ 'a set" fix i :: "'a \ 'a set" - assume "i \ (\(x, k). (x, g k)) ` p - {(x, g k) |x k. (x, k) \ p \ g k \ {}}" - then obtain x k where xk: - "i = (x, g k)" "(x, k) \ p" - "(x, g k) \ {(x, g k) |x k. (x, k) \ p \ g k \ {}}" - by auto - have "content (g k) = 0" + assume "i \ (\(x, k). (x, \ k)) ` p - {(x, \ k) |x k. (x, k) \ p \ \ k \ {}}" + then obtain x K where xk: "i = (x, \ K)" "(x,K) \ p" + "(x, \ K) \ {(x, \ K) |x K. (x,K) \ p \ \ K \ {}}" + by auto + have "content (\ K) = 0" using xk using content_empty by auto - then have "(\(x, k). content k *\<^sub>R f x) i = 0" + then have "(\(x,K). content K *\<^sub>R f x) i = 0" unfolding xk split_conv by auto } note [simp] = this - have lem3: "\g :: 'a set \ 'a set. finite p \ - sum (\(x, k). content k *\<^sub>R f x) {(x,g k) |x k. (x,k) \ p \ g k \ {}} = - sum (\(x, k). content k *\<^sub>R f x) ((\(x, k). (x, g k)) ` p)" - by (rule sum.mono_neutral_left) auto - let ?M1 = "{(x, kk \ {x. x\k \ c}) |x kk. (x, kk) \ p \ kk \ {x. x\k \ c} \ {}}" - have d1_fine: "d1 fine ?M1" - by (force intro: fineI dest: fineD[OF p(2)] simp add: split: if_split_asm) + have "finite p" + using p by blast + let ?M1 = "{(x, K \ {x. x\k \ c}) |x K. (x,K) \ p \ K \ {x. x\k \ c} \ {}}" + have \1_fine: "\1 fine ?M1" + using \?\ fine p\ by (fastforce simp: fine_def split: if_split_asm) have "norm ((\(x, k)\?M1. content k *\<^sub>R f x) - i) < e/2" - proof (rule d1norm [OF tagged_division_ofI d1_fine]) + proof (rule \1norm [OF tagged_division_ofI \1_fine]) show "finite ?M1" - by (rule fin_finite p(3))+ + by (rule fin_finite) (use p in blast) show "\{k. \x. (x, k) \ ?M1} = cbox a b \ {x. x\k \ c}" - unfolding p(8)[symmetric] by auto - fix x l - assume xl: "(x, l) \ ?M1" - then guess x' l' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note xl'=this - show "x \ l" "l \ cbox a b \ {x. x \ k \ c}" - unfolding xl' - using p(4-6)[OF xl'(3)] using xl'(4) - using xk_le_c[OF xl'(3-4)] by auto - show "\a b. l = cbox a b" - unfolding xl' - using p(6)[OF xl'(3)] - by (fastforce simp add: interval_split[OF k,where c=c]) - fix y r - let ?goal = "interior l \ interior r = {}" - assume yr: "(y, r) \ ?M1" - then guess y' r' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note yr'=this - assume as: "(x, l) \ (y, r)" - show "interior l \ interior r = {}" - proof (cases "l' = r' \ x' = y'") + by (auto simp: ab_eqp) + + fix x L + assume xL: "(x, L) \ ?M1" + then obtain x' L' where xL': "x = x'" "L = L' \ {x. x \ k \ c}" + "(x', L') \ p" "L' \ {x. x \ k \ c} \ {}" + by blast + then obtain a' b' where ab': "L' = cbox a' b'" + using p by blast + show "x \ L" "L \ cbox a b \ {x. x \ k \ c}" + using p xk_le_c xL' by auto + show "\a b. L = cbox a b" + using p xL' ab' by (auto simp add: interval_split[OF k,where c=c]) + + fix y R + assume yR: "(y, R) \ ?M1" + then obtain y' R' where yR': "y = y'" "R = R' \ {x. x \ k \ c}" + "(y', R') \ p" "R' \ {x. x \ k \ c} \ {}" + by blast + assume as: "(x, L) \ (y, R)" + show "interior L \ interior R = {}" + proof (cases "L' = R' \ x' = y'") case False + have "interior R' = {}" + by (metis (no_types) False Pair_inject inf.idem tagged_division_ofD(5) [OF p] xL'(3) yR'(3)) then show ?thesis - using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto + using yR' by simp next case True - then have "l' \ r'" - using as unfolding xl' yr' by auto + then have "L' \ R'" + using as unfolding xL' yR' by auto + have "interior L' \ interior R' = {}" + by (metis (no_types) Pair_inject \L' \ R'\ p tagged_division_ofD(5) xL'(3) yR'(3)) then show ?thesis - using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto + using xL'(2) yR'(2) by auto qed qed moreover - let ?M2 = "{(x,kk \ {x. x\k \ c}) |x kk. (x,kk) \ p \ kk \ {x. x\k \ c} \ {}}" - have d2_fine: "d2 fine ?M2" - by (force intro: fineI dest: fineD[OF p(2)] simp add: split: if_split_asm) + let ?M2 = "{(x,K \ {x. x\k \ c}) |x K. (x,K) \ p \ K \ {x. x\k \ c} \ {}}" + have \2_fine: "\2 fine ?M2" + using \?\ fine p\ by (fastforce simp: fine_def split: if_split_asm) have "norm ((\(x, k)\?M2. content k *\<^sub>R f x) - j) < e/2" - proof (rule d2norm [OF tagged_division_ofI d2_fine]) + proof (rule \2norm [OF tagged_division_ofI \2_fine]) show "finite ?M2" - by (rule fin_finite p(3))+ + by (rule fin_finite) (use p in blast) show "\{k. \x. (x, k) \ ?M2} = cbox a b \ {x. x\k \ c}" - unfolding p(8)[symmetric] by auto - fix x l - assume xl: "(x, l) \ ?M2" - then guess x' l' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note xl'=this - show "x \ l" "l \ cbox a b \ {x. x \ k \ c}" - unfolding xl' - using p(4-6)[OF xl'(3)] xl'(4) xk_ge_c[OF xl'(3-4)] - by auto - show "\a b. l = cbox a b" - unfolding xl' - using p(6)[OF xl'(3)] - by (fastforce simp add: interval_split[OF k, where c=c]) - fix y r - let ?goal = "interior l \ interior r = {}" - assume yr: "(y, r) \ ?M2" - then guess y' r' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note yr'=this - assume as: "(x, l) \ (y, r)" - show "interior l \ interior r = {}" - proof (cases "l' = r' \ x' = y'") + by (auto simp: ab_eqp) + + fix x L + assume xL: "(x, L) \ ?M2" + then obtain x' L' where xL': "x = x'" "L = L' \ {x. x \ k \ c}" + "(x', L') \ p" "L' \ {x. x \ k \ c} \ {}" + by blast + then obtain a' b' where ab': "L' = cbox a' b'" + using p by blast + show "x \ L" "L \ cbox a b \ {x. x \ k \ c}" + using p xk_ge_c xL' by auto + show "\a b. L = cbox a b" + using p xL' ab' by (auto simp add: interval_split[OF k,where c=c]) + + fix y R + assume yR: "(y, R) \ ?M2" + then obtain y' R' where yR': "y = y'" "R = R' \ {x. x \ k \ c}" + "(y', R') \ p" "R' \ {x. x \ k \ c} \ {}" + by blast + assume as: "(x, L) \ (y, R)" + show "interior L \ interior R = {}" + proof (cases "L' = R' \ x' = y'") case False + have "interior R' = {}" + by (metis (no_types) False Pair_inject inf.idem tagged_division_ofD(5) [OF p] xL'(3) yR'(3)) then show ?thesis - using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto + using yR' by simp next case True - then have "l' \ r'" - using as unfolding xl' yr' by auto + then have "L' \ R'" + using as unfolding xL' yR' by auto + have "interior L' \ interior R' = {}" + by (metis (no_types) Pair_inject \L' \ R'\ p tagged_division_ofD(5) xL'(3) yR'(3)) then show ?thesis - using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto + using xL'(2) yR'(2) by auto qed qed ultimately - have "norm (((\(x, k)\?M1. content k *\<^sub>R f x) - i) + ((\(x, k)\?M2. content k *\<^sub>R f x) - j)) < e/2 + e/2" + have "norm (((\(x,K) \ ?M1. content K *\<^sub>R f x) - i) + ((\(x,K) \ ?M2. content K *\<^sub>R f x) - j)) < e/2 + e/2" using norm_add_less by blast - also { + moreover have "((\(x,K) \ ?M1. content K *\<^sub>R f x) - i) + + ((\(x,K) \ ?M2. content K *\<^sub>R f x) - j) = + (\(x, ka)\p. content ka *\<^sub>R f x) - (i + j)" + proof - have eq0: "\x y. x = (0::real) \ x *\<^sub>R (y::'b) = 0" - using scaleR_zero_left by auto + by auto have cont_eq: "\g. (\(x,l). content l *\<^sub>R f x) \ (\(x,l). (x,g l)) = (\(x,l). content (g l) *\<^sub>R f x)" by auto + have *: "\\ :: 'a set \ 'a set. + (\(x,K)\{(x, \ K) |x K. (x,K) \ p \ \ K \ {}}. content K *\<^sub>R f x) = + (\(x,K)\(\(x,K). (x, \ K)) ` p. content K *\<^sub>R f x)" + by (rule sum.mono_neutral_left) (auto simp: \finite p\) have "((\(x, k)\?M1. content k *\<^sub>R f x) - i) + ((\(x, k)\?M2. content k *\<^sub>R f x) - j) = (\(x, k)\?M1. content k *\<^sub>R f x) + (\(x, k)\?M2. content k *\<^sub>R f x) - (i + j)" by auto - also have "\ = (\(x, ka)\p. content (ka \ {x. x \ k \ c}) *\<^sub>R f x) + - (\(x, ka)\p. content (ka \ {x. c \ x \ k}) *\<^sub>R f x) - (i + j)" - unfolding lem3[OF p(3)] - by (subst (1 2) sum.reindex_nontrivial[OF p(3)]) - (auto intro!: k eq0 tagged_division_split_left_inj_content[OF p(1)] tagged_division_split_right_inj_content[OF p(1)] - simp: cont_eq)+ - also note sum.distrib[symmetric] - also have "\x. x \ p \ - (\(x,ka). content (ka \ {x. x \ k \ c}) *\<^sub>R f x) x + - (\(x,ka). content (ka \ {x. c \ x \ k}) *\<^sub>R f x) x = - (\(x,ka). content ka *\<^sub>R f x) x" + moreover have "\ = (\(x,K) \ p. content (K \ {x. x \ k \ c}) *\<^sub>R f x) + + (\(x,K) \ p. content (K \ {x. c \ x \ k}) *\<^sub>R f x) - (i + j)" + unfolding * + apply (subst (1 2) sum.reindex_nontrivial) + apply (auto intro!: k p eq0 tagged_division_split_left_inj_content tagged_division_split_right_inj_content + simp: cont_eq \finite p\) + done + moreover have "\x. x \ p \ (\(a,B). content (B \ {a. a \ k \ c}) *\<^sub>R f a) x + + (\(a,B). content (B \ {a. c \ a \ k}) *\<^sub>R f a) x = + (\(a,B). content B *\<^sub>R f a) x" proof clarify - fix a b - assume "(a, b) \ p" - from p(6)[OF this] guess u v by (elim exE) note uv=this - then show "content (b \ {x. x \ k \ c}) *\<^sub>R f a + content (b \ {x. c \ x \ k}) *\<^sub>R f a = - content b *\<^sub>R f a" - unfolding scaleR_left_distrib[symmetric] - unfolding uv content_split[OF k,of u v c] - by auto + fix a B + assume "(a, B) \ p" + with p obtain u v where uv: "B = cbox u v" by blast + then show "content (B \ {x. x \ k \ c}) *\<^sub>R f a + content (B \ {x. c \ x \ k}) *\<^sub>R f a = content B *\<^sub>R f a" + by (auto simp: scaleR_left_distrib uv content_split[OF k,of u v c]) qed - note sum.cong [OF _ this] - finally have "(\(x, k)\{(x, kk \ {x. x \ k \ c}) |x kk. (x, kk) \ p \ kk \ {x. x \ k \ c} \ {}}. content k *\<^sub>R f x) - i + - ((\(x, k)\{(x, kk \ {x. c \ x \ k}) |x kk. (x, kk) \ p \ kk \ {x. c \ x \ k} \ {}}. content k *\<^sub>R f x) - j) = - (\(x, ka)\p. content ka *\<^sub>R f x) - (i + j)" - by auto - } - finally show "norm ((\(x, k)\p. content k *\<^sub>R f x) - (i + j)) < e" + ultimately show ?thesis + by (auto simp: sum.distrib[symmetric]) + qed + ultimately show "norm ((\(x, k)\p. content k *\<^sub>R f x) - (i + j)) < e" by auto qed qed @@ -1303,7 +1302,7 @@ norm ((\(x, k)\p1 \ p2. content k *\<^sub>R f x) - i)" by (subst sum.union_inter_neutral) (auto simp: p1 p2) also have "\ < e" - by (rule k d(2) p12 fine_union p1 p2)+ + by (rule k d(2) p12 fine_Un p1 p2)+ finally have "norm ((\(x, k)\p1. content k *\<^sub>R f x) + (\(x, k)\p2. content k *\<^sub>R f x) - i) < e" . } then show ?thesis @@ -1352,7 +1351,7 @@ qed qed with f show ?thesis1 - by (simp add: interval_split[OF k] integrable_cauchy) + by (simp add: interval_split[OF k] integrable_Cauchy) have "\d. gauge d \ (\p1 p2. p1 tagged_division_of cbox a b \ {x. x \ k \ c} \ d fine p1 \ p2 tagged_division_of cbox a b \ {x. x \ k \ c} \ d fine p2 \ @@ -1384,7 +1383,7 @@ qed qed with f show ?thesis2 - by (simp add: interval_split[OF k] integrable_cauchy) + by (simp add: interval_split[OF k] integrable_Cauchy) qed lemma operative_integral: @@ -1509,21 +1508,25 @@ lemma has_integral_bound: fixes f :: "'a::euclidean_space \ 'b::real_normed_vector" assumes "0 \ B" - and *: "(f has_integral i) (cbox a b)" - and "\x\cbox a b. norm (f x) \ B" + and f: "(f has_integral i) (cbox a b)" + and "\x. x\cbox a b \ norm (f x) \ B" shows "norm i \ B * content (cbox a b)" proof (rule ccontr) assume "\ ?thesis" - then have *: "norm i - B * content (cbox a b) > 0" + then have "norm i - B * content (cbox a b) > 0" by auto - from assms(2)[unfolded has_integral,rule_format,OF *] - guess d by (elim exE conjE) note d=this[rule_format] - from fine_division_exists[OF this(1), of a b] guess p . note p=this - have *: "\s B. norm s \ B \ \ norm (s - i) < norm i - B" + with f[unfolded has_integral] + obtain \ where "gauge \" and \: + "\p. \p tagged_division_of cbox a b; \ fine p\ + \ norm ((\(x, K)\p. content K *\<^sub>R f x) - i) < norm i - B * content (cbox a b)" + by metis + then obtain p where p: "p tagged_division_of cbox a b" and "\ fine p" + using fine_division_exists by blast + have "\s B. norm s \ B \ \ norm (s - i) < norm i - B" unfolding not_less - by (metis norm_triangle_sub[of i] add.commute le_less_trans less_diff_eq linorder_not_le norm_minus_commute) - show False - using d(2)[OF conjI[OF p]] *[OF rsum_bound[OF p(1) assms(3)]] by auto + by (metis diff_left_mono dist_commute dist_norm norm_triangle_ineq2 order_trans) + then show False + using \ [OF p \\ fine p\] rsum_bound[OF p] assms by metis qed corollary has_integral_bound_real: @@ -1547,20 +1550,17 @@ lemma rsum_component_le: fixes f :: "'a::euclidean_space \ 'b::euclidean_space" - assumes "p tagged_division_of (cbox a b)" - and "\x\cbox a b. (f x)\i \ (g x)\i" - shows "(sum (\(x,k). content k *\<^sub>R f x) p)\i \ (sum (\(x,k). content k *\<^sub>R g x) p)\i" + assumes p: "p tagged_division_of (cbox a b)" + and "\x. x \ cbox a b \ (f x)\i \ (g x)\i" + shows "(\(x, K)\p. content K *\<^sub>R f x) \ i \ (\(x, K)\p. content K *\<^sub>R g x) \ i" unfolding inner_sum_left proof (rule sum_mono, clarify) - fix a b - assume ab: "(a, b) \ p" - note tagged = tagged_division_ofD(2-4)[OF assms(1) ab] - from this(3) guess u v by (elim exE) note b=this - show "(content b *\<^sub>R f a) \ i \ (content b *\<^sub>R g a) \ i" - unfolding b inner_simps real_scaleR_def - apply (rule mult_left_mono) - using assms(2) tagged - by (auto simp add: content_pos_le) + fix x K + assume ab: "(x, K) \ p" + with p obtain u v where K: "K = cbox u v" + by blast + then show "(content K *\<^sub>R f x) \ i \ (content K *\<^sub>R g x) \ i" + by (metis ab assms inner_scaleR_left measure_nonneg mult_left_mono tag_in_interval) qed lemma has_integral_component_le: @@ -1582,7 +1582,7 @@ guess d1 using f_i[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d1=this[rule_format] guess d2 using g_j[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d2=this[rule_format] obtain p where p: "p tagged_division_of cbox a b" "d1 fine p" "d2 fine p" - using fine_division_exists[OF gauge_Int[OF d1(1) d2(1)], of a b] unfolding fine_inter + using fine_division_exists[OF gauge_Int[OF d1(1) d2(1)], of a b] unfolding fine_Int by metis note le_less_trans[OF Basis_le_norm[OF k]] then have "\((\(x, k)\p. content k *\<^sub>R f x) - i) \ k\ < (i \ k - j \ k) / 3" @@ -1591,8 +1591,8 @@ by blast+ then show False unfolding inner_simps - using rsum_component_le[OF p(1) le] - by (simp add: abs_real_def split: if_split_asm) + using rsum_component_le[OF p(1)] le + by (force simp add: abs_real_def split: if_split_asm) qed show ?thesis proof (cases "\a b. s = cbox a b") @@ -1787,7 +1787,7 @@ finally have "norm (i1 - i2) < e" . } note triangle3 = this have finep: "gm fine p" "gn fine p" - using fine_inter p by auto + using fine_Int p by auto { fix x assume x: "x \ cbox a b" have "norm (f x - g n x) + norm (f x - g m x) \ inverse (real n + 1) + inverse (real m + 1)" @@ -4444,7 +4444,7 @@ have *: "(\x. f (- x)) integrable_on {-b .. -a}" "- b < - c" "- c \ - a" using assms by auto from indefinite_integral_continuous_left[OF * \e>0\] guess d . note d = this - let ?d = "min d (b - c)" + let ?d = "min d (b - c)" show ?thesis apply (rule that[of "?d"]) apply safe @@ -4471,92 +4471,62 @@ qed qed -lemma indefinite_integral_continuous: +lemma indefinite_integral_continuous_1: fixes f :: "real \ 'a::banach" assumes "f integrable_on {a .. b}" shows "continuous_on {a .. b} (\x. integral {a .. x} f)" -proof (unfold continuous_on_iff, safe) - fix x e :: real - assume as: "x \ {a .. b}" "e > 0" - let ?thesis = "\d>0. \x'\{a .. b}. dist x' x < d \ dist (integral {a .. x'} f) (integral {a .. x} f) < e" - { - presume *: "a < b \ ?thesis" - show ?thesis - apply cases - apply (rule *) - apply assumption - proof goal_cases - case 1 - then have "cbox a b = {x}" - using as(1) - apply - - apply (rule set_eqI) - apply auto +proof - + have "\d>0. \x'\{a..b}. dist x' x < d \ dist (integral {a..x'} f) (integral {a..x} f) < e" + if x: "x \ {a..b}" and "e > 0" for x e :: real + proof (cases "a = b") + case True + with that show ?thesis by force + next + case False + with x have "a < b" by force + with x consider "x = a" | "x = b" | "a < x" "x < b" + by force + then show ?thesis + proof cases + case 1 show ?thesis + apply (rule indefinite_integral_continuous_right [OF assms _ \a < b\ \e > 0\], force) + using \x = a\ apply (force simp: dist_norm algebra_simps) + done + next + case 2 show ?thesis + apply (rule indefinite_integral_continuous_left [OF assms \a < b\ _ \e > 0\], force) + using \x = b\ apply (force simp: dist_norm norm_minus_commute algebra_simps) done - then show ?case using \e > 0\ by auto - qed - } - assume "a < b" - have "(x = a \ x = b) \ (a < x \ x < b)" - using as(1) by auto - then show ?thesis - apply (elim disjE) - proof - - assume "x = a" - have "a \ a" .. - from indefinite_integral_continuous_right[OF assms(1) this \a \e>0\] guess d . note d=this - show ?thesis - apply rule - apply rule - apply (rule d) - apply safe - apply (subst dist_commute) - unfolding \x = a\ dist_norm - apply (rule d(2)[rule_format]) - apply auto - done - next - assume "x = b" - have "b \ b" .. - from indefinite_integral_continuous_left[OF assms(1) \a this \e>0\] guess d . note d=this - show ?thesis - apply rule - apply rule - apply (rule d) - apply safe - apply (subst dist_commute) - unfolding \x = b\ dist_norm - apply (rule d(2)[rule_format]) - apply auto - done - next - assume "a < x \ x < b" - then have xl: "a < x" "x \ b" and xr: "a \ x" "x < b" - by auto - from indefinite_integral_continuous_left [OF assms(1) xl \e>0\] guess d1 . note d1=this - from indefinite_integral_continuous_right[OF assms(1) xr \e>0\] guess d2 . note d2=this - show ?thesis - apply (rule_tac x="min d1 d2" in exI) - proof safe - show "0 < min d1 d2" - using d1 d2 by auto - fix y - assume "y \ {a .. b}" and "dist y x < min d1 d2" - then show "dist (integral {a .. y} f) (integral {a .. x} f) < e" - apply (subst dist_commute) - apply (cases "y < x") - unfolding dist_norm - apply (rule d1(2)[rule_format]) - defer - apply (rule d2(2)[rule_format]) - unfolding not_less - apply (auto simp add: field_simps) - done + next + case 3 + obtain d1 where "0 < d1" + and d1: "\t. \x - d1 < t; t \ x\ \ norm (integral {a..x} f - integral {a..t} f) < e" + using 3 by (auto intro: indefinite_integral_continuous_left [OF assms \a < x\ _ \e > 0\]) + obtain d2 where "0 < d2" + and d2: "\t. \x \ t; t < x + d2\ \ norm (integral {a..x} f - integral {a..t} f) < e" + using 3 by (auto intro: indefinite_integral_continuous_right [OF assms _ \x < b\ \e > 0\]) + show ?thesis + proof (intro exI ballI conjI impI) + show "0 < min d1 d2" + using \0 < d1\ \0 < d2\ by simp + show "dist (integral {a..y} f) (integral {a..x} f) < e" + if "y \ {a..b}" "dist y x < min d1 d2" for y + proof (cases "y < x") + case True + with that d1 show ?thesis by (auto simp: dist_commute dist_norm) + next + case False + with that d2 show ?thesis + by (auto simp: dist_commute dist_norm) + qed + qed qed qed + then show ?thesis + by (auto simp: continuous_on_iff) qed -lemma indefinite_integral_continuous': +lemma indefinite_integral_continuous_1': fixes f::"real \ 'a::banach" assumes "f integrable_on {a..b}" shows "continuous_on {a..b} (\x. integral {x..b} f)" @@ -4565,7 +4535,7 @@ using integral_combine[OF _ _ assms, of x] that by (auto simp: algebra_simps) with _ show ?thesis - by (rule continuous_on_eq) (auto intro!: continuous_intros indefinite_integral_continuous assms) + by (rule continuous_on_eq) (auto intro!: continuous_intros indefinite_integral_continuous_1 assms) qed @@ -5248,7 +5218,7 @@ assumes "negligible ((S - T) \ (T - S))" shows "f integrable_on S \ f integrable_on T" by (blast intro: integrable_spike_set assms negligible_subset) - + lemma has_integral_interior: fixes f :: "'a :: euclidean_space \ 'b :: banach" shows "negligible(frontier S) \ (f has_integral y) (interior S) \ (f has_integral y) S" @@ -5256,7 +5226,7 @@ apply (auto simp: frontier_def Un_Diff closure_def) apply (metis Diff_eq_empty_iff interior_subset negligible_empty) done - + lemma has_integral_closure: fixes f :: "'a :: euclidean_space \ 'b :: banach" shows "negligible(frontier S) \ (f has_integral y) (closure S) \ (f has_integral y) S" @@ -5593,10 +5563,10 @@ qed then show ?thesis by (rule_tac x="\x. d1 x \ d2 x" in exI) - (auto simp: fine_inter intro: \gauge d1\ \gauge d2\ d1 d2) + (auto simp: fine_Int intro: \gauge d1\ \gauge d2\ d1 d2) qed then show ?thesis - by (simp add: integrable_cauchy) + by (simp add: integrable_Cauchy) qed lemma integrable_straddle: @@ -5605,142 +5575,123 @@ \i - j\ < e \ (\x\s. g x \ f x \ f x \ h x)" shows "f integrable_on s" proof - - have "\a b. (\x. if x \ s then f x else 0) integrable_on cbox a b" - proof (rule integrable_straddle_interval, goal_cases) - case (1 a b e) + let ?fs = "(\x. if x \ s then f x else 0)" + have "?fs integrable_on cbox a b" for a b + proof (rule integrable_straddle_interval) + fix e::real + assume "e > 0" then have *: "e/4 > 0" by auto - from assms[rule_format,OF this] guess g h i j by (elim exE conjE) note obt=this - note obt(1)[unfolded has_integral_alt'[of g]] - note conjunctD2[OF this, rule_format] - note g = this(1) and this(2)[OF *] - from this(2) guess B1 .. note B1 = conjunctD2[OF this,rule_format] - note obt(2)[unfolded has_integral_alt'[of h]] - note conjunctD2[OF this, rule_format] - note h = this(1) and this(2)[OF *] - from this(2) guess B2 .. note B2 = conjunctD2[OF this,rule_format] - define c :: 'n where "c = (\i\Basis. min (a\i) (- (max B1 B2)) *\<^sub>R i)" - define d :: 'n where "d = (\i\Basis. max (b\i) (max B1 B2) *\<^sub>R i)" - have *: "ball 0 B1 \ cbox c d" "ball 0 B2 \ cbox c d" - apply safe - unfolding mem_ball mem_box dist_norm - apply (rule_tac[!] ballI) - proof goal_cases - case (1 x i) - then show ?case using Basis_le_norm[of i x] - unfolding c_def d_def by auto - next - case (2 x i) - then show ?case using Basis_le_norm[of i x] - unfolding c_def d_def by auto - qed - have **: "\ch cg ag ah::real. norm (ah - ag) \ norm (ch - cg) \ norm (cg - i) < e / 4 \ - norm (ch - j) < e / 4 \ abs (ag - ah) < e" - using obt(3) - unfolding real_norm_def - by arith - show ?case - apply (rule_tac x="\x. if x \ s then g x else 0" in exI) - apply (rule_tac x="\x. if x \ s then h x else 0" in exI) - apply (rule_tac x="integral (cbox a b) (\x. if x \ s then g x else 0)" in exI) - apply (rule_tac x="integral (cbox a b) (\x. if x \ s then h x else 0)" in exI) - apply safe - apply (rule_tac[1-2] integrable_integral,rule g) - apply (rule h) - apply (rule **[OF _ B1(2)[OF *(1)] B2(2)[OF *(2)]]) - proof - - have *: "\x f g. (if x \ s then f x else 0) - (if x \ s then g x else 0) = - (if x \ s then f x - g x else (0::real))" + with assms obtain g h i j where g: "(g has_integral i) s" and h: "(h has_integral j) s" + and ij: "\i - j\ < e/4" + and fgh: "\x. x \ s \ g x \ f x \ f x \ h x" + by metis + let ?gs = "(\x. if x \ s then g x else 0)" + let ?hs = "(\x. if x \ s then h x else 0)" + obtain Bg where Bg: "\a b. ball 0 Bg \ cbox a b \ \integral (cbox a b) ?gs - i\ < e/4" + and int_g: "\a b. ?gs integrable_on cbox a b" + using g * unfolding has_integral_alt' real_norm_def by meson + obtain Bh where + Bh: "\a b. ball 0 Bh \ cbox a b \ \integral (cbox a b) ?hs - j\ < e/4" + and int_h: "\a b. ?hs integrable_on cbox a b" + using h * unfolding has_integral_alt' real_norm_def by meson + define c where "c = (\i\Basis. min (a\i) (- (max Bg Bh)) *\<^sub>R i)" + define d where "d = (\i\Basis. max (b\i) (max Bg Bh) *\<^sub>R i)" + have "\norm (0 - x) < Bg; i \ Basis\ \ c \ i \ x \ i \ x \ i \ d \ i" for x i + using Basis_le_norm[of i x] unfolding c_def d_def by auto + then have ballBg: "ball 0 Bg \ cbox c d" + by (auto simp: mem_box dist_norm) + have "\norm (0 - x) < Bh; i \ Basis\ \ c \ i \ x \ i \ x \ i \ d \ i" for x i + using Basis_le_norm[of i x] unfolding c_def d_def by auto + then have ballBh: "ball 0 Bh \ cbox c d" + by (auto simp: mem_box dist_norm) + have ab_cd: "cbox a b \ cbox c d" + by (auto simp: c_def d_def subset_box_imp) + have **: "\ch cg ag ah::real. \\ah - ag\ \ \ch - cg\; \cg - i\ < e/4; \ch - j\ < e/4\ + \ \ag - ah\ < e" + using ij by arith + show "\g h i j. (g has_integral i) (cbox a b) \ (h has_integral j) (cbox a b) \ \i - j\ < e \ + (\x\cbox a b. g x \ (if x \ s then f x else 0) \ + (if x \ s then f x else 0) \ h x)" + proof (intro exI ballI conjI) + have eq: "\x f g. (if x \ s then f x else 0) - (if x \ s then g x else 0) = + (if x \ s then f x - g x else (0::real))" by auto - note ** = abs_of_nonneg[OF integral_nonneg[OF integrable_diff, OF h g]] - show "norm (integral (cbox a b) (\x. if x \ s then h x else 0) - - integral (cbox a b) (\x. if x \ s then g x else 0)) \ - norm (integral (cbox c d) (\x. if x \ s then h x else 0) - - integral (cbox c d) (\x. if x \ s then g x else 0))" - unfolding integral_diff[OF h g,symmetric] real_norm_def - apply (subst **) - defer - apply (subst **) - defer - apply (rule has_integral_subset_le) - defer - apply (rule integrable_integral integrable_diff h g)+ - proof safe - fix x - assume "x \ cbox a b" - then show "x \ cbox c d" - unfolding mem_box c_def d_def - apply - - apply rule - apply (erule_tac x=i in ballE) - apply auto - done - qed (insert obt(4), auto) - qed (insert obt(4), auto) - qed - note interv = this - - show ?thesis - unfolding integrable_alt[of f] - apply safe - apply (rule interv) - proof goal_cases - case (1 e) - then have *: "e/3 > 0" - by auto - from assms[rule_format,OF this] guess g h i j by (elim exE conjE) note obt=this - note obt(1)[unfolded has_integral_alt'[of g]] - note conjunctD2[OF this, rule_format] - note g = this(1) and this(2)[OF *] - from this(2) guess B1 .. note B1 = conjunctD2[OF this,rule_format] - note obt(2)[unfolded has_integral_alt'[of h]] - note conjunctD2[OF this, rule_format] - note h = this(1) and this(2)[OF *] - from this(2) guess B2 .. note B2 = conjunctD2[OF this,rule_format] - show ?case - apply (rule_tac x="max B1 B2" in exI) - apply safe - apply (rule max.strict_coboundedI1) - apply (rule B1) - proof - - fix a b c d :: 'n - assume as: "ball 0 (max B1 B2) \ cbox a b" "ball 0 (max B1 B2) \ cbox c d" - have **: "ball 0 B1 \ ball (0::'n) (max B1 B2)" "ball 0 B2 \ ball (0::'n) (max B1 B2)" - by auto - have *: "\ga gc ha hc fa fc::real. - \ga - i\ < e / 3 \ \gc - i\ < e / 3 \ \ha - j\ < e / 3 \ - \hc - j\ < e / 3 \ \i - j\ < e / 3 \ ga \ fa \ fa \ ha \ gc \ fc \ fc \ hc \ - \fa - fc\ < e" - by (simp add: abs_real_def split: if_split_asm) - show "norm (integral (cbox a b) (\x. if x \ s then f x else 0) - integral (cbox c d) - (\x. if x \ s then f x else 0)) < e" - unfolding real_norm_def - apply (rule *) - apply safe - unfolding real_norm_def[symmetric] - apply (rule B1(2)) - apply (rule order_trans) + have int_hg: "(\x. if x \ s then h x - g x else 0) integrable_on cbox a b" + "(\x. if x \ s then h x - g x else 0) integrable_on cbox c d" + by (metis (no_types) integrable_diff g h has_integral_integrable integrable_altD(1))+ + show "(?gs has_integral integral (cbox a b) ?gs) (cbox a b)" + "(?hs has_integral integral (cbox a b) ?hs) (cbox a b)" + by (intro integrable_integral int_g int_h)+ + then have "integral (cbox a b) ?gs \ integral (cbox a b) ?hs" + apply (rule has_integral_le) + using fgh by force + then have "0 \ integral (cbox a b) ?hs - integral (cbox a b) ?gs" + by simp + then have "\integral (cbox a b) ?hs - integral (cbox a b) ?gs\ + \ \integral (cbox c d) ?hs - integral (cbox c d) ?gs\" + apply (simp add: integral_diff [symmetric] int_g int_h) + apply (subst abs_of_nonneg[OF integral_nonneg[OF integrable_diff, OF int_h int_g]]) + using fgh apply (force simp: eq intro!: integral_subset_le [OF ab_cd int_hg])+ + done + then show "\integral (cbox a b) ?gs - integral (cbox a b) ?hs\ < e" apply (rule **) - apply (rule as(1)) - apply (rule B1(2)) - apply (rule order_trans) - apply (rule **) - apply (rule as(2)) - apply (rule B2(2)) - apply (rule order_trans) - apply (rule **) - apply (rule as(1)) - apply (rule B2(2)) - apply (rule order_trans) - apply (rule **) - apply (rule as(2)) - using obt(3) apply auto[1] - apply (rule_tac[!] integral_le) - using obt - apply (auto intro!: h g interv) + apply (rule Bg ballBg Bh ballBh)+ done + show "\x. x \ cbox a b \ ?gs x \ ?fs x" "\x. x \ cbox a b \ ?fs x \ ?hs x" + using fgh by auto qed qed + then have int_f: "?fs integrable_on cbox a b" for a b + by simp + have "\B>0. \a b c d. + ball 0 B \ cbox a b \ ball 0 B \ cbox c d \ + abs (integral (cbox a b) ?fs - integral (cbox c d) ?fs) < e" + if "0 < e" for e + proof - + have *: "e/3 > 0" + using that by auto + with assms obtain g h i j where g: "(g has_integral i) s" and h: "(h has_integral j) s" + and ij: "\i - j\ < e/3" + and fgh: "\x. x \ s \ g x \ f x \ f x \ h x" + by metis + let ?gs = "(\x. if x \ s then g x else 0)" + let ?hs = "(\x. if x \ s then h x else 0)" + obtain Bg where "Bg > 0" + and Bg: "\a b. ball 0 Bg \ cbox a b \ \integral (cbox a b) ?gs - i\ < e/3" + and int_g: "\a b. ?gs integrable_on cbox a b" + using g * unfolding has_integral_alt' real_norm_def by meson + obtain Bh where "Bh > 0" + and Bh: "\a b. ball 0 Bh \ cbox a b \ \integral (cbox a b) ?hs - j\ < e/3" + and int_h: "\a b. ?hs integrable_on cbox a b" + using h * unfolding has_integral_alt' real_norm_def by meson + { fix a b c d :: 'n + assume as: "ball 0 (max Bg Bh) \ cbox a b" "ball 0 (max Bg Bh) \ cbox c d" + have **: "ball 0 Bg \ ball (0::'n) (max Bg Bh)" "ball 0 Bh \ ball (0::'n) (max Bg Bh)" + by auto + have *: "\ga gc ha hc fa fc. \\ga - i\ < e/3; \gc - i\ < e/3; \ha - j\ < e/3; + \hc - j\ < e/3; ga \ fa; fa \ ha; gc \ fc; fc \ hc\ \ + \fa - fc\ < e" + using ij by arith + have "abs (integral (cbox a b) (\x. if x \ s then f x else 0) - integral (cbox c d) + (\x. if x \ s then f x else 0)) < e" + proof (rule *) + show "\integral (cbox a b) ?gs - i\ < e/3" + using "**" Bg as by blast + show "\integral (cbox c d) ?gs - i\ < e/3" + using "**" Bg as by blast + show "\integral (cbox a b) ?hs - j\ < e/3" + using "**" Bh as by blast + show "\integral (cbox c d) ?hs - j\ < e/3" + using "**" Bh as by blast + qed (use int_f int_g int_h fgh in \simp_all add: integral_le\) + } + then show ?thesis + apply (rule_tac x="max Bg Bh" in exI) + using \Bg > 0\ by auto + qed + then show ?thesis + unfolding integrable_alt[of f] real_norm_def by (blast intro: int_f) qed @@ -6043,7 +5994,7 @@ then show ?case apply (rule_tac x=qq in exI) using dd(2)[of qq] - unfolding fine_inter uv + unfolding fine_Int uv apply auto done qed @@ -6054,9 +6005,9 @@ apply (rule assms(4)[rule_format]) proof show "d fine ?p" - apply (rule fine_union) + apply (rule fine_Un) apply (rule p) - apply (rule fine_unions) + apply (rule fine_Union) using qq apply auto done @@ -6952,7 +6903,7 @@ using that(3) as apply auto done - qed (insert p[unfolded fine_inter], auto) + qed (insert p[unfolded fine_Int], auto) qed { presume "\e. 0 < e \ norm (integral s f) < integral s g + e" @@ -7400,7 +7351,7 @@ proof - let ?F = "\x. integral {c..g x} f" have cont_int: "continuous_on {a..b} ?F" - by (rule continuous_on_compose2[OF _ g subset] indefinite_integral_continuous + by (rule continuous_on_compose2[OF _ g subset] indefinite_integral_continuous_1 f integrable_continuous_real)+ have deriv: "(((\x. integral {c..x} f) \ g) has_vector_derivative g' x *\<^sub>R f (g x)) (at x within {a..b})" if "x \ {a..b} - s" for x