# HG changeset patch # User paulson # Date 1504024871 -3600 # Node ID 507a42c0a0ffc599c9d35ec0e372af13e324bbac # Parent 1f955cdd9e5901606444ce84f58a70e53ea75005 last-minute integration unscrambling diff -r 1f955cdd9e59 -r 507a42c0a0ff src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy --- a/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Mon Aug 28 22:32:22 2017 +0100 +++ b/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Tue Aug 29 17:41:11 2017 +0100 @@ -314,7 +314,7 @@ then have "(\x. f x * indicator \ x) integrable_on \" by (auto simp: integrable_on_def cong: has_integral_cong) then have "(\x. f x * indicator \ x) integrable_on (\ \ B n)" - by (rule integrable_on_superset[rotated 2]) auto + by (rule integrable_on_superset) auto then have "(\x. f x * indicator \ x) integrable_on B n" unfolding B_def by (rule integrable_on_subcbox) auto then show "(\x. f x * indicator \ x) \ lebesgue_on \' \\<^sub>M borel" @@ -2717,7 +2717,7 @@ note intl = has_integral_integrable[OF int] have af: "f absolutely_integrable_on (closure S)" using nonneg - by (intro absolutely_integrable_onI intl integrable_eq[OF _ intl]) simp + by (intro absolutely_integrable_onI intl integrable_eq[OF intl]) simp then have "integral (closure S) f = set_lebesgue_integral lebesgue (closure S) f" by (intro set_lebesgue_integral_eq_integral(2)[symmetric]) also have "\ = 0 \ (AE x in lebesgue. indicator (closure S) x *\<^sub>R f x = 0)" diff -r 1f955cdd9e59 -r 507a42c0a0ff src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Mon Aug 28 22:32:22 2017 +0100 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Tue Aug 29 17:41:11 2017 +0100 @@ -716,7 +716,7 @@ using assms(1) by auto -lemma integrable_eq: "(\x. x \ s \ f x = g x) \ f integrable_on s \ g integrable_on s" +lemma integrable_eq: "\f integrable_on s; \x. x \ s \ f x = g x\ \ g integrable_on s" unfolding integrable_on_def using has_integral_eq[of s f g] has_integral_eq by blast @@ -2615,79 +2615,70 @@ and "Inf {a..b} = a" using assms by auto -lemma fundamental_theorem_of_calculus: +theorem fundamental_theorem_of_calculus: fixes f :: "real \ 'a::banach" - assumes "a \ b" - and vecd: "\x\{a..b}. (f has_vector_derivative f' x) (at x within {a..b})" + assumes "a \ b" + and vecd: "\x. x \ {a..b} \ (f has_vector_derivative f' x) (at x within {a..b})" shows "(f' has_integral (f b - f a)) {a..b}" unfolding has_integral_factor_content box_real[symmetric] proof safe fix e :: real assume "e > 0" - then have "\x. \d>0. - x \ {a..b} \ - (\y\{a..b}. - norm (y-x) < d \ norm (f y - f x - (y-x) *\<^sub>R f' x) \ e * norm (y-x))" + then have "\x. \d>0. x \ {a..b} \ + (\y\{a..b}. norm (y-x) < d \ norm (f y - f x - (y-x) *\<^sub>R f' x) \ e * norm (y-x))" using vecd[unfolded has_vector_derivative_def has_derivative_within_alt] by blast then obtain d where d: "\x. 0 < d x" "\x y. \x \ {a..b}; y \ {a..b}; norm (y-x) < d x\ \ norm (f y - f x - (y-x) *\<^sub>R f' x) \ e * norm (y-x)" - by metis - + by metis 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) - (f b - f a)) \ e * content (cbox a b))" - apply (rule_tac x="\x. ball x (d x)" in exI) - apply safe - apply (rule gauge_ball_dependent) - apply rule - apply (rule d(1)) - proof - + proof (rule exI, safe) + show "gauge (\x. ball x (d x))" + using d(1) gauge_ball_dependent by blast + next fix p - assume as: "p tagged_division_of cbox a b" "(\x. ball x (d x)) fine p" - show "norm ((\(x, k)\p. content k *\<^sub>R f' x) - (f b - f a)) \ e * content (cbox a b)" - unfolding content_real[OF assms(1), simplified box_real[symmetric]] additive_tagged_division_1[OF assms(1) as(1)[simplified box_real],of f,symmetric] - unfolding additive_tagged_division_1[OF assms(1) as(1)[simplified box_real],of "\x. x",symmetric] - unfolding sum_distrib_left - defer - unfolding sum_subtractf[symmetric] + assume ptag: "p tagged_division_of cbox a b" and finep: "(\x. ball x (d x)) fine p" + have ba: "b - a = (\(x,K)\p. Sup K - Inf K)" "f b - f a = (\(x,K)\p. f(Sup K) - f(Inf K))" + using additive_tagged_division_1[where f= "\x. x"] additive_tagged_division_1[where f= f] + \a \ b\ ptag by auto + have "norm (\(x, K) \ p. (content K *\<^sub>R f' x) - (f (Sup K) - f (Inf K))) + \ (\n\p. e * (case n of (x, k) \ Sup k - Inf k))" proof (rule sum_norm_le,safe) - fix x k - assume "(x, k) \ p" - note xk = tagged_division_ofD(2-4)[OF as(1) this] - then obtain u v where k: "k = cbox u v" by blast - have *: "u \ v" - using xk unfolding k by auto - have ball: "\xa\k. xa \ ball x (d x)" - using as(2)[unfolded fine_def,rule_format,OF \(x,k)\p\,unfolded split_conv subset_eq] . - have "norm ((v - u) *\<^sub>R f' x - (f v - f u)) \ - norm (f u - f x - (u - x) *\<^sub>R f' x) + norm (f v - f x - (v - x) *\<^sub>R f' x)" - apply (rule order_trans[OF _ norm_triangle_ineq4]) - apply (rule eq_refl) - apply (rule arg_cong[where f=norm]) - unfolding scaleR_diff_left - apply (auto simp add:algebra_simps) - done + fix x K + assume "(x, K) \ p" + then have "x \ K" and kab: "K \ cbox a b" + using ptag by blast+ + then obtain u v where k: "K = cbox u v" and "x \ K" and kab: "K \ cbox a b" + using ptag \(x, K) \ p\ by auto + have "u \ v" + using \x \ K\ unfolding k by auto + have ball: "\y\K. y \ ball x (d x)" + using finep \(x, K) \ p\ by blast + have "u \ K" "v \ K" + by (simp_all add: \u \ v\ k) + 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 (auto simp add: algebra_simps) + also have "... \ norm (f u - f x - (u - x) *\<^sub>R f' x) + norm (f v - f x - (v - x) *\<^sub>R f' x)" + by (rule norm_triangle_ineq4) + finally have "norm ((v - u) *\<^sub>R f' x - (f v - f u)) \ + norm (f u - f x - (u - x) *\<^sub>R f' x) + norm (f v - f x - (v - x) *\<^sub>R f' x)" . also have "\ \ e * norm (u - x) + e * norm (v - x)" - apply (rule add_mono) - apply (rule d(2)[of "x" "u",unfolded o_def]) - prefer 4 - apply (rule d(2)[of "x" "v",unfolded o_def]) - using ball[rule_format,of u] ball[rule_format,of v] - using xk(1-2) - unfolding k subset_eq - apply (auto simp add:dist_real_def) - done - also have "\ \ e * (Sup k - Inf k)" - unfolding k interval_bounds_real[OF *] - using xk(1) - unfolding k - by (auto simp add: dist_real_def field_simps) - finally show "norm (content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \ - e * (Sup k - Inf k)" - unfolding box_real k interval_bounds_real[OF *] content_real[OF *] - interval_upperbound_real interval_lowerbound_real - . + proof (rule add_mono) + show "norm (f u - f x - (u - x) *\<^sub>R f' x) \ e * norm (u - x)" + apply (rule d(2)[of x u]) + using \x \ K\ kab \u \ K\ ball dist_real_def by (auto simp add:dist_real_def) + show "norm (f v - f x - (v - x) *\<^sub>R f' x) \ e * norm (v - x)" + apply (rule d(2)[of x v]) + using \x \ K\ kab \v \ K\ ball dist_real_def by (auto simp add:dist_real_def) + qed + also have "\ \ e * (Sup K - Inf K)" + using \x \ K\ by (auto simp: k interval_bounds_real[OF \u \ v\] field_simps) + finally show "norm (content K *\<^sub>R f' x - (f (Sup K) - f (Inf K))) \ e * (Sup K - Inf K)" + using \u \ v\ by (simp add: k) qed + with \a \ b\ show "norm ((\(x, K)\p. content K *\<^sub>R f' x) - (f b - f a)) \ e * content (cbox a b)" + by (auto simp: ba split_def sum_subtractf [symmetric] sum_distrib_left) qed qed @@ -2697,7 +2688,7 @@ 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) + apply (rule fundamental_theorem_of_calculus [OF assms]) unfolding power2_eq_square by (rule derivative_eq_intros | simp)+ then show ?thesis @@ -3144,10 +3135,10 @@ using antiderivative_continuous[OF assms] by metis have "(f has_integral g v - g u) {u..v}" if "u \ {a..b}" "v \ {a..b}" "u \ v" for u v proof - - have "\x\cbox u v. (g has_vector_derivative f x) (at x within cbox u v)" + have "\x. x \ cbox u v \ (g has_vector_derivative f x) (at x within cbox u v)" by (meson g has_vector_derivative_within_subset interval_subset_is_interval is_interval_closed_interval subsetCE that(1) that(2)) then show ?thesis - by (simp add: fundamental_theorem_of_calculus that(3)) + by (metis box_real(2) that(3) fundamental_theorem_of_calculus) qed then show ?thesis using that by blast @@ -3158,39 +3149,30 @@ lemma has_integral_twiddle: assumes "0 < r" - and "\x. h(g x) = x" - and "\x. g(h x) = x" + and hg: "\x. h(g x) = x" + and gh: "\x. g(h x) = x" and contg: "\x. continuous (at x) g" - and "\u v. \w z. g ` cbox u v = cbox w z" - and h: "\u v. \w z. h ` cbox u v = cbox w z" - and "\u v. content(g ` cbox u v) = r * content (cbox u v)" + and g: "\u v. \w z. g ` cbox u v = cbox w z" + and h: "\u v. \w z. h ` cbox u v = cbox w z" + and r: "\u v. content(g ` cbox u v) = r * content (cbox u v)" and intfi: "(f has_integral i) (cbox a b)" shows "((\x. f(g x)) has_integral (1 / r) *\<^sub>R i) (h ` cbox a b)" -proof - - show ?thesis when *: "cbox a b \ {} \ ?thesis" - apply cases - defer - apply (rule *) - apply assumption - proof goal_cases - case prems: 1 - then show ?thesis - unfolding prems assms(8)[unfolded prems has_integral_empty_eq] by auto - qed - assume "cbox a b \ {}" +proof (cases "cbox a b = {}") + case True + then show ?thesis + using intfi by auto +next + case False obtain w z where wz: "h ` cbox a b = cbox w z" using h by blast have inj: "inj g" "inj h" - apply (metis assms(2) injI) - by (metis assms(3) injI) + using hg gh injI by metis+ from h obtain ha hb where h_eq: "h ` cbox a b = cbox ha hb" by blast - show ?thesis - unfolding h_eq has_integral - unfolding h_eq[symmetric] - proof safe - fix e :: real - assume e: "e > 0" - with \0 < r\ have "e * r > 0" by simp + have "\d. gauge d \ (\p. p tagged_division_of h ` cbox a b \ d fine p + \ norm ((\(x, k)\p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i) < e)" + if "e > 0" for e + proof - + have "e * r > 0" using that \0 < r\ by simp with intfi[unfolded has_integral] obtain d where d: "gauge d" "\p. p tagged_division_of cbox a b \ d fine p @@ -3199,69 +3181,49 @@ define d' where "d' x = {y. g y \ d (g x)}" for x have d': "\x. d' x = {y. g y \ (d (g x))}" unfolding d'_def .. - show "\d. gauge d \ (\p. p tagged_division_of h ` cbox a b \ d fine p - \ norm ((\(x, k)\p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i) < e)" + show ?thesis proof (rule_tac x=d' in exI, safe) show "gauge d'" - using d(1) - unfolding gauge_def d' - using continuous_open_preimage_univ[OF _ contg] - by auto + using d(1) continuous_open_preimage_univ[OF _ contg] by (auto simp: gauge_def d') + next fix p - assume as: "p tagged_division_of h ` cbox a b" "d' fine p" - note p = tagged_division_ofD[OF as(1)] - have "(\(x, k). (g x, g ` k)) ` p tagged_division_of (cbox a b) \ d fine (\(x, k). (g x, g ` k)) ` p" + assume ptag: "p tagged_division_of h ` cbox a b" and finep: "d' fine p" + note p = tagged_division_ofD[OF ptag] + have gab: "g y \ cbox a b" if "y \ K" "(x, K) \ p" for x y K + by (metis hg inj(2) inj_image_mem_iff p(3) subsetCE that that) + have gimp: "(\(x,K). (g x, g ` K)) ` p tagged_division_of (cbox a b) \ + d fine (\(x, k). (g x, g ` k)) ` p" unfolding tagged_division_of proof safe show "finite ((\(x, k). (g x, g ` k)) ` p)" - using as by auto + using ptag by auto show "d fine (\(x, k). (g x, g ` k)) ` p" - using as(2) unfolding fine_def d' by auto + using finep unfolding fine_def d' by auto + next fix x k - assume xk[intro]: "(x, k) \ p" + assume xk: "(x, k) \ p" show "g x \ g ` k" using p(2)[OF xk] by auto show "\u v. g ` k = cbox u v" using p(4)[OF xk] using assms(5-6) by auto - { - fix y - assume "y \ k" - then show "g y \ cbox a b" "g y \ cbox a b" - using p(3)[OF xk,unfolded subset_eq,rule_format,of "h (g y)"] - using assms(2)[rule_format,of y] - unfolding inj_image_mem_iff[OF inj(2)] - by auto - } - fix x' k' - assume xk': "(x', k') \ p" - fix z - assume z: "z \ interior (g ` k)" "z \ interior (g ` k')" - have same: "(x, k) = (x', k')" - apply - - apply (rule ccontr) - apply (drule p(5)[OF xk xk']) - proof - - assume as: "interior k \ interior k' = {}" - have "z \ g ` (interior k \ interior k')" - using interior_image_subset[OF \inj g\ contg] z + fix x' K' u + assume xk': "(x', K') \ p" and u: "u \ interior (g ` k)" "u \ interior (g ` K')" + have "interior k \ interior K' \ {}" + proof + assume "interior k \ interior K' = {}" + moreover have "u \ g ` (interior k \ interior K')" + using interior_image_subset[OF \inj g\ contg] u unfolding image_Int[OF inj(1)] by blast - then show False - using as by blast + ultimately show False by blast qed + then have same: "(x, k) = (x', K')" + using ptag xk' xk by blast then show "g x = g x'" by auto - { - fix z - assume "z \ k" - then show "g z \ g ` k'" - using same by auto - } - { - fix z - assume "z \ k'" - then show "g z \ g ` k" - using same by auto - } + show "g u \ g ` K'"if "u \ k" for u + using that same by auto + show "g u \ g ` k"if "u \ K'" for u + using that same by auto next fix x assume "x \ cbox a b" @@ -3269,31 +3231,26 @@ using p(6) by auto then obtain X y where "h x \ X" "(y, X) \ p" by blast then show "x \ \{k. \x. (x, k) \ (\(x, k). (g x, g ` k)) ` p}" - apply (clarsimp simp: ) + apply clarsimp by (metis (no_types, lifting) assms(3) image_eqI pair_imageI) - qed - note ** = d(2)[OF this] - have *: "inj_on (\(x, k). (g x, g ` k)) p" - using inj(1) unfolding inj_on_def by fastforce - have "(\(x, k)\(\(x, k). (g x, g ` k)) ` p. content k *\<^sub>R f x) - i = r *\<^sub>R (\(x, k)\p. content k *\<^sub>R f (g x)) - i" (is "?l = _") - using assms(7) - apply (simp only: algebra_simps add_left_cancel scaleR_right.sum) - apply (subst sum.reindex_bij_betw[symmetric, where h="\(x, k). (g x, g ` k)" and S=p]) - apply (auto intro!: * sum.cong simp: bij_betw_def dest!: p(4)) - done + qed (use gab in auto) + have *: "inj_on (\(x, k). (g x, g ` k)) p" + using inj(1) unfolding inj_on_def by fastforce + have "(\(x, k)\(\(x, k). (g x, g ` k)) ` p. content k *\<^sub>R f x) - i = r *\<^sub>R (\(x, k)\p. content k *\<^sub>R f (g x)) - i" (is "?l = _") + using r + apply (simp only: algebra_simps add_left_cancel scaleR_right.sum) + apply (subst sum.reindex_bij_betw[symmetric, where h="\(x, k). (g x, g ` k)" and S=p]) + apply (auto intro!: * sum.cong simp: bij_betw_def dest!: p(4)) + done also have "\ = r *\<^sub>R ((\(x, k)\p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i)" (is "_ = ?r") - unfolding scaleR_diff_right scaleR_scaleR - using assms(1) - by auto - finally have *: "?l = ?r" . - show "norm ((\(x, k)\p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i) < e" - using ** - unfolding * - unfolding norm_scaleR - using assms(1) - by (auto simp add:field_simps) + using \0 < r\ by (auto simp: scaleR_diff_right) + finally have eq: "?l = ?r" . + show "norm ((\(x,K)\p. content K *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i) < e" + using d(2)[OF gimp] \0 < r\ by (auto simp add: eq) qed qed + then show ?thesis + by (auto simp: h_eq has_integral) qed @@ -4408,10 +4365,7 @@ then have "?g integrable_on cbox c d" using assms has_integral_integrable integrable_subinterval by blast then have "f integrable_on cbox c d" - apply - - apply (rule integrable_eq) - apply auto - done + by (rule integrable_eq) auto moreover then have "i = integral (cbox c d) f" by (meson \((\x. if x \ cbox c d then f x else 0) has_integral i) (cbox a b)\ assms has_integral_restrict_closed_subinterval has_integral_unique integrable_integral) ultimately show ?r by auto @@ -4591,9 +4545,9 @@ lemma integrable_on_superset: fixes f :: "'n::euclidean_space \ 'a::banach" - assumes "\x. x \ s \ f x = 0" - and "s \ t" - and "f integrable_on s" + assumes "f integrable_on S" + and "\x. x \ S \ f x = 0" + and "S \ t" shows "f integrable_on t" using assms unfolding integrable_on_def @@ -4601,7 +4555,7 @@ lemma integral_restrict_UNIV [intro]: fixes f :: "'n::euclidean_space \ 'a::banach" - shows "f integrable_on s \ integral UNIV (\x. if x \ s then f x else 0) = integral s f" + shows "f integrable_on S \ integral UNIV (\x. if x \ S then f x else 0) = integral S f" apply (rule integral_unique) unfolding has_integral_restrict_UNIV apply auto @@ -6881,7 +6835,7 @@ proof - have "((\(x, y). f x y) has_integral integral (cbox (c, a) (d, b)) (\(x, y). f y x)) (prod.swap ` (cbox (c, a) (d, b)))" apply (rule has_integral_twiddle [of 1 prod.swap prod.swap "\(x,y). f y x" "integral (cbox (c, a) (d, b)) (\(x, y). f y x)", simplified]) - apply (auto simp: isCont_swap content_Pair has_integral_integral [symmetric] integrable_continuous swap_continuous assms) + apply (force simp: isCont_swap content_Pair has_integral_integral [symmetric] integrable_continuous swap_continuous assms)+ done then show ?thesis by force @@ -6934,10 +6888,10 @@ fix k ::nat have "(\x. exp (-a*x)) integrable_on {c..of_real k}" (is ?P) unfolding f_def by (auto intro!: continuous_intros integrable_continuous_real) - hence int: "(f k) integrable_on {c..of_real k}" - by (rule integrable_eq[rotated]) (simp add: f_def) - show "f k integrable_on {c..}" - by (rule integrable_on_superset[OF _ _ int]) (auto simp: f_def) + hence "(f k) integrable_on {c..of_real k}" + by (rule integrable_eq) (simp add: f_def) + then show "f k integrable_on {c..}" + by (rule integrable_on_superset) (auto simp: f_def) next fix x assume x: "x \ {c..}" have "sequentially \ principal {nat \x\..}" unfolding at_top_def by (simp add: Inf_lower) @@ -7118,9 +7072,9 @@ from assms have "(\x. x powr e) integrable_on {a..n}" by (auto intro!: integrable_continuous_real continuous_intros) hence "f n integrable_on {a..n}" - by (rule integrable_eq [rotated]) (auto simp: f_def) + by (rule integrable_eq) (auto simp: f_def) thus "f n integrable_on {a..}" - by (rule integrable_on_superset [rotated 2]) (auto simp: f_def) + by (rule integrable_on_superset) (auto simp: f_def) next fix n :: nat and x :: real show "f n x \ f (Suc n) x" by (auto simp: f_def) diff -r 1f955cdd9e59 -r 507a42c0a0ff src/HOL/Analysis/Improper_Integral.thy --- a/src/HOL/Analysis/Improper_Integral.thy Mon Aug 28 22:32:22 2017 +0100 +++ b/src/HOL/Analysis/Improper_Integral.thy Tue Aug 29 17:41:11 2017 +0100 @@ -220,7 +220,10 @@ qed qed then show ?thesis - using assms by (auto simp: equiintegrable_on_def integrable_eq) + using assms + apply (auto simp: equiintegrable_on_def) + apply (rule integrable_eq) + by auto qed subsection\Subinterval restrictions for equiintegrable families\