Skip to content

Commit f83741b

Browse files
committed
feat(MeasureTheory): add Lebesgue differentiation theorem for intervals (leanprover-community#29503)
Add the Lebesgue differentiation theorem for intervals. Part of originally planned leanprover-community#29092.
1 parent fc733ac commit f83741b

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4608,6 +4608,7 @@ import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic
46084608
import Mathlib.MeasureTheory.Integral.IntervalIntegral.ContDiff
46094609
import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus
46104610
import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts
4611+
import Mathlib.MeasureTheory.Integral.IntervalIntegral.LebesgueDifferentiationThm
46114612
import Mathlib.MeasureTheory.Integral.IntervalIntegral.Periodic
46124613
import Mathlib.MeasureTheory.Integral.Layercake
46134614
import Mathlib.MeasureTheory.Integral.Lebesgue

Mathlib/Analysis/Calculus/Deriv/Slope.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ theorem hasDerivWithinAt_iff_tendsto_slope' (hs : x ∉ s) :
6969
theorem hasDerivAt_iff_tendsto_slope : HasDerivAt f f' x ↔ Tendsto (slope f x) (𝓝[≠] x) (𝓝 f') :=
7070
hasDerivAtFilter_iff_tendsto_slope
7171

72+
theorem hasDerivAt_iff_tendsto_slope_left_right [LinearOrder 𝕜] : HasDerivAt f f' x ↔
73+
Tendsto (slope f x) (𝓝[<] x) (𝓝 f') ∧ Tendsto (slope f x) (𝓝[>] x) (𝓝 f') := by
74+
simp [hasDerivAt_iff_tendsto_slope, ← Iio_union_Ioi, nhdsWithin_union]
75+
7276
theorem hasDerivAt_iff_tendsto_slope_zero :
7377
HasDerivAt f f' x ↔ Tendsto (fun t ↦ t⁻¹ • (f (x + t) - f x)) (𝓝[≠] 0) (𝓝 f') := by
7478
have : 𝓝[≠] x = Filter.map (fun t ↦ x + t) (𝓝[≠] 0) := by
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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

Comments
 (0)