Skip to content

Commit 44d1fd9

Browse files
YaelDillieskim-em
andcommitted
feat: Lebesgue average (#5810)
Match leanprover-community/mathlib3#19199 Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 4a7628d commit 44d1fd9

File tree

9 files changed

+441
-64
lines changed

9 files changed

+441
-64
lines changed

Mathlib/Analysis/Convex/Integral.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ theorem ae_eq_const_or_exists_average_ne_compl [IsFiniteMeasure μ] (hfi : Integ
248248
rw [restrict_congr_set h₀', restrict_univ, measure_congr h₀', measure_smul_average]
249249
have := average_mem_openSegment_compl_self ht.nullMeasurableSet h₀ h₀' hfi
250250
rw [← H t ht h₀ h₀', openSegment_same, mem_singleton_iff] at this
251-
rw [this, measure_smul_set_average _ (measure_ne_top μ _)]
251+
rw [this, measure_smul_setAverage _ (measure_ne_top μ _)]
252252
#align ae_eq_const_or_exists_average_ne_compl ae_eq_const_or_exists_average_ne_compl
253253

254254
/-- If an integrable function `f : α → E` takes values in a convex set `s` and for some set `t` of

Mathlib/Data/Real/ENNReal.lean

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Johannes Hölzl, Yury Kudryashov
55
66
! This file was ported from Lean 3 source module data.real.ennreal
7-
! leanprover-community/mathlib commit ccdbfb6e5614667af5aa3ab2d50885e0ef44a46f
7+
! leanprover-community/mathlib commit c14c8fcde993801fca8946b0d80131a1a81d1520
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
@@ -132,6 +132,10 @@ noncomputable instance : LinearOrderedCommMonoidWithZero ℝ≥0∞ :=
132132
mul_le_mul_left := fun _ _ => mul_le_mul_left'
133133
zero_le_one := zero_le 1 }
134134

135+
noncomputable instance : Unique (AddUnits ℝ≥0∞) where
136+
default := 0
137+
uniq a := AddUnits.ext <| le_zero_iff.1 <| by rw [← a.add_neg]; exact le_self_add
138+
135139
instance : Inhabited ℝ≥0∞ := ⟨0
136140

137141
/-- Coercion from `ℝ≥0` to `ℝ≥0∞`. -/
@@ -1413,6 +1417,15 @@ protected theorem mul_div_cancel' (h0 : a ≠ 0) (hI : a ≠ ∞) : a * (b / a)
14131417
rw [mul_comm, ENNReal.div_mul_cancel h0 hI]
14141418
#align ennreal.mul_div_cancel' ENNReal.mul_div_cancel'
14151419

1420+
-- porting note: `simp only [div_eq_mul_inv, mul_comm, mul_assoc]` doesn't work in the following two
1421+
protected theorem mul_comm_div : a / b * c = a * (c / b) := by
1422+
simp only [div_eq_mul_inv, mul_right_comm, ←mul_assoc]
1423+
#align ennreal.mul_comm_div ENNReal.mul_comm_div
1424+
1425+
protected theorem mul_div_right_comm : a * b / c = a / c * b := by
1426+
simp only [div_eq_mul_inv, mul_right_comm]
1427+
#align ennreal.mul_div_right_comm ENNReal.mul_div_right_comm
1428+
14161429
instance : InvolutiveInv ℝ≥0where
14171430
inv_inv a := by
14181431
by_cases a = 0 <;> cases a <;> simp_all [none_eq_top, some_eq_coe, -coe_inv, (coe_inv _).symm]
@@ -1440,6 +1453,10 @@ protected theorem inv_eq_zero : a⁻¹ = 0 ↔ a = ∞ :=
14401453
protected theorem inv_ne_zero : a⁻¹ ≠ 0 ↔ a ≠ ∞ := by simp
14411454
#align ennreal.inv_ne_zero ENNReal.inv_ne_zero
14421455

1456+
protected theorem div_pos (ha : a ≠ 0) (hb : b ≠ ∞) : 0 < a / b :=
1457+
ENNReal.mul_pos ha <| ENNReal.inv_ne_zero.2 hb
1458+
#align ennreal.div_pos ENNReal.div_pos
1459+
14431460
protected theorem mul_inv {a b : ℝ≥0∞} (ha : a ≠ 0 ∨ b ≠ ∞) (hb : a ≠ ∞ ∨ b ≠ 0) :
14441461
(a * b)⁻¹ = a⁻¹ * b⁻¹ := by
14451462
induction' b using recTopCoe with b

Mathlib/MeasureTheory/Covering/Differentiation.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ theorem ae_tendsto_average_norm_sub {f : α → E} (hf : Integrable f μ) :
902902
simp only [ENNReal.zero_toReal] at this
903903
apply Tendsto.congr' _ this
904904
filter_upwards [h'x, v.eventually_measure_lt_top x] with a _ h'a
905-
simp only [Function.comp_apply, ENNReal.toReal_div, set_average_eq, div_eq_inv_mul]
905+
simp only [Function.comp_apply, ENNReal.toReal_div, setAverage_eq, div_eq_inv_mul]
906906
have A : IntegrableOn (fun y => (‖f y - f x‖₊ : ℝ)) a μ := by
907907
simp_rw [coe_nnnorm]
908908
exact (hf.integrableOn.sub (integrableOn_const.2 (Or.inr h'a))).norm
@@ -922,8 +922,8 @@ theorem ae_tendsto_average [NormedSpace ℝ E] [CompleteSpace E] {f : α → E}
922922
rw [tendsto_iff_norm_tendsto_zero]
923923
refine' squeeze_zero' (eventually_of_forall fun a => norm_nonneg _) _ hx
924924
filter_upwards [h'x, v.eventually_measure_lt_top x] with a ha h'a
925-
nth_rw 1 [← set_average_const ha.ne' h'a.ne (f x)]
926-
simp_rw [set_average_eq']
925+
nth_rw 1 [← setAverage_const ha.ne' h'a.ne (f x)]
926+
simp_rw [setAverage_eq']
927927
rw [← integral_sub]
928928
· exact norm_integral_le_integral_norm _
929929
· exact (integrable_inv_smul_measure ha.ne' h'a.ne).2 hf.integrableOn

Mathlib/MeasureTheory/Integral/Average.lean

Lines changed: 379 additions & 40 deletions
Large diffs are not rendered by default.

Mathlib/MeasureTheory/Integral/IntervalAverage.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ notation3 "⨍ "(...)" in "a".."b",
4040
"r:60:(scoped f => average (Measure.restrict volume (uIoc a b)) f) => r
4141

4242
theorem interval_average_symm (f : ℝ → E) (a b : ℝ) : (⨍ x in a..b, f x) = ⨍ x in b..a, f x := by
43-
rw [set_average_eq, set_average_eq, uIoc_comm]
43+
rw [setAverage_eq, setAverage_eq, uIoc_comm]
4444
#align interval_average_symm interval_average_symm
4545

4646
theorem interval_average_eq (f : ℝ → E) (a b : ℝ) :
4747
(⨍ x in a..b, f x) = (b - a)⁻¹ • ∫ x in a..b, f x := by
4848
cases' le_or_lt a b with h h
49-
· rw [set_average_eq, uIoc_of_le h, Real.volume_Ioc, intervalIntegral.integral_of_le h,
49+
· rw [setAverage_eq, uIoc_of_le h, Real.volume_Ioc, intervalIntegral.integral_of_le h,
5050
ENNReal.toReal_ofReal (sub_nonneg.2 h)]
51-
· rw [set_average_eq, uIoc_of_lt h, Real.volume_Ioc, intervalIntegral.integral_of_ge h.le,
51+
· rw [setAverage_eq, uIoc_of_lt h, Real.volume_Ioc, intervalIntegral.integral_of_ge h.le,
5252
ENNReal.toReal_ofReal (sub_nonneg.2 h.le), smul_neg, ← neg_smul, ← inv_neg, neg_sub]
5353
#align interval_average_eq interval_average_eq
5454

Mathlib/MeasureTheory/Integral/Lebesgue.lean

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Mario Carneiro, Johannes Hölzl
55
66
! This file was ported from Lean 3 source module measure_theory.integral.lebesgue
7-
! leanprover-community/mathlib commit bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf
7+
! leanprover-community/mathlib commit c14c8fcde993801fca8946b0d80131a1a81d1520
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
@@ -46,7 +46,7 @@ namespace MeasureTheory
4646

4747
section MoveThis
4848

49-
variable {α : Type _} {mα : MeasurableSpace α} {a : α} {s : Set α}
49+
variable {m : MeasurableSpace α} {μ ν : Measure α} {f : α → ℝ≥0} {s : Set α}
5050

5151
-- todo after the port: move to measure_theory/measure/measure_space
5252
theorem restrict_dirac' (hs : MeasurableSet s) [Decidable (a ∈ s)] :
@@ -805,6 +805,11 @@ theorem set_lintegral_eq_const {f : α → ℝ≥0∞} (hf : Measurable f) (r :
805805
exact hf (measurableSet_singleton r)
806806
#align measure_theory.set_lintegral_eq_const MeasureTheory.set_lintegral_eq_const
807807

808+
@[simp]
809+
theorem lintegral_indicator_one (hs : MeasurableSet s) : ∫⁻ a, s.indicator 1 a ∂μ = μ s :=
810+
(lintegral_indicator_const hs _).trans $ one_mul _
811+
#align measure_theory.lintegral_indicator_one MeasureTheory.lintegral_indicator_one
812+
808813
/-- A version of **Markov's inequality** for two functions. It doesn't follow from the standard
809814
Markov's inequality because we only assume measurability of `g`, not `f`. -/
810815
theorem lintegral_add_mul_meas_add_le_le_lintegral {f g : α → ℝ≥0∞} (hle : f ≤ᵐ[μ] g)
@@ -839,13 +844,29 @@ theorem mul_meas_ge_le_lintegral {f : α → ℝ≥0∞} (hf : Measurable f) (ε
839844
mul_meas_ge_le_lintegral₀ hf.aemeasurable ε
840845
#align measure_theory.mul_meas_ge_le_lintegral MeasureTheory.mul_meas_ge_le_lintegral
841846

842-
theorem lintegral_eq_top_of_measure_eq_top_pos {f : α → ℝ≥0∞} (hf : AEMeasurable f μ)
843-
(hμf : 0 < μ { x | f x = ∞ }) : ∫⁻ x, f x ∂μ = ∞ :=
847+
theorem lintegral_eq_top_of_measure_eq_top_ne_zero {f : α → ℝ≥0∞} (hf : AEMeasurable f μ)
848+
(hμf : μ {x | f x = ∞} ≠ 0) : ∫⁻ x, f x ∂μ = ∞ :=
844849
eq_top_iff.mpr <|
845850
calc
846-
∞ = ∞ * μ { x | ∞ ≤ f x } := by simp [mul_eq_top, hμf.ne.symm]
851+
∞ = ∞ * μ { x | ∞ ≤ f x } := by simp [mul_eq_top, hμf]
847852
_ ≤ ∫⁻ x, f x ∂μ := mul_meas_ge_le_lintegral₀ hf ∞
848-
#align measure_theory.lintegral_eq_top_of_measure_eq_top_pos MeasureTheory.lintegral_eq_top_of_measure_eq_top_pos
853+
#align measure_theory.lintegral_eq_top_of_measure_eq_top_ne_zero MeasureTheory.lintegral_eq_top_of_measure_eq_top_ne_zero
854+
855+
theorem setLintegral_eq_top_of_measure_eq_top_ne_zero (hf : AEMeasurable f (μ.restrict s))
856+
(hμf : μ ({x ∈ s | f x = ∞}) ≠ 0) : ∫⁻ x in s, f x ∂μ = ∞ :=
857+
lintegral_eq_top_of_measure_eq_top_ne_zero hf $
858+
mt (eq_bot_mono $ by rw [←setOf_inter_eq_sep]; exact Measure.le_restrict_apply _ _) hμf
859+
#align measure_theory.set_lintegral_eq_top_of_measure_eq_top_ne_zero MeasureTheory.setLintegral_eq_top_of_measure_eq_top_ne_zero
860+
861+
theorem measure_eq_top_of_lintegral_ne_top (hf : AEMeasurable f μ) (hμf : ∫⁻ x, f x ∂μ ≠ ∞) :
862+
μ {x | f x = ∞} = 0 :=
863+
of_not_not fun h => hμf <| lintegral_eq_top_of_measure_eq_top_ne_zero hf h
864+
#align measure_theory.measure_eq_top_of_lintegral_ne_top MeasureTheory.measure_eq_top_of_lintegral_ne_top
865+
866+
theorem measure_eq_top_of_setLintegral_ne_top (hf : AEMeasurable f (μ.restrict s))
867+
(hμf : ∫⁻ x in s, f x ∂μ ≠ ∞) : μ ({x ∈ s | f x = ∞}) = 0 :=
868+
of_not_not fun h => hμf $ setLintegral_eq_top_of_measure_eq_top_ne_zero hf h
869+
#align measure_theory.measure_eq_top_of_set_lintegral_ne_top MeasureTheory.measure_eq_top_of_setLintegral_ne_top
849870

850871
/-- **Markov's inequality** also known as **Chebyshev's first inequality**. -/
851872
theorem meas_ge_le_lintegral_div {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) {ε : ℝ≥0∞} (hε : ε ≠ 0)

Mathlib/MeasureTheory/MeasurableSpace.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Johannes Hölzl, Mario Carneiro
55
66
! This file was ported from Lean 3 source module measure_theory.measurable_space
7-
! leanprover-community/mathlib commit 3905fa80e62c0898131285baab35559fbc4e5cda
7+
! leanprover-community/mathlib commit c14c8fcde993801fca8946b0d80131a1a81d1520
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
@@ -255,7 +255,7 @@ theorem measurable_of_subsingleton_codomain [Subsingleton β] (f : α → β) :
255255
fun s _ => Subsingleton.set_cases MeasurableSet.empty MeasurableSet.univ s
256256
#align measurable_of_subsingleton_codomain measurable_of_subsingleton_codomain
257257

258-
@[to_additive]
258+
@[measurability, to_additive]
259259
theorem measurable_one [One α] : Measurable (1 : β → α) :=
260260
@measurable_const _ _ _ _ 1
261261
#align measurable_one measurable_one

Mathlib/MeasureTheory/Measure/MeasureSpaceDef.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Johannes Hölzl, Mario Carneiro
55
66
! This file was ported from Lean 3 source module measure_theory.measure.measure_space_def
7-
! leanprover-community/mathlib commit 146a2eed7ad5887ade571e073d0805d2ac618043
7+
! leanprover-community/mathlib commit c14c8fcde993801fca8946b0d80131a1a81d1520
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
@@ -551,11 +551,11 @@ theorem inter_ae_eq_empty_of_ae_eq_empty_right (h : t =ᵐ[μ] (∅ : Set α)) :
551551
#align measure_theory.inter_ae_eq_empty_of_ae_eq_empty_right MeasureTheory.inter_ae_eq_empty_of_ae_eq_empty_right
552552

553553
@[to_additive]
554-
theorem Set.mulIndicator_ae_eq_one {M : Type _} [One M] {f : α → M} {s : Set α}
555-
(h : s.mulIndicator f =ᵐ[μ] 1) : μ (s ∩ Function.mulSupport f) = 0 := by
556-
simpa [Filter.EventuallyEq, ae_iff] using h
557-
#align set.mul_indicator_ae_eq_one MeasureTheory.Set.mulIndicator_ae_eq_one
558-
#align set.indicator_ae_eq_zero MeasureTheory.Set.indicator_ae_eq_zero
554+
theorem _root_.Set.mulIndicator_ae_eq_one {M : Type _} [One M] {f : α → M} {s : Set α} :
555+
s.mulIndicator f =ᵐ[μ] 1 μ (s ∩ f.mulSupport) = 0 := by
556+
simp [EventuallyEq, eventually_iff, Measure.ae, compl_setOf]; rfl
557+
#align set.mul_indicator_ae_eq_one Set.mulIndicator_ae_eq_one
558+
#align set.indicator_ae_eq_zero Set.indicator_ae_eq_zero
559559

560560
/-- If `s ⊆ t` modulo a set of measure `0`, then `μ s ≤ μ t`. -/
561561
@[mono]

Mathlib/Probability/Density.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kexing Ying
55
66
! This file was ported from Lean 3 source module probability.density
7-
! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
7+
! leanprover-community/mathlib commit c14c8fcde993801fca8946b0d80131a1a81d1520
88
! Please do not edit these lines, except to modify the commit id
99
! if you have ported upstream changes.
1010
-/
@@ -333,7 +333,7 @@ theorem hasPDF {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ :
333333
simp [hnt]
334334
rw [heq, Set.inter_univ] at this
335335
exact hns this
336-
exact MeasureTheory.Set.indicator_ae_eq_zero hu.symm)
336+
exact Set.indicator_ae_eq_zero.1 hu.symm)
337337
#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF
338338

339339
theorem pdf_toReal_ae_eq {_ : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}

0 commit comments

Comments
 (0)