|
| 1 | +/- |
| 2 | +Copyright (c) 2025 Yizheng Zhu. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Yizheng Zhu |
| 5 | +-/ |
| 6 | +import Mathlib.Analysis.Calculus.Deriv.Slope |
| 7 | +import Mathlib.MeasureTheory.Covering.OneDim |
| 8 | +import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic |
| 9 | + |
| 10 | +/-! |
| 11 | +# Lebesgue Differentiation Theorem (Interval Version) |
| 12 | +
|
| 13 | +This file proves the interval version of the Lebesgue Differentiation Theorem. There are two |
| 14 | +versions in this file. |
| 15 | +
|
| 16 | +* `LocallyIntegrable.ae_hasDerivAt_integral` is the global version. It states that if `f : ℝ → ℝ` |
| 17 | +is locally integrable, then for almost every `x`, for any `c : ℝ`, the derivative of |
| 18 | +`∫ (t : ℝ) in c..x, f t` at `x` is equal to `f x`. |
| 19 | +
|
| 20 | +* `IntervalIntegrable.ae_hasDerivAt_integral` is the local version. It states that if `f : ℝ → ℝ` |
| 21 | +is interval integrable on `a..b`, then for almost every `x ∈ uIcc a b`, for any `c ∈ uIcc a b`, the |
| 22 | +derivative of `∫ (t : ℝ) in c..x, f t` at `x` is equal to `f x`. |
| 23 | +-/ |
| 24 | + |
| 25 | +open MeasureTheory Set Filter Function IsUnifLocDoublingMeasure |
| 26 | + |
| 27 | +open scoped Topology |
| 28 | + |
| 29 | +/-- The (global) interval version of the *Lebesgue Differentiation Theorem*: if `f : ℝ → ℝ` is |
| 30 | +locally integrable, then for almost every `x`, for any `c : ℝ`, the derivative of |
| 31 | +`∫ (t : ℝ) in c..x, f t` at `x` is equal to `f x`. -/ |
| 32 | +theorem LocallyIntegrable.ae_hasDerivAt_integral {f : ℝ → ℝ} (hf : LocallyIntegrable f volume) : |
| 33 | + ∀ᵐ x, ∀ c, HasDerivAt (fun x => ∫ (t : ℝ) in c..x, f t) (f x) x := by |
| 34 | + have hg (x y : ℝ) : IntervalIntegrable f volume x y := |
| 35 | + intervalIntegrable_iff.mpr <| |
| 36 | + (hf.integrableOn_isCompact isCompact_uIcc).mono_set uIoc_subset_uIcc |
| 37 | + have LDT := (vitaliFamily volume 1).ae_tendsto_average hf |
| 38 | + have {a b : ℝ} : ∫ (t : ℝ) in Ioc a b, f t = ∫ (t : ℝ) in Icc a b, f t := |
| 39 | + integral_Icc_eq_integral_Ioc (x := a) (y := b) (X := ℝ) |>.symm |
| 40 | + filter_upwards [LDT] with x hx |
| 41 | + intro c |
| 42 | + rw [hasDerivAt_iff_tendsto_slope_left_right] |
| 43 | + constructor |
| 44 | + · refine Filter.tendsto_congr' ?_ |>.mpr (hx.comp x.tendsto_Icc_vitaliFamily_left) |
| 45 | + filter_upwards [self_mem_nhdsWithin] with y hy |
| 46 | + replace hy : y ≤ x := by grind |
| 47 | + simp [slope, average, intervalIntegral.integral_interval_sub_left, hg, |
| 48 | + intervalIntegral.integral_of_ge, hy, this] |
| 49 | + grind |
| 50 | + · refine Filter.tendsto_congr' ?_ |>.mpr (hx.comp x.tendsto_Icc_vitaliFamily_right) |
| 51 | + filter_upwards [self_mem_nhdsWithin] with y hy |
| 52 | + replace hy : x ≤ y := by grind |
| 53 | + simp [slope, average, intervalIntegral.integral_interval_sub_left, hg, |
| 54 | + intervalIntegral.integral_of_le, hy, this] |
| 55 | + |
| 56 | +/-- The (local) interval version of the *Lebesgue Differentiation Theorem*: if `f : ℝ → ℝ` is |
| 57 | +interval integrable on `a..b`, then for almost every `x ∈ uIcc a b`, for any `c ∈ uIcc a b`, the |
| 58 | +derivative of `∫ (t : ℝ) in c..x, f t` at `x` is equal to `f x`. -/ |
| 59 | +theorem IntervalIntegrable.ae_hasDerivAt_integral {f : ℝ → ℝ} {a b : ℝ} |
| 60 | + (hf : IntervalIntegrable f volume a b) : |
| 61 | + ∀ᵐ x, x ∈ uIcc a b → ∀ c ∈ uIcc a b, HasDerivAt (fun x => ∫ (t : ℝ) in c..x, f t) (f x) x := by |
| 62 | + wlog hab : a ≤ b |
| 63 | + · exact uIcc_comm b a ▸ @this f b a hf.symm (by linarith) |
| 64 | + rw [uIcc_of_le hab] |
| 65 | + have h₁ : ∀ᵐ x, x ≠ a := by simp [ae_iff, measure_singleton] |
| 66 | + have h₂ : ∀ᵐ x, x ≠ b := by simp [ae_iff, measure_singleton] |
| 67 | + let g (x : ℝ) := if x ∈ Ioc a b then f x else 0 |
| 68 | + have hg : LocallyIntegrable g volume := |
| 69 | + integrableOn_congr_fun (by grind [EqOn]) (by simp) |>.mpr hf.left |
| 70 | + |>.integrable_of_forall_notMem_eq_zero (by grind) |>.locallyIntegrable |
| 71 | + filter_upwards [LocallyIntegrable.ae_hasDerivAt_integral hg, h₁, h₂] with x hx _ _ _ |
| 72 | + intro c hc |
| 73 | + refine HasDerivWithinAt.hasDerivAt (s := Ioo a b) ?_ <| Ioo_mem_nhds (by grind) (by grind) |
| 74 | + rw [show f x = g x by grind] |
| 75 | + refine (hx c).hasDerivWithinAt.congr (fun y hy ↦ ?_) ?_ |
| 76 | + all_goals apply intervalIntegral.integral_congr_ae' <;> filter_upwards <;> grind |
0 commit comments