diff --git a/src/analysis/special_functions/integrals.lean b/src/analysis/special_functions/integrals.lean index 72ef11e59b58d..0d161e9cdffc2 100644 --- a/src/analysis/special_functions/integrals.lean +++ b/src/analysis/special_functions/integrals.lean @@ -5,6 +5,7 @@ Authors: Benjamin Davidson -/ import measure_theory.integral.interval_integral import analysis.special_functions.trigonometric.arctan_deriv +import measure_theory.integral.integral_eq_improper /-! # Integration of specific interval integrals @@ -52,6 +53,32 @@ lemma interval_integrable_rpow {r : ℝ} (h : 0 ≤ r ∨ (0 : ℝ) ∉ [a, b]) interval_integrable (λ x, x ^ r) μ a b := (continuous_on_id.rpow_const $ λ x hx, h.symm.imp (ne_of_mem_of_not_mem hx) id).interval_integrable +/-- Alternative version with a weaker hypothesis on `r`, but assuming the measure is volume. -/ +lemma interval_integrable_rpow' {r : ℝ} (h : -1 < r) : + interval_integrable (λ x, x ^ r) volume a b := +begin + suffices : ∀ (c : ℝ), interval_integrable (λ x, x ^ r) volume 0 c, + { exact interval_integrable.trans (this a).symm (this b) }, + have : ∀ (c : ℝ), (0 ≤ c) → interval_integrable (λ x, x ^ r) volume 0 c, + { intros c hc, + rw [interval_integrable_iff, interval_oc_of_le hc], + have hderiv : ∀ x ∈ Ioo 0 c, has_deriv_at (λ x : ℝ, x ^ (r + 1) / (r + 1)) (x ^ r) x, + { intros x hx, convert (real.has_deriv_at_rpow_const (or.inl hx.1.ne')).div_const (r + 1), + field_simp [(by linarith : r + 1 ≠ 0)], ring, }, + apply integrable_on_deriv_of_nonneg hc _ hderiv, + { intros x hx, apply rpow_nonneg_of_nonneg hx.1.le, }, + { refine (continuous_on_id.rpow_const _).div_const, intros x hx, right, linarith } }, + intro c, rcases le_total 0 c with hc|hc, + { exact this c hc }, + { rw [interval_integrable.iff_comp_neg, neg_zero], + have m := (this (-c) (by linarith)).smul (cos (r * π)), + rw interval_integrable_iff at m ⊢, + refine m.congr_fun _ measurable_set_Ioc, intros x hx, + rw interval_oc_of_le (by linarith : 0 ≤ -c) at hx, + simp only [pi.smul_apply, algebra.id.smul_eq_mul, log_neg_eq_log, mul_comm, + rpow_def_of_pos hx.1, rpow_def_of_neg (by linarith [hx.1] : -x < 0)], } +end + @[simp] lemma interval_integrable_id : interval_integrable (λ x, x) μ a b := continuous_id.interval_integrable a b @@ -172,28 +199,43 @@ open interval_integral /-! ### Integrals of simple functions -/ -lemma integral_rpow {r : ℝ} (h : 0 ≤ r ∨ r ≠ -1 ∧ (0 : ℝ) ∉ [a, b]) : +lemma integral_rpow {r : ℝ} (h : -1 < r ∨ (r ≠ -1 ∧ (0 : ℝ) ∉ [a, b])) : ∫ x in a..b, x ^ r = (b ^ (r + 1) - a ^ (r + 1)) / (r + 1) := begin - suffices : ∀ x ∈ [a, b], has_deriv_at (λ x : ℝ, x ^ (r + 1) / (r + 1)) (x ^ r) x, - { rw sub_div, - exact integral_eq_sub_of_has_deriv_at this (interval_integrable_rpow (h.imp_right and.right)) }, - intros x hx, - have hx' : x ≠ 0 ∨ 1 ≤ r + 1, - from h.symm.imp (λ h, ne_of_mem_of_not_mem hx h.2) (le_add_iff_nonneg_left _).2, - convert (real.has_deriv_at_rpow_const hx').div_const (r + 1), - rw [add_sub_cancel, mul_div_cancel_left], - rw [ne.def, ← eq_neg_iff_add_eq_zero], - rintro rfl, - apply (@zero_lt_one ℝ _ _).not_le, - simpa using h + rw sub_div, + have hderiv : ∀ (x : ℝ), x ≠ 0 → has_deriv_at (λ x : ℝ, x ^ (r + 1) / (r + 1)) (x ^ r) x, + { intros x hx, + convert (real.has_deriv_at_rpow_const (or.inl hx)).div_const (r + 1), + rw [add_sub_cancel, mul_div_cancel_left], + contrapose! h, rw ←eq_neg_iff_add_eq_zero at h, rw h, tauto, }, + cases h, + { suffices : ∀ (c : ℝ), ∫ x in 0..c, x ^ r = c ^ (r + 1) / (r + 1), + { rw [←integral_add_adjacent_intervals + (interval_integrable_rpow' h) (interval_integrable_rpow' h), this b], + have t := this a, rw integral_symm at t, apply_fun (λ x, -x) at t, rw neg_neg at t, + rw t, ring }, + intro c, rcases le_total 0 c with hc|hc, + { convert integral_eq_sub_of_has_deriv_at_of_le hc _ (λ x hx, hderiv x hx.1.ne') _, + { rw zero_rpow, ring, linarith,}, + { apply continuous_at.continuous_on, intros x hx, + refine (continuous_at_id.rpow_const _).div_const, right, linarith,}, + apply interval_integrable_rpow' h }, + { rw integral_symm, symmetry, rw eq_neg_iff_eq_neg, + convert integral_eq_sub_of_has_deriv_at_of_le hc _ (λ x hx, hderiv x hx.2.ne) _, + { rw zero_rpow, ring, linarith }, + { apply continuous_at.continuous_on, intros x hx, + refine (continuous_at_id.rpow_const _).div_const, right, linarith }, + apply interval_integrable_rpow' h, } }, + { have hderiv' : ∀ (x : ℝ), x ∈ [a, b] → has_deriv_at (λ x : ℝ, x ^ (r + 1) / (r + 1)) (x ^ r) x, + { intros x hx, apply hderiv x, exact ne_of_mem_of_not_mem hx h.2 }, + exact integral_eq_sub_of_has_deriv_at hderiv' (interval_integrable_rpow (or.inr h.2)) }, end lemma integral_zpow {n : ℤ} (h : 0 ≤ n ∨ n ≠ -1 ∧ (0 : ℝ) ∉ [a, b]) : ∫ x in a..b, x ^ n = (b ^ (n + 1) - a ^ (n + 1)) / (n + 1) := begin - replace h : 0 ≤ (n : ℝ) ∨ (n : ℝ) ≠ -1 ∧ (0 : ℝ) ∉ [a, b], by exact_mod_cast h, - exact_mod_cast integral_rpow h + replace h : -1 < (n : ℝ) ∨ (n : ℝ) ≠ -1 ∧ (0 : ℝ) ∉ [a, b], by exact_mod_cast h, + exact_mod_cast integral_rpow h, end @[simp] lemma integral_pow : ∫ x in a..b, x ^ n = (b ^ (n + 1) - a ^ (n + 1)) / (n + 1) := diff --git a/src/measure_theory/integral/integral_eq_improper.lean b/src/measure_theory/integral/integral_eq_improper.lean index 4e86fb8d2125c..18f1050d4bf0a 100644 --- a/src/measure_theory/integral/integral_eq_improper.lean +++ b/src/measure_theory/integral/integral_eq_improper.lean @@ -576,6 +576,29 @@ lemma integrable_on_Ioi_of_interval_integral_norm_tendsto (I a : ℝ) let ⟨I', hI'⟩ := h.is_bounded_under_le in integrable_on_Ioi_of_interval_integral_norm_bounded I' a hfi hb hI' +lemma integrable_on_Ioc_of_interval_integral_norm_bounded {I a₀ b₀ : ℝ} + (hfi : ∀ i, integrable_on f $ Ioc (a i) (b i)) + (ha : tendsto a l $ 𝓝 a₀) (hb : tendsto b l $ 𝓝 b₀) + (h : ∀ᶠ i in l, (∫ x in Ioc (a i) (b i), ∥f x∥) ≤ I) : integrable_on f (Ioc a₀ b₀) := +begin + refine (ae_cover_Ioc_of_Ioc ha hb).integrable_of_integral_norm_bounded I + (λ i, (hfi i).restrict measurable_set_Ioc) (eventually.mono h _), + intros i hi, simp only [measure.restrict_restrict measurable_set_Ioc], + refine le_trans (set_integral_mono_set (hfi i).norm _ _) hi, + { apply ae_of_all, simp only [pi.zero_apply, norm_nonneg, forall_const] }, + { apply ae_of_all, intros c hc, exact hc.1 }, +end + +lemma integrable_on_Ioc_of_interval_integral_norm_bounded_left {I a₀ b : ℝ} + (hfi : ∀ i, integrable_on f $ Ioc (a i) b) (ha : tendsto a l $ 𝓝 a₀) + (h : ∀ᶠ i in l, (∫ x in Ioc (a i) b, ∥f x∥ ) ≤ I) : integrable_on f (Ioc a₀ b) := +integrable_on_Ioc_of_interval_integral_norm_bounded hfi ha tendsto_const_nhds h + +lemma integrable_on_Ioc_of_interval_integral_norm_bounded_right {I a b₀ : ℝ} + (hfi : ∀ i, integrable_on f $ Ioc a (b i)) (hb : tendsto b l $ 𝓝 b₀) + (h : ∀ᶠ i in l, (∫ x in Ioc a (b i), ∥f x∥ ) ≤ I) : integrable_on f (Ioc a b₀) := +integrable_on_Ioc_of_interval_integral_norm_bounded hfi tendsto_const_nhds hb h + end integrable_of_interval_integral section integral_of_interval_integral diff --git a/src/measure_theory/integral/interval_integral.lean b/src/measure_theory/integral/interval_integral.lean index 9bc8ce070c6a1..f2ddfdaaa13f7 100644 --- a/src/measure_theory/integral/interval_integral.lean +++ b/src/measure_theory/integral/interval_integral.lean @@ -10,6 +10,7 @@ import analysis.calculus.extend_deriv import measure_theory.function.locally_integrable import measure_theory.integral.set_integral import measure_theory.integral.vitali_caratheodory +import analysis.calculus.fderiv_measurable /-! # Integral over an interval @@ -166,7 +167,7 @@ noncomputable theory open topological_space (second_countable_topology) open measure_theory set classical filter function -open_locale classical topological_space filter ennreal big_operators interval +open_locale classical topological_space filter ennreal big_operators interval nnreal variables {ι 𝕜 E F : Type*} [normed_group E] @@ -187,7 +188,7 @@ variables {f : ℝ → E} {a b : ℝ} {μ : measure ℝ} /-- A function is interval integrable with respect to a given measure `μ` on `a..b` if and only if it is integrable on `interval_oc a b` with respect to `μ`. This is an equivalent - defintion of `interval_integrable`. -/ + definition of `interval_integrable`. -/ lemma interval_integrable_iff : interval_integrable f μ a b ↔ integrable_on f (Ι a b) μ := by rw [interval_oc_eq_union, integrable_on_union, interval_integrable] @@ -200,6 +201,53 @@ lemma interval_integrable_iff_integrable_Ioc_of_le (hab : a ≤ b) : interval_integrable f μ a b ↔ integrable_on f (Ioc a b) μ := by rw [interval_integrable_iff, interval_oc_of_le hab] +lemma integrable_on_Icc_iff_integrable_on_Ioc' + {E : Type*} [normed_group E] {f : ℝ → E} (ha : μ {a} ≠ ∞) : + integrable_on f (Icc a b) μ ↔ integrable_on f (Ioc a b) μ := +begin + cases le_or_lt a b with hab hab, + { have : Icc a b = Icc a a ∪ Ioc a b := (Icc_union_Ioc_eq_Icc le_rfl hab).symm, + rw [this, integrable_on_union], + simp [ha.lt_top] }, + { simp [hab, hab.le] }, +end + +lemma integrable_on_Icc_iff_integrable_on_Ioc + {E : Type*}[normed_group E] [has_no_atoms μ] {f : ℝ → E} {a b : ℝ} : + integrable_on f (Icc a b) μ ↔ integrable_on f (Ioc a b) μ := +integrable_on_Icc_iff_integrable_on_Ioc' (by simp) + +lemma integrable_on_Ioc_iff_integrable_on_Ioo' + {E : Type*} [normed_group E] + {f : ℝ → E} {a b : ℝ} (hb : μ {b} ≠ ∞) : + integrable_on f (Ioc a b) μ ↔ integrable_on f (Ioo a b) μ := +begin + cases lt_or_le a b with hab hab, + { have : Ioc a b = Ioo a b ∪ Icc b b := (Ioo_union_Icc_eq_Ioc hab le_rfl).symm, + rw [this, integrable_on_union], + simp [hb.lt_top] }, + { simp [hab] }, +end + +lemma integrable_on_Ioc_iff_integrable_on_Ioo + {E : Type*} [normed_group E] [has_no_atoms μ] {f : ℝ → E} {a b : ℝ} : + integrable_on f (Ioc a b) μ ↔ integrable_on f (Ioo a b) μ := +integrable_on_Ioc_iff_integrable_on_Ioo' (by simp) + +lemma integrable_on_Icc_iff_integrable_on_Ioo + {E : Type*} [normed_group E] [has_no_atoms μ] {f : ℝ → E} {a b : ℝ} : + integrable_on f (Icc a b) μ ↔ integrable_on f (Ioo a b) μ := +by rw [integrable_on_Icc_iff_integrable_on_Ioc, integrable_on_Ioc_iff_integrable_on_Ioo] + +lemma interval_integrable_iff' [has_no_atoms μ] : + interval_integrable f μ a b ↔ integrable_on f (interval a b) μ := +by rw [interval_integrable_iff, interval, interval_oc, integrable_on_Icc_iff_integrable_on_Ioc] + +lemma interval_integrable_iff_integrable_Icc_of_le {E : Type*} [normed_group E] + {f : ℝ → E} {a b : ℝ} (hab : a ≤ b) {μ : measure ℝ} [has_no_atoms μ] : + interval_integrable f μ a b ↔ integrable_on f (Icc a b) μ := +by rw [interval_integrable_iff_integrable_Ioc_of_le hab, integrable_on_Icc_iff_integrable_on_Ioc] + /-- If a function is integrable with respect to a given measure `μ` then it is interval integrable with respect to `μ` on `interval a b`. -/ lemma measure_theory.integrable.interval_integrable (hf : integrable f μ) : @@ -333,6 +381,27 @@ lemma continuous_on_mul {f g : ℝ → ℝ} (hf : interval_integrable f μ a b) interval_integrable (λ x, g x * f x) μ a b := by simpa [mul_comm] using hf.mul_continuous_on hg +lemma comp_mul_left (hf : interval_integrable f volume a b) (c : ℝ) : + interval_integrable (λ x, f (c * x)) volume (a / c) (b / c) := +begin + rcases eq_or_ne c 0 with hc|hc, { rw hc, simp }, + rw interval_integrable_iff' at hf ⊢, + have A : measurable_embedding (λ x, x * c⁻¹) := + (homeomorph.mul_right₀ _ (inv_ne_zero hc)).closed_embedding.measurable_embedding, + rw [←real.smul_map_volume_mul_right (inv_ne_zero hc), integrable_on, measure.restrict_smul, + integrable_smul_measure (by simpa : ennreal.of_real (|c⁻¹|) ≠ 0) ennreal.of_real_ne_top, + ←integrable_on, measurable_embedding.integrable_on_map_iff A], + convert hf using 1, + { ext, simp only [comp_app], congr' 1, field_simp, ring }, + { rw preimage_mul_const_interval (inv_ne_zero hc), field_simp [hc] }, +end + +lemma iff_comp_neg : + interval_integrable f volume a b ↔ interval_integrable (λ x, f (-x)) volume (-a) (-b) := +begin + split, all_goals { intro hf, convert comp_mul_left hf (-1), simp, field_simp, field_simp }, +end + end interval_integrable section @@ -733,28 +802,6 @@ section order_closed_topology variables {a b c d : ℝ} {f g : ℝ → E} {μ : measure ℝ} -lemma integrable_on_Icc_iff_integrable_on_Ioc' - {E : Type*} [normed_group E] - {f : ℝ → E} {a b : ℝ} (ha : μ {a} ≠ ∞) : - integrable_on f (Icc a b) μ ↔ integrable_on f (Ioc a b) μ := -begin - cases le_or_lt a b with hab hab, - { have : Icc a b = Icc a a ∪ Ioc a b := (Icc_union_Ioc_eq_Icc le_rfl hab).symm, - rw [this, integrable_on_union], - simp [ha.lt_top] }, - { simp [hab, hab.le] }, -end - -lemma integrable_on_Icc_iff_integrable_on_Ioc - {E : Type*}[normed_group E] [has_no_atoms μ] {f : ℝ → E} {a b : ℝ} : - integrable_on f (Icc a b) μ ↔ integrable_on f (Ioc a b) μ := -integrable_on_Icc_iff_integrable_on_Ioc' (by simp) - -lemma interval_integrable_iff_integrable_Icc_of_le {E : Type*} [normed_group E] - {f : ℝ → E} {a b : ℝ} (hab : a ≤ b) {μ : measure ℝ} [has_no_atoms μ] : - interval_integrable f μ a b ↔ integrable_on f (Icc a b) μ := -by rw [interval_integrable_iff_integrable_Ioc_of_le hab, integrable_on_Icc_iff_integrable_on_Ioc] - /-- If two functions are equal in the relevant interval, their interval integrals are also equal. -/ lemma integral_congr {a b : ℝ} (h : eq_on f g [a, b]) : ∫ x in a..b, f x ∂μ = ∫ x in a..b, g x ∂μ := @@ -2043,20 +2090,23 @@ semicontinuity. As `g' t < G' t`, this gives the conclusion. One can therefore this inequality to the right until the point `b`, where it gives the desired conclusion. -/ -variables {g' g : ℝ → ℝ} +variables {g' g φ : ℝ → ℝ} /-- Hard part of FTC-2 for integrable derivatives, real-valued functions: one has -`g b - g a ≤ ∫ y in a..b, g' y`. -Auxiliary lemma in the proof of `integral_eq_sub_of_has_deriv_right_of_le`. -/ -lemma sub_le_integral_of_has_deriv_right_of_le (hab : a ≤ b) (hcont : continuous_on g (Icc a b)) +`g b - g a ≤ ∫ y in a..b, g' y` when `g'` is integrable. +Auxiliary lemma in the proof of `integral_eq_sub_of_has_deriv_right_of_le`. +We give the slightly more general version that `g b - g a ≤ ∫ y in a..b, φ y` when `g' ≤ φ` and +`φ` is integrable (even if `g'` is not known to be integrable). +Version assuming that `g` is differentiable on `[a, b)`. -/ +lemma sub_le_integral_of_has_deriv_right_of_le_Ico (hab : a ≤ b) (hcont : continuous_on g (Icc a b)) (hderiv : ∀ x ∈ Ico a b, has_deriv_within_at g (g' x) (Ioi x) x) - (g'int : integrable_on g' (Icc a b)) : - g b - g a ≤ ∫ y in a..b, g' y := + (φint : integrable_on φ (Icc a b)) (hφg : ∀ x ∈ Ico a b, g' x ≤ φ x) : + g b - g a ≤ ∫ y in a..b, φ y := begin refine le_of_forall_pos_le_add (λ ε εpos, _), -- Bound from above `g'` by a lower-semicontinuous function `G'`. - rcases exists_lt_lower_semicontinuous_integral_lt g' g'int εpos with - ⟨G', g'_lt_G', G'cont, G'int, G'lt_top, hG'⟩, + rcases exists_lt_lower_semicontinuous_integral_lt φ φint εpos with + ⟨G', f_lt_G', G'cont, G'int, G'lt_top, hG'⟩, -- we will show by "induction" that `g t - g a ≤ ∫ u in a..t, G' u` for all `t ∈ [a, b]`. set s := {t | g t - g a ≤ ∫ u in a..t, (G' u).to_real} ∩ Icc a b, -- the set `s` of points where this property holds is closed. @@ -2073,7 +2123,7 @@ begin apply s_closed.Icc_subset_of_forall_exists_gt (by simp only [integral_same, mem_set_of_eq, sub_self]) (λ t ht v t_lt_v, _), obtain ⟨y, g'_lt_y', y_lt_G'⟩ : ∃ (y : ℝ), (g' t : ereal) < y ∧ (y : ereal) < G' t := - ereal.lt_iff_exists_real_btwn.1 (g'_lt_G' t), + ereal.lt_iff_exists_real_btwn.1 ((ereal.coe_le_coe_iff.2 (hφg t ht.2)).trans_lt (f_lt_G' t)), -- bound from below the increase of `∫ x in a..u, G' x` on the right of `t`, using the lower -- semicontinuity of `G'`. have I1 : ∀ᶠ u in 𝓝[>] t, (u - t) * y ≤ ∫ w in t..u, (G' w).to_real, @@ -2103,7 +2153,7 @@ begin have : x ∈ Ioo m M, by simp only [hm.trans_le hx.left, (hx.right.trans_lt hu.right).trans_le (min_le_left M b), mem_Ioo, and_self], convert le_of_lt (H this), - exact ereal.coe_to_real G'x.ne (ne_bot_of_gt (g'_lt_G' x)) } + exact ereal.coe_to_real G'x.ne (ne_bot_of_gt (f_lt_G' x)) } end }, -- bound from above the increase of `g u - g a` on the right of `t`, using the derivative at `t` have I2 : ∀ᶠ u in 𝓝[>] t, g u - g t ≤ (u - t) * y, @@ -2138,7 +2188,7 @@ begin end }, -- now that we know that `s` contains `[a, b]`, we get the desired result by applying this to `b`. calc g b - g a ≤ ∫ y in a..b, (G' y).to_real : main (right_mem_Icc.2 hab) - ... ≤ (∫ y in a..b, g' y) + ε : + ... ≤ (∫ y in a..b, φ y) + ε : begin convert hG'.le; { rw interval_integral.integral_of_le hab, @@ -2146,59 +2196,65 @@ begin end end -/-- Auxiliary lemma in the proof of `integral_eq_sub_of_has_deriv_right_of_le`. -/ -lemma integral_le_sub_of_has_deriv_right_of_le (hab : a ≤ b) - (hcont : continuous_on g (Icc a b)) - (hderiv : ∀ x ∈ Ico a b, has_deriv_within_at g (g' x) (Ioi x) x) - (g'int : integrable_on g' (Icc a b)) : - ∫ y in a..b, g' y ≤ g b - g a := -begin - rw ← neg_le_neg_iff, - convert sub_le_integral_of_has_deriv_right_of_le hab hcont.neg (λ x hx, (hderiv x hx).neg) - g'int.neg, - { abel }, - { simp only [integral_neg] } -end - -/-- Auxiliary lemma in the proof of `integral_eq_sub_of_has_deriv_right_of_le`: real version -/ -lemma integral_eq_sub_of_has_deriv_right_of_le_real (hab : a ≤ b) - (hcont : continuous_on g (Icc a b)) - (hderiv : ∀ x ∈ Ico a b, has_deriv_within_at g (g' x) (Ioi x) x) - (g'int : integrable_on g' (Icc a b)) : - ∫ y in a..b, g' y = g b - g a := -le_antisymm - (integral_le_sub_of_has_deriv_right_of_le hab hcont hderiv g'int) - (sub_le_integral_of_has_deriv_right_of_le hab hcont hderiv g'int) - -/-- Auxiliary lemma in the proof of `integral_eq_sub_of_has_deriv_right_of_le`: real version, not -requiring differentiability as the left endpoint of the interval. Follows from -`integral_eq_sub_of_has_deriv_right_of_le_real` together with a continuity argument. -/ -lemma integral_eq_sub_of_has_deriv_right_of_le_real' (hab : a ≤ b) +/-- Hard part of FTC-2 for integrable derivatives, real-valued functions: one has +`g b - g a ≤ ∫ y in a..b, g' y` when `g'` is integrable. +Auxiliary lemma in the proof of `integral_eq_sub_of_has_deriv_right_of_le`. +We give the slightly more general version that `g b - g a ≤ ∫ y in a..b, φ y` when `g' ≤ φ` and +`φ` is integrable (even if `g'` is not known to be integrable). +Version assuming that `g` is differentiable on `(a, b)`. -/ +lemma sub_le_integral_of_has_deriv_right_of_le (hab : a ≤ b) (hcont : continuous_on g (Icc a b)) (hderiv : ∀ x ∈ Ioo a b, has_deriv_within_at g (g' x) (Ioi x) x) - (g'int : integrable_on g' (Icc a b)) : - ∫ y in a..b, g' y = g b - g a := + (φint : integrable_on φ (Icc a b)) (hφg : ∀ x ∈ Ioo a b, g' x ≤ φ x) : + g b - g a ≤ ∫ y in a..b, φ y := begin + -- This follows from the version on a closed-open interval (applied to `[t, b)` for `t` close to + -- `a`) and a continuity argument. obtain rfl|a_lt_b := hab.eq_or_lt, { simp }, - set s := {t | ∫ u in t..b, g' u = g b - g t} ∩ Icc a b, + set s := {t | g b - g t ≤ ∫ u in t..b, φ u} ∩ Icc a b, have s_closed : is_closed s, - { have : continuous_on (λ t, (∫ u in t..b, g' u, g b - g t)) (Icc a b), - { rw ← interval_of_le hab at ⊢ hcont g'int, - exact (continuous_on_primitive_interval_left g'int).prod (continuous_on_const.sub hcont) }, + { have : continuous_on (λ t, (g b - g t, ∫ u in t..b, φ u)) (Icc a b), + { rw ← interval_of_le hab at ⊢ hcont φint, + exact (continuous_on_const.sub hcont).prod (continuous_on_primitive_interval_left φint) }, simp only [s, inter_comm], - exact this.preimage_closed_of_closed is_closed_Icc is_closed_diagonal, }, + exact this.preimage_closed_of_closed is_closed_Icc is_closed_le_prod, }, have A : closure (Ioc a b) ⊆ s, { apply s_closed.closure_subset_iff.2, assume t ht, refine ⟨_, ⟨ht.1.le, ht.2⟩⟩, - exact integral_eq_sub_of_has_deriv_right_of_le_real ht.2 + exact sub_le_integral_of_has_deriv_right_of_le_Ico ht.2 (hcont.mono (Icc_subset_Icc ht.1.le le_rfl)) (λ x hx, hderiv x ⟨ht.1.trans_le hx.1, hx.2⟩) - (g'int.mono_set (Icc_subset_Icc ht.1.le le_rfl)) }, + (φint.mono_set (Icc_subset_Icc ht.1.le le_rfl)) + (λ x hx, hφg x ⟨ht.1.trans_le hx.1, hx.2⟩) }, rw closure_Ioc a_lt_b.ne at A, exact (A (left_mem_Icc.2 hab)).1, end +/-- Auxiliary lemma in the proof of `integral_eq_sub_of_has_deriv_right_of_le`. -/ +lemma integral_le_sub_of_has_deriv_right_of_le (hab : a ≤ b) + (hcont : continuous_on g (Icc a b)) + (hderiv : ∀ x ∈ Ioo a b, has_deriv_within_at g (g' x) (Ioi x) x) + (φint : integrable_on φ (Icc a b)) (hφg : ∀ x ∈ Ioo a b, φ x ≤ g' x) : + ∫ y in a..b, φ y ≤ g b - g a := +begin + rw ← neg_le_neg_iff, + convert sub_le_integral_of_has_deriv_right_of_le hab hcont.neg (λ x hx, (hderiv x hx).neg) + φint.neg (λ x hx, neg_le_neg (hφg x hx)), + { abel }, + { simp only [← integral_neg], refl }, +end + +/-- Auxiliary lemma in the proof of `integral_eq_sub_of_has_deriv_right_of_le`: real version -/ +lemma integral_eq_sub_of_has_deriv_right_of_le_real (hab : a ≤ b) + (hcont : continuous_on g (Icc a b)) + (hderiv : ∀ x ∈ Ioo a b, has_deriv_within_at g (g' x) (Ioi x) x) + (g'int : integrable_on g' (Icc a b)) : + ∫ y in a..b, g' y = g b - g a := +le_antisymm + (integral_le_sub_of_has_deriv_right_of_le hab hcont hderiv g'int (λ x hx, le_rfl)) + (sub_le_integral_of_has_deriv_right_of_le hab hcont hderiv g'int (λ x hx, le_rfl)) + variable {f' : ℝ → E} /-- **Fundamental theorem of calculus-2**: If `f : ℝ → E` is continuous on `[a, b]` (where `a ≤ b`) @@ -2211,7 +2267,7 @@ theorem integral_eq_sub_of_has_deriv_right_of_le (hab : a ≤ b) (hcont : contin begin refine (normed_space.eq_iff_forall_dual_eq ℝ).2 (λ g, _), rw [← g.interval_integral_comp_comm f'int, g.map_sub], - exact integral_eq_sub_of_has_deriv_right_of_le_real' hab (g.continuous.comp_continuous_on hcont) + exact integral_eq_sub_of_has_deriv_right_of_le_real hab (g.continuous.comp_continuous_on hcont) (λ x hx, g.has_fderiv_at.comp_has_deriv_within_at x (hderiv x hx)) (g.integrable_comp ((interval_integrable_iff_integrable_Icc_of_le hab).1 f'int)) end @@ -2288,6 +2344,68 @@ begin exact hcont.interval_integrable end +/-! +### Automatic integrability for nonnegative derivatives +-/ + +/-- When the right derivative of a function is nonnegative, then it is automatically integrable. -/ +lemma integrable_on_deriv_right_of_nonneg (hab : a ≤ b) (hcont : continuous_on g (Icc a b)) + (hderiv : ∀ x ∈ Ioo a b, has_deriv_within_at g (g' x) (Ioi x) x) + (g'pos : ∀ x ∈ Ioo a b, 0 ≤ g' x) : + integrable_on g' (Ioc a b) := +begin + rw integrable_on_Ioc_iff_integrable_on_Ioo, + have meas_g' : ae_measurable g' (volume.restrict (Ioo a b)), + { apply (ae_measurable_deriv_within_Ioi g _).congr, + refine (ae_restrict_mem measurable_set_Ioo).mono (λ x hx, _), + exact (hderiv x hx).deriv_within (unique_diff_within_at_Ioi _) }, + suffices H : ∫⁻ x in Ioo a b, ∥g' x∥₊ ≤ ennreal.of_real (g b - g a), + from ⟨meas_g'.ae_strongly_measurable, H.trans_lt ennreal.of_real_lt_top⟩, + by_contra' H, + obtain ⟨f, fle, fint, hf⟩ : + ∃ (f : simple_func ℝ ℝ≥0), (∀ x, f x ≤ ∥g' x∥₊) ∧ ∫⁻ (x : ℝ) in Ioo a b, f x < ∞ + ∧ ennreal.of_real (g b - g a) < ∫⁻ (x : ℝ) in Ioo a b, f x := + exists_lt_lintegral_simple_func_of_lt_lintegral H, + let F : ℝ → ℝ := coe ∘ f, + have intF : integrable_on F (Ioo a b), + { refine ⟨f.measurable.coe_nnreal_real.ae_strongly_measurable, _⟩, + simpa only [has_finite_integral, nnreal.nnnorm_eq] using fint }, + have A : ∫⁻ (x : ℝ) in Ioo a b, f x = ennreal.of_real (∫ x in Ioo a b, F x) := + lintegral_coe_eq_integral _ intF, + rw A at hf, + have B : ∫ (x : ℝ) in Ioo a b, F x ≤ g b - g a, + { rw [← integral_Ioc_eq_integral_Ioo, ← interval_integral.integral_of_le hab], + apply integral_le_sub_of_has_deriv_right_of_le hab hcont hderiv _ (λ x hx, _), + { rwa integrable_on_Icc_iff_integrable_on_Ioo }, + { convert nnreal.coe_le_coe.2 (fle x), + simp only [real.norm_of_nonneg (g'pos x hx), coe_nnnorm] } }, + exact lt_irrefl _ (hf.trans_le (ennreal.of_real_le_of_real B)), +end + +/-- When the derivative of a function is nonnegative, then it is automatically integrable, +Ioc version. -/ +lemma integrable_on_deriv_of_nonneg (hab : a ≤ b) (hcont : continuous_on g (Icc a b)) + (hderiv : ∀ x ∈ Ioo a b, has_deriv_at g (g' x) x) + (g'pos : ∀ x ∈ Ioo a b, 0 ≤ g' x) : + integrable_on g' (Ioc a b) := +integrable_on_deriv_right_of_nonneg hab hcont (λ x hx, (hderiv x hx).has_deriv_within_at) g'pos + +/-- When the derivative of a function is nonnegative, then it is automatically integrable, +interval version. -/ +theorem interval_integrable_deriv_of_nonneg (hcont : continuous_on g (interval a b)) + (hderiv : ∀ x ∈ Ioo (min a b) (max a b), has_deriv_at g (g' x) x) + (hpos : ∀ x ∈ Ioo (min a b) (max a b), 0 ≤ g' x) : + interval_integrable g' volume a b := +begin + cases le_total a b with hab hab, + { simp only [interval_of_le, min_eq_left, max_eq_right, hab, interval_integrable, + hab, Ioc_eq_empty_of_le, integrable_on_empty, and_true] at hcont hderiv hpos ⊢, + exact integrable_on_deriv_of_nonneg hab hcont hderiv hpos, }, + { simp only [interval_of_ge, min_eq_right, max_eq_left, hab, interval_integrable, + Ioc_eq_empty_of_le, integrable_on_empty, true_and] at hcont hderiv hpos ⊢, + exact integrable_on_deriv_of_nonneg hab hcont hderiv hpos } +end + /-! ### Integration by parts -/