source stringlengths 17 118 | lean4 stringlengths 0 335k |
|---|---|
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Regular.lean | import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
import Mathlib.MeasureTheory.Group.MeasurableEquiv
/-!
# Regular measures
A measure is `OuterRegular` if the measure of any measurable set `A` is the infimum of `μ U` over
all open sets `U` containing `A`.
A measure is `WeaklyRegular` if it satisfies the following properties:
* it is outer regular;
* it is inner regular for open sets with respect to closed sets: the measure of any open set `U`
is the supremum of `μ F` over all closed sets `F` contained in `U`.
A measure is `Regular` if it satisfies the following properties:
* it is finite on compact sets;
* it is outer regular;
* it is inner regular for open sets with respect to compacts closed sets: the measure of any open
set `U` is the supremum of `μ K` over all compact sets `K` contained in `U`.
A measure is `InnerRegular` if it is inner regular for measurable sets with respect to compact
sets: the measure of any measurable set `s` is the supremum of `μ K` over all compact
sets contained in `s`.
A measure is `InnerRegularCompactLTTop` if it is inner regular for measurable sets of finite
measure with respect to compact sets: the measure of any measurable set `s` is the supremum
of `μ K` over all compact sets contained in `s`.
There is a reason for this zoo of regularity classes:
* A finite measure on a metric space is always weakly regular. Therefore, in probability theory,
weakly regular measures play a prominent role.
* In locally compact topological spaces, there are two competing notions of Radon measures: the
ones that are regular, and the ones that are inner regular. For any of these two notions, there is
a Riesz representation theorem, and an existence and uniqueness statement for the Haar measure in
locally compact topological groups. The two notions coincide in sigma-compact spaces, but they
differ in general, so it is worth having the two of them.
* Both notions of Haar measure satisfy the weaker notion `InnerRegularCompactLTTop`, so it is worth
trying to express theorems using this weaker notion whenever possible, to make sure that it
applies to both Haar measures simultaneously.
While traditional textbooks on measure theory on locally compact spaces emphasize regular measures,
more recent textbooks emphasize that inner regular Haar measures are better behaved than regular
Haar measures, so we will develop both notions.
The five conditions above are registered as typeclasses for a measure `μ`, and implications between
them are recorded as instances. For example, in a Hausdorff topological space, regularity implies
weak regularity. Also, regularity or inner regularity both imply `InnerRegularCompactLTTop`.
In a regular locally compact finite measure space, then regularity, inner regularity
and `InnerRegularCompactLTTop` are all equivalent.
In order to avoid code duplication, we also define a measure `μ` to be `InnerRegularWRT` for sets
satisfying a predicate `q` with respect to sets satisfying a predicate `p` if for any set
`U ∈ {U | q U}` and a number `r < μ U` there exists `F ⊆ U` such that `p F` and `r < μ F`.
There are two main nontrivial results in the development below:
* `InnerRegularWRT.measurableSet_of_isOpen` shows that, for an outer regular measure, inner
regularity for open sets with respect to compact sets or closed sets implies inner regularity for
all measurable sets of finite measure (with respect to compact sets or closed sets respectively).
* `InnerRegularWRT.weaklyRegular_of_finite` shows that a finite measure which is inner regular for
open sets with respect to closed sets (for instance a finite measure on a metric space) is weakly
regular.
All other results are deduced from these ones.
Here is an example showing how regularity and inner regularity may differ even on locally compact
spaces. Consider the group `ℝ × ℝ` where the first factor has the discrete topology and the second
one the usual topology. It is a locally compact Hausdorff topological group, with Haar measure equal
to Lebesgue measure on each vertical fiber. Let us consider the regular version of Haar measure.
Then the set `ℝ × {0}` has infinite measure (by outer regularity), but any compact set it contains
has zero measure (as it is finite). In fact, this set only contains subset with measure zero or
infinity. The inner regular version of Haar measure, on the other hand, gives zero mass to the
set `ℝ × {0}`.
Another interesting example is the sum of the Dirac masses at rational points in the real line.
It is a σ-finite measure on a locally compact metric space, but it is not outer regular: for
outer regularity, one needs additional locally finite assumptions. On the other hand, it is
inner regular.
Several authors require both regularity and inner regularity for their measures. We have opted
for the more fine grained definitions above as they apply more generally.
## Main definitions
* `MeasureTheory.Measure.OuterRegular μ`: a typeclass registering that a measure `μ` on a
topological space is outer regular.
* `MeasureTheory.Measure.Regular μ`: a typeclass registering that a measure `μ` on a topological
space is regular.
* `MeasureTheory.Measure.WeaklyRegular μ`: a typeclass registering that a measure `μ` on a
topological space is weakly regular.
* `MeasureTheory.Measure.InnerRegularWRT μ p q`: a non-typeclass predicate saying that a measure `μ`
is inner regular for sets satisfying `q` with respect to sets satisfying `p`.
* `MeasureTheory.Measure.InnerRegular μ`: a typeclass registering that a measure `μ` on a
topological space is inner regular for measurable sets with respect to compact sets.
* `MeasureTheory.Measure.InnerRegularCompactLTTop μ`: a typeclass registering that a measure `μ`
on a topological space is inner regular for measurable sets of finite measure with respect to
compact sets.
## Main results
### Outer regular measures
* `Set.measure_eq_iInf_isOpen` asserts that, when `μ` is outer regular, the measure of a
set is the infimum of the measure of open sets containing it.
* `Set.exists_isOpen_lt_of_lt` asserts that, when `μ` is outer regular, for every set `s`
and `r > μ s` there exists an open superset `U ⊇ s` of measure less than `r`.
* push forward of an outer regular measure is outer regular, and scalar multiplication of a regular
measure by a finite number is outer regular.
### Weakly regular measures
* `IsOpen.measure_eq_iSup_isClosed` asserts that the measure of an open set is the supremum of
the measure of closed sets it contains.
* `IsOpen.exists_lt_isClosed`: for an open set `U` and `r < μ U`, there exists a closed `F ⊆ U`
of measure greater than `r`;
* `MeasurableSet.measure_eq_iSup_isClosed_of_ne_top` asserts that the measure of a measurable set
of finite measure is the supremum of the measure of closed sets it contains.
* `MeasurableSet.exists_lt_isClosed_of_ne_top` and `MeasurableSet.exists_isClosed_lt_add`:
a measurable set of finite measure can be approximated by a closed subset (stated as
`r < μ F` and `μ s < μ F + ε`, respectively).
* `MeasureTheory.Measure.WeaklyRegular.of_pseudoMetrizableSpace_of_isFiniteMeasure` is an
instance registering that a finite measure on a metric space is weakly regular (in fact, a pseudo
metrizable space is enough);
* `MeasureTheory.Measure.WeaklyRegular.of_pseudoMetrizableSpace_secondCountable_of_locallyFinite`
is an instance registering that a locally finite measure on a second countable metric space (or
even a pseudo metrizable space) is weakly regular.
### Regular measures
* `IsOpen.measure_eq_iSup_isCompact` asserts that the measure of an open set is the supremum of
the measure of compact sets it contains.
* `IsOpen.exists_lt_isCompact`: for an open set `U` and `r < μ U`, there exists a compact `K ⊆ U`
of measure greater than `r`;
* `MeasureTheory.Measure.Regular.of_sigmaCompactSpace_of_isLocallyFiniteMeasure` is an
instance registering that a locally finite measure on a `σ`-compact metric space is regular (in
fact, an emetric space is enough).
### Inner regular measures
* `MeasurableSet.measure_eq_iSup_isCompact` asserts that the measure of a measurable set is the
supremum of the measure of compact sets it contains.
* `MeasurableSet.exists_lt_isCompact`: for a measurable set `s` and `r < μ s`, there exists a
compact `K ⊆ s` of measure greater than `r`;
### Inner regular measures for finite measure sets with respect to compact sets
* `MeasurableSet.measure_eq_iSup_isCompact_of_ne_top` asserts that the measure of a measurable set
of finite measure is the supremum of the measure of compact sets it contains.
* `MeasurableSet.exists_lt_isCompact_of_ne_top` and `MeasurableSet.exists_isCompact_lt_add`:
a measurable set of finite measure can be approximated by a compact subset (stated as
`r < μ K` and `μ s < μ K + ε`, respectively).
## Implementation notes
The main nontrivial statement is `MeasureTheory.Measure.InnerRegular.weaklyRegular_of_finite`,
expressing that in a finite measure space, if every open set can be approximated from inside by
closed sets, then the measure is in fact weakly regular. To prove that we show that any measurable
set can be approximated from inside by closed sets and from outside by open sets. This statement is
proved by measurable induction, starting from open sets and checking that it is stable by taking
complements (this is the point of this condition, being symmetrical between inside and outside) and
countable disjoint unions.
Once this statement is proved, one deduces results for `σ`-finite measures from this statement, by
restricting them to finite measure sets (and proving that this restriction is weakly regular, using
again the same statement).
For non-Hausdorff spaces, one may argue whether the right condition for inner regularity is with
respect to compact sets, or to compact closed sets. For instance,
[Fremlin, *Measure Theory* (volume 4, 411J)][fremlin_vol4] considers measures which are inner
regular with respect to compact closed sets (and calls them *tight*). However, since most of the
literature uses mere compact sets, we have chosen to follow this convention. It doesn't make a
difference in Hausdorff spaces, of course. In locally compact topological groups, the two
conditions coincide, since if a compact set `k` is contained in a measurable set `u`, then the
closure of `k` is a compact closed set still contained in `u`, see
`IsCompact.closure_subset_of_measurableSet_of_group`.
## References
[Halmos, Measure Theory, §52][halmos1950measure]. Note that Halmos uses an unusual definition of
Borel sets (for him, they are elements of the `σ`-algebra generated by compact sets!), so his
proofs or statements do not apply directly.
[Billingsley, Convergence of Probability Measures][billingsley1999]
[Bogachev, Measure Theory, volume 2, Theorem 7.11.1][bogachev2007]
-/
open Set Filter ENNReal NNReal TopologicalSpace
open scoped symmDiff Topology
namespace MeasureTheory
namespace Measure
/-- We say that a measure `μ` is *inner regular* with respect to predicates `p q : Set α → Prop`,
if for every `U` such that `q U` and `r < μ U`, there exists a subset `K ⊆ U` satisfying `p K`
of measure greater than `r`.
This definition is used to prove some facts about regular and weakly regular measures without
repeating the proofs. -/
def InnerRegularWRT {α} {_ : MeasurableSpace α} (μ : Measure α) (p q : Set α → Prop) :=
∀ ⦃U⦄, q U → ∀ r < μ U, ∃ K, K ⊆ U ∧ p K ∧ r < μ K
namespace InnerRegularWRT
variable {α : Type*} {m : MeasurableSpace α} {μ : Measure α} {p q : Set α → Prop} {U : Set α}
{ε : ℝ≥0∞}
theorem measure_eq_iSup (H : InnerRegularWRT μ p q) (hU : q U) :
μ U = ⨆ (K) (_ : K ⊆ U) (_ : p K), μ K := by
refine
le_antisymm (le_of_forall_lt fun r hr => ?_) (iSup₂_le fun K hK => iSup_le fun _ => μ.mono hK)
simpa only [lt_iSup_iff, exists_prop] using H hU r hr
theorem eq_of_innerRegularWRT_of_forall_eq {ν : Measure α} (hμ : μ.InnerRegularWRT p q)
(hν : ν.InnerRegularWRT p q) (hμν : ∀ U, p U → μ U = ν U)
{U : Set α} (hU : q U) : μ U = ν U := by
rw [hμ.measure_eq_iSup hU, hν.measure_eq_iSup hU]
congr! 4 with t _ ht2
exact hμν t ht2
theorem exists_subset_lt_add (H : InnerRegularWRT μ p q) (h0 : p ∅) (hU : q U) (hμU : μ U ≠ ∞)
(hε : ε ≠ 0) : ∃ K, K ⊆ U ∧ p K ∧ μ U < μ K + ε := by
rcases eq_or_ne (μ U) 0 with h₀ | h₀
· refine ⟨∅, empty_subset _, h0, ?_⟩
rwa [measure_empty, h₀, zero_add, pos_iff_ne_zero]
· rcases H hU _ (ENNReal.sub_lt_self hμU h₀ hε) with ⟨K, hKU, hKc, hrK⟩
exact ⟨K, hKU, hKc, ENNReal.lt_add_of_sub_lt_right (Or.inl hμU) hrK⟩
protected theorem map {α β} [MeasurableSpace α] [MeasurableSpace β]
{μ : Measure α} {pa qa : Set α → Prop}
(H : InnerRegularWRT μ pa qa) {f : α → β} (hf : AEMeasurable f μ) {pb qb : Set β → Prop}
(hAB : ∀ U, qb U → qa (f ⁻¹' U)) (hAB' : ∀ K, pa K → pb (f '' K))
(hB₂ : ∀ U, qb U → MeasurableSet U) :
InnerRegularWRT (map f μ) pb qb := by
intro U hU r hr
rw [map_apply_of_aemeasurable hf (hB₂ _ hU)] at hr
rcases H (hAB U hU) r hr with ⟨K, hKU, hKc, hK⟩
refine ⟨f '' K, image_subset_iff.2 hKU, hAB' _ hKc, ?_⟩
exact hK.trans_le (le_map_apply_image hf _)
theorem map' {α β} [MeasurableSpace α] [MeasurableSpace β] {μ : Measure α} {pa qa : Set α → Prop}
(H : InnerRegularWRT μ pa qa) (f : α ≃ᵐ β) {pb qb : Set β → Prop}
(hAB : ∀ U, qb U → qa (f ⁻¹' U)) (hAB' : ∀ K, pa K → pb (f '' K)) :
InnerRegularWRT (map f μ) pb qb := by
intro U hU r hr
rw [f.map_apply U] at hr
rcases H (hAB U hU) r hr with ⟨K, hKU, hKc, hK⟩
refine ⟨f '' K, image_subset_iff.2 hKU, hAB' _ hKc, ?_⟩
rwa [f.map_apply, f.preimage_image]
protected theorem comap {α β} [MeasurableSpace α] {mβ : MeasurableSpace β}
{μ : Measure β} {pa qa : Set α → Prop} {pb qb : Set β → Prop}
(H : InnerRegularWRT μ pb qb) {f : α → β} (hf : MeasurableEmbedding f)
(hAB : ∀ U, qa U → qb (f '' U)) (hAB' : ∀ K ⊆ range f, pb K → pa (f ⁻¹' K)) :
(μ.comap f).InnerRegularWRT pa qa := by
intro U hU r hr
rw [hf.comap_apply] at hr
obtain ⟨K, hKU, hK, hμU⟩ := H (hAB U hU) r hr
have hKrange := hKU.trans (image_subset_range _ _)
refine ⟨f ⁻¹' K, ?_, hAB' K hKrange hK, ?_⟩
· rw [← hf.injective.preimage_image U]; exact preimage_mono hKU
· rwa [hf.comap_apply, image_preimage_eq_iff.mpr hKrange]
theorem smul (H : InnerRegularWRT μ p q) (c : ℝ≥0∞) : InnerRegularWRT (c • μ) p q := by
intro U hU r hr
rw [smul_apply, H.measure_eq_iSup hU, smul_eq_mul] at hr
simpa only [ENNReal.mul_iSup, lt_iSup_iff, exists_prop] using hr
theorem trans {q' : Set α → Prop} (H : InnerRegularWRT μ p q) (H' : InnerRegularWRT μ q q') :
InnerRegularWRT μ p q' := by
intro U hU r hr
rcases H' hU r hr with ⟨F, hFU, hqF, hF⟩; rcases H hqF _ hF with ⟨K, hKF, hpK, hrK⟩
exact ⟨K, hKF.trans hFU, hpK, hrK⟩
theorem rfl {p : Set α → Prop} : InnerRegularWRT μ p p :=
fun U hU _r hr ↦ ⟨U, Subset.rfl, hU, hr⟩
theorem of_imp (h : ∀ s, q s → p s) : InnerRegularWRT μ p q :=
fun U hU _ hr ↦ ⟨U, Subset.rfl, h U hU, hr⟩
theorem mono {p' q' : Set α → Prop} (H : InnerRegularWRT μ p q)
(h : ∀ s, q' s → q s) (h' : ∀ s, p s → p' s) : InnerRegularWRT μ p' q' :=
of_imp h' |>.trans H |>.trans (of_imp h)
end InnerRegularWRT
variable {α β : Type*} [MeasurableSpace α] {μ : Measure α}
section Classes
variable [TopologicalSpace α]
/-- A measure `μ` is outer regular if `μ(A) = inf {μ(U) | A ⊆ U open}` for a measurable set `A`.
This definition implies the same equality for any (not necessarily measurable) set, see
`Set.measure_eq_iInf_isOpen`. -/
class OuterRegular (μ : Measure α) : Prop where
protected outerRegular :
∀ ⦃A : Set α⦄, MeasurableSet A → ∀ r > μ A, ∃ U, U ⊇ A ∧ IsOpen U ∧ μ U < r
/-- A measure `μ` is regular if
- it is finite on all compact sets;
- it is outer regular: `μ(A) = inf {μ(U) | A ⊆ U open}` for `A` measurable;
- it is inner regular for open sets, using compact sets:
`μ(U) = sup {μ(K) | K ⊆ U compact}` for `U` open. -/
class Regular (μ : Measure α) : Prop extends IsFiniteMeasureOnCompacts μ, OuterRegular μ where
innerRegular : InnerRegularWRT μ IsCompact IsOpen
/-- A measure `μ` is weakly regular if
- it is outer regular: `μ(A) = inf {μ(U) | A ⊆ U open}` for `A` measurable;
- it is inner regular for open sets, using closed sets:
`μ(U) = sup {μ(F) | F ⊆ U closed}` for `U` open. -/
class WeaklyRegular (μ : Measure α) : Prop extends OuterRegular μ where
protected innerRegular : InnerRegularWRT μ IsClosed IsOpen
/-- A measure `μ` is inner regular if, for any measurable set `s`, then
`μ(s) = sup {μ(K) | K ⊆ s compact}`. -/
class InnerRegular (μ : Measure α) : Prop where
protected innerRegular : InnerRegularWRT μ IsCompact MeasurableSet
/-- A measure `μ` is inner regular for finite measure sets with respect to compact sets:
for any measurable set `s` with finite measure, then `μ(s) = sup {μ(K) | K ⊆ s compact}`.
The main interest of this class is that it is satisfied for both natural Haar measures (the
regular one and the inner regular one). -/
class InnerRegularCompactLTTop (μ : Measure α) : Prop where
protected innerRegular : InnerRegularWRT μ IsCompact (fun s ↦ MeasurableSet s ∧ μ s ≠ ∞)
-- see Note [lower instance priority]
/-- A regular measure is weakly regular in an R₁ space. -/
instance (priority := 100) Regular.weaklyRegular [R1Space α] [Regular μ] :
WeaklyRegular μ where
innerRegular := fun _U hU r hr ↦
let ⟨K, KU, K_comp, hK⟩ := Regular.innerRegular hU r hr
⟨closure K, K_comp.closure_subset_of_isOpen hU KU, isClosed_closure,
hK.trans_le (measure_mono subset_closure)⟩
end Classes
namespace OuterRegular
variable [TopologicalSpace α]
instance zero : OuterRegular (0 : Measure α) :=
⟨fun A _ _r hr => ⟨univ, subset_univ A, isOpen_univ, hr⟩⟩
/-- Given `r` larger than the measure of a set `A`, there exists an open superset of `A` with
measure less than `r`. -/
theorem _root_.Set.exists_isOpen_lt_of_lt [OuterRegular μ] (A : Set α) (r : ℝ≥0∞) (hr : μ A < r) :
∃ U, U ⊇ A ∧ IsOpen U ∧ μ U < r := by
rcases OuterRegular.outerRegular (measurableSet_toMeasurable μ A) r
(by rwa [measure_toMeasurable]) with
⟨U, hAU, hUo, hU⟩
exact ⟨U, (subset_toMeasurable _ _).trans hAU, hUo, hU⟩
/-- For an outer regular measure, the measure of a set is the infimum of the measures of open sets
containing it. -/
theorem _root_.Set.measure_eq_iInf_isOpen (A : Set α) (μ : Measure α) [OuterRegular μ] :
μ A = ⨅ (U : Set α) (_ : A ⊆ U) (_ : IsOpen U), μ U := by
refine le_antisymm (le_iInf₂ fun s hs => le_iInf fun _ => μ.mono hs) ?_
refine le_of_forall_gt fun r hr => ?_
simpa only [iInf_lt_iff, exists_prop] using A.exists_isOpen_lt_of_lt r hr
theorem _root_.Set.exists_isOpen_lt_add [OuterRegular μ] (A : Set α) (hA : μ A ≠ ∞) {ε : ℝ≥0∞}
(hε : ε ≠ 0) : ∃ U, U ⊇ A ∧ IsOpen U ∧ μ U < μ A + ε :=
A.exists_isOpen_lt_of_lt _ (ENNReal.lt_add_right hA hε)
theorem _root_.Set.exists_isOpen_le_add (A : Set α) (μ : Measure α) [OuterRegular μ] {ε : ℝ≥0∞}
(hε : ε ≠ 0) : ∃ U, U ⊇ A ∧ IsOpen U ∧ μ U ≤ μ A + ε := by
rcases eq_or_ne (μ A) ∞ with (H | H)
· exact ⟨univ, subset_univ _, isOpen_univ, by simp only [H, _root_.top_add, le_top]⟩
· rcases A.exists_isOpen_lt_add H hε with ⟨U, AU, U_open, hU⟩
exact ⟨U, AU, U_open, hU.le⟩
theorem _root_.MeasurableSet.exists_isOpen_diff_lt [OuterRegular μ] {A : Set α}
(hA : MeasurableSet A) (hA' : μ A ≠ ∞) {ε : ℝ≥0∞} (hε : ε ≠ 0) :
∃ U, U ⊇ A ∧ IsOpen U ∧ μ U < ∞ ∧ μ (U \ A) < ε := by
rcases A.exists_isOpen_lt_add hA' hε with ⟨U, hAU, hUo, hU⟩
use U, hAU, hUo, hU.trans_le le_top
exact measure_diff_lt_of_lt_add hA.nullMeasurableSet hAU hA' hU
protected theorem map [OpensMeasurableSpace α] [MeasurableSpace β] [TopologicalSpace β]
[BorelSpace β] (f : α ≃ₜ β) (μ : Measure α) [OuterRegular μ] :
(Measure.map f μ).OuterRegular := by
refine ⟨fun A hA r hr => ?_⟩
rw [map_apply f.measurable hA, ← f.image_symm] at hr
rcases Set.exists_isOpen_lt_of_lt _ r hr with ⟨U, hAU, hUo, hU⟩
have : IsOpen (f.symm ⁻¹' U) := hUo.preimage f.symm.continuous
refine ⟨f.symm ⁻¹' U, image_subset_iff.1 hAU, this, ?_⟩
rwa [map_apply f.measurable this.measurableSet, f.preimage_symm, f.preimage_image]
theorem comap' {mβ : MeasurableSpace β} [TopologicalSpace β] (μ : Measure β) [OuterRegular μ]
{f : α → β} (f_cont : Continuous f) (f_me : MeasurableEmbedding f) :
(μ.comap f).OuterRegular where
outerRegular A hA r hr := by
rw [f_me.comap_apply] at hr
obtain ⟨U, hUA, Uopen, hμU⟩ := OuterRegular.outerRegular (f_me.measurableSet_image' hA) r hr
refine ⟨f ⁻¹' U, by rwa [Superset, ← image_subset_iff], Uopen.preimage f_cont, ?_⟩
rw [f_me.comap_apply]
exact (measure_mono (image_preimage_subset _ _)).trans_lt hμU
protected theorem comap [BorelSpace α] {mβ : MeasurableSpace β} [TopologicalSpace β] [BorelSpace β]
(μ : Measure β) [OuterRegular μ] (f : α ≃ₜ β) : (μ.comap f).OuterRegular :=
OuterRegular.comap' μ f.continuous f.measurableEmbedding
protected theorem smul (μ : Measure α) [OuterRegular μ] {x : ℝ≥0∞} (hx : x ≠ ∞) :
(x • μ).OuterRegular := by
rcases eq_or_ne x 0 with (rfl | h0)
· rw [zero_smul]
exact OuterRegular.zero
· refine ⟨fun A _ r hr => ?_⟩
rw [smul_apply, A.measure_eq_iInf_isOpen, smul_eq_mul] at hr
simpa only [ENNReal.mul_iInf_of_ne h0 hx, gt_iff_lt, iInf_lt_iff, exists_prop] using hr
instance smul_nnreal (μ : Measure α) [OuterRegular μ] (c : ℝ≥0) :
OuterRegular (c • μ) :=
OuterRegular.smul μ coe_ne_top
open scoped Function in -- required for scoped `on` notation
/-- If the restrictions of a measure to countably many open sets covering the space are
outer regular, then the measure itself is outer regular. -/
lemma of_restrict [OpensMeasurableSpace α] {μ : Measure α} {s : ℕ → Set α}
(h : ∀ n, OuterRegular (μ.restrict (s n))) (h' : ∀ n, IsOpen (s n)) (h'' : univ ⊆ ⋃ n, s n) :
OuterRegular μ := by
refine ⟨fun A hA r hr => ?_⟩
have HA : μ A < ∞ := lt_of_lt_of_le hr le_top
have hm : ∀ n, MeasurableSet (s n) := fun n => (h' n).measurableSet
-- Note that `A = ⋃ n, A ∩ disjointed s n`. We replace `A` with this sequence.
obtain ⟨A, hAm, hAs, hAd, rfl⟩ :
∃ A' : ℕ → Set α,
(∀ n, MeasurableSet (A' n)) ∧
(∀ n, A' n ⊆ s n) ∧ Pairwise (Disjoint on A') ∧ A = ⋃ n, A' n := by
refine
⟨fun n => A ∩ disjointed s n, fun n => hA.inter (MeasurableSet.disjointed hm _), fun n =>
inter_subset_right.trans (disjointed_subset _ _),
(disjoint_disjointed s).mono fun k l hkl => hkl.mono inf_le_right inf_le_right, ?_⟩
rw [← inter_iUnion, iUnion_disjointed, univ_subset_iff.mp h'', inter_univ]
rcases ENNReal.exists_pos_sum_of_countable' (tsub_pos_iff_lt.2 hr).ne' ℕ with ⟨δ, δ0, hδε⟩
rw [lt_tsub_iff_right, add_comm] at hδε
have : ∀ n, ∃ U ⊇ A n, IsOpen U ∧ μ U < μ (A n) + δ n := by
intro n
have H₁ : ∀ t, μ.restrict (s n) t = μ (t ∩ s n) := fun t => restrict_apply' (hm n)
have Ht : μ.restrict (s n) (A n) ≠ ∞ := by
rw [H₁]
exact ((measure_mono (inter_subset_left.trans (subset_iUnion A n))).trans_lt HA).ne
rcases (A n).exists_isOpen_lt_add Ht (δ0 n).ne' with ⟨U, hAU, hUo, hU⟩
rw [H₁, H₁, inter_eq_self_of_subset_left (hAs _)] at hU
exact ⟨U ∩ s n, subset_inter hAU (hAs _), hUo.inter (h' n), hU⟩
choose U hAU hUo hU using this
refine ⟨⋃ n, U n, iUnion_mono hAU, isOpen_iUnion hUo, ?_⟩
calc
μ (⋃ n, U n) ≤ ∑' n, μ (U n) := measure_iUnion_le _
_ ≤ ∑' n, (μ (A n) + δ n) := ENNReal.tsum_le_tsum fun n => (hU n).le
_ = ∑' n, μ (A n) + ∑' n, δ n := ENNReal.tsum_add
_ = μ (⋃ n, A n) + ∑' n, δ n := (congr_arg₂ (· + ·) (measure_iUnion hAd hAm).symm rfl)
_ < r := hδε
/-- See also `IsCompact.measure_closure` for a version
that assumes the `σ`-algebra to be the Borel `σ`-algebra but makes no assumptions on `μ`. -/
lemma measure_closure_eq_of_isCompact [R1Space α] [OuterRegular μ]
{k : Set α} (hk : IsCompact k) : μ (closure k) = μ k := by
apply le_antisymm ?_ (measure_mono subset_closure)
simp only [measure_eq_iInf_isOpen k, le_iInf_iff]
intro u ku u_open
exact measure_mono (hk.closure_subset_of_isOpen u_open ku)
/-- Outer regular measures are determined by values on open sets. -/
theorem ext_isOpen {ν : Measure α} [OuterRegular μ] [OuterRegular ν]
(hμν : ∀ U, IsOpen U → μ U = ν U) : μ = ν := by
ext s ms
rw [Set.measure_eq_iInf_isOpen, Set.measure_eq_iInf_isOpen]
congr! 4 with t _ ht2
exact hμν t ht2
end OuterRegular
/-- If a measure `μ` admits finite spanning open sets such that the restriction of `μ` to each set
is outer regular, then the original measure is outer regular as well. -/
protected theorem FiniteSpanningSetsIn.outerRegular
[TopologicalSpace α] [OpensMeasurableSpace α] {μ : Measure α}
(s : μ.FiniteSpanningSetsIn { U | IsOpen U ∧ OuterRegular (μ.restrict U) }) :
OuterRegular μ :=
OuterRegular.of_restrict (s := fun n ↦ s.set n) (fun n ↦ (s.set_mem n).2)
(fun n ↦ (s.set_mem n).1) s.spanning.symm.subset
namespace InnerRegularWRT
variable {p : Set α → Prop}
/-- If the restrictions of a measure to a monotone sequence of sets covering the space are
inner regular for some property `p` and all measurable sets, then the measure itself is
inner regular. -/
lemma of_restrict {μ : Measure α} {s : ℕ → Set α}
(h : ∀ n, InnerRegularWRT (μ.restrict (s n)) p MeasurableSet)
(hs : univ ⊆ ⋃ n, s n) (hmono : Monotone s) : InnerRegularWRT μ p MeasurableSet := by
intro F hF r hr
have hBU : ⋃ n, F ∩ s n = F := by rw [← inter_iUnion, univ_subset_iff.mp hs, inter_univ]
have : μ F = ⨆ n, μ (F ∩ s n) := by
rw [← (monotone_const.inter hmono).measure_iUnion, hBU]
rw [this] at hr
rcases lt_iSup_iff.1 hr with ⟨n, hn⟩
rw [← restrict_apply hF] at hn
rcases h n hF _ hn with ⟨K, KF, hKp, hK⟩
exact ⟨K, KF, hKp, hK.trans_le (restrict_apply_le _ _)⟩
/-- If `μ` is inner regular for measurable finite measure sets with respect to some class of sets,
then its restriction to any set is also inner regular for measurable finite measure sets, with
respect to the same class of sets. -/
lemma restrict (h : InnerRegularWRT μ p (fun s ↦ MeasurableSet s ∧ μ s ≠ ∞)) (A : Set α) :
InnerRegularWRT (μ.restrict A) p (fun s ↦ MeasurableSet s ∧ μ.restrict A s ≠ ∞) := by
rintro s ⟨s_meas, hs⟩ r hr
rw [restrict_apply s_meas] at hs
obtain ⟨K, K_subs, pK, rK⟩ : ∃ K, K ⊆ (toMeasurable μ (s ∩ A)) ∩ s ∧ p K ∧ r < μ K := by
have : r < μ ((toMeasurable μ (s ∩ A)) ∩ s) := by
apply hr.trans_le
rw [restrict_apply s_meas]
exact measure_mono <| subset_inter (subset_toMeasurable μ (s ∩ A)) inter_subset_left
refine h ⟨(measurableSet_toMeasurable _ _).inter s_meas, ?_⟩ _ this
apply (lt_of_le_of_lt _ hs.lt_top).ne
rw [← measure_toMeasurable (s ∩ A)]
exact measure_mono inter_subset_left
refine ⟨K, K_subs.trans inter_subset_right, pK, ?_⟩
calc
r < μ K := rK
_ = μ.restrict (toMeasurable μ (s ∩ A)) K := by
rw [restrict_apply' (measurableSet_toMeasurable μ (s ∩ A))]
congr
apply (inter_eq_left.2 ?_).symm
exact K_subs.trans inter_subset_left
_ = μ.restrict (s ∩ A) K := by rwa [restrict_toMeasurable]
_ ≤ μ.restrict A K := Measure.le_iff'.1 (restrict_mono inter_subset_right le_rfl) K
/-- If `μ` is inner regular for measurable finite measure sets with respect to some class of sets,
then its restriction to any finite measure set is also inner regular for measurable sets with
respect to the same class of sets. -/
lemma restrict_of_measure_ne_top (h : InnerRegularWRT μ p (fun s ↦ MeasurableSet s ∧ μ s ≠ ∞))
{A : Set α} (hA : μ A ≠ ∞) :
InnerRegularWRT (μ.restrict A) p (fun s ↦ MeasurableSet s) := by
have : Fact (μ A < ∞) := ⟨hA.lt_top⟩
exact (restrict h A).trans (of_imp (fun s hs ↦ ⟨hs, measure_ne_top _ _⟩))
/-- Given a σ-finite measure, any measurable set can be approximated from inside by a measurable
set of finite measure. -/
lemma of_sigmaFinite [SigmaFinite μ] :
InnerRegularWRT μ (fun s ↦ MeasurableSet s ∧ μ s ≠ ∞) (fun s ↦ MeasurableSet s) := by
intro s hs r hr
set B : ℕ → Set α := spanningSets μ
have hBU : ⋃ n, s ∩ B n = s := by rw [← inter_iUnion, iUnion_spanningSets, inter_univ]
have : μ s = ⨆ n, μ (s ∩ B n) := by
rw [← (monotone_const.inter (monotone_spanningSets μ)).measure_iUnion, hBU]
rw [this] at hr
rcases lt_iSup_iff.1 hr with ⟨n, hn⟩
refine ⟨s ∩ B n, inter_subset_left, ⟨hs.inter (measurableSet_spanningSets μ n), ?_⟩, hn⟩
exact ((measure_mono inter_subset_right).trans_lt (measure_spanningSets_lt_top μ n)).ne
variable [TopologicalSpace α]
/-- If a measure is inner regular (using closed or compact sets) for open sets, then every
measurable set of finite measure can be approximated by a (closed or compact) subset. -/
theorem measurableSet_of_isOpen [OuterRegular μ] (H : InnerRegularWRT μ p IsOpen)
(hd : ∀ ⦃s U⦄, p s → IsOpen U → p (s \ U)) :
InnerRegularWRT μ p fun s => MeasurableSet s ∧ μ s ≠ ∞ := by
rintro s ⟨hs, hμs⟩ r hr
have h0 : p ∅ := by
have : 0 < μ univ := (bot_le.trans_lt hr).trans_le (measure_mono (subset_univ _))
obtain ⟨K, -, hK, -⟩ : ∃ K, K ⊆ univ ∧ p K ∧ 0 < μ K := H isOpen_univ _ this
simpa using hd hK isOpen_univ
obtain ⟨ε, hε, hεs, rfl⟩ : ∃ ε ≠ 0, ε + ε ≤ μ s ∧ r = μ s - (ε + ε) := by
use (μ s - r) / 2
simp [*, hr.le, ENNReal.add_halves, ENNReal.sub_sub_cancel, tsub_eq_zero_iff_le]
rcases hs.exists_isOpen_diff_lt hμs hε with ⟨U, hsU, hUo, hUt, hμU⟩
rcases (U \ s).exists_isOpen_lt_of_lt _ hμU with ⟨U', hsU', hU'o, hμU'⟩
replace hsU' := diff_subset_comm.1 hsU'
rcases H.exists_subset_lt_add h0 hUo hUt.ne hε with ⟨K, hKU, hKc, hKr⟩
refine ⟨K \ U', fun x hx => hsU' ⟨hKU hx.1, hx.2⟩, hd hKc hU'o, ENNReal.sub_lt_of_lt_add hεs ?_⟩
calc
μ s ≤ μ U := μ.mono hsU
_ < μ K + ε := hKr
_ ≤ μ (K \ U') + μ U' + ε := by grw [tsub_le_iff_right.1 le_measure_diff]
_ ≤ μ (K \ U') + ε + ε := by gcongr
_ = μ (K \ U') + (ε + ε) := add_assoc _ _ _
open Finset in
/-- In a finite measure space, assume that any open set can be approximated from inside by closed
sets. Then the measure is weakly regular. -/
theorem weaklyRegular_of_finite [BorelSpace α] (μ : Measure α) [IsFiniteMeasure μ]
(H : InnerRegularWRT μ IsClosed IsOpen) : WeaklyRegular μ := by
have hfin : ∀ {s}, μ s ≠ ∞ := @(measure_ne_top μ)
suffices ∀ s, MeasurableSet s → ∀ ε, ε ≠ 0 → ∃ F, F ⊆ s ∧ ∃ U, U ⊇ s ∧
IsClosed F ∧ IsOpen U ∧ μ s ≤ μ F + ε ∧ μ U ≤ μ s + ε by
refine
{ outerRegular := fun s hs r hr => ?_
innerRegular := H }
rcases exists_between hr with ⟨r', hsr', hr'r⟩
rcases this s hs _ (tsub_pos_iff_lt.2 hsr').ne' with ⟨-, -, U, hsU, -, hUo, -, H⟩
refine ⟨U, hsU, hUo, ?_⟩
rw [add_tsub_cancel_of_le hsr'.le] at H
exact H.trans_lt hr'r
apply MeasurableSet.induction_on_open
/- The proof is by measurable induction: we should check that the property is true for the empty
set, for open sets, and is stable by taking the complement and by taking countable disjoint
unions. The point of the property we are proving is that it is stable by taking complements
(exchanging the roles of closed and open sets and thanks to the finiteness of the measure). -/
-- check for open set
· intro U hU ε hε
rcases H.exists_subset_lt_add isClosed_empty hU hfin hε with ⟨F, hsF, hFc, hF⟩
exact ⟨F, hsF, U, Subset.rfl, hFc, hU, hF.le, le_self_add⟩
-- check for complements
· rintro s hs H ε hε
rcases H ε hε with ⟨F, hFs, U, hsU, hFc, hUo, hF, hU⟩
refine
⟨Uᶜ, compl_subset_compl.2 hsU, Fᶜ, compl_subset_compl.2 hFs, hUo.isClosed_compl,
hFc.isOpen_compl, ?_⟩
simp only [measure_compl_le_add_iff, *, hUo.measurableSet, hFc.measurableSet, true_and]
-- check for disjoint unions
· intro s hsd hsm H ε ε0
have ε0' : ε / 2 ≠ 0 := (ENNReal.half_pos ε0).ne'
rcases ENNReal.exists_pos_sum_of_countable' ε0' ℕ with ⟨δ, δ0, hδε⟩
choose F hFs U hsU hFc hUo hF hU using fun n => H n (δ n) (δ0 n).ne'
-- the approximating closed set is constructed by considering finitely many sets `s i`, which
-- cover all the measure up to `ε/2`, approximating each of these by a closed set `F i`, and
-- taking the union of these (finitely many) `F i`.
have : Tendsto (fun t => (∑ k ∈ t, μ (s k)) + ε / 2) atTop (𝓝 <| μ (⋃ n, s n) + ε / 2) := by
rw [measure_iUnion hsd hsm]
exact Tendsto.add ENNReal.summable.hasSum tendsto_const_nhds
rcases (this.eventually <| lt_mem_nhds <| ENNReal.lt_add_right hfin ε0').exists with ⟨t, ht⟩
-- the approximating open set is constructed by taking for each `s n` an approximating open set
-- `U n` with measure at most `μ (s n) + δ n` for a summable `δ`, and taking the union of these.
refine
⟨⋃ k ∈ t, F k, iUnion_mono fun k => iUnion_subset fun _ => hFs _, ⋃ n, U n, iUnion_mono hsU,
isClosed_biUnion_finset fun k _ => hFc k, isOpen_iUnion hUo, ht.le.trans ?_, ?_⟩
· calc
(∑ k ∈ t, μ (s k)) + ε / 2 ≤ ((∑ k ∈ t, μ (F k)) + ∑ k ∈ t, δ k) + ε / 2 := by
rw [← sum_add_distrib]
gcongr
apply hF
_ ≤ (∑ k ∈ t, μ (F k)) + ε / 2 + ε / 2 := by
gcongr
exact (ENNReal.sum_le_tsum _).trans hδε.le
_ = μ (⋃ k ∈ t, F k) + ε := by
rw [measure_biUnion_finset, add_assoc, ENNReal.add_halves]
exacts [fun k _ n _ hkn => (hsd hkn).mono (hFs k) (hFs n),
fun k _ => (hFc k).measurableSet]
· calc
μ (⋃ n, U n) ≤ ∑' n, μ (U n) := measure_iUnion_le _
_ ≤ ∑' n, (μ (s n) + δ n) := ENNReal.tsum_le_tsum hU
_ = μ (⋃ n, s n) + ∑' n, δ n := by rw [measure_iUnion hsd hsm, ENNReal.tsum_add]
_ ≤ μ (⋃ n, s n) + ε := by grw [hδε, ENNReal.half_le_self]
/-- In a metrizable space (or even a pseudo metrizable space), an open set can be approximated from
inside by closed sets. -/
theorem of_pseudoMetrizableSpace {X : Type*} [TopologicalSpace X] [PseudoMetrizableSpace X]
[MeasurableSpace X] (μ : Measure X) : InnerRegularWRT μ IsClosed IsOpen := by
let A : PseudoMetricSpace X := TopologicalSpace.pseudoMetrizableSpacePseudoMetric X
intro U hU r hr
rcases hU.exists_iUnion_isClosed with ⟨F, F_closed, -, rfl, F_mono⟩
rw [F_mono.measure_iUnion] at hr
rcases lt_iSup_iff.1 hr with ⟨n, hn⟩
exact ⟨F n, subset_iUnion _ _, F_closed n, hn⟩
/-- In a `σ`-compact space, any closed set can be approximated by a compact subset. -/
theorem isCompact_isClosed {X : Type*} [TopologicalSpace X] [SigmaCompactSpace X]
[MeasurableSpace X] (μ : Measure X) : InnerRegularWRT μ IsCompact IsClosed := by
intro F hF r hr
set B : ℕ → Set X := compactCovering X
have hBc : ∀ n, IsCompact (F ∩ B n) := fun n => (isCompact_compactCovering X n).inter_left hF
have hBU : ⋃ n, F ∩ B n = F := by rw [← inter_iUnion, iUnion_compactCovering, Set.inter_univ]
have : μ F = ⨆ n, μ (F ∩ B n) := by
rw [← Monotone.measure_iUnion, hBU]
exact monotone_const.inter monotone_accumulate
rw [this] at hr
rcases lt_iSup_iff.1 hr with ⟨n, hn⟩
exact ⟨_, inter_subset_left, hBc n, hn⟩
end InnerRegularWRT
namespace InnerRegular
variable [TopologicalSpace α]
/-- The measure of a measurable set is the supremum of the measures of compact sets it contains. -/
theorem _root_.MeasurableSet.measure_eq_iSup_isCompact ⦃U : Set α⦄ (hU : MeasurableSet U)
(μ : Measure α) [InnerRegular μ] :
μ U = ⨆ (K : Set α) (_ : K ⊆ U) (_ : IsCompact K), μ K :=
InnerRegular.innerRegular.measure_eq_iSup hU
instance zero : InnerRegular (0 : Measure α) :=
⟨fun _ _ _r hr => ⟨∅, empty_subset _, isCompact_empty, hr⟩⟩
instance smul [h : InnerRegular μ] (c : ℝ≥0∞) : InnerRegular (c • μ) :=
⟨InnerRegularWRT.smul h.innerRegular c⟩
instance smul_nnreal [InnerRegular μ] (c : ℝ≥0) : InnerRegular (c • μ) := smul (c : ℝ≥0∞)
instance (priority := 100) [InnerRegular μ] : InnerRegularCompactLTTop μ :=
⟨fun _s hs r hr ↦ InnerRegular.innerRegular hs.1 r hr⟩
lemma innerRegularWRT_isClosed_isOpen [R1Space α] [OpensMeasurableSpace α] [h : InnerRegular μ] :
InnerRegularWRT μ IsClosed IsOpen := by
intro U hU r hr
rcases h.innerRegular hU.measurableSet r hr with ⟨K, KU, K_comp, hK⟩
exact ⟨closure K, K_comp.closure_subset_of_isOpen hU KU, isClosed_closure,
hK.trans_le (measure_mono subset_closure)⟩
theorem exists_isCompact_not_null [InnerRegular μ] : (∃ K, IsCompact K ∧ μ K ≠ 0) ↔ μ ≠ 0 := by
simp_rw [Ne, ← measure_univ_eq_zero, MeasurableSet.univ.measure_eq_iSup_isCompact,
ENNReal.iSup_eq_zero, not_forall, exists_prop, subset_univ, true_and]
/-- If `μ` is inner regular, then any measurable set can be approximated by a compact subset.
See also `MeasurableSet.exists_isCompact_lt_add_of_ne_top`. -/
theorem _root_.MeasurableSet.exists_lt_isCompact [InnerRegular μ] ⦃A : Set α⦄
(hA : MeasurableSet A) {r : ℝ≥0∞} (hr : r < μ A) :
∃ K, K ⊆ A ∧ IsCompact K ∧ r < μ K :=
InnerRegular.innerRegular hA _ hr
protected theorem map_of_continuous [BorelSpace α] [MeasurableSpace β] [TopologicalSpace β]
[BorelSpace β] [h : InnerRegular μ] {f : α → β} (hf : Continuous f) :
InnerRegular (Measure.map f μ) :=
⟨InnerRegularWRT.map h.innerRegular hf.aemeasurable (fun _s hs ↦ hf.measurable hs)
(fun _K hK ↦ hK.image hf) (fun _s hs ↦ hs)⟩
protected theorem map [BorelSpace α] [MeasurableSpace β] [TopologicalSpace β]
[BorelSpace β] [InnerRegular μ] (f : α ≃ₜ β) : (Measure.map f μ).InnerRegular :=
InnerRegular.map_of_continuous f.continuous
protected theorem map_iff [BorelSpace α] [MeasurableSpace β] [TopologicalSpace β]
[BorelSpace β] (f : α ≃ₜ β) :
InnerRegular (Measure.map f μ) ↔ InnerRegular μ := by
refine ⟨fun h ↦ ?_, fun h ↦ h.map f⟩
convert h.map f.symm
rw [map_map f.symm.continuous.measurable f.continuous.measurable]
simp
open Topology in
protected theorem comap' [BorelSpace α]
{mβ : MeasurableSpace β} [TopologicalSpace β] [BorelSpace β]
(μ : Measure β) [H : InnerRegular μ] {f : α → β} (hf : IsOpenEmbedding f) :
(μ.comap f).InnerRegular where
innerRegular :=
H.innerRegular.comap hf.measurableEmbedding
(fun _ hU ↦ hf.measurableEmbedding.measurableSet_image' hU)
(fun _ hKrange hK ↦ hf.isInducing.isCompact_preimage' hK hKrange)
protected theorem comap [BorelSpace α] {mβ : MeasurableSpace β} [TopologicalSpace β] [BorelSpace β]
{μ : Measure β} [InnerRegular μ] (f : α ≃ₜ β) :
(μ.comap f).InnerRegular :=
InnerRegular.comap' μ f.isOpenEmbedding
end InnerRegular
namespace InnerRegularCompactLTTop
variable [TopologicalSpace α]
/-- If `μ` is inner regular for finite measure sets with respect to compact sets,
then any measurable set of finite measure can be approximated by a
compact subset. See also `MeasurableSet.exists_lt_isCompact_of_ne_top`. -/
theorem _root_.MeasurableSet.exists_isCompact_lt_add [InnerRegularCompactLTTop μ]
⦃A : Set α⦄ (hA : MeasurableSet A) (h'A : μ A ≠ ∞) {ε : ℝ≥0∞} (hε : ε ≠ 0) :
∃ K, K ⊆ A ∧ IsCompact K ∧ μ A < μ K + ε :=
InnerRegularCompactLTTop.innerRegular.exists_subset_lt_add isCompact_empty ⟨hA, h'A⟩ h'A hε
/-- If `μ` is inner regular for finite measure sets with respect to compact sets,
then any measurable set of finite measure can be approximated by a compact closed subset.
Compared to `MeasurableSet.exists_isCompact_lt_add`,
this version additionally assumes that `α` is an R₁ space with Borel σ-algebra.
-/
theorem _root_.MeasurableSet.exists_isCompact_isClosed_lt_add
[InnerRegularCompactLTTop μ] [R1Space α] [BorelSpace α]
⦃A : Set α⦄ (hA : MeasurableSet A) (h'A : μ A ≠ ∞) {ε : ℝ≥0∞} (hε : ε ≠ 0) :
∃ K, K ⊆ A ∧ IsCompact K ∧ IsClosed K ∧ μ A < μ K + ε :=
let ⟨K, hKA, hK, hμK⟩ := hA.exists_isCompact_lt_add h'A hε
⟨closure K, hK.closure_subset_measurableSet hA hKA, hK.closure, isClosed_closure,
by rwa [hK.measure_closure]⟩
/-- If `μ` is inner regular for finite measure sets with respect to compact sets,
then any measurable set of finite measure can be approximated by a
compact subset. See also `MeasurableSet.exists_isCompact_lt_add` and
`MeasurableSet.exists_lt_isCompact_of_ne_top`. -/
theorem _root_.MeasurableSet.exists_isCompact_diff_lt [OpensMeasurableSpace α] [T2Space α]
[InnerRegularCompactLTTop μ] ⦃A : Set α⦄ (hA : MeasurableSet A) (h'A : μ A ≠ ∞)
{ε : ℝ≥0∞} (hε : ε ≠ 0) :
∃ K, K ⊆ A ∧ IsCompact K ∧ μ (A \ K) < ε := by
rcases hA.exists_isCompact_lt_add h'A hε with ⟨K, hKA, hKc, hK⟩
exact ⟨K, hKA, hKc, measure_diff_lt_of_lt_add hKc.nullMeasurableSet hKA
(ne_top_of_le_ne_top h'A <| measure_mono hKA) hK⟩
/-- If `μ` is inner regular for finite measure sets with respect to compact sets,
then any measurable set of finite measure can be approximated by a compact closed subset.
Compared to `MeasurableSet.exists_isCompact_diff_lt`,
this lemma additionally assumes that `α` is an R₁ space with Borel σ-algebra. -/
theorem _root_.MeasurableSet.exists_isCompact_isClosed_diff_lt [BorelSpace α] [R1Space α]
[InnerRegularCompactLTTop μ] ⦃A : Set α⦄ (hA : MeasurableSet A) (h'A : μ A ≠ ∞)
{ε : ℝ≥0∞} (hε : ε ≠ 0) :
∃ K, K ⊆ A ∧ IsCompact K ∧ IsClosed K ∧ μ (A \ K) < ε := by
rcases hA.exists_isCompact_isClosed_lt_add h'A hε with ⟨K, hKA, hKco, hKcl, hK⟩
exact ⟨K, hKA, hKco, hKcl, measure_diff_lt_of_lt_add hKcl.nullMeasurableSet hKA
(ne_top_of_le_ne_top h'A <| measure_mono hKA) hK⟩
/-- If `μ` is inner regular for finite measure sets with respect to compact sets,
then any measurable set of finite measure can be approximated by a
compact subset. See also `MeasurableSet.exists_isCompact_lt_add`. -/
theorem _root_.MeasurableSet.exists_lt_isCompact_of_ne_top [InnerRegularCompactLTTop μ] ⦃A : Set α⦄
(hA : MeasurableSet A) (h'A : μ A ≠ ∞) {r : ℝ≥0∞} (hr : r < μ A) :
∃ K, K ⊆ A ∧ IsCompact K ∧ r < μ K :=
InnerRegularCompactLTTop.innerRegular ⟨hA, h'A⟩ _ hr
/-- If `μ` is inner regular for finite measure sets with respect to compact sets,
any measurable set of finite mass can be approximated from inside by compact sets. -/
theorem _root_.MeasurableSet.measure_eq_iSup_isCompact_of_ne_top [InnerRegularCompactLTTop μ]
⦃A : Set α⦄ (hA : MeasurableSet A) (h'A : μ A ≠ ∞) :
μ A = ⨆ (K) (_ : K ⊆ A) (_ : IsCompact K), μ K :=
InnerRegularCompactLTTop.innerRegular.measure_eq_iSup ⟨hA, h'A⟩
/-- If `μ` is inner regular for finite measure sets with respect to compact sets, then its
restriction to any set also is. -/
instance restrict [h : InnerRegularCompactLTTop μ] (A : Set α) :
InnerRegularCompactLTTop (μ.restrict A) :=
⟨InnerRegularWRT.restrict h.innerRegular A⟩
instance (priority := 50) [h : InnerRegularCompactLTTop μ] [IsFiniteMeasure μ] :
InnerRegular μ := by
constructor
convert h.innerRegular with s
simp [measure_ne_top μ s]
instance (priority := 50) [BorelSpace α] [R1Space α] [InnerRegularCompactLTTop μ]
[IsFiniteMeasure μ] : WeaklyRegular μ :=
InnerRegular.innerRegularWRT_isClosed_isOpen.weaklyRegular_of_finite _
instance (priority := 50) [BorelSpace α] [R1Space α] [h : InnerRegularCompactLTTop μ]
[IsFiniteMeasure μ] : Regular μ where
innerRegular := InnerRegularWRT.trans h.innerRegular <|
InnerRegularWRT.of_imp (fun U hU ↦ ⟨hU.measurableSet, measure_ne_top μ U⟩)
protected lemma _root_.IsCompact.exists_isOpen_lt_of_lt [InnerRegularCompactLTTop μ]
[IsLocallyFiniteMeasure μ] [R1Space α] [BorelSpace α] {K : Set α}
(hK : IsCompact K) (r : ℝ≥0∞) (hr : μ K < r) :
∃ U, K ⊆ U ∧ IsOpen U ∧ μ U < r := by
rcases hK.exists_open_superset_measure_lt_top μ with ⟨V, hKV, hVo, hμV⟩
have := Fact.mk hμV
obtain ⟨U, hKU, hUo, hμU⟩ : ∃ U, K ⊆ U ∧ IsOpen U ∧ μ.restrict V U < r :=
exists_isOpen_lt_of_lt K r <| (restrict_apply_le _ _).trans_lt hr
refine ⟨U ∩ V, subset_inter hKU hKV, hUo.inter hVo, ?_⟩
rwa [restrict_apply hUo.measurableSet] at hμU
/-- If `μ` is inner regular for finite measure sets with respect to compact sets
and is locally finite in an R₁ space,
then any compact set can be approximated from outside by open sets. -/
protected lemma _root_.IsCompact.measure_eq_iInf_isOpen [InnerRegularCompactLTTop μ]
[IsLocallyFiniteMeasure μ] [R1Space α] [BorelSpace α] {K : Set α} (hK : IsCompact K) :
μ K = ⨅ (U : Set α) (_ : K ⊆ U) (_ : IsOpen U), μ U := by
apply le_antisymm
· simp only [le_iInf_iff]
exact fun U KU _ ↦ measure_mono KU
· apply le_of_forall_gt
simpa only [iInf_lt_iff, exists_prop, exists_and_left] using hK.exists_isOpen_lt_of_lt
protected theorem _root_.IsCompact.exists_isOpen_lt_add [InnerRegularCompactLTTop μ]
[IsLocallyFiniteMeasure μ] [R1Space α] [BorelSpace α]
{K : Set α} (hK : IsCompact K) {ε : ℝ≥0∞} (hε : ε ≠ 0) :
∃ U, K ⊆ U ∧ IsOpen U ∧ μ U < μ K + ε :=
hK.exists_isOpen_lt_of_lt _ (ENNReal.lt_add_right hK.measure_lt_top.ne hε)
/-- Let `μ` be a locally finite measure on an R₁ topological space with Borel σ-algebra.
If `μ` is inner regular for finite measure sets with respect to compact sets,
then any measurable set of finite measure can be approximated in measure by an open set.
See also `Set.exists_isOpen_lt_of_lt` and `MeasurableSet.exists_isOpen_diff_lt`
for the case of an outer regular measure. -/
protected theorem _root_.MeasurableSet.exists_isOpen_symmDiff_lt [InnerRegularCompactLTTop μ]
[IsLocallyFiniteMeasure μ] [R1Space α] [BorelSpace α]
{s : Set α} (hs : MeasurableSet s) (hμs : μ s ≠ ∞) {ε : ℝ≥0∞} (hε : ε ≠ 0) :
∃ U, IsOpen U ∧ μ U < ∞ ∧ μ (U ∆ s) < ε := by
have : ε / 2 ≠ 0 := (ENNReal.half_pos hε).ne'
rcases hs.exists_isCompact_isClosed_diff_lt hμs this with ⟨K, hKs, hKco, hKcl, hμK⟩
rcases hKco.exists_isOpen_lt_add (μ := μ) this with ⟨U, hKU, hUo, hμU⟩
refine ⟨U, hUo, hμU.trans_le le_top, ?_⟩
rw [← ENNReal.add_halves ε, measure_symmDiff_eq hUo.nullMeasurableSet hs.nullMeasurableSet]
gcongr
· calc
μ (U \ s) ≤ μ (U \ K) := by gcongr
_ < ε / 2 := by
apply measure_diff_lt_of_lt_add hKcl.nullMeasurableSet hKU _ hμU
exact ne_top_of_le_ne_top hμs (by gcongr)
· exact lt_of_le_of_lt (by gcongr) hμK
/-- Let `μ` be a locally finite measure on an R₁ topological space with Borel σ-algebra.
If `μ` is inner regular for finite measure sets with respect to compact sets,
then any null measurable set of finite measure can be approximated in measure by an open set.
See also `Set.exists_isOpen_lt_of_lt` and `MeasurableSet.exists_isOpen_diff_lt`
for the case of an outer regular measure. -/
protected theorem _root_.MeasureTheory.NullMeasurableSet.exists_isOpen_symmDiff_lt
[InnerRegularCompactLTTop μ] [IsLocallyFiniteMeasure μ] [R1Space α] [BorelSpace α]
{s : Set α} (hs : NullMeasurableSet s μ) (hμs : μ s ≠ ∞) {ε : ℝ≥0∞} (hε : ε ≠ 0) :
∃ U, IsOpen U ∧ μ U < ∞ ∧ μ (U ∆ s) < ε := by
rcases hs with ⟨t, htm, hst⟩
rcases htm.exists_isOpen_symmDiff_lt (by rwa [← measure_congr hst]) hε with ⟨U, hUo, hμU, hUs⟩
refine ⟨U, hUo, hμU, ?_⟩
rwa [measure_congr <| (ae_eq_refl _).symmDiff hst]
instance smul [h : InnerRegularCompactLTTop μ] (c : ℝ≥0∞) : InnerRegularCompactLTTop (c • μ) := by
by_cases hc : c = 0
· simp only [hc, zero_smul]
infer_instance
by_cases h'c : c = ∞
· constructor
intro s hs r hr
by_cases h's : μ s = 0
· simp [h's] at hr
· simp [h'c, h's] at hs
· constructor
convert InnerRegularWRT.smul h.innerRegular c using 2 with s
have : (c • μ) s ≠ ∞ ↔ μ s ≠ ∞ := by simp [ENNReal.mul_eq_top, hc, h'c]
simp only [this]
instance smul_nnreal [InnerRegularCompactLTTop μ] (c : ℝ≥0) :
InnerRegularCompactLTTop (c • μ) :=
inferInstanceAs (InnerRegularCompactLTTop ((c : ℝ≥0∞) • μ))
instance (priority := 80) [InnerRegularCompactLTTop μ] [SigmaFinite μ] : InnerRegular μ :=
⟨InnerRegularCompactLTTop.innerRegular.trans InnerRegularWRT.of_sigmaFinite⟩
protected theorem map_of_continuous [BorelSpace α] [MeasurableSpace β] [TopologicalSpace β]
[BorelSpace β] [h : InnerRegularCompactLTTop μ] {f : α → β} (hf : Continuous f) :
InnerRegularCompactLTTop (Measure.map f μ) := by
constructor
refine InnerRegularWRT.map h.innerRegular hf.aemeasurable ?_ (fun K hK ↦ hK.image hf) ?_
· rintro s ⟨hs, h's⟩
exact ⟨hf.measurable hs, by rwa [map_apply hf.measurable hs] at h's⟩
· rintro s ⟨hs, -⟩
exact hs
end InnerRegularCompactLTTop
-- Generalized and moved to another file
namespace WeaklyRegular
variable [TopologicalSpace α]
instance zero : WeaklyRegular (0 : Measure α) :=
⟨fun _ _ _r hr => ⟨∅, empty_subset _, isClosed_empty, hr⟩⟩
/-- If `μ` is a weakly regular measure, then any open set can be approximated by a closed subset. -/
theorem _root_.IsOpen.exists_lt_isClosed [WeaklyRegular μ] ⦃U : Set α⦄ (hU : IsOpen U) {r : ℝ≥0∞}
(hr : r < μ U) : ∃ F, F ⊆ U ∧ IsClosed F ∧ r < μ F :=
WeaklyRegular.innerRegular hU r hr
/-- If `μ` is a weakly regular measure, then any open set can be approximated by a closed subset. -/
theorem _root_.IsOpen.measure_eq_iSup_isClosed ⦃U : Set α⦄ (hU : IsOpen U) (μ : Measure α)
[WeaklyRegular μ] : μ U = ⨆ (F) (_ : F ⊆ U) (_ : IsClosed F), μ F :=
WeaklyRegular.innerRegular.measure_eq_iSup hU
theorem innerRegular_measurable [WeaklyRegular μ] :
InnerRegularWRT μ IsClosed fun s => MeasurableSet s ∧ μ s ≠ ∞ :=
WeaklyRegular.innerRegular.measurableSet_of_isOpen (fun _ _ h₁ h₂ ↦ h₁.inter h₂.isClosed_compl)
/-- If `s` is a measurable set, a weakly regular measure `μ` is finite on `s`, and `ε` is a positive
number, then there exist a closed set `K ⊆ s` such that `μ s < μ K + ε`. -/
theorem _root_.MeasurableSet.exists_isClosed_lt_add [WeaklyRegular μ] {s : Set α}
(hs : MeasurableSet s) (hμs : μ s ≠ ∞) {ε : ℝ≥0∞} (hε : ε ≠ 0) :
∃ K, K ⊆ s ∧ IsClosed K ∧ μ s < μ K + ε :=
innerRegular_measurable.exists_subset_lt_add isClosed_empty ⟨hs, hμs⟩ hμs hε
theorem _root_.MeasurableSet.exists_isClosed_diff_lt [OpensMeasurableSpace α] [WeaklyRegular μ]
⦃A : Set α⦄ (hA : MeasurableSet A) (h'A : μ A ≠ ∞) {ε : ℝ≥0∞} (hε : ε ≠ 0) :
∃ F, F ⊆ A ∧ IsClosed F ∧ μ (A \ F) < ε := by
rcases hA.exists_isClosed_lt_add h'A hε with ⟨F, hFA, hFc, hF⟩
exact ⟨F, hFA, hFc, measure_diff_lt_of_lt_add hFc.nullMeasurableSet hFA
(ne_top_of_le_ne_top h'A <| measure_mono hFA) hF⟩
/-- Given a weakly regular measure, any measurable set of finite mass can be approximated from
inside by closed sets. -/
theorem _root_.MeasurableSet.exists_lt_isClosed_of_ne_top [WeaklyRegular μ] ⦃A : Set α⦄
(hA : MeasurableSet A) (h'A : μ A ≠ ∞) {r : ℝ≥0∞} (hr : r < μ A) :
∃ K, K ⊆ A ∧ IsClosed K ∧ r < μ K :=
innerRegular_measurable ⟨hA, h'A⟩ _ hr
/-- Given a weakly regular measure, any measurable set of finite mass can be approximated from
inside by closed sets. -/
theorem _root_.MeasurableSet.measure_eq_iSup_isClosed_of_ne_top [WeaklyRegular μ] ⦃A : Set α⦄
(hA : MeasurableSet A) (h'A : μ A ≠ ∞) : μ A = ⨆ (K) (_ : K ⊆ A) (_ : IsClosed K), μ K :=
innerRegular_measurable.measure_eq_iSup ⟨hA, h'A⟩
/-- The restriction of a weakly regular measure to a measurable set of finite measure is
weakly regular. -/
theorem restrict_of_measure_ne_top [BorelSpace α] [WeaklyRegular μ] {A : Set α}
(h'A : μ A ≠ ∞) : WeaklyRegular (μ.restrict A) := by
haveI : Fact (μ A < ∞) := ⟨h'A.lt_top⟩
refine InnerRegularWRT.weaklyRegular_of_finite (μ.restrict A) (fun V V_open r hr ↦ ?_)
have : InnerRegularWRT (μ.restrict A) IsClosed (fun s ↦ MeasurableSet s) :=
InnerRegularWRT.restrict_of_measure_ne_top innerRegular_measurable h'A
exact this V_open.measurableSet r hr
-- see Note [lower instance priority]
/-- Any finite measure on a metrizable space (or even a pseudo metrizable space)
is weakly regular. -/
instance (priority := 100) of_pseudoMetrizableSpace_of_isFiniteMeasure {X : Type*}
[TopologicalSpace X] [PseudoMetrizableSpace X] [MeasurableSpace X] [BorelSpace X]
(μ : Measure X) [IsFiniteMeasure μ] :
WeaklyRegular μ :=
(InnerRegularWRT.of_pseudoMetrizableSpace μ).weaklyRegular_of_finite μ
-- see Note [lower instance priority]
/-- Any locally finite measure on a second countable metrizable space
(or even a pseudo metrizable space) is weakly regular. -/
instance (priority := 100) of_pseudoMetrizableSpace_secondCountable_of_locallyFinite {X : Type*}
[TopologicalSpace X] [PseudoMetrizableSpace X] [SecondCountableTopology X] [MeasurableSpace X]
[BorelSpace X] (μ : Measure X) [IsLocallyFiniteMeasure μ] : WeaklyRegular μ :=
have : OuterRegular μ := by
refine (μ.finiteSpanningSetsInOpen'.mono' fun U hU => ?_).outerRegular
have : Fact (μ U < ∞) := ⟨hU.2⟩
exact ⟨hU.1, inferInstance⟩
⟨InnerRegularWRT.of_pseudoMetrizableSpace μ⟩
protected theorem smul [WeaklyRegular μ] {x : ℝ≥0∞} (hx : x ≠ ∞) : (x • μ).WeaklyRegular := by
haveI := OuterRegular.smul μ hx
exact ⟨WeaklyRegular.innerRegular.smul x⟩
instance smul_nnreal [WeaklyRegular μ] (c : ℝ≥0) : WeaklyRegular (c • μ) :=
WeaklyRegular.smul coe_ne_top
end WeaklyRegular
namespace Regular
variable [TopologicalSpace α]
instance zero : Regular (0 : Measure α) :=
⟨fun _ _ _r hr => ⟨∅, empty_subset _, isCompact_empty, hr⟩⟩
/-- If `μ` is a regular measure, then any open set can be approximated by a compact subset. -/
theorem _root_.IsOpen.exists_lt_isCompact [Regular μ] ⦃U : Set α⦄ (hU : IsOpen U) {r : ℝ≥0∞}
(hr : r < μ U) : ∃ K, K ⊆ U ∧ IsCompact K ∧ r < μ K :=
Regular.innerRegular hU r hr
/-- The measure of an open set is the supremum of the measures of compact sets it contains. -/
theorem _root_.IsOpen.measure_eq_iSup_isCompact ⦃U : Set α⦄ (hU : IsOpen U) (μ : Measure α)
[Regular μ] : μ U = ⨆ (K : Set α) (_ : K ⊆ U) (_ : IsCompact K), μ K :=
Regular.innerRegular.measure_eq_iSup hU
theorem exists_isCompact_not_null [Regular μ] : (∃ K, IsCompact K ∧ μ K ≠ 0) ↔ μ ≠ 0 := by
simp_rw [Ne, ← measure_univ_eq_zero, isOpen_univ.measure_eq_iSup_isCompact,
ENNReal.iSup_eq_zero, not_forall, exists_prop, subset_univ, true_and]
/-- If `μ` is a regular measure, then any measurable set of finite measure can be approximated by a
compact subset. See also `MeasurableSet.exists_isCompact_lt_add` and
`MeasurableSet.exists_lt_isCompact_of_ne_top`. -/
instance (priority := 100) [Regular μ] : InnerRegularCompactLTTop μ :=
⟨Regular.innerRegular.measurableSet_of_isOpen (fun _ _ hs hU ↦ hs.diff hU)⟩
protected theorem map [BorelSpace α] [MeasurableSpace β] [TopologicalSpace β]
[BorelSpace β] [Regular μ] (f : α ≃ₜ β) : (Measure.map f μ).Regular := by
haveI := OuterRegular.map f μ
haveI := IsFiniteMeasureOnCompacts.map μ f
exact
⟨Regular.innerRegular.map' f.toMeasurableEquiv
(fun U hU => hU.preimage f.continuous)
(fun K hK => hK.image f.continuous)⟩
protected theorem map_iff [BorelSpace α] [MeasurableSpace β] [TopologicalSpace β]
[BorelSpace β] (f : α ≃ₜ β) :
Regular (Measure.map f μ) ↔ Regular μ := by
refine ⟨fun h ↦ ?_, fun h ↦ h.map f⟩
convert h.map f.symm
rw [map_map f.symm.continuous.measurable f.continuous.measurable]
simp
open Topology in
protected theorem comap' [BorelSpace α]
{mβ : MeasurableSpace β} [TopologicalSpace β] [BorelSpace β] (μ : Measure β) [Regular μ]
{f : α → β} (hf : IsOpenEmbedding f) : (μ.comap f).Regular := by
haveI := OuterRegular.comap' μ hf.continuous hf.measurableEmbedding
haveI := IsFiniteMeasureOnCompacts.comap' μ hf.continuous hf.measurableEmbedding
exact ⟨InnerRegularWRT.comap Regular.innerRegular hf.measurableEmbedding
(fun _ hU ↦ hf.isOpen_iff_image_isOpen.mp hU)
(fun _ hKrange hK ↦ hf.isInducing.isCompact_preimage' hK hKrange)⟩
protected theorem comap [BorelSpace α] {mβ : MeasurableSpace β} [TopologicalSpace β]
[BorelSpace β] (μ : Measure β) [Regular μ] (f : α ≃ₜ β) : (μ.comap f).Regular :=
Regular.comap' μ f.isOpenEmbedding
protected theorem smul [Regular μ] {x : ℝ≥0∞} (hx : x ≠ ∞) : (x • μ).Regular := by
haveI := OuterRegular.smul μ hx
haveI := IsFiniteMeasureOnCompacts.smul μ hx
exact ⟨Regular.innerRegular.smul x⟩
instance smul_nnreal [Regular μ] (c : ℝ≥0) : Regular (c • μ) := Regular.smul coe_ne_top
/-- The restriction of a regular measure to a set of finite measure is regular. -/
theorem restrict_of_measure_ne_top [R1Space α] [BorelSpace α] [Regular μ]
{A : Set α} (h'A : μ A ≠ ∞) : Regular (μ.restrict A) := by
have : WeaklyRegular (μ.restrict A) := WeaklyRegular.restrict_of_measure_ne_top h'A
constructor
intro V hV r hr
have R : restrict μ A V ≠ ∞ := by
rw [restrict_apply hV.measurableSet]
exact ((measure_mono inter_subset_right).trans_lt h'A.lt_top).ne
exact MeasurableSet.exists_lt_isCompact_of_ne_top hV.measurableSet R hr
end Regular
instance Regular.domSMul {G A : Type*} [Group G] [AddCommGroup A] [DistribMulAction G A]
[MeasurableSpace A] [TopologicalSpace A] [BorelSpace A] [ContinuousConstSMul G A]
{μ : Measure A} (g : Gᵈᵐᵃ) [Regular μ] : Regular (g • μ) :=
.map <| .smul ((DomMulAct.mk.symm g : G)⁻¹)
-- see Note [lower instance priority]
/-- Any locally finite measure on a `σ`-compact pseudometrizable space is regular. -/
instance (priority := 100) Regular.of_sigmaCompactSpace_of_isLocallyFiniteMeasure {X : Type*}
[TopologicalSpace X] [PseudoMetrizableSpace X] [SigmaCompactSpace X] [MeasurableSpace X]
[BorelSpace X] (μ : Measure X) [IsLocallyFiniteMeasure μ] : Regular μ := by
let A : PseudoMetricSpace X := TopologicalSpace.pseudoMetrizableSpacePseudoMetric X
exact ⟨(InnerRegularWRT.isCompact_isClosed μ).trans (InnerRegularWRT.of_pseudoMetrizableSpace μ)⟩
/-- Any sigma finite measure on a `σ`-compact pseudometrizable space is inner regular. -/
instance (priority := 100) {X : Type*}
[TopologicalSpace X] [PseudoMetrizableSpace X] [SigmaCompactSpace X] [MeasurableSpace X]
[BorelSpace X] (μ : Measure X) [SigmaFinite μ] : InnerRegular μ := by
refine ⟨(InnerRegularWRT.isCompact_isClosed μ).trans ?_⟩
refine InnerRegularWRT.of_restrict (fun n ↦ ?_) (iUnion_spanningSets μ).superset
(monotone_spanningSets μ)
have : Fact (μ (spanningSets μ n) < ∞) := ⟨measure_spanningSets_lt_top μ n⟩
exact WeaklyRegular.innerRegular_measurable.trans InnerRegularWRT.of_sigmaFinite
end Measure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Doubling.lean | import Mathlib.Analysis.SpecialFunctions.Log.Base
import Mathlib.MeasureTheory.Measure.MeasureSpaceDef
/-!
# Uniformly locally doubling measures
A uniformly locally doubling measure `μ` on a metric space is a measure for which there exists a
constant `C` such that for all sufficiently small radii `ε`, and for any centre, the measure of a
ball of radius `2 * ε` is bounded by `C` times the measure of the concentric ball of radius `ε`.
This file records basic facts about uniformly locally doubling measures.
## Main definitions
* `IsUnifLocDoublingMeasure`: the definition of a uniformly locally doubling measure (as a
typeclass).
* `IsUnifLocDoublingMeasure.doublingConstant`: a function yielding the doubling constant `C`
appearing in the definition of a uniformly locally doubling measure.
-/
noncomputable section
open Set Filter Metric MeasureTheory TopologicalSpace ENNReal NNReal Topology
/-- A measure `μ` is said to be a uniformly locally doubling measure if there exists a constant `C`
such that for all sufficiently small radii `ε`, and for any centre, the measure of a ball of radius
`2 * ε` is bounded by `C` times the measure of the concentric ball of radius `ε`.
Note: it is important that this definition makes a demand only for sufficiently small `ε`. For
example we want hyperbolic space to carry the instance `IsUnifLocDoublingMeasure volume` but
volumes grow exponentially in hyperbolic space. To be really explicit, consider the hyperbolic plane
of curvature -1, the area of a disc of radius `ε` is `A(ε) = 2π(cosh(ε) - 1)` so
`A(2ε)/A(ε) ~ exp(ε)`. -/
class IsUnifLocDoublingMeasure {α : Type*} [PseudoMetricSpace α] [MeasurableSpace α]
(μ : Measure α) : Prop where
exists_measure_closedBall_le_mul'' :
∃ C : ℝ≥0, ∀ᶠ ε in 𝓝[>] 0, ∀ x, μ (closedBall x (2 * ε)) ≤ C * μ (closedBall x ε)
namespace IsUnifLocDoublingMeasure
variable {α : Type*} [PseudoMetricSpace α] [MeasurableSpace α] (μ : Measure α)
[IsUnifLocDoublingMeasure μ]
theorem exists_measure_closedBall_le_mul :
∃ C : ℝ≥0, ∀ᶠ ε in 𝓝[>] 0, ∀ x, μ (closedBall x (2 * ε)) ≤ C * μ (closedBall x ε) :=
exists_measure_closedBall_le_mul''
/-- A doubling constant for a uniformly locally doubling measure.
See also `IsUnifLocDoublingMeasure.scalingConstantOf`. -/
def doublingConstant : ℝ≥0 :=
Classical.choose <| exists_measure_closedBall_le_mul μ
theorem exists_measure_closedBall_le_mul' :
∀ᶠ ε in 𝓝[>] 0, ∀ x, μ (closedBall x (2 * ε)) ≤ doublingConstant μ * μ (closedBall x ε) :=
Classical.choose_spec <| exists_measure_closedBall_le_mul μ
theorem exists_eventually_forall_measure_closedBall_le_mul (K : ℝ) :
∃ C : ℝ≥0, ∀ᶠ ε in 𝓝[>] 0, ∀ x, ∀ t ≤ K, μ (closedBall x (t * ε)) ≤ C * μ (closedBall x ε) := by
let C := doublingConstant μ
have hμ :
∀ n : ℕ, ∀ᶠ ε in 𝓝[>] 0, ∀ x,
μ (closedBall x ((2 : ℝ) ^ n * ε)) ≤ ↑(C ^ n) * μ (closedBall x ε) := fun n ↦ by
induction n with
| zero => simp
| succ n ih =>
replace ih := eventually_nhdsGT_zero_mul_left (two_pos : 0 < (2 : ℝ)) ih
refine (ih.and (exists_measure_closedBall_le_mul' μ)).mono fun ε hε x => ?_
calc
μ (closedBall x ((2 : ℝ) ^ (n + 1) * ε)) = μ (closedBall x ((2 : ℝ) ^ n * (2 * ε))) := by
rw [pow_succ, mul_assoc]
_ ≤ ↑(C ^ n) * μ (closedBall x (2 * ε)) := hε.1 x
_ ≤ ↑(C ^ n) * (C * μ (closedBall x ε)) := by gcongr; exact hε.2 x
_ = ↑(C ^ (n + 1)) * μ (closedBall x ε) := by rw [← mul_assoc, pow_succ, ENNReal.coe_mul]
rcases lt_or_ge K 1 with (hK | hK)
· refine ⟨1, ?_⟩
simp only [ENNReal.coe_one, one_mul]
refine eventually_mem_nhdsWithin.mono fun ε hε x t ht ↦ ?_
gcongr
nlinarith [mem_Ioi.mp hε]
· use C ^ ⌈Real.logb 2 K⌉₊
filter_upwards [hμ ⌈Real.logb 2 K⌉₊, eventually_mem_nhdsWithin] with ε hε hε₀ x t ht
refine le_trans ?_ (hε x)
gcongr
· exact (mem_Ioi.mp hε₀).le
· refine ht.trans ?_
rw [← Real.rpow_natCast, ← Real.logb_le_iff_le_rpow]
exacts [Nat.le_ceil _, by simp, by linarith]
/-- A variant of `IsUnifLocDoublingMeasure.doublingConstant` which allows for scaling the
radius by values other than `2`. -/
def scalingConstantOf (K : ℝ) : ℝ≥0 :=
max (Classical.choose <| exists_eventually_forall_measure_closedBall_le_mul μ K) 1
@[simp]
theorem one_le_scalingConstantOf (K : ℝ) : 1 ≤ scalingConstantOf μ K :=
le_max_of_le_right <| le_refl 1
theorem eventually_measure_mul_le_scalingConstantOf_mul (K : ℝ) :
∃ R : ℝ,
0 < R ∧
∀ x t r, t ∈ Ioc 0 K → r ≤ R →
μ (closedBall x (t * r)) ≤ scalingConstantOf μ K * μ (closedBall x r) := by
have h := Classical.choose_spec (exists_eventually_forall_measure_closedBall_le_mul μ K)
rcases mem_nhdsGT_iff_exists_Ioc_subset.1 h with ⟨R, Rpos, hR⟩
refine ⟨R, Rpos, fun x t r ht hr => ?_⟩
rcases lt_trichotomy r 0 with (rneg | rfl | rpos)
· have : t * r < 0 := mul_neg_of_pos_of_neg ht.1 rneg
simp only [closedBall_eq_empty.2 this, measure_empty, zero_le']
· simp only [mul_zero]
refine le_mul_of_one_le_of_le ?_ le_rfl
apply ENNReal.one_le_coe_iff.2 (le_max_right _ _)
· apply (hR ⟨rpos, hr⟩ x t ht.2).trans
gcongr
apply le_max_left
theorem eventually_measure_le_scaling_constant_mul (K : ℝ) :
∀ᶠ r in 𝓝[>] 0, ∀ x, μ (closedBall x (K * r)) ≤ scalingConstantOf μ K * μ (closedBall x r) := by
filter_upwards [Classical.choose_spec
(exists_eventually_forall_measure_closedBall_le_mul μ K)] with r hr x
grw [hr x K le_rfl, scalingConstantOf, ← le_max_left]
theorem eventually_measure_le_scaling_constant_mul' (K : ℝ) (hK : 0 < K) :
∀ᶠ r in 𝓝[>] 0, ∀ x,
μ (closedBall x r) ≤ scalingConstantOf μ K⁻¹ * μ (closedBall x (K * r)) := by
convert eventually_nhdsGT_zero_mul_left hK (eventually_measure_le_scaling_constant_mul μ K⁻¹)
simp [inv_mul_cancel_left₀ hK.ne']
/-- A scale below which the doubling measure `μ` satisfies good rescaling properties when one
multiplies the radius of balls by at most `K`, as stated
in `IsUnifLocDoublingMeasure.measure_mul_le_scalingConstantOf_mul`. -/
def scalingScaleOf (K : ℝ) : ℝ :=
(eventually_measure_mul_le_scalingConstantOf_mul μ K).choose
theorem scalingScaleOf_pos (K : ℝ) : 0 < scalingScaleOf μ K :=
(eventually_measure_mul_le_scalingConstantOf_mul μ K).choose_spec.1
theorem measure_mul_le_scalingConstantOf_mul {K : ℝ} {x : α} {t r : ℝ} (ht : t ∈ Ioc 0 K)
(hr : r ≤ scalingScaleOf μ K) :
μ (closedBall x (t * r)) ≤ scalingConstantOf μ K * μ (closedBall x r) :=
(eventually_measure_mul_le_scalingConstantOf_mul μ K).choose_spec.2 x t r ht hr
end IsUnifLocDoublingMeasure |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Support.lean | import Mathlib.MeasureTheory.Measure.OpenPos
/-!
# Support of a Measure
This file develops the theory of the **support** of a measure `μ` on a
topological measurable space. The support is defined as the set of points whose every open
neighborhood has positive measure. We give equivalent characterizations, prove basic
measure-theoretic properties, and study interactions with sums, restrictions, and
absolute continuity. Under various Lindelöf conditions, the support is conull,
and various descriptions of the complement of the support are provided.
## Main definitions
* `Measure.support` : the support of a measure `μ`, defined as
`{x | ∃ᶠ u in (𝓝 x).smallSets, 0 < μ u}` — equivalently, every neighborhood of `x`
has positive `μ`-measure.
## Main results
* `compl_support_eq_sUnion` and `support_eq_sInter` : the complement of the support is the
union of open measure-zero sets, and the support is the intersection of closed sets whose
complements have measure zero.
* `isClosed_support` : the support is a closed set.
* `support_mem_ae_of_isLindelof` and `support_mem_ae` : under Lindelöf (or hereditarily
Lindelöf) hypotheses, the support is conull.
## Tags
measure, support, Lindelöf
-/
section Support
namespace MeasureTheory
namespace Measure
open scoped Topology
variable {X : Type*} [TopologicalSpace X] [MeasurableSpace X]
/-- A point `x` is in the support of `μ` if any open neighborhood of `x` has positive measure.
We provide the definition in terms of the filter-theoretic equivalent
`∃ᶠ u in (𝓝 x).smallSets, 0 < μ u`. -/
protected def support (μ : Measure X) : Set X := {x : X | ∃ᶠ u in (𝓝 x).smallSets, 0 < μ u}
variable {μ : Measure X}
theorem _root_.Filter.HasBasis.mem_measureSupport {ι : Sort*} {p : ι → Prop}
{s : ι → Set X} {x : X} (hl : (𝓝 x).HasBasis p s) :
x ∈ μ.support ↔ ∀ (i : ι), p i → 0 < μ (s i) :=
hl.frequently_smallSets pos_mono
/-- A point `x` is in the support of measure `μ` iff any neighborhood of `x` contains a
subset with positive measure. -/
lemma mem_support_iff {x : X} : x ∈ μ.support ↔
∃ᶠ u in (𝓝 x).smallSets, 0 < μ u := Iff.rfl
/-- A point `x` is in the support of measure `μ` iff every neighborhood of `x` has positive
measure. -/
lemma mem_support_iff_forall (x : X) : x ∈ μ.support ↔ ∀ U ∈ 𝓝 x, 0 < μ U :=
(𝓝 x).basis_sets.mem_measureSupport
lemma support_eq_univ [μ.IsOpenPosMeasure] : μ.support = Set.univ := by
simpa [Set.eq_univ_iff_forall, mem_support_iff_forall] using fun _ _ ↦ μ.measure_pos_of_mem_nhds
lemma AbsolutelyContinuous.support_mono {μ ν : Measure X} (hμν : μ ≪ ν) :
μ.support ⊆ ν.support :=
fun _ hx ↦ hx.mp <| .of_forall hμν.pos_mono
lemma support_mono {ν : Measure X} (h : μ ≤ ν) : μ.support ⊆ ν.support :=
h.absolutelyContinuous.support_mono
/-- A point `x` lies outside the support of `μ` iff all of the subsets of one of its neighborhoods
have measure zero. -/
lemma notMem_support_iff {x : X} : x ∉ μ.support ↔ ∀ᶠ u in (𝓝 x).smallSets, μ u = 0 := by
simp [mem_support_iff]
theorem _root_.Filter.HasBasis.notMem_measureSupport {ι : Sort*} {p : ι → Prop}
{s : ι → Set X} {x : X} (hl : (𝓝 x).HasBasis p s) :
x ∉ μ.support ↔ ∃ i, p i ∧ μ (s i) = 0 := by
simp [hl.mem_measureSupport]
@[simp]
lemma support_zero : (0 : Measure X).support = ∅ := by simp [Measure.support]
/-- The support of the sum of two measures is the union of the supports. -/
lemma support_add (μ ν : Measure X) : (μ + ν).support = μ.support ∪ ν.support := by
ext; simp [mem_support_iff]
/-- A point `x` lies outside the support of `μ` iff some neighborhood of `x` has measure zero. -/
lemma notMem_support_iff_exists {x : X} : x ∉ μ.support ↔ ∃ U ∈ 𝓝 x, μ U = 0 := by
simp [mem_support_iff_forall]
/-- The support of a measure equals the set of points whose open neighborhoods
all have positive measure. -/
lemma support_eq_forall_isOpen : μ.support =
{x : X | ∀ u : Set X, x ∈ u → IsOpen u → 0 < μ u} := by
simp [Set.ext_iff, nhds_basis_opens _ |>.mem_measureSupport]
lemma isClosed_support {μ : Measure X} : IsClosed μ.support := by
simp_rw [isClosed_iff_frequently, nhds_basis_opens _ |>.mem_measureSupport,
nhds_basis_opens _ |>.frequently_iff]
grind
lemma isOpen_compl_support {μ : Measure X} : IsOpen μ.supportᶜ :=
isOpen_compl_iff.mpr μ.isClosed_support
lemma subset_compl_support_of_isOpen {t : Set X} (ht : IsOpen t) (h : μ t = 0) :
t ⊆ μ.supportᶜ :=
fun _ hx ↦ notMem_support_iff_exists.mpr ⟨t, ht.mem_nhds hx, h⟩
lemma support_subset_of_isClosed {t : Set X} (ht : IsClosed t) (h : t ∈ ae μ) :
μ.support ⊆ t :=
Set.compl_subset_compl.mp <| subset_compl_support_of_isOpen ht.isOpen_compl h
lemma compl_support_eq_sUnion : μ.supportᶜ = ⋃₀ {t : Set X | IsOpen t ∧ μ t = 0} := by
ext x
simp only [Set.mem_compl_iff, Set.mem_sUnion, Set.mem_setOf_eq, and_right_comm,
nhds_basis_opens x |>.notMem_measureSupport, fun t ↦ and_comm (b := x ∈ t)]
lemma support_eq_sInter : μ.support = ⋂₀ {t : Set X | IsClosed t ∧ μ tᶜ = 0} := by
convert congr($(compl_support_eq_sUnion (μ := μ))ᶜ)
all_goals simp [Set.compl_sUnion, compl_involutive.image_eq_preimage_symm]
section Lindelof
/-- If the complement of the support is Lindelöf, then the support of a measure is conull. -/
lemma support_mem_ae_of_isLindelof (h : IsLindelof μ.supportᶜ) : μ.support ∈ ae μ := by
refine compl_compl μ.support ▸ h.compl_mem_sets_of_nhdsWithin fun s hs ↦ ?_
simpa [compl_mem_ae_iff, isOpen_compl_support.nhdsWithin_eq hs]
using notMem_support_iff_exists.mp hs
variable [HereditarilyLindelofSpace X]
/-- In a hereditarily Lindelöf space, the support of a measure is conull. -/
lemma support_mem_ae : μ.support ∈ ae μ :=
support_mem_ae_of_isLindelof <| HereditarilyLindelof_LindelofSets μ.supportᶜ
@[simp]
lemma measure_compl_support : μ μ.supportᶜ = 0 := support_mem_ae
open Set
lemma nonempty_inter_support_of_pos {s : Set X} (hμ : 0 < μ s) :
(s ∩ μ.support).Nonempty := by
rw [← Set.not_disjoint_iff_nonempty_inter]
contrapose! hμ
exact μ.mono hμ.subset_compl_right |>.trans <| by simp
/-- Under the assumption `OpensMeasurableSpace`, this is redundant because
the complement of the support is open, and therefore measurable. -/
lemma nullMeasurableSet_compl_support : NullMeasurableSet (μ.supportᶜ) μ :=
NullMeasurableSet.of_null measure_compl_support
/-- Under the assumption `OpensMeasurableSpace`, this is redundant because
the support is closed, and therefore measurable. -/
lemma nullMeasurableSet_support : NullMeasurableSet μ.support μ :=
NullMeasurableSet.compl_iff.mp nullMeasurableSet_compl_support
lemma nonempty_support (hμ : μ ≠ 0) : μ.support.Nonempty :=
Nonempty.right <| nonempty_inter_support_of_pos <| measure_univ_pos.mpr hμ
lemma nonempty_support_iff : μ.support.Nonempty ↔ μ ≠ 0 :=
⟨fun h e ↦ (not_nonempty_iff_eq_empty.mpr <| congrArg Measure.support e |>.trans
<| support_zero) h, fun h ↦ nonempty_support h⟩
end Lindelof
section Restrict
variable [OpensMeasurableSpace X]
lemma mem_support_restrict {s : Set X} {x : X} :
x ∈ (μ.restrict s).support ↔ ∃ᶠ u in (𝓝[s] x).smallSets, 0 < μ u := by
rw [nhds_basis_opens x |>.mem_measureSupport,
(nhdsWithin_basis_open x s).frequently_smallSets pos_mono]
grind [IsOpen.measurableSet, restrict_apply]
lemma interior_inter_support {s : Set X} :
interior s ∩ μ.support ⊆ (μ.restrict s).support := by
rintro x ⟨hxs, hxμ⟩
rw [mem_support_restrict, (nhdsWithin_basis_open x s).frequently_smallSets pos_mono]
rw [(nhds_basis_opens x).mem_measureSupport] at hxμ
rintro u ⟨hxu, hu⟩
apply hxμ (u ∩ interior s) ⟨⟨hxu, hxs⟩, hu.inter isOpen_interior⟩ |>.trans_le
gcongr
exact interior_subset
lemma support_restrict_subset {s : Set X} :
(μ.restrict s).support ⊆ closure s ∩ μ.support := by
refine Set.subset_inter (support_subset_of_isClosed isClosed_closure ?_)
(support_mono restrict_le_self)
rw [mem_ae_iff, μ.restrict_apply isClosed_closure.isOpen_compl.measurableSet]
convert μ.empty
exact subset_closure.disjoint_compl_left.eq_bot
end Restrict
end Measure
end MeasureTheory
end Support |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Comap.lean | import Mathlib.MeasureTheory.Measure.QuasiMeasurePreserving
/-!
# Pullback of a measure
In this file we define the pullback `MeasureTheory.Measure.comap f μ`
of a measure `μ` along an injective map `f`
such that the image of any measurable set under `f` is a null-measurable set.
If `f` does not have these properties, then we define `comap f μ` to be zero.
In the future, we may decide to redefine `comap f μ` so that it gives meaningful results, e.g.,
for covering maps like `(↑) : ℝ → AddCircle (1 : ℝ)`.
-/
open Function Set Filter
open scoped ENNReal
noncomputable section
namespace MeasureTheory
namespace Measure
variable {α β γ : Type*} {s : Set α}
open Classical in
/-- Pullback of a `Measure` as a linear map. If `f` sends each measurable set to a measurable
set, then for each measurable set `s` we have `comapₗ f μ s = μ (f '' s)`.
Note that if `f` is not injective, this definition assigns `Set.univ` measure zero.
If the linearity is not needed, please use `comap` instead, which works for a larger class of
functions. `comapₗ` is an auxiliary definition and most lemmas deal with comap. -/
def comapₗ [MeasurableSpace α] [MeasurableSpace β] (f : α → β) : Measure β →ₗ[ℝ≥0∞] Measure α :=
if hf : Injective f ∧ ∀ s, MeasurableSet s → MeasurableSet (f '' s) then
liftLinear (OuterMeasure.comap f) fun μ s hs t => by
simp only [OuterMeasure.comap_apply, image_inter hf.1, image_diff hf.1]
apply le_toOuterMeasure_caratheodory
exact hf.2 s hs
else 0
theorem comapₗ_apply {_ : MeasurableSpace α} {_ : MeasurableSpace β} (f : α → β)
(hfi : Injective f) (hf : ∀ s, MeasurableSet s → MeasurableSet (f '' s)) (μ : Measure β)
(hs : MeasurableSet s) : comapₗ f μ s = μ (f '' s) := by
rw [comapₗ, dif_pos, liftLinear_apply _ hs, OuterMeasure.comap_apply, coe_toOuterMeasure]
exact ⟨hfi, hf⟩
open Classical in
/-- Pullback of a `Measure`. If `f` sends each measurable set to a null-measurable set,
then for each measurable set `s` we have `comap f μ s = μ (f '' s)`.
Note that if `f` is not injective, this definition assigns `Set.univ` measure zero. -/
def comap [MeasurableSpace α] [MeasurableSpace β] (f : α → β) (μ : Measure β) : Measure α :=
if hf : Injective f ∧ ∀ s, MeasurableSet s → NullMeasurableSet (f '' s) μ then
(OuterMeasure.comap f μ.toOuterMeasure).toMeasure fun s hs t => by
simp only [OuterMeasure.comap_apply, image_inter hf.1, image_diff hf.1]
exact (measure_inter_add_diff₀ _ (hf.2 s hs)).symm
else 0
variable {mα : MeasurableSpace α} {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ}
{f : α → β} {g : β → γ}
theorem comap_apply₀ (f : α → β) (μ : Measure β) (hfi : Injective f)
(hf : ∀ s, MeasurableSet s → NullMeasurableSet (f '' s) μ)
(hs : NullMeasurableSet s (comap f μ)) : comap f μ s = μ (f '' s) := by
rw [comap, dif_pos (And.intro hfi hf)] at hs ⊢
rw [toMeasure_apply₀ _ _ hs, OuterMeasure.comap_apply, coe_toOuterMeasure]
lemma comap_undef {μ : Measure β}
(h : ¬ (Injective f ∧ ∀ s, MeasurableSet s → NullMeasurableSet (f '' s) μ)) :
comap f μ = 0 := dif_neg h
theorem le_comap_apply (f : α → β) (μ : Measure β) (hfi : Injective f)
(hf : ∀ s, MeasurableSet s → NullMeasurableSet (f '' s) μ) (s : Set α) :
μ (f '' s) ≤ comap f μ s := by
rw [comap, dif_pos (And.intro hfi hf)]
exact le_toMeasure_apply _ _ _
theorem comap_apply (f : α → β) (hfi : Injective f)
(hf : ∀ s, MeasurableSet s → MeasurableSet (f '' s)) (μ : Measure β) (hs : MeasurableSet s) :
comap f μ s = μ (f '' s) :=
comap_apply₀ f μ hfi (fun s hs => (hf s hs).nullMeasurableSet) hs.nullMeasurableSet
theorem comapₗ_eq_comap (f : α → β) (hfi : Injective f)
(hf : ∀ s, MeasurableSet s → MeasurableSet (f '' s)) (μ : Measure β) (hs : MeasurableSet s) :
comapₗ f μ s = comap f μ s :=
(comapₗ_apply f hfi hf μ hs).trans (comap_apply f hfi hf μ hs).symm
theorem measure_image_eq_zero_of_comap_eq_zero (f : α → β) (μ : Measure β) (hfi : Injective f)
(hf : ∀ s, MeasurableSet s → NullMeasurableSet (f '' s) μ) {s : Set α} (hs : comap f μ s = 0) :
μ (f '' s) = 0 :=
le_antisymm ((le_comap_apply f μ hfi hf s).trans hs.le) (zero_le _)
theorem ae_eq_image_of_ae_eq_comap (f : α → β) (μ : Measure β) (hfi : Injective f)
(hf : ∀ s, MeasurableSet s → NullMeasurableSet (f '' s) μ)
{s t : Set α} (hst : s =ᵐ[comap f μ] t) : f '' s =ᵐ[μ] f '' t := by
rw [EventuallyEq, ae_iff] at hst ⊢
have h_eq_α : { a : α | ¬s a = t a } = s \ t ∪ t \ s := by
ext1 x
simp only [eq_iff_iff, mem_setOf_eq, mem_union, mem_diff]
tauto
have h_eq_β : { a : β | ¬(f '' s) a = (f '' t) a } = f '' s \ f '' t ∪ f '' t \ f '' s := by
ext1 x
simp only [eq_iff_iff, mem_setOf_eq, mem_union, mem_diff]
tauto
rw [← Set.image_diff hfi, ← Set.image_diff hfi, ← Set.image_union] at h_eq_β
rw [h_eq_β]
rw [h_eq_α] at hst
exact measure_image_eq_zero_of_comap_eq_zero f μ hfi hf hst
theorem NullMeasurableSet.image (f : α → β) (μ : Measure β) (hfi : Injective f)
(hf : ∀ s, MeasurableSet s → NullMeasurableSet (f '' s) μ)
(hs : NullMeasurableSet s (μ.comap f)) : NullMeasurableSet (f '' s) μ := by
refine ⟨toMeasurable μ (f '' toMeasurable (μ.comap f) s), measurableSet_toMeasurable _ _, ?_⟩
refine EventuallyEq.trans ?_ (NullMeasurableSet.toMeasurable_ae_eq ?_).symm
swap
· exact hf _ (measurableSet_toMeasurable _ _)
have h : toMeasurable (comap f μ) s =ᵐ[comap f μ] s :=
NullMeasurableSet.toMeasurable_ae_eq hs
exact ae_eq_image_of_ae_eq_comap f μ hfi hf h.symm
theorem comap_preimage (f : α → β) (μ : Measure β) (hf : Injective f) (hf' : Measurable f)
(h : ∀ t, MeasurableSet t → NullMeasurableSet (f '' t) μ) {s : Set β} (hs : MeasurableSet s) :
μ.comap f (f ⁻¹' s) = μ (s ∩ range f) := by
rw [comap_apply₀ _ _ hf h (hf' hs).nullMeasurableSet, image_preimage_eq_inter_range]
@[simp] lemma comap_zero (f : α → β) : (0 : Measure β).comap f = 0 := by
by_cases hf : Injective f ∧ ∀ s, MeasurableSet s → NullMeasurableSet (f '' s) (0 : Measure β)
· simp [comap, hf]
· simp [comap, hf]
@[simp]
lemma comap_id (μ : Measure β) : comap (fun x ↦ x) μ = μ := by
ext s hs
rw [comap_apply, image_id']
· exact injective_id
all_goals simp [*]
lemma comap_comap (hf' : ∀ s, MeasurableSet s → MeasurableSet (f '' s)) (hg : Injective g)
(hg' : ∀ s, MeasurableSet s → MeasurableSet (g '' s)) (μ : Measure γ) :
comap f (comap g μ) = comap (g ∘ f) μ := by
by_cases hf : Injective f
· ext s hs
rw [comap_apply _ hf hf' _ hs, comap_apply _ hg hg' _ (hf' _ hs),
comap_apply _ (hg.comp hf) (fun t ht ↦ image_comp g f _ ▸ hg' _ <| hf' _ ht) _ hs, image_comp]
· rw [comap, dif_neg <| mt And.left hf, comap, dif_neg fun h ↦ hf h.1.of_comp]
lemma comap_smul {μ : Measure β} (c : ℝ≥0∞) : comap f (c • μ) = c • comap f μ := by
obtain rfl | hc := eq_or_ne c 0
· simp
by_cases h : Function.Injective f ∧ ∀ s : Set α, MeasurableSet s → NullMeasurableSet (f '' s) μ
· ext s hs
rw [comap_apply₀ f _ h.1 _ hs.nullMeasurableSet, smul_apply, smul_apply,
comap_apply₀ f μ h.1 h.2 hs.nullMeasurableSet]
simpa [nullMeasurableSet_smul_measure_iff hc] using h.2
· have h' : ¬ (Function.Injective f ∧
∀ (s : Set α), MeasurableSet s → NullMeasurableSet (f '' s) (c • μ)) := by
simpa [nullMeasurableSet_smul_measure_iff hc] using h
simp [comap_undef, h, h']
end Measure
end MeasureTheory
open MeasureTheory Measure
variable {α β : Type*} {ma : MeasurableSpace α} {mb : MeasurableSpace β}
lemma MeasurableEmbedding.comap_add {f : α → β} (hf : MeasurableEmbedding f) (μ ν : Measure β) :
(μ + ν).comap f = μ.comap f + ν.comap f := by
ext s hs
simp only [← comapₗ_eq_comap _ hf.injective (fun _ ↦ hf.measurableSet_image.mpr) _ hs,
map_add, add_apply]
namespace MeasurableEquiv
lemma comap_symm {μ : Measure α} (e : α ≃ᵐ β) : μ.comap e.symm = μ.map e := by
ext s hs
rw [e.map_apply, Measure.comap_apply _ e.symm.injective _ _ hs, image_symm]
exact fun t ht ↦ e.symm.measurableSet_image.mpr ht
lemma map_symm {μ : Measure α} (e : β ≃ᵐ α) : μ.map e.symm = μ.comap e := by
rw [← comap_symm, symm_symm]
end MeasurableEquiv
lemma MeasureTheory.Measure.comap_swap (μ : Measure (α × β)) : μ.comap .swap = μ.map .swap :=
(MeasurableEquiv.prodComm ..).comap_symm |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/ProbabilityMeasure.lean | import Mathlib.MeasureTheory.Measure.FiniteMeasure
import Mathlib.MeasureTheory.Integral.Average
import Mathlib.MeasureTheory.Measure.Prod
/-!
# Probability measures
This file defines the type of probability measures on a given measurable space. When the underlying
space has a topology and the measurable space structure (sigma algebra) is finer than the Borel
sigma algebra, then the type of probability measures is equipped with the topology of convergence
in distribution (weak convergence of measures). The topology of convergence in distribution is the
coarsest topology w.r.t. which for every bounded continuous `ℝ≥0`-valued random variable `X`, the
expected value of `X` depends continuously on the choice of probability measure. This is a special
case of the topology of weak convergence of finite measures.
## Main definitions
The main definitions are
* the type `MeasureTheory.ProbabilityMeasure Ω` with the topology of convergence in
distribution (a.k.a. convergence in law, weak convergence of measures);
* `MeasureTheory.ProbabilityMeasure.toFiniteMeasure`: Interpret a probability measure as
a finite measure;
* `MeasureTheory.FiniteMeasure.normalize`: Normalize a finite measure to a probability measure
(returns junk for the zero measure).
* `MeasureTheory.ProbabilityMeasure.map`: The push-forward `f* μ` of a probability measure
`μ` on `Ω` along a measurable function `f : Ω → Ω'`.
## Main results
* `MeasureTheory.ProbabilityMeasure.tendsto_iff_forall_integral_tendsto`: Convergence of
probability measures is characterized by the convergence of expected values of all bounded
continuous random variables. This shows that the chosen definition of topology coincides with
the common textbook definition of convergence in distribution, i.e., weak convergence of
measures. A similar characterization by the convergence of expected values (in the
`MeasureTheory.lintegral` sense) of all bounded continuous nonnegative random variables is
`MeasureTheory.ProbabilityMeasure.tendsto_iff_forall_lintegral_tendsto`.
* `MeasureTheory.FiniteMeasure.tendsto_normalize_iff_tendsto`: The convergence of finite
measures to a nonzero limit is characterized by the convergence of the probability-normalized
versions and of the total masses.
* `MeasureTheory.ProbabilityMeasure.continuous_map`: For a continuous function `f : Ω → Ω'`, the
push-forward of probability measures `f* : ProbabilityMeasure Ω → ProbabilityMeasure Ω'` is
continuous.
* `MeasureTheory.ProbabilityMeasure.t2Space`: The topology of convergence in distribution is
Hausdorff on Borel spaces where indicators of closed sets have continuous decreasing
approximating sequences (in particular on any pseudo-metrizable spaces).
TODO:
* Probability measures form a convex space.
## Implementation notes
The topology of convergence in distribution on `MeasureTheory.ProbabilityMeasure Ω` is inherited
weak convergence of finite measures via the mapping
`MeasureTheory.ProbabilityMeasure.toFiniteMeasure`.
Like `MeasureTheory.FiniteMeasure Ω`, the implementation of `MeasureTheory.ProbabilityMeasure Ω`
is directly as a subtype of `MeasureTheory.Measure Ω`, and the coercion to a function is the
composition `ENNReal.toNNReal` and the coercion to function of `MeasureTheory.Measure Ω`.
## References
* [Billingsley, *Convergence of probability measures*][billingsley1999]
## Tags
convergence in distribution, convergence in law, weak convergence of measures, probability measure
-/
noncomputable section
open Set Filter BoundedContinuousFunction Topology
open scoped ENNReal NNReal
namespace MeasureTheory
section ProbabilityMeasure
/-! ### Probability measures
In this section we define the type of probability measures on a measurable space `Ω`, denoted by
`MeasureTheory.ProbabilityMeasure Ω`.
If `Ω` is moreover a topological space and the sigma algebra on `Ω` is finer than the Borel sigma
algebra (i.e. `[OpensMeasurableSpace Ω]`), then `MeasureTheory.ProbabilityMeasure Ω` is
equipped with the topology of weak convergence of measures. Since every probability measure is a
finite measure, this is implemented as the induced topology from the mapping
`MeasureTheory.ProbabilityMeasure.toFiniteMeasure`.
-/
/-- Probability measures are defined as the subtype of measures that have the property of being
probability measures (i.e., their total mass is one). -/
def ProbabilityMeasure (Ω : Type*) [MeasurableSpace Ω] : Type _ :=
{ μ : Measure Ω // IsProbabilityMeasure μ }
namespace ProbabilityMeasure
variable {Ω : Type*} [MeasurableSpace Ω]
instance [Inhabited Ω] : Inhabited (ProbabilityMeasure Ω) :=
⟨⟨Measure.dirac default, Measure.dirac.isProbabilityMeasure⟩⟩
/-- Coercion from `MeasureTheory.ProbabilityMeasure Ω` to `MeasureTheory.Measure Ω`. -/
@[coe]
def toMeasure : ProbabilityMeasure Ω → Measure Ω := Subtype.val
/-- A probability measure can be interpreted as a measure. -/
instance : Coe (ProbabilityMeasure Ω) (MeasureTheory.Measure Ω) := { coe := toMeasure }
instance (μ : ProbabilityMeasure Ω) : IsProbabilityMeasure (μ : Measure Ω) :=
μ.prop
@[simp, norm_cast] lemma coe_mk (μ : Measure Ω) (hμ) : toMeasure ⟨μ, hμ⟩ = μ := rfl
@[simp]
theorem val_eq_to_measure (ν : ProbabilityMeasure Ω) : ν.val = (ν : Measure Ω) := rfl
theorem toMeasure_injective : Function.Injective ((↑) : ProbabilityMeasure Ω → Measure Ω) :=
Subtype.coe_injective
instance instFunLike : FunLike (ProbabilityMeasure Ω) (Set Ω) ℝ≥0 where
coe μ s := ((μ : Measure Ω) s).toNNReal
coe_injective' μ ν h := toMeasure_injective <| Measure.ext fun s _ ↦ by
simpa [ENNReal.toNNReal_eq_toNNReal_iff, measure_ne_top] using congr_fun h s
lemma coeFn_def (μ : ProbabilityMeasure Ω) : μ = fun s ↦ ((μ : Measure Ω) s).toNNReal := rfl
lemma coeFn_mk (μ : Measure Ω) (hμ) :
DFunLike.coe (F := ProbabilityMeasure Ω) ⟨μ, hμ⟩ = fun s ↦ (μ s).toNNReal := rfl
@[simp, norm_cast]
lemma mk_apply (μ : Measure Ω) (hμ) (s : Set Ω) :
DFunLike.coe (F := ProbabilityMeasure Ω) ⟨μ, hμ⟩ s = (μ s).toNNReal := rfl
@[simp, norm_cast]
theorem coeFn_univ (ν : ProbabilityMeasure Ω) : ν univ = 1 :=
congr_arg ENNReal.toNNReal ν.prop.measure_univ
@[simp]
theorem coeFn_empty (ν : ProbabilityMeasure Ω) : ν ∅ = 0 := by simp [coeFn_def]
theorem coeFn_univ_ne_zero (ν : ProbabilityMeasure Ω) : ν univ ≠ 0 := by
simp only [coeFn_univ, Ne, one_ne_zero, not_false_iff]
@[simp] theorem measureReal_eq_coe_coeFn (ν : ProbabilityMeasure Ω) (s : Set Ω) :
(ν : Measure Ω).real s = ν s := by
simp [coeFn_def, Measure.real, ENNReal.toReal]
theorem toNNReal_measureReal_eq_coeFn (ν : ProbabilityMeasure Ω) (s : Set Ω) :
((ν : Measure Ω).real s).toNNReal = ν s := by
simp
/-- A probability measure can be interpreted as a finite measure. -/
def toFiniteMeasure (μ : ProbabilityMeasure Ω) : FiniteMeasure Ω := ⟨μ, inferInstance⟩
@[simp] lemma coeFn_toFiniteMeasure (μ : ProbabilityMeasure Ω) : ⇑μ.toFiniteMeasure = μ := rfl
lemma toFiniteMeasure_apply (μ : ProbabilityMeasure Ω) (s : Set Ω) :
μ.toFiniteMeasure s = μ s := rfl
@[simp]
theorem toMeasure_comp_toFiniteMeasure_eq_toMeasure (ν : ProbabilityMeasure Ω) :
(ν.toFiniteMeasure : Measure Ω) = (ν : Measure Ω) := rfl
@[simp]
theorem coeFn_comp_toFiniteMeasure_eq_coeFn (ν : ProbabilityMeasure Ω) :
(ν.toFiniteMeasure : Set Ω → ℝ≥0) = (ν : Set Ω → ℝ≥0) := rfl
@[simp]
theorem toFiniteMeasure_apply_eq_apply (ν : ProbabilityMeasure Ω) (s : Set Ω) :
ν.toFiniteMeasure s = ν s := rfl
@[simp]
theorem ennreal_coeFn_eq_coeFn_toMeasure (ν : ProbabilityMeasure Ω) (s : Set Ω) :
(ν s : ℝ≥0∞) = (ν : Measure Ω) s := by
rw [← coeFn_comp_toFiniteMeasure_eq_coeFn, FiniteMeasure.ennreal_coeFn_eq_coeFn_toMeasure,
toMeasure_comp_toFiniteMeasure_eq_toMeasure]
@[simp]
theorem null_iff_toMeasure_null (ν : ProbabilityMeasure Ω) (s : Set Ω) :
ν s = 0 ↔ (ν : Measure Ω) s = 0 :=
⟨fun h ↦ by rw [← ennreal_coeFn_eq_coeFn_toMeasure, h, ENNReal.coe_zero],
fun h ↦ congrArg ENNReal.toNNReal h⟩
theorem apply_mono (μ : ProbabilityMeasure Ω) {s₁ s₂ : Set Ω} (h : s₁ ⊆ s₂) : μ s₁ ≤ μ s₂ := by
rw [← coeFn_comp_toFiniteMeasure_eq_coeFn]
exact FiniteMeasure.apply_mono _ h
theorem apply_union_le (μ : ProbabilityMeasure Ω) {s₁ s₂ : Set Ω} : μ (s₁ ∪ s₂) ≤ μ s₁ + μ s₂ := by
rw [← coeFn_comp_toFiniteMeasure_eq_coeFn]
exact FiniteMeasure.apply_union_le _
/-- Continuity from below: the measure of the union of a sequence of (not necessarily measurable)
sets is the limit of the measures of the partial unions. -/
protected lemma tendsto_measure_iUnion_accumulate {ι : Type*} [Preorder ι]
[IsCountablyGenerated (atTop : Filter ι)] {μ : ProbabilityMeasure Ω} {f : ι → Set Ω} :
Tendsto (fun i ↦ μ (Accumulate f i)) atTop (𝓝 (μ (⋃ i, f i))) := by
simpa [← ennreal_coeFn_eq_coeFn_toMeasure, ENNReal.tendsto_coe]
using tendsto_measure_iUnion_accumulate (μ := μ.toMeasure)
@[simp] theorem apply_le_one (μ : ProbabilityMeasure Ω) (s : Set Ω) : μ s ≤ 1 := by
simpa using apply_mono μ (subset_univ s)
theorem nonempty (μ : ProbabilityMeasure Ω) : Nonempty Ω := by
by_contra maybe_empty
have zero : (μ : Measure Ω) univ = 0 := by
rw [univ_eq_empty_iff.mpr (not_nonempty_iff.mp maybe_empty), measure_empty]
rw [measure_univ] at zero
exact zero_ne_one zero.symm
@[ext]
theorem eq_of_forall_toMeasure_apply_eq (μ ν : ProbabilityMeasure Ω)
(h : ∀ s : Set Ω, MeasurableSet s → (μ : Measure Ω) s = (ν : Measure Ω) s) : μ = ν := by
apply toMeasure_injective
ext1 s s_mble
exact h s s_mble
theorem eq_of_forall_apply_eq (μ ν : ProbabilityMeasure Ω)
(h : ∀ s : Set Ω, MeasurableSet s → μ s = ν s) : μ = ν := by
ext1 s s_mble
simpa [ennreal_coeFn_eq_coeFn_toMeasure] using congr_arg ((↑) : ℝ≥0 → ℝ≥0∞) (h s s_mble)
@[simp]
theorem mass_toFiniteMeasure (μ : ProbabilityMeasure Ω) : μ.toFiniteMeasure.mass = 1 :=
μ.coeFn_univ
theorem toFiniteMeasure_nonzero (μ : ProbabilityMeasure Ω) : μ.toFiniteMeasure ≠ 0 := by
simp [← FiniteMeasure.mass_nonzero_iff]
/-- The type of probability measures is a measurable space when equipped with the Giry monad. -/
instance : MeasurableSpace (ProbabilityMeasure Ω) := Subtype.instMeasurableSpace
lemma measurableSet_isProbabilityMeasure :
MeasurableSet { μ : Measure Ω | IsProbabilityMeasure μ } := by
suffices { μ : Measure Ω | IsProbabilityMeasure μ } = (fun μ => μ univ) ⁻¹' {1} by
rw [this]
exact Measure.measurable_coe MeasurableSet.univ (measurableSet_singleton 1)
ext _
apply isProbabilityMeasure_iff
/-- The monoidal product is a measurable function from the product of probability spaces over
`α` and `β` into the type of probability spaces over `α × β`. Lemma 4.1 of [A synthetic approach to
Markov kernels, conditional independence and theorems on sufficient statistics][fritz2020]. -/
theorem measurable_fun_prod {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] :
Measurable (fun (μ : ProbabilityMeasure α × ProbabilityMeasure β)
↦ μ.1.toMeasure.prod μ.2.toMeasure) := by
apply Measurable.measure_of_isPiSystem_of_isProbabilityMeasure generateFrom_prod.symm
isPiSystem_prod _
simp only [mem_image2, mem_setOf_eq, forall_exists_index, and_imp]
intro _ u Hu v Hv Heq
simp_rw [← Heq, Measure.prod_prod]
apply Measurable.mul
· exact (Measure.measurable_coe Hu).comp (measurable_subtype_coe.comp measurable_fst)
· exact (Measure.measurable_coe Hv).comp (measurable_subtype_coe.comp measurable_snd)
lemma apply_iUnion_le {μ : ProbabilityMeasure Ω} {f : ℕ → Set Ω}
(hf : Summable fun n ↦ μ (f n)) :
μ (⋃ n, f n) ≤ ∑' n, μ (f n) := by
simpa [← ENNReal.coe_le_coe, ENNReal.coe_tsum hf] using MeasureTheory.measure_iUnion_le f
section convergence_in_distribution
variable [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
theorem testAgainstNN_lipschitz (μ : ProbabilityMeasure Ω) :
LipschitzWith 1 fun f : Ω →ᵇ ℝ≥0 ↦ μ.toFiniteMeasure.testAgainstNN f :=
μ.mass_toFiniteMeasure ▸ μ.toFiniteMeasure.testAgainstNN_lipschitz
/-- The topology of weak convergence on `MeasureTheory.ProbabilityMeasure Ω`. This is inherited
(induced) from the topology of weak convergence of finite measures via the inclusion
`MeasureTheory.ProbabilityMeasure.toFiniteMeasure`. -/
instance : TopologicalSpace (ProbabilityMeasure Ω) :=
TopologicalSpace.induced toFiniteMeasure inferInstance
theorem toFiniteMeasure_continuous :
Continuous (toFiniteMeasure : ProbabilityMeasure Ω → FiniteMeasure Ω) :=
continuous_induced_dom
/-- Probability measures yield elements of the `WeakDual` of bounded continuous nonnegative
functions via `MeasureTheory.FiniteMeasure.testAgainstNN`, i.e., integration. -/
def toWeakDualBCNN : ProbabilityMeasure Ω → WeakDual ℝ≥0 (Ω →ᵇ ℝ≥0) :=
FiniteMeasure.toWeakDualBCNN ∘ toFiniteMeasure
@[simp]
theorem coe_toWeakDualBCNN (μ : ProbabilityMeasure Ω) :
⇑μ.toWeakDualBCNN = μ.toFiniteMeasure.testAgainstNN := rfl
@[simp]
theorem toWeakDualBCNN_apply (μ : ProbabilityMeasure Ω) (f : Ω →ᵇ ℝ≥0) :
μ.toWeakDualBCNN f = (∫⁻ ω, f ω ∂(μ : Measure Ω)).toNNReal := rfl
theorem toWeakDualBCNN_continuous : Continuous fun μ : ProbabilityMeasure Ω ↦ μ.toWeakDualBCNN :=
FiniteMeasure.toWeakDualBCNN_continuous.comp toFiniteMeasure_continuous
/- Integration of (nonnegative bounded continuous) test functions against Borel probability
measures depends continuously on the measure. -/
theorem continuous_testAgainstNN_eval (f : Ω →ᵇ ℝ≥0) :
Continuous fun μ : ProbabilityMeasure Ω ↦ μ.toFiniteMeasure.testAgainstNN f :=
(FiniteMeasure.continuous_testAgainstNN_eval f).comp toFiniteMeasure_continuous
-- The canonical mapping from probability measures to finite measures is an embedding.
theorem toFiniteMeasure_isEmbedding (Ω : Type*) [MeasurableSpace Ω] [TopologicalSpace Ω]
[OpensMeasurableSpace Ω] :
IsEmbedding (toFiniteMeasure : ProbabilityMeasure Ω → FiniteMeasure Ω) where
eq_induced := rfl
injective _μ _ν h := Subtype.eq <| congr_arg FiniteMeasure.toMeasure h
theorem tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds {δ : Type*} (F : Filter δ)
{μs : δ → ProbabilityMeasure Ω} {μ₀ : ProbabilityMeasure Ω} :
Tendsto μs F (𝓝 μ₀) ↔ Tendsto (toFiniteMeasure ∘ μs) F (𝓝 μ₀.toFiniteMeasure) :=
(toFiniteMeasure_isEmbedding Ω).tendsto_nhds_iff
/-- A characterization of weak convergence of probability measures by the condition that the
integrals of every continuous bounded nonnegative function converge to the integral of the function
against the limit measure. -/
theorem tendsto_iff_forall_lintegral_tendsto {γ : Type*} {F : Filter γ}
{μs : γ → ProbabilityMeasure Ω} {μ : ProbabilityMeasure Ω} :
Tendsto μs F (𝓝 μ) ↔
∀ f : Ω →ᵇ ℝ≥0,
Tendsto (fun i ↦ ∫⁻ ω, f ω ∂(μs i : Measure Ω)) F (𝓝 (∫⁻ ω, f ω ∂(μ : Measure Ω))) := by
rw [tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds]
exact FiniteMeasure.tendsto_iff_forall_lintegral_tendsto
/-- The characterization of weak convergence of probability measures by the usual (defining)
condition that the integrals of every continuous bounded function converge to the integral of the
function against the limit measure. -/
theorem tendsto_iff_forall_integral_tendsto {γ : Type*} {F : Filter γ}
{μs : γ → ProbabilityMeasure Ω} {μ : ProbabilityMeasure Ω} :
Tendsto μs F (𝓝 μ) ↔
∀ f : Ω →ᵇ ℝ,
Tendsto (fun i ↦ ∫ ω, f ω ∂(μs i : Measure Ω)) F (𝓝 (∫ ω, f ω ∂(μ : Measure Ω))) := by
simp [tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds,
FiniteMeasure.tendsto_iff_forall_integral_tendsto]
theorem tendsto_iff_forall_integral_rclike_tendsto {γ : Type*} (𝕜 : Type*) [RCLike 𝕜]
{F : Filter γ} {μs : γ → ProbabilityMeasure Ω} {μ : ProbabilityMeasure Ω} :
Tendsto μs F (𝓝 μ) ↔
∀ f : Ω →ᵇ 𝕜,
Tendsto (fun i ↦ ∫ ω, f ω ∂(μs i : Measure Ω)) F (𝓝 (∫ ω, f ω ∂(μ : Measure Ω))) := by
simp [tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds,
FiniteMeasure.tendsto_iff_forall_integral_rclike_tendsto 𝕜]
lemma continuous_integral_boundedContinuousFunction
{α : Type*} [TopologicalSpace α] [MeasurableSpace α] [OpensMeasurableSpace α] (f : α →ᵇ ℝ) :
Continuous fun μ : ProbabilityMeasure α ↦ ∫ x, f x ∂μ := by
rw [continuous_iff_continuousAt]
intro μ
exact continuousAt_of_tendsto_nhds
(ProbabilityMeasure.tendsto_iff_forall_integral_tendsto.mp tendsto_id f)
end convergence_in_distribution -- section
section Hausdorff
variable [TopologicalSpace Ω] [HasOuterApproxClosed Ω] [BorelSpace Ω]
variable (Ω)
/-- On topological spaces where indicators of closed sets have decreasing approximating sequences of
continuous functions (`HasOuterApproxClosed`), the topology of convergence in distribution of Borel
probability measures is Hausdorff (`T2Space`). -/
instance t2Space : T2Space (ProbabilityMeasure Ω) := (toFiniteMeasure_isEmbedding Ω).t2Space
end Hausdorff -- section
end ProbabilityMeasure
-- namespace
end ProbabilityMeasure
-- section
section NormalizeFiniteMeasure
/-! ### Normalization of finite measures to probability measures
This section is about normalizing finite measures to probability measures.
The weak convergence of finite measures to nonzero limit measures is characterized by
the convergence of the total mass and the convergence of the normalized probability
measures.
-/
namespace FiniteMeasure
variable {Ω : Type*} [Nonempty Ω] {m0 : MeasurableSpace Ω} (μ : FiniteMeasure Ω)
/-- Normalize a finite measure so that it becomes a probability measure, i.e., divide by the
total mass. -/
def normalize : ProbabilityMeasure Ω :=
if zero : μ.mass = 0 then ⟨Measure.dirac ‹Nonempty Ω›.some, Measure.dirac.isProbabilityMeasure⟩
else
{ val := μ.mass⁻¹ • (μ : Measure Ω)
property := by
refine ⟨?_⟩
simp only [Measure.coe_smul, Pi.smul_apply, Measure.nnreal_smul_coe_apply,
ENNReal.coe_inv zero, ennreal_mass]
rw [← Ne, ← ENNReal.coe_ne_zero, ennreal_mass] at zero
exact ENNReal.inv_mul_cancel zero μ.prop.measure_univ_lt_top.ne }
@[simp]
theorem self_eq_mass_mul_normalize (s : Set Ω) : μ s = μ.mass * μ.normalize s := by
obtain rfl | h := eq_or_ne μ 0
· simp
have mass_nonzero : μ.mass ≠ 0 := by rwa [μ.mass_nonzero_iff]
simp only [normalize, dif_neg mass_nonzero]
simp [mul_inv_cancel_left₀ mass_nonzero, coeFn_def]
theorem self_eq_mass_smul_normalize : μ = μ.mass • μ.normalize.toFiniteMeasure := by
apply eq_of_forall_apply_eq
intro s _s_mble
rw [μ.self_eq_mass_mul_normalize s, smul_apply, smul_eq_mul,
ProbabilityMeasure.coeFn_comp_toFiniteMeasure_eq_coeFn]
theorem normalize_eq_of_nonzero (nonzero : μ ≠ 0) (s : Set Ω) : μ.normalize s = μ.mass⁻¹ * μ s := by
simp only [μ.self_eq_mass_mul_normalize, μ.mass_nonzero_iff.mpr nonzero, inv_mul_cancel_left₀,
Ne, not_false_iff]
theorem normalize_eq_inv_mass_smul_of_nonzero (nonzero : μ ≠ 0) :
μ.normalize.toFiniteMeasure = μ.mass⁻¹ • μ := by
nth_rw 3 [μ.self_eq_mass_smul_normalize]
rw [← smul_assoc]
simp only [μ.mass_nonzero_iff.mpr nonzero, Algebra.id.smul_eq_mul, inv_mul_cancel₀, Ne,
not_false_iff, one_smul]
theorem toMeasure_normalize_eq_of_nonzero (nonzero : μ ≠ 0) :
(μ.normalize : Measure Ω) = μ.mass⁻¹ • μ := by
ext1 s _s_mble
rw [← μ.normalize.ennreal_coeFn_eq_coeFn_toMeasure s, μ.normalize_eq_of_nonzero nonzero s,
ENNReal.coe_mul, ennreal_coeFn_eq_coeFn_toMeasure]
exact Measure.coe_nnreal_smul_apply _ _ _
@[simp]
theorem _root_.ProbabilityMeasure.toFiniteMeasure_normalize_eq_self {m0 : MeasurableSpace Ω}
(μ : ProbabilityMeasure Ω) : μ.toFiniteMeasure.normalize = μ := by
apply ProbabilityMeasure.eq_of_forall_apply_eq
intro s _s_mble
rw [μ.toFiniteMeasure.normalize_eq_of_nonzero μ.toFiniteMeasure_nonzero s]
simp only [ProbabilityMeasure.mass_toFiniteMeasure, inv_one, one_mul, μ.coeFn_toFiniteMeasure]
/-- Averaging with respect to a finite measure is the same as integrating against
`MeasureTheory.FiniteMeasure.normalize`. -/
theorem average_eq_integral_normalize {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
(nonzero : μ ≠ 0) (f : Ω → E) :
average (μ : Measure Ω) f = ∫ ω, f ω ∂(μ.normalize : Measure Ω) := by
rw [μ.toMeasure_normalize_eq_of_nonzero nonzero, average]
congr
simp [ENNReal.coe_inv (μ.mass_nonzero_iff.mpr nonzero), ennreal_mass]
variable [TopologicalSpace Ω]
theorem testAgainstNN_eq_mass_mul (f : Ω →ᵇ ℝ≥0) :
μ.testAgainstNN f = μ.mass * μ.normalize.toFiniteMeasure.testAgainstNN f := by
nth_rw 1 [μ.self_eq_mass_smul_normalize]
rw [μ.normalize.toFiniteMeasure.smul_testAgainstNN_apply μ.mass f, smul_eq_mul]
theorem normalize_testAgainstNN (nonzero : μ ≠ 0) (f : Ω →ᵇ ℝ≥0) :
μ.normalize.toFiniteMeasure.testAgainstNN f = μ.mass⁻¹ * μ.testAgainstNN f := by
simp [μ.testAgainstNN_eq_mass_mul, inv_mul_cancel_left₀ <| μ.mass_nonzero_iff.mpr nonzero]
variable [OpensMeasurableSpace Ω]
variable {μ}
theorem tendsto_testAgainstNN_of_tendsto_normalize_testAgainstNN_of_tendsto_mass {γ : Type*}
{F : Filter γ} {μs : γ → FiniteMeasure Ω}
(μs_lim : Tendsto (fun i ↦ (μs i).normalize) F (𝓝 μ.normalize))
(mass_lim : Tendsto (fun i ↦ (μs i).mass) F (𝓝 μ.mass)) (f : Ω →ᵇ ℝ≥0) :
Tendsto (fun i ↦ (μs i).testAgainstNN f) F (𝓝 (μ.testAgainstNN f)) := by
by_cases h_mass : μ.mass = 0
· simp only [μ.mass_zero_iff.mp h_mass, zero_testAgainstNN_apply, zero_mass] at mass_lim ⊢
exact tendsto_zero_testAgainstNN_of_tendsto_zero_mass mass_lim f
simp_rw [fun i ↦ (μs i).testAgainstNN_eq_mass_mul f, μ.testAgainstNN_eq_mass_mul f]
rw [ProbabilityMeasure.tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds] at μs_lim
rw [tendsto_iff_forall_testAgainstNN_tendsto] at μs_lim
have lim_pair :
Tendsto (fun i ↦ (⟨(μs i).mass, (μs i).normalize.toFiniteMeasure.testAgainstNN f⟩ : ℝ≥0 × ℝ≥0))
F (𝓝 ⟨μ.mass, μ.normalize.toFiniteMeasure.testAgainstNN f⟩) :=
(Prod.tendsto_iff _ _).mpr ⟨mass_lim, μs_lim f⟩
exact tendsto_mul.comp lim_pair
theorem tendsto_normalize_testAgainstNN_of_tendsto {γ : Type*} {F : Filter γ}
{μs : γ → FiniteMeasure Ω} (μs_lim : Tendsto μs F (𝓝 μ)) (nonzero : μ ≠ 0) (f : Ω →ᵇ ℝ≥0) :
Tendsto (fun i ↦ (μs i).normalize.toFiniteMeasure.testAgainstNN f) F
(𝓝 (μ.normalize.toFiniteMeasure.testAgainstNN f)) := by
have lim_mass := μs_lim.mass
have aux : {(0 : ℝ≥0)}ᶜ ∈ 𝓝 μ.mass :=
isOpen_compl_singleton.mem_nhds (μ.mass_nonzero_iff.mpr nonzero)
have eventually_nonzero : ∀ᶠ i in F, μs i ≠ 0 := by
simp_rw [← mass_nonzero_iff]
exact lim_mass aux
have eve : ∀ᶠ i in F,
(μs i).normalize.toFiniteMeasure.testAgainstNN f =
(μs i).mass⁻¹ * (μs i).testAgainstNN f := by
filter_upwards [eventually_iff.mp eventually_nonzero]
intro i hi
apply normalize_testAgainstNN _ hi
simp_rw [tendsto_congr' eve, μ.normalize_testAgainstNN nonzero]
have lim_pair :
Tendsto (fun i ↦ (⟨(μs i).mass⁻¹, (μs i).testAgainstNN f⟩ : ℝ≥0 × ℝ≥0)) F
(𝓝 ⟨μ.mass⁻¹, μ.testAgainstNN f⟩) := by
refine (Prod.tendsto_iff _ _).mpr ⟨?_, ?_⟩
· exact (continuousOn_inv₀.continuousAt aux).tendsto.comp lim_mass
· exact tendsto_iff_forall_testAgainstNN_tendsto.mp μs_lim f
exact tendsto_mul.comp lim_pair
/-- If the normalized versions of finite measures converge weakly and their total masses
also converge, then the finite measures themselves converge weakly. -/
theorem tendsto_of_tendsto_normalize_testAgainstNN_of_tendsto_mass {γ : Type*} {F : Filter γ}
{μs : γ → FiniteMeasure Ω} (μs_lim : Tendsto (fun i ↦ (μs i).normalize) F (𝓝 μ.normalize))
(mass_lim : Tendsto (fun i ↦ (μs i).mass) F (𝓝 μ.mass)) : Tendsto μs F (𝓝 μ) := by
rw [tendsto_iff_forall_testAgainstNN_tendsto]
exact fun f ↦
tendsto_testAgainstNN_of_tendsto_normalize_testAgainstNN_of_tendsto_mass μs_lim mass_lim f
/-- If finite measures themselves converge weakly to a nonzero limit measure, then their
normalized versions also converge weakly. -/
theorem tendsto_normalize_of_tendsto {γ : Type*} {F : Filter γ} {μs : γ → FiniteMeasure Ω}
(μs_lim : Tendsto μs F (𝓝 μ)) (nonzero : μ ≠ 0) :
Tendsto (fun i ↦ (μs i).normalize) F (𝓝 μ.normalize) := by
rw [ProbabilityMeasure.tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds,
tendsto_iff_forall_testAgainstNN_tendsto]
exact fun f ↦ tendsto_normalize_testAgainstNN_of_tendsto μs_lim nonzero f
/-- The weak convergence of finite measures to a nonzero limit can be characterized by the weak
convergence of both their normalized versions (probability measures) and their total masses. -/
theorem tendsto_normalize_iff_tendsto {γ : Type*} {F : Filter γ} {μs : γ → FiniteMeasure Ω}
(nonzero : μ ≠ 0) :
Tendsto (fun i ↦ (μs i).normalize) F (𝓝 μ.normalize) ∧
Tendsto (fun i ↦ (μs i).mass) F (𝓝 μ.mass) ↔
Tendsto μs F (𝓝 μ) := by
constructor
· rintro ⟨normalized_lim, mass_lim⟩
exact tendsto_of_tendsto_normalize_testAgainstNN_of_tendsto_mass normalized_lim mass_lim
· intro μs_lim
exact ⟨tendsto_normalize_of_tendsto μs_lim nonzero, μs_lim.mass⟩
end FiniteMeasure --namespace
end NormalizeFiniteMeasure -- section
section map
variable {Ω Ω' : Type*} [MeasurableSpace Ω] [MeasurableSpace Ω']
namespace ProbabilityMeasure
/-- The push-forward of a probability measure by a measurable function. -/
noncomputable def map (ν : ProbabilityMeasure Ω) {f : Ω → Ω'} (f_aemble : AEMeasurable f ν) :
ProbabilityMeasure Ω' :=
⟨(ν : Measure Ω).map f, (ν : Measure Ω).isProbabilityMeasure_map f_aemble⟩
@[simp] lemma toMeasure_map (ν : ProbabilityMeasure Ω) {f : Ω → Ω'} (hf : AEMeasurable f ν) :
(ν.map hf).toMeasure = ν.toMeasure.map f := rfl
/-- Note that this is an equality of elements of `ℝ≥0∞`. See also
`MeasureTheory.ProbabilityMeasure.map_apply` for the corresponding equality as elements of `ℝ≥0`. -/
lemma map_apply' (ν : ProbabilityMeasure Ω) {f : Ω → Ω'} (f_aemble : AEMeasurable f ν)
{A : Set Ω'} (A_mble : MeasurableSet A) :
(ν.map f_aemble : Measure Ω') A = (ν : Measure Ω) (f ⁻¹' A) :=
Measure.map_apply_of_aemeasurable f_aemble A_mble
lemma map_apply_of_aemeasurable (ν : ProbabilityMeasure Ω) {f : Ω → Ω'}
(f_aemble : AEMeasurable f ν) {A : Set Ω'} (A_mble : MeasurableSet A) :
(ν.map f_aemble) A = ν (f ⁻¹' A) := by
exact (ENNReal.toNNReal_eq_toNNReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mpr <|
ν.map_apply' f_aemble A_mble
lemma map_apply (ν : ProbabilityMeasure Ω) {f : Ω → Ω'} (f_aemble : AEMeasurable f ν)
{A : Set Ω'} (A_mble : MeasurableSet A) :
(ν.map f_aemble) A = ν (f ⁻¹' A) :=
map_apply_of_aemeasurable ν f_aemble A_mble
variable [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
variable [TopologicalSpace Ω'] [BorelSpace Ω']
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
convergence (in distribution) of `ProbabilityMeasure`s on `X` implies convergence (in
distribution) of the push-forwards of these measures by `f`. -/
lemma tendsto_map_of_tendsto_of_continuous {ι : Type*} {L : Filter ι}
(νs : ι → ProbabilityMeasure Ω) (ν : ProbabilityMeasure Ω) (lim : Tendsto νs L (𝓝 ν))
{f : Ω → Ω'} (f_cont : Continuous f) :
Tendsto (fun i ↦ (νs i).map f_cont.measurable.aemeasurable) L
(𝓝 (ν.map f_cont.measurable.aemeasurable)) := by
rw [ProbabilityMeasure.tendsto_iff_forall_lintegral_tendsto] at lim ⊢
intro g
convert lim (g.compContinuous ⟨f, f_cont⟩) <;>
· simp only [map, compContinuous_apply, ContinuousMap.coe_mk]
refine lintegral_map ?_ f_cont.measurable
exact (ENNReal.continuous_coe.comp g.continuous).measurable
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
the push-forward of probability measures `f* : ProbabilityMeasure X → ProbabilityMeasure Y`
is continuous (in the topologies of convergence in distribution). -/
lemma continuous_map {f : Ω → Ω'} (f_cont : Continuous f) :
Continuous (fun ν ↦ ProbabilityMeasure.map ν f_cont.measurable.aemeasurable) := by
rw [continuous_iff_continuousAt]
exact fun _ ↦ tendsto_map_of_tendsto_of_continuous _ _ continuous_id.continuousAt f_cont
end ProbabilityMeasure -- namespace
end map -- section
end MeasureTheory -- namespace |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/WithDensityFinite.lean | import Mathlib.LinearAlgebra.FreeModule.Basic
import Mathlib.MeasureTheory.Measure.Decomposition.Exhaustion
import Mathlib.Probability.ConditionalProbability
/-!
# s-finite measures can be written as `withDensity` of a finite measure
If `μ` is an s-finite measure, then there exists a finite measure `μ.toFinite`
such that a set is `μ`-null iff it is `μ.toFinite`-null.
In particular, `MeasureTheory.ae μ.toFinite = MeasureTheory.ae μ` and `μ.toFinite = 0` iff `μ = 0`.
As a corollary, `μ` can be represented as `μ.toFinite.withDensity (μ.rnDeriv μ.toFinite)`.
Our definition of `MeasureTheory.Measure.toFinite` ensures some extra properties:
- if `μ` is a finite measure, then `μ.toFinite = μ[|univ] = (μ univ)⁻¹ • μ`;
- in particular, `μ.toFinite = μ` for a probability measure;
- if `μ ≠ 0`, then `μ.toFinite` is a probability measure.
## Main definitions
In this definition and the results below, `μ` is an s-finite measure (`SFinite μ`).
* `MeasureTheory.Measure.toFinite`: a finite measure with `μ ≪ μ.toFinite` and `μ.toFinite ≪ μ`.
If `μ ≠ 0`, this is a probability measure.
## Main statements
* `absolutelyContinuous_toFinite`: `μ ≪ μ.toFinite`.
* `toFinite_absolutelyContinuous`: `μ.toFinite ≪ μ`.
* `ae_toFinite`: `ae μ.toFinite = ae μ`.
-/
open Set
open scoped ENNReal ProbabilityTheory
namespace MeasureTheory
variable {α : Type*} {mα : MeasurableSpace α} {μ : Measure α}
/-- Auxiliary definition for `MeasureTheory.Measure.toFinite`. -/
noncomputable def Measure.toFiniteAux (μ : Measure α) [SFinite μ] : Measure α :=
letI := Classical.dec
if IsFiniteMeasure μ then μ else (exists_isFiniteMeasure_absolutelyContinuous μ).choose
/-- A finite measure obtained from an s-finite measure `μ`, such that
`μ = μ.toFinite.withDensity (μ.rnDeriv µ.toFinite)`
(see `MeasureTheory.Measure.withDensity_rnDeriv_eq` along with
`MeasureTheory.absolutelyContinuous_toFinite`). If `μ` is non-zero, then `μ.toFinite` is a
probability measure. -/
noncomputable def Measure.toFinite (μ : Measure α) [SFinite μ] : Measure α :=
μ.toFiniteAux[|univ]
@[local simp]
lemma ae_toFiniteAux [SFinite μ] : ae μ.toFiniteAux = ae μ := by
rw [Measure.toFiniteAux]
split_ifs
· simp
· obtain ⟨_, h₁, h₂⟩ := (exists_isFiniteMeasure_absolutelyContinuous μ).choose_spec
exact h₂.ae_le.antisymm h₁.ae_le
@[local instance]
theorem isFiniteMeasure_toFiniteAux [SFinite μ] : IsFiniteMeasure μ.toFiniteAux := by
rw [Measure.toFiniteAux]
split_ifs
· assumption
· exact (exists_isFiniteMeasure_absolutelyContinuous μ).choose_spec.1
@[simp]
lemma ae_toFinite [SFinite μ] : ae μ.toFinite = ae μ := by
simp [Measure.toFinite, ProbabilityTheory.cond]
@[simp]
lemma toFinite_apply_eq_zero_iff [SFinite μ] {s : Set α} : μ.toFinite s = 0 ↔ μ s = 0 := by
simp only [← compl_mem_ae_iff, ae_toFinite]
@[simp]
lemma toFinite_eq_zero_iff [SFinite μ] : μ.toFinite = 0 ↔ μ = 0 := by
simp_rw [← Measure.measure_univ_eq_zero, toFinite_apply_eq_zero_iff]
@[simp]
lemma toFinite_zero : Measure.toFinite (0 : Measure α) = 0 := by simp
lemma toFinite_eq_self [IsProbabilityMeasure μ] : μ.toFinite = μ := by
rw [Measure.toFinite, Measure.toFiniteAux, if_pos, ProbabilityTheory.cond_univ]
infer_instance
instance [SFinite μ] : IsFiniteMeasure μ.toFinite := by
rw [Measure.toFinite]
infer_instance
instance [SFinite μ] [NeZero μ] : IsProbabilityMeasure μ.toFinite := by
apply ProbabilityTheory.cond_isProbabilityMeasure
simp [ne_eq, ← compl_mem_ae_iff, ae_toFiniteAux]
lemma absolutelyContinuous_toFinite (μ : Measure α) [SFinite μ] : μ ≪ μ.toFinite :=
Measure.ae_le_iff_absolutelyContinuous.mp ae_toFinite.ge
lemma sfiniteSeq_absolutelyContinuous_toFinite (μ : Measure α) [SFinite μ] (n : ℕ) :
sfiniteSeq μ n ≪ μ.toFinite :=
(sfiniteSeq_le μ n).absolutelyContinuous.trans (absolutelyContinuous_toFinite μ)
lemma toFinite_absolutelyContinuous (μ : Measure α) [SFinite μ] : μ.toFinite ≪ μ :=
Measure.ae_le_iff_absolutelyContinuous.mp ae_toFinite.le
lemma restrict_compl_sigmaFiniteSet [SFinite μ] :
μ.restrict μ.sigmaFiniteSetᶜ = ∞ • μ.toFinite.restrict μ.sigmaFiniteSetᶜ := by
rw [Measure.sigmaFiniteSet,
restrict_compl_sigmaFiniteSetWRT (Measure.AbsolutelyContinuous.refl μ)]
ext t ht
simp only [Measure.smul_apply, smul_eq_mul]
rw [Measure.restrict_apply ht, Measure.restrict_apply ht]
by_cases hμt : μ (t ∩ (μ.sigmaFiniteSetWRT μ)ᶜ) = 0
· rw [hμt, toFinite_absolutelyContinuous μ hμt]
· rw [ENNReal.top_mul hμt, ENNReal.top_mul]
exact fun h ↦ hμt (absolutelyContinuous_toFinite μ h)
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/IntegralCharFun.lean | import Mathlib.Analysis.SpecialFunctions.Integrals.Basic
import Mathlib.MeasureTheory.Function.SpecialFunctions.Sinc
import Mathlib.MeasureTheory.Measure.CharacteristicFunction
/-!
# Integrals of characteristic functions
This file contains results about integrals of characteristic functions, and lemmas
relating the measure of some sets to integrals of characteristic functions.
## Main statements
* `integral_charFun_Icc`: `∫ t in -r..r, charFun μ t = 2 * r * ∫ x, sinc (r * x) ∂μ`
* `measureReal_abs_gt_le_integral_charFun`: bound on the measure of the set
`{x | r < |x|}` in terms of the integral of the characteristic function of `μ`, for `μ` a
probability measure on `ℝ`:
`μ.real {x | r < |x|} ≤ 2⁻¹ * r * ‖∫ t in (-2 * r⁻¹)..(2 * r⁻¹), 1 - charFun μ t‖`
* `measureReal_abs_dual_gt_le_integral_charFunDual`: an application of the previous lemma in a
normed space `E`, which gives for all `L : Dual ℝ E`,
`μ.real {x | r < |L x|} ≤ 2⁻¹ * r * ‖∫ t in -2 * r⁻¹..2 * r⁻¹, 1 - charFunDual μ (t • L)‖`
* `measureReal_abs_inner_gt_le_integral_charFun`: an application in an inner product space,
which gives for all `a`,
`μ.real {x | r < |⟪a, x⟫|} ≤ 2⁻¹ * r * ‖∫ t in -2 * r⁻¹..2 * r⁻¹, 1 - charFun μ (t • a)‖`
-/
open RealInnerProductSpace Real Complex NormedSpace
namespace MeasureTheory
section Real
variable {μ : Measure ℝ} {r : ℝ}
lemma integral_charFun_Icc [IsFiniteMeasure μ] (hr : 0 < r) :
∫ t in -r..r, charFun μ t = 2 * r * ∫ x, sinc (r * x) ∂μ := by
have h_int : Integrable (Function.uncurry fun (x y : ℝ) ↦ cexp (x * y * I))
((volume.restrict (Set.uIoc (-r) r)).prod μ) := by
simp only [neg_le_self_iff, hr.le, Set.uIoc_of_le]
-- integrable since the function has norm 1 everywhere and the measure is finite
rw [← integrable_norm_iff (by fun_prop)]
suffices (fun a => ‖Function.uncurry (fun (x y : ℝ) ↦ cexp (x * y * I)) a‖) = fun _ ↦ 1 by
rw [this]
fun_prop
ext p
rw [← Prod.mk.eta (p := p)]
norm_cast
simp only [Function.uncurry_apply_pair, norm_exp_ofReal_mul_I]
calc ∫ t in -r..r, charFun μ t
_ = ∫ x in -r..r, ∫ y, cexp (x * y * I) ∂μ := by simp_rw [charFun_apply_real]
_ = ∫ y, ∫ x in -r..r, cexp (x * y * I) ∂volume ∂μ := by
rw [intervalIntegral_integral_swap h_int]
_ = ∫ y, if r * y = 0 then 2 * (r : ℂ)
else y⁻¹ * ∫ x in -(y * r)..y * r, cexp (x * I) ∂volume ∂μ := by
congr with y
by_cases hy : y = 0
· simp [hy, two_mul]
simp only [mul_eq_zero, hr.ne', hy, or_self, ↓reduceIte, ofReal_inv]
have h := intervalIntegral.integral_comp_smul_deriv (E := ℂ) (a := -r) (b := r)
(f := fun x ↦ y * x) (f' := fun _ ↦ y) (g := fun x ↦ cexp (x * I)) ?_ (by fun_prop)
(by fun_prop)
swap
· intro x hx
simp_rw [mul_comm y]
exact hasDerivAt_mul_const _
simp only [Function.comp_apply, ofReal_mul, real_smul, intervalIntegral.integral_const_mul,
mul_neg] at h
rw [← h, ← mul_assoc]
norm_cast
simp [mul_comm _ y, mul_inv_cancel₀ hy]
_ = ∫ x, 2 * (r : ℂ) * sinc (r * x) ∂μ := by
congr with y
rw [integral_exp_mul_I_eq_sinc]
split_ifs with hry
· simp [hry]
have hy : y ≠ 0 := fun hy ↦ hry (by simp [hy])
norm_cast
field_simp
_ = 2 * r * ∫ x, sinc (r * x) ∂μ := by
norm_cast
rw [integral_complex_ofReal, ← integral_const_mul]
/-- A bound on the measure of the set `{x | r < |x|}` in terms of the integral of
the characteristic function, for a probability measure on `ℝ`. -/
lemma measureReal_abs_gt_le_integral_charFun [IsProbabilityMeasure μ] (hr : 0 < r) :
μ.real {x | r < |x|} ≤ 2⁻¹ * r * ‖∫ t in (-2 * r⁻¹)..(2 * r⁻¹), 1 - charFun μ t‖ := by
have integrable_sinc_const_mul (r : ℝ) : Integrable (fun x ↦ sinc (r * x)) μ :=
(integrable_map_measure stronglyMeasurable_sinc.aestronglyMeasurable (by fun_prop)).mp
integrable_sinc
calc μ.real {x | r < |x|}
_ = μ.real {x | 2 < |2 * r⁻¹ * x|} := by
congr 1 with x
simp only [Set.mem_setOf_eq, abs_mul, Nat.abs_ofNat]
rw [abs_of_nonneg (a := r⁻¹) (by positivity), mul_assoc, ← inv_mul_lt_iff₀ (by positivity),
inv_mul_cancel₀ (by positivity), lt_inv_mul_iff₀ (by positivity), mul_one]
_ = ∫ x in {x | 2 < |2 * r⁻¹ * x|}, 1 ∂μ := by simp
_ = 2 * ∫ x in {x | 2 < |2 * r⁻¹ * x|}, 2⁻¹ ∂μ := by
rw [← integral_const_mul]
congr with _
rw [mul_inv_cancel₀ (by positivity)]
_ ≤ 2 * ∫ x in {x | 2 < |2 * r⁻¹ * x|}, 1 - sinc (2 * r⁻¹ * x) ∂μ := by
gcongr (2 : ℝ) * ?_
refine setIntegral_mono_on ?_
((integrable_const _).sub (integrable_sinc_const_mul _)).integrableOn ?_ fun x hx ↦ ?_
· exact Integrable.integrableOn <| by fun_prop
· exact MeasurableSet.preimage measurableSet_Ioi (by fun_prop)
· have hx_ne : 2 * r⁻¹ * x ≠ 0 := by
intro hx0
simp only [hx0, Set.mem_setOf_eq, abs_zero] at hx
linarith
rw [le_sub_iff_add_le, ← le_sub_iff_add_le']
norm_num
rw [one_div]
refine (sinc_le_inv_abs hx_ne).trans ?_
exact (inv_le_inv₀ (by positivity) (by positivity)).mpr (le_of_lt hx)
_ ≤ 2 * ∫ x, 1 - sinc (2 * r⁻¹ * x) ∂μ := by
grw [setIntegral_le_integral (by fun_prop) <| ae_of_all _ fun x ↦ ?_]
simp only [Pi.zero_apply, sub_nonneg]
exact sinc_le_one (2 * r⁻¹ * x)
_ ≤ 2 * ‖∫ x, 1 - sinc (2 * r⁻¹ * x) ∂μ‖ := by
gcongr
exact Real.le_norm_self _
_ = 2⁻¹ * r *
‖2 * (r : ℂ)⁻¹ + 2 * r⁻¹ - 2 * (2 * r⁻¹) * ∫ x, sinc (2 * r⁻¹ * x) ∂μ‖ := by
norm_cast
rw [← two_mul, mul_assoc 2, ← mul_sub, norm_mul, Real.norm_ofNat, ← mul_assoc,
← mul_one_sub, norm_mul, Real.norm_of_nonneg (r := 2 * r⁻¹) (by positivity), ← mul_assoc]
congr
· ring_nf
rw [mul_inv_cancel₀ (by positivity), one_mul]
· rw [integral_sub (integrable_const _) (integrable_sinc_const_mul _)]
simp
_ = 2⁻¹ * r * ‖∫ t in (-2 * r⁻¹)..(2 * r⁻¹), 1 - charFun μ t‖ := by
rw [intervalIntegral.integral_sub intervalIntegrable_const intervalIntegrable_charFun, neg_mul,
integral_charFun_Icc (by positivity)]
simp
end Real
/-- For a probability measure on a normed space `E` and `L : Dual ℝ E`, a bound on the measure
of the set `{x | r < |L x|}` in terms of the integral of the characteristic function. -/
lemma measureReal_abs_dual_gt_le_integral_charFunDual {E : Type*} [NormedAddCommGroup E]
[NormedSpace ℝ E] {mE : MeasurableSpace E} [OpensMeasurableSpace E]
{μ : Measure E} [IsProbabilityMeasure μ] (L : StrongDual ℝ E) {r : ℝ} (hr : 0 < r) :
μ.real {x | r < |L x|} ≤ 2⁻¹ * r * ‖∫ t in -2 * r⁻¹..2 * r⁻¹, 1 - charFunDual μ (t • L)‖ := by
have : IsProbabilityMeasure (μ.map L) := Measure.isProbabilityMeasure_map (by fun_prop)
convert measureReal_abs_gt_le_integral_charFun (μ := μ.map L) hr with x
· rw [map_measureReal_apply (by fun_prop)]
· simp
· exact MeasurableSet.preimage measurableSet_Ioi (by fun_prop)
· rw [charFun_map_eq_charFunDual_smul]
/-- A bound on the measure of the set `{x | r < |⟪a, x⟫|}` in terms of the integral of
the characteristic function, for a probability measure on an inner product space. -/
lemma measureReal_abs_inner_gt_le_integral_charFun {E : Type*} [SeminormedAddCommGroup E]
[InnerProductSpace ℝ E] {mE : MeasurableSpace E} [OpensMeasurableSpace E]
{μ : Measure E} [IsProbabilityMeasure μ] {a : E} {r : ℝ} (hr : 0 < r) :
μ.real {x | r < |⟪a, x⟫|} ≤ 2⁻¹ * r * ‖∫ t in -2 * r⁻¹..2 * r⁻¹, 1 - charFun μ (t • a)‖ := by
have : IsProbabilityMeasure (μ.map (fun x ↦ ⟪a, x⟫)) :=
Measure.isProbabilityMeasure_map (by fun_prop)
convert measureReal_abs_gt_le_integral_charFun (μ := μ.map (fun x ↦ ⟪a, x⟫)) hr with x
· rw [map_measureReal_apply (by fun_prop)]
· simp
· exact MeasurableSet.preimage measurableSet_Ioi (by fun_prop)
· simp only [charFun_apply, inner_smul_right, conj_trivial, ofReal_mul, RCLike.inner_apply]
rw [integral_map (by fun_prop) (by fun_prop)]
simp_rw [real_inner_comm a]
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/OpenPos.lean | import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
import Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms
import Mathlib.MeasureTheory.Measure.Typeclasses.Probability
/-!
# Measures positive on nonempty opens
In this file we define a typeclass for measures that are positive on nonempty opens, see
`MeasureTheory.Measure.IsOpenPosMeasure`. Examples include (additive) Haar measures, as well as
measures that have positive density with respect to a Haar measure. We also prove some basic facts
about these measures.
-/
open Topology ENNReal MeasureTheory
open Set Function Filter
namespace MeasureTheory
namespace Measure
section Basic
variable {X Y : Type*} [TopologicalSpace X] {m : MeasurableSpace X} [TopologicalSpace Y]
[T2Space Y] (μ ν : Measure X)
/-- A measure is said to be `IsOpenPosMeasure` if it is positive on nonempty open sets. -/
class IsOpenPosMeasure : Prop where
open_pos : ∀ U : Set X, IsOpen U → U.Nonempty → μ U ≠ 0
variable [IsOpenPosMeasure μ] {s U F : Set X} {x : X}
theorem _root_.IsOpen.measure_ne_zero (hU : IsOpen U) (hne : U.Nonempty) : μ U ≠ 0 :=
IsOpenPosMeasure.open_pos U hU hne
theorem _root_.IsOpen.measure_pos (hU : IsOpen U) (hne : U.Nonempty) : 0 < μ U :=
(hU.measure_ne_zero μ hne).bot_lt
instance (priority := 100) [Nonempty X] : NeZero μ :=
⟨measure_univ_pos.mp <| isOpen_univ.measure_pos μ univ_nonempty⟩
theorem _root_.IsOpen.measure_pos_iff (hU : IsOpen U) : 0 < μ U ↔ U.Nonempty :=
⟨fun h => nonempty_iff_ne_empty.2 fun he => h.ne' <| he.symm ▸ measure_empty, hU.measure_pos μ⟩
theorem _root_.IsOpen.measure_eq_zero_iff (hU : IsOpen U) : μ U = 0 ↔ U = ∅ := by
simpa only [not_lt, nonpos_iff_eq_zero, not_nonempty_iff_eq_empty] using
not_congr (hU.measure_pos_iff μ)
theorem measure_pos_of_nonempty_interior (h : (interior s).Nonempty) : 0 < μ s :=
(isOpen_interior.measure_pos μ h).trans_le (measure_mono interior_subset)
theorem measure_pos_of_mem_nhds (h : s ∈ 𝓝 x) : 0 < μ s :=
measure_pos_of_nonempty_interior _ ⟨x, mem_interior_iff_mem_nhds.2 h⟩
theorem isOpenPosMeasure_smul {c : ℝ≥0∞} (h : c ≠ 0) : IsOpenPosMeasure (c • μ) :=
⟨fun _U Uo Une => mul_ne_zero h (Uo.measure_ne_zero μ Une)⟩
variable {μ ν}
protected theorem AbsolutelyContinuous.isOpenPosMeasure (h : μ ≪ ν) : IsOpenPosMeasure ν :=
⟨fun _U ho hne h₀ => ho.measure_ne_zero μ hne (h h₀)⟩
theorem _root_.LE.le.isOpenPosMeasure (h : μ ≤ ν) : IsOpenPosMeasure ν :=
h.absolutelyContinuous.isOpenPosMeasure
theorem _root_.IsOpen.measure_zero_iff_eq_empty (hU : IsOpen U) :
μ U = 0 ↔ U = ∅ :=
⟨fun h ↦ (hU.measure_eq_zero_iff μ).mp h, fun h ↦ by simp [h]⟩
theorem _root_.IsOpen.ae_eq_empty_iff_eq (hU : IsOpen U) :
U =ᵐ[μ] (∅ : Set X) ↔ U = ∅ := by
rw [ae_eq_empty, hU.measure_zero_iff_eq_empty]
/-- An open null set w.r.t. an `IsOpenPosMeasure` is empty. -/
theorem _root_.IsOpen.eq_empty_of_measure_zero (hU : IsOpen U) (h₀ : μ U = 0) : U = ∅ :=
(hU.measure_eq_zero_iff μ).mp h₀
theorem _root_.IsClosed.ae_eq_univ_iff_eq (hF : IsClosed F) :
F =ᵐ[μ] univ ↔ F = univ := by
refine ⟨fun h ↦ ?_, fun h ↦ by rw [h]⟩
rwa [ae_eq_univ, hF.isOpen_compl.measure_eq_zero_iff μ, compl_empty_iff] at h
theorem _root_.IsClosed.measure_eq_univ_iff_eq [OpensMeasurableSpace X] [IsFiniteMeasure μ]
(hF : IsClosed F) :
μ F = μ univ ↔ F = univ := by
rw [← ae_eq_univ_iff_measure_eq hF.measurableSet.nullMeasurableSet, hF.ae_eq_univ_iff_eq]
theorem _root_.IsClosed.measure_eq_one_iff_eq_univ [OpensMeasurableSpace X] [IsProbabilityMeasure μ]
(hF : IsClosed F) :
μ F = 1 ↔ F = univ := by
rw [← measure_univ (μ := μ), hF.measure_eq_univ_iff_eq]
/-- A null set has empty interior. -/
theorem interior_eq_empty_of_null (hs : μ s = 0) : interior s = ∅ :=
isOpen_interior.eq_empty_of_measure_zero <| measure_mono_null interior_subset hs
/-- A property satisfied almost everywhere is satisfied on a dense subset. -/
theorem dense_of_ae {p : X → Prop} (hp : ∀ᵐ x ∂μ, p x) : Dense {x | p x} := by
rw [dense_iff_closure_eq, closure_eq_compl_interior_compl, compl_univ_iff]
exact μ.interior_eq_empty_of_null hp
/-- If two functions are a.e. equal on an open set and are continuous on this set, then they are
equal on this set. -/
theorem eqOn_open_of_ae_eq {f g : X → Y} (h : f =ᵐ[μ.restrict U] g) (hU : IsOpen U)
(hf : ContinuousOn f U) (hg : ContinuousOn g U) : EqOn f g U := by
replace h := ae_imp_of_ae_restrict h
simp only [ae_iff, Classical.not_imp] at h
have : IsOpen (U ∩ { a | f a ≠ g a }) := by
refine isOpen_iff_mem_nhds.mpr fun a ha => inter_mem (hU.mem_nhds ha.1) ?_
rcases ha with ⟨ha : a ∈ U, ha' : (f a, g a) ∈ (diagonal Y)ᶜ⟩
exact
(hf.continuousAt (hU.mem_nhds ha)).prodMk_nhds (hg.continuousAt (hU.mem_nhds ha))
(isClosed_diagonal.isOpen_compl.mem_nhds ha')
replace := (this.eq_empty_of_measure_zero h).le
exact fun x hx => Classical.not_not.1 fun h => this ⟨hx, h⟩
/-- If two continuous functions are a.e. equal, then they are equal. -/
theorem eq_of_ae_eq {f g : X → Y} (h : f =ᵐ[μ] g) (hf : Continuous f) (hg : Continuous g) : f = g :=
suffices EqOn f g univ from funext fun _ => this trivial
eqOn_open_of_ae_eq (ae_restrict_of_ae h) isOpen_univ hf.continuousOn hg.continuousOn
theorem eqOn_of_ae_eq {f g : X → Y} (h : f =ᵐ[μ.restrict s] g) (hf : ContinuousOn f s)
(hg : ContinuousOn g s) (hU : s ⊆ closure (interior s)) : EqOn f g s :=
have : interior s ⊆ s := interior_subset
(eqOn_open_of_ae_eq (ae_restrict_of_ae_restrict_of_subset this h) isOpen_interior (hf.mono this)
(hg.mono this)).of_subset_closure
hf hg this hU
variable (μ) in
theorem _root_.Continuous.ae_eq_iff_eq {f g : X → Y} (hf : Continuous f) (hg : Continuous g) :
f =ᵐ[μ] g ↔ f = g :=
⟨fun h => eq_of_ae_eq h hf hg, fun h => h ▸ EventuallyEq.rfl⟩
theorem _root_.Continuous.isOpenPosMeasure_map [OpensMeasurableSpace X]
{Z : Type*} [TopologicalSpace Z] [MeasurableSpace Z] [BorelSpace Z]
{f : X → Z} (hf : Continuous f) (hf_surj : Function.Surjective f) :
(Measure.map f μ).IsOpenPosMeasure := by
refine ⟨fun U hUo hUne => ?_⟩
rw [Measure.map_apply hf.measurable hUo.measurableSet]
exact (hUo.preimage hf).measure_ne_zero μ (hf_surj.nonempty_preimage.mpr hUne)
protected theorem IsOpenPosMeasure.comap [BorelSpace X]
{Z : Type*} [TopologicalSpace Z] {mZ : MeasurableSpace Z} [BorelSpace Z]
(μ : Measure Z) [IsOpenPosMeasure μ] {f : X → Z} (hf : IsOpenEmbedding f) :
(μ.comap f).IsOpenPosMeasure where
open_pos U hU Une := by
rw [hf.measurableEmbedding.comap_apply]
exact IsOpenPosMeasure.open_pos _ (hf.isOpen_iff_image_isOpen.mp hU) (Une.image f)
end Basic
section LinearOrder
variable {X Y : Type*} [TopologicalSpace X] [LinearOrder X] [OrderTopology X]
{m : MeasurableSpace X} [TopologicalSpace Y] [T2Space Y] (μ : Measure X) [IsOpenPosMeasure μ]
theorem measure_Ioi_pos [NoMaxOrder X] (a : X) : 0 < μ (Ioi a) :=
isOpen_Ioi.measure_pos μ nonempty_Ioi
theorem measure_Iio_pos [NoMinOrder X] (a : X) : 0 < μ (Iio a) :=
isOpen_Iio.measure_pos μ nonempty_Iio
theorem measure_Ioo_pos [DenselyOrdered X] {a b : X} : 0 < μ (Ioo a b) ↔ a < b :=
(isOpen_Ioo.measure_pos_iff μ).trans nonempty_Ioo
theorem measure_Ioo_eq_zero [DenselyOrdered X] {a b : X} : μ (Ioo a b) = 0 ↔ b ≤ a :=
(isOpen_Ioo.measure_eq_zero_iff μ).trans (Ioo_eq_empty_iff.trans not_lt)
theorem eqOn_Ioo_of_ae_eq {a b : X} {f g : X → Y} (hfg : f =ᵐ[μ.restrict (Ioo a b)] g)
(hf : ContinuousOn f (Ioo a b)) (hg : ContinuousOn g (Ioo a b)) : EqOn f g (Ioo a b) :=
eqOn_of_ae_eq hfg hf hg Ioo_subset_closure_interior
theorem eqOn_Ioc_of_ae_eq [DenselyOrdered X] {a b : X} {f g : X → Y}
(hfg : f =ᵐ[μ.restrict (Ioc a b)] g) (hf : ContinuousOn f (Ioc a b))
(hg : ContinuousOn g (Ioc a b)) : EqOn f g (Ioc a b) :=
eqOn_of_ae_eq hfg hf hg (Ioc_subset_closure_interior _ _)
theorem eqOn_Ico_of_ae_eq [DenselyOrdered X] {a b : X} {f g : X → Y}
(hfg : f =ᵐ[μ.restrict (Ico a b)] g) (hf : ContinuousOn f (Ico a b))
(hg : ContinuousOn g (Ico a b)) : EqOn f g (Ico a b) :=
eqOn_of_ae_eq hfg hf hg (Ico_subset_closure_interior _ _)
theorem eqOn_Icc_of_ae_eq [DenselyOrdered X] {a b : X} (hne : a ≠ b) {f g : X → Y}
(hfg : f =ᵐ[μ.restrict (Icc a b)] g) (hf : ContinuousOn f (Icc a b))
(hg : ContinuousOn g (Icc a b)) : EqOn f g (Icc a b) :=
eqOn_of_ae_eq hfg hf hg (closure_interior_Icc hne).symm.subset
end LinearOrder
end Measure
end MeasureTheory
open MeasureTheory MeasureTheory.Measure
namespace Metric
variable {X : Type*} [PseudoMetricSpace X] {m : MeasurableSpace X} (μ : Measure X)
[IsOpenPosMeasure μ]
theorem measure_ball_pos (x : X) {r : ℝ} (hr : 0 < r) : 0 < μ (ball x r) :=
isOpen_ball.measure_pos μ (nonempty_ball.2 hr)
/-- See also `Metric.measure_closedBall_pos_iff`. -/
theorem measure_closedBall_pos (x : X) {r : ℝ} (hr : 0 < r) : 0 < μ (closedBall x r) :=
(measure_ball_pos μ x hr).trans_le (measure_mono ball_subset_closedBall)
@[simp] lemma measure_closedBall_pos_iff {X : Type*} [MetricSpace X] {m : MeasurableSpace X}
(μ : Measure X) [IsOpenPosMeasure μ] [NoAtoms μ] {x : X} {r : ℝ} :
0 < μ (closedBall x r) ↔ 0 < r := by
refine ⟨fun h ↦ ?_, measure_closedBall_pos μ x⟩
contrapose! h
rw [(subsingleton_closedBall x h).measure_zero μ]
end Metric
namespace EMetric
variable {X : Type*} [PseudoEMetricSpace X] {m : MeasurableSpace X} (μ : Measure X)
[IsOpenPosMeasure μ]
theorem measure_ball_pos (x : X) {r : ℝ≥0∞} (hr : r ≠ 0) : 0 < μ (ball x r) :=
isOpen_ball.measure_pos μ ⟨x, mem_ball_self hr.bot_lt⟩
theorem measure_closedBall_pos (x : X) {r : ℝ≥0∞} (hr : r ≠ 0) : 0 < μ (closedBall x r) :=
(measure_ball_pos μ x hr).trans_le (measure_mono ball_subset_closedBall)
end EMetric
section MeasureZero
/-! ## Meagre sets and measure zero
In general, neither of meagre and measure zero implies the other.
- The set of Liouville numbers is a Lebesgue measure zero subset of ℝ, but is not meagre.
(In fact, its complement is meagre. See `Real.disjoint_residual_ae`.)
- The complement of the set of Liouville numbers in $[0,1]$ is meagre and has measure 1.
For another counterexample, for all $α ∈ (0,1)$, there is a generalised Cantor set $C ⊆ [0,1]$
of measure `α`. Cantor sets are nowhere dense (hence meagre). Taking a countable union of
fat Cantor sets whose measure approaches 1 even yields a meagre set of measure 1.
However, with respect to a measure which is positive on non-empty open sets, *closed* measure
zero sets are nowhere dense and σ-compact measure zero sets in a Hausdorff space are meagre.
-/
variable {X : Type*} [TopologicalSpace X] [MeasurableSpace X] {s : Set X}
{μ : Measure X} [IsOpenPosMeasure μ]
/-- A *closed* measure zero subset is nowhere dense. (Closedness is required: for instance, the
rational numbers are countable (thus have measure zero), but are dense (hence not nowhere dense). -/
lemma IsNowhereDense.of_isClosed_null (h₁s : IsClosed s) (h₂s : μ s = 0) :
IsNowhereDense s := h₁s.isNowhereDense_iff.mpr (interior_eq_empty_of_null h₂s)
/-- A σ-compact measure zero subset is meagre.
(More generally, every Fσ set of measure zero is meagre.) -/
lemma IsMeagre.of_isSigmaCompact_null [T2Space X] (h₁s : IsSigmaCompact s) (h₂s : μ s = 0) :
IsMeagre s := by
rcases h₁s with ⟨K, hcompact, hcover⟩
have h (n : ℕ) : IsNowhereDense (K n) := by
have : μ (K n) = 0 := measure_mono_null (hcover ▸ subset_iUnion K n) h₂s
exact .of_isClosed_null (hcompact n).isClosed this
rw [isMeagre_iff_countable_union_isNowhereDense]
exact ⟨range K, fun t ⟨n, hn⟩ ↦ hn ▸ h n, countable_range K, hcover.symm.subset⟩
end MeasureZero |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/TightNormed.lean | import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.MeasureTheory.Measure.Tight
import Mathlib.Order.CompletePartialOrder
/-!
# Tight sets of measures in normed spaces
Criteria for tightness of sets of measures in normed and inner product spaces.
## Main statements
* `isTightMeasureSet_iff_tendsto_measure_norm_gt`: in a proper normed group, a set of measures `S`
is tight if and only if the function `r ↦ ⨆ μ ∈ S, μ {x | r < ‖x‖}` tends to `0` at infinity.
* `isTightMeasureSet_iff_inner_tendsto`: in a finite-dimensional inner product space,
a set of measures `S` is tight if and only if the function `r ↦ ⨆ μ ∈ S, μ {x | r < |⟪y, x⟫|}`
tends to `0` at infinity for all `y`.
-/
open Filter
open scoped Topology ENNReal InnerProductSpace
namespace MeasureTheory
variable {E : Type*} {mE : MeasurableSpace E} {S : Set (Measure E)}
section PseudoMetricSpace
variable [PseudoMetricSpace E]
lemma tendsto_measure_compl_closedBall_of_isTightMeasureSet (hS : IsTightMeasureSet S) (x : E) :
Tendsto (fun r : ℝ ↦ ⨆ μ ∈ S, μ (Metric.closedBall x r)ᶜ) atTop (𝓝 0) := by
suffices Tendsto ((⨆ μ ∈ S, μ) ∘ (fun r ↦ (Metric.closedBall x r)ᶜ)) atTop (𝓝 0) by
convert this with r
simp
refine hS.comp <| .mono_right ?_ <| monotone_smallSets Metric.cobounded_le_cocompact
exact (Metric.hasAntitoneBasis_cobounded_compl_closedBall _).tendsto_smallSets
lemma isTightMeasureSet_of_tendsto_measure_compl_closedBall [ProperSpace E] {x : E}
(h : Tendsto (fun r : ℝ ↦ ⨆ μ ∈ S, μ (Metric.closedBall x r)ᶜ) atTop (𝓝 0)) :
IsTightMeasureSet S := by
refine IsTightMeasureSet_iff_exists_isCompact_measure_compl_le.mpr fun ε hε ↦ ?_
rw [ENNReal.tendsto_atTop_zero] at h
obtain ⟨r, h⟩ := h ε hε
exact ⟨Metric.closedBall x r, isCompact_closedBall x r, by simpa using h r le_rfl⟩
/-- In a proper pseudo-metric space, a set of measures `S` is tight if and only if
the function `r ↦ ⨆ μ ∈ S, μ (Metric.closedBall x r)ᶜ` tends to `0` at infinity. -/
lemma isTightMeasureSet_iff_tendsto_measure_compl_closedBall [ProperSpace E] (x : E) :
IsTightMeasureSet S ↔ Tendsto (fun r : ℝ ↦ ⨆ μ ∈ S, μ (Metric.closedBall x r)ᶜ) atTop (𝓝 0) :=
⟨fun hS ↦ tendsto_measure_compl_closedBall_of_isTightMeasureSet hS x,
isTightMeasureSet_of_tendsto_measure_compl_closedBall⟩
end PseudoMetricSpace
section NormedAddCommGroup
variable [NormedAddCommGroup E]
lemma tendsto_measure_norm_gt_of_isTightMeasureSet (hS : IsTightMeasureSet S) :
Tendsto (fun r : ℝ ↦ ⨆ μ ∈ S, μ {x | r < ‖x‖}) atTop (𝓝 0) := by
have h := tendsto_measure_compl_closedBall_of_isTightMeasureSet hS 0
convert h using 6 with r
ext
simp
lemma isTightMeasureSet_of_tendsto_measure_norm_gt [ProperSpace E]
(h : Tendsto (fun r : ℝ ↦ ⨆ μ ∈ S, μ {x | r < ‖x‖}) atTop (𝓝 0)) :
IsTightMeasureSet S := by
refine isTightMeasureSet_of_tendsto_measure_compl_closedBall (x := 0) ?_
convert h using 6 with r
ext
simp
/-- In a proper normed group, a set of measures `S` is tight if and only if
the function `r ↦ ⨆ μ ∈ S, μ {x | r < ‖x‖}` tends to `0` at infinity. -/
lemma isTightMeasureSet_iff_tendsto_measure_norm_gt [ProperSpace E] :
IsTightMeasureSet S ↔ Tendsto (fun r : ℝ ↦ ⨆ μ ∈ S, μ {x | r < ‖x‖}) atTop (𝓝 0) :=
⟨tendsto_measure_norm_gt_of_isTightMeasureSet, isTightMeasureSet_of_tendsto_measure_norm_gt⟩
section InnerProductSpace
variable {𝕜 ι : Type*} [RCLike 𝕜] [Fintype ι] [InnerProductSpace 𝕜 E] [FiniteDimensional 𝕜 E]
lemma isTightMeasureSet_of_forall_basis_tendsto (b : OrthonormalBasis ι 𝕜 E)
(h : ∀ i, Tendsto (fun r : ℝ ↦ ⨆ μ ∈ S, μ {x | r < ‖⟪b i, x⟫_𝕜‖}) atTop (𝓝 0)) :
IsTightMeasureSet S := by
rcases subsingleton_or_nontrivial E with hE | hE
· simp only [IsTightMeasureSet, cocompact_eq_bot, smallSets_bot]
convert tendsto_pure_nhds (a := ∅) _
simp
have h_rank : (0 : ℝ) < Fintype.card ι := by
simpa [← Module.finrank_eq_card_basis b.toBasis, Module.finrank_pos_iff]
have : Nonempty ι := by simpa [Fintype.card_pos_iff] using h_rank
have : ProperSpace E := FiniteDimensional.proper 𝕜 E
refine isTightMeasureSet_of_tendsto_measure_norm_gt ?_
have h_le : (fun r ↦ ⨆ μ ∈ S, μ {x | r < ‖x‖})
≤ fun r ↦ ∑ i, ⨆ μ ∈ S, μ {x | r / √(Fintype.card ι) < ‖⟪b i, x⟫_𝕜‖} := by
intro r
calc ⨆ μ ∈ S, μ {x | r < ‖x‖}
_ ≤ ⨆ μ ∈ S, μ (⋃ i, {x : E | r / √(Fintype.card ι) < ‖⟪b i, x⟫_𝕜‖}) := by
gcongr with μ hμS
intro x hx
simp only [Set.mem_setOf_eq, Set.mem_iUnion] at hx ⊢
have hx' : r < √(Fintype.card ι) * ⨆ i, ‖⟪b i, x⟫_𝕜‖ :=
hx.trans_le (b.norm_le_card_mul_iSup_norm_inner x)
rw [← div_lt_iff₀' (by positivity)] at hx'
by_contra! h_le
exact lt_irrefl (r / √(Fintype.card ι)) (hx'.trans_le (ciSup_le h_le))
_ ≤ ⨆ μ ∈ S, ∑ i, μ {x : E | r / √(Fintype.card ι) < ‖⟪b i, x⟫_𝕜‖} := by
gcongr with μ hμS
exact measure_iUnion_fintype_le μ _
_ ≤ ∑ i, ⨆ μ ∈ S, μ {x | r / √(Fintype.card ι) < ‖⟪b i, x⟫_𝕜‖} := by
refine iSup_le fun μ ↦ (iSup_le fun hμS ↦ ?_)
gcongr with i
exact le_biSup (fun μ ↦ μ {x | r / √(Fintype.card ι) < ‖⟪b i, x⟫_𝕜‖}) hμS
refine tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds ?_ (fun _ ↦ zero_le') h_le
rw [← Finset.sum_const_zero]
refine tendsto_finset_sum Finset.univ fun i _ ↦ (h i).comp ?_
exact tendsto_id.atTop_div_const (by positivity)
lemma isTightMeasureSet_of_inner_tendsto
(h : ∀ y, Tendsto (fun r : ℝ ↦ ⨆ μ ∈ S, μ {x | r < ‖⟪y, x⟫_𝕜‖}) atTop (𝓝 0)) :
IsTightMeasureSet S :=
isTightMeasureSet_of_forall_basis_tendsto (stdOrthonormalBasis 𝕜 E)
fun i ↦ h (stdOrthonormalBasis 𝕜 E i)
variable (𝕜) in
/-- In a finite-dimensional inner product space,
a set of measures `S` is tight if and only if the function `r ↦ ⨆ μ ∈ S, μ {x | r < |⟪y, x⟫|}`
tends to `0` at infinity for all `y`. -/
lemma isTightMeasureSet_iff_inner_tendsto :
IsTightMeasureSet S
↔ ∀ y, Tendsto (fun r : ℝ ↦ ⨆ μ ∈ S, μ {x | r < ‖⟪y, x⟫_𝕜‖}) atTop (𝓝 0) := by
refine ⟨fun h y ↦ ?_, isTightMeasureSet_of_inner_tendsto⟩
have : ProperSpace E := FiniteDimensional.proper 𝕜 E
rw [isTightMeasureSet_iff_tendsto_measure_norm_gt] at h
by_cases hy : y = 0
· simp only [hy, inner_zero_left]
refine (tendsto_congr' ?_).mpr tendsto_const_nhds
filter_upwards [eventually_ge_atTop 0] with r hr
simp [not_lt.mpr hr]
have h' : Tendsto (fun r ↦ ⨆ μ ∈ S, μ {x | r * ‖y‖⁻¹ < ‖x‖}) atTop (𝓝 0) :=
h.comp <| (tendsto_mul_const_atTop_of_pos (by positivity)).mpr tendsto_id
refine tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds h' (fun _ ↦ zero_le') ?_
intro r
have h_le (μ : Measure E) : μ {x | r < ‖⟪y, x⟫_𝕜‖} ≤ μ {x | r * ‖y‖⁻¹ < ‖x‖} := by
refine measure_mono fun x hx ↦ ?_
simp only [Set.mem_setOf_eq] at hx ⊢
rw [mul_inv_lt_iff₀]
· rw [mul_comm]
exact hx.trans_le (norm_inner_le_norm y x)
· positivity
refine iSup₂_le_iff.mpr fun μ hμS ↦ ?_
exact le_iSup_of_le (i := μ) <| by simp [hμS, h_le]
end InnerProductSpace
end NormedAddCommGroup
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/RegularityCompacts.lean | import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.MeasureTheory.Measure.Regular
import Mathlib.Topology.MetricSpace.Polish
import Mathlib.Topology.UniformSpace.Cauchy
/-!
# Inner regularity of finite measures
The main result of this file is
`InnerRegularCompactLTTop_of_pseudoEMetricSpace_completeSpace_secondCountable`:
A finite measure `μ` on a `PseudoEMetricSpace E` and `CompleteSpace E` with
`SecondCountableTopology E` is inner regular with respect to compact sets. In other
words, a finite measure on such a space is a tight measure.
Finite measures on Polish spaces are an important special case, which makes the result
`MeasureTheory.PolishSpace.innerRegular_isCompact_isClosed_measurableSet` an important result in
probability.
-/
open Set MeasureTheory
open scoped ENNReal Uniformity
namespace MeasureTheory
variable {α : Type*} [MeasurableSpace α] {μ : Measure α}
theorem innerRegularWRT_isCompact_closure_iff [TopologicalSpace α] [R1Space α] :
μ.InnerRegularWRT (IsCompact ∘ closure) IsClosed ↔ μ.InnerRegularWRT IsCompact IsClosed := by
constructor <;> intro h A hA r hr
· rcases h hA r hr with ⟨K, ⟨hK1, hK2, hK3⟩⟩
exact ⟨closure K, closure_minimal hK1 hA, hK2, hK3.trans_le (measure_mono subset_closure)⟩
· rcases h hA r hr with ⟨K, ⟨hK1, hK2, hK3⟩⟩
refine ⟨closure K, closure_minimal hK1 hA, ?_, ?_⟩
· simpa only [closure_closure, Function.comp_apply] using hK2.closure
· exact hK3.trans_le (measure_mono subset_closure)
lemma innerRegularWRT_isCompact_isClosed_iff_innerRegularWRT_isCompact_closure
[TopologicalSpace α] [R1Space α] :
μ.InnerRegularWRT (fun s ↦ IsCompact s ∧ IsClosed s) IsClosed
↔ μ.InnerRegularWRT (IsCompact ∘ closure) IsClosed := by
constructor <;> intro h A hA r hr
· obtain ⟨K, hK1, ⟨hK2, _⟩, hK4⟩ := h hA r hr
refine ⟨K, hK1, ?_, hK4⟩
simp only [Function.comp_apply]
exact hK2.closure
· obtain ⟨K, hK1, hK2, hK3⟩ := h hA r hr
refine ⟨closure K, closure_minimal hK1 hA, ?_, ?_⟩
· simpa only [isClosed_closure, and_true]
· exact hK3.trans_le (measure_mono subset_closure)
lemma innerRegularWRT_isCompact_isClosed_iff [TopologicalSpace α] [R1Space α] :
μ.InnerRegularWRT (fun s ↦ IsCompact s ∧ IsClosed s) IsClosed
↔ μ.InnerRegularWRT IsCompact IsClosed :=
innerRegularWRT_isCompact_isClosed_iff_innerRegularWRT_isCompact_closure.trans
innerRegularWRT_isCompact_closure_iff
/--
If predicate `p` is preserved under intersections with sets satisfying predicate `q`, and sets
satisfying `p` cover the space arbitrarily well, then `μ` is inner regular with respect to
predicates `p` and `q`.
-/
theorem innerRegularWRT_of_exists_compl_lt {p q : Set α → Prop} (hpq : ∀ A B, p A → q B → p (A ∩ B))
(hμ : ∀ ε, 0 < ε → ∃ K, p K ∧ μ Kᶜ < ε) :
μ.InnerRegularWRT p q := by
intro A hA r hr
obtain ⟨K, hK, hK_subset, h_lt⟩ : ∃ K, p K ∧ K ⊆ A ∧ μ (A \ K) < μ A - r := by
obtain ⟨K', hpK', hK'_lt⟩ := hμ (μ A - r) (tsub_pos_of_lt hr)
refine ⟨K' ∩ A, hpq K' A hpK' hA, inter_subset_right, ?_⟩
· refine (measure_mono fun x ↦ ?_).trans_lt hK'_lt
simp only [diff_inter_self_eq_diff, mem_diff, mem_compl_iff, and_imp, imp_self, imp_true_iff]
refine ⟨K, hK_subset, hK, ?_⟩
have h_lt' : μ A - μ K < μ A - r := le_measure_diff.trans_lt h_lt
exact lt_of_tsub_lt_tsub_left h_lt'
theorem innerRegularWRT_isCompact_closure_of_univ [TopologicalSpace α]
(hμ : ∀ ε, 0 < ε → ∃ K, IsCompact (closure K) ∧ μ (Kᶜ) < ε) :
μ.InnerRegularWRT (IsCompact ∘ closure) IsClosed := by
refine innerRegularWRT_of_exists_compl_lt (fun s t hs ht ↦ ?_) hμ
have : IsCompact (closure s ∩ t) := hs.inter_right ht
refine this.of_isClosed_subset isClosed_closure ?_
refine (closure_inter_subset_inter_closure _ _).trans_eq ?_
rw [IsClosed.closure_eq ht]
theorem exists_isCompact_closure_measure_compl_lt [UniformSpace α] [CompleteSpace α]
[SecondCountableTopology α] [(uniformity α).IsCountablyGenerated]
[OpensMeasurableSpace α] (P : Measure α) [IsFiniteMeasure P] (ε : ℝ≥0∞) (hε : 0 < ε) :
∃ K, IsCompact (closure K) ∧ P Kᶜ < ε := by
/-
If α is empty, the result is trivial.
Otherwise, fix a dense sequence `seq` and an antitone basis `t` of entourages. We find a sequence
of natural numbers `u n`, such that `interUnionBalls seq u t`, which is the intersection over
`n` of the `t n`-neighborhood of `seq 1, ..., seq (u n)`, covers the space arbitrarily well.
-/
cases isEmpty_or_nonempty α
case inl =>
refine ⟨∅, by simp, ?_⟩
rwa [Set.eq_empty_of_isEmpty ∅ᶜ, measure_empty]
case inr =>
let seq := TopologicalSpace.denseSeq α
have hseq_dense : DenseRange seq := TopologicalSpace.denseRange_denseSeq α
obtain ⟨t : ℕ → SetRel α α,
ht : ∀ i, t i ∈ 𝓤 α ∧ IsOpen (t i) ∧ (t i).IsSymm,
h_basis : (uniformity α).HasAntitoneBasis t⟩ :=
(@uniformity_hasBasis_open_symmetric α _).exists_antitone_subbasis
choose htu hto _ using ht
let f : ℕ → ℕ → Set α := fun n m ↦ UniformSpace.ball (seq m) (t n)
have h_univ n : (⋃ m, f n m) = univ := hseq_dense.iUnion_uniformity_ball (htu n)
have h3 n (ε : ℝ≥0∞) (hε : 0 < ε) : ∃ m, P (⋂ m' ≤ m, (f n m')ᶜ) < ε := by
refine exists_measure_iInter_lt (fun m ↦ ?_) hε ⟨0, measure_ne_top P _⟩ ?_
· exact (measurable_prodMk_left (hto n).measurableSet).compl.nullMeasurableSet
· rw [← compl_iUnion, h_univ, compl_univ]
choose! s' s'bound using h3
rcases ENNReal.exists_pos_sum_of_countable' (ne_of_gt hε) ℕ with ⟨δ, hδ1, hδ2⟩
classical
let u : ℕ → ℕ := fun n ↦ s' n (δ n)
refine ⟨interUnionBalls seq u t, isCompact_closure_interUnionBalls h_basis.toHasBasis seq u, ?_⟩
rw [interUnionBalls, Set.compl_iInter]
refine ((measure_iUnion_le _).trans ?_).trans_lt hδ2
refine ENNReal.tsum_le_tsum (fun n ↦ ?_)
have h'' n : Prod.swap ⁻¹' t n = t n := by ext; exact (t n).comm
simp only [h'', compl_iUnion, ge_iff_le]
exact (s'bound n (δ n) (hδ1 n)).le
theorem innerRegularWRT_isCompact_closure [UniformSpace α] [CompleteSpace α]
[SecondCountableTopology α] [(uniformity α).IsCountablyGenerated]
[OpensMeasurableSpace α] (P : Measure α) [IsFiniteMeasure P] :
P.InnerRegularWRT (IsCompact ∘ closure) IsClosed :=
innerRegularWRT_isCompact_closure_of_univ
(exists_isCompact_closure_measure_compl_lt P)
theorem innerRegularWRT_isCompact_isClosed [UniformSpace α] [CompleteSpace α]
[SecondCountableTopology α] [(uniformity α).IsCountablyGenerated]
[OpensMeasurableSpace α] (P : Measure α) [IsFiniteMeasure P] :
P.InnerRegularWRT (fun s ↦ IsCompact s ∧ IsClosed s) IsClosed := by
rw [innerRegularWRT_isCompact_isClosed_iff_innerRegularWRT_isCompact_closure]
exact innerRegularWRT_isCompact_closure P
theorem innerRegularWRT_isCompact [UniformSpace α] [CompleteSpace α]
[SecondCountableTopology α] [(uniformity α).IsCountablyGenerated]
[OpensMeasurableSpace α] (P : Measure α) [IsFiniteMeasure P] :
P.InnerRegularWRT IsCompact IsClosed := by
rw [← innerRegularWRT_isCompact_closure_iff]
exact innerRegularWRT_isCompact_closure P
theorem innerRegularWRT_isCompact_isClosed_isOpen [PseudoEMetricSpace α]
[CompleteSpace α] [SecondCountableTopology α] [OpensMeasurableSpace α]
(P : Measure α) [IsFiniteMeasure P] :
P.InnerRegularWRT (fun s ↦ IsCompact s ∧ IsClosed s) IsOpen :=
(innerRegularWRT_isCompact_isClosed P).trans
(Measure.InnerRegularWRT.of_pseudoMetrizableSpace P)
theorem innerRegularWRT_isCompact_isOpen [PseudoEMetricSpace α]
[CompleteSpace α] [SecondCountableTopology α] [OpensMeasurableSpace α]
(P : Measure α) [IsFiniteMeasure P] :
P.InnerRegularWRT IsCompact IsOpen :=
(innerRegularWRT_isCompact P).trans
(Measure.InnerRegularWRT.of_pseudoMetrizableSpace P)
/--
A finite measure `μ` on a `PseudoEMetricSpace E` and `CompleteSpace E` with
`SecondCountableTopology E` is inner regular. In other words, a finite measure
on such a space is a tight measure.
-/
instance InnerRegular_of_pseudoEMetricSpace_completeSpace_secondCountable [PseudoEMetricSpace α]
[CompleteSpace α] [SecondCountableTopology α] [BorelSpace α]
(P : Measure α) [IsFiniteMeasure P] :
P.InnerRegular := by
suffices P.InnerRegularCompactLTTop from inferInstance
refine ⟨Measure.InnerRegularWRT.measurableSet_of_isOpen ?_ ?_⟩
· exact innerRegularWRT_isCompact_isOpen P
· exact fun s t hs_compact ht_open ↦ hs_compact.inter_right ht_open.isClosed_compl
/--
A special case of `innerRegular_of_pseudoEMetricSpace_completeSpace_secondCountable` for Polish
spaces: A finite measure on a Polish space is a tight measure.
-/
instance InnerRegular_of_polishSpace [TopologicalSpace α]
[PolishSpace α] [BorelSpace α] (P : Measure α) [IsFiniteMeasure P] :
P.InnerRegular := by
letI := TopologicalSpace.upgradeIsCompletelyMetrizable α
exact InnerRegular_of_pseudoEMetricSpace_completeSpace_secondCountable P
/--
A measure `μ` on a `PseudoEMetricSpace E` and `CompleteSpace E` with `SecondCountableTopology E`
is inner regular for finite measure sets with respect to compact sets.
-/
instance InnerRegularCompactLTTop_of_pseudoEMetricSpace_completeSpace_secondCountable
[PseudoEMetricSpace α] [CompleteSpace α] [SecondCountableTopology α] [BorelSpace α]
(μ : Measure α) :
μ.InnerRegularCompactLTTop := by
constructor
intro A ⟨hA1, hA2⟩ r hr
have := Fact.mk hA2.lt_top
have hA2' : (μ.restrict A) A ≠ ⊤ := by
rwa [Measure.restrict_apply_self]
have hr' : r < μ.restrict A A := by
rwa [Measure.restrict_apply_self]
obtain ⟨K, ⟨hK1, hK2, hK3⟩⟩ := MeasurableSet.exists_lt_isCompact_of_ne_top hA1 hA2' hr'
use K, hK1, hK2
rwa [Measure.restrict_eq_self μ hK1] at hK3
/--
A special case of `innerRegularCompactLTTop_of_pseudoEMetricSpace_completeSpace_secondCountable`
for Polish spaces: A measure `μ` on a Polish space inner regular for finite measure sets with
respect to compact sets.
-/
instance InnerRegularCompactLTTop_of_polishSpace
[TopologicalSpace α] [PolishSpace α] [BorelSpace α] (μ : Measure α) :
μ.InnerRegularCompactLTTop := by
letI := TopologicalSpace.upgradeIsCompletelyMetrizable α
exact InnerRegularCompactLTTop_of_pseudoEMetricSpace_completeSpace_secondCountable μ
theorem innerRegular_isCompact_isClosed_measurableSet_of_finite [PseudoEMetricSpace α]
[CompleteSpace α] [SecondCountableTopology α] [BorelSpace α]
(P : Measure α) [IsFiniteMeasure P] :
P.InnerRegularWRT (fun s ↦ IsCompact s ∧ IsClosed s) MeasurableSet := by
suffices P.InnerRegularWRT (fun s ↦ IsCompact s ∧ IsClosed s)
fun s ↦ MeasurableSet s ∧ P s ≠ ∞ by
convert this
simp only [iff_self_and]
exact fun _ ↦ measure_ne_top P _
refine Measure.InnerRegularWRT.measurableSet_of_isOpen ?_ ?_
· exact innerRegularWRT_isCompact_isClosed_isOpen P
· rintro s t ⟨hs_compact, hs_closed⟩ ht_open
rw [diff_eq]
exact ⟨hs_compact.inter_right ht_open.isClosed_compl,
hs_closed.inter (isClosed_compl_iff.mpr ht_open)⟩
/--
On a Polish space, any finite measure is regular with respect to compact and closed sets. In
particular, a finite measure on a Polish space is a tight measure.
-/
theorem PolishSpace.innerRegular_isCompact_isClosed_measurableSet [TopologicalSpace α]
[PolishSpace α] [BorelSpace α] (P : Measure α) [IsFiniteMeasure P] :
P.InnerRegularWRT (fun s ↦ IsCompact s ∧ IsClosed s) MeasurableSet := by
letI := TopologicalSpace.upgradeIsCompletelyMetrizable α
exact innerRegular_isCompact_isClosed_measurableSet_of_finite P
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/MeasureSpace.lean | import Mathlib.MeasureTheory.MeasurableSpace.MeasurablyGenerated
import Mathlib.MeasureTheory.Measure.NullMeasurable
import Mathlib.Order.Interval.Set.Monotone
/-!
# Measure spaces
The definition of a measure and a measure space are in `MeasureTheory.MeasureSpaceDef`, with
only a few basic properties. This file provides many more properties of these objects.
This separation allows the measurability tactic to import only the file `MeasureSpaceDef`, and to
be available in `MeasureSpace` (through `MeasurableSpace`).
Given a measurable space `α`, a measure on `α` is a function that sends measurable sets to the
extended nonnegative reals that satisfies the following conditions:
1. `μ ∅ = 0`;
2. `μ` is countably additive. This means that the measure of a countable union of pairwise disjoint
sets is equal to the measure of the individual sets.
Every measure can be canonically extended to an outer measure, so that it assigns values to
all subsets, not just the measurable subsets. On the other hand, a measure that is countably
additive on measurable sets can be restricted to measurable sets to obtain a measure.
In this file a measure is defined to be an outer measure that is countably additive on
measurable sets, with the additional assumption that the outer measure is the canonical
extension of the restricted measure.
Measures on `α` form a complete lattice, and are closed under scalar multiplication with `ℝ≥0∞`.
Given a measure, the null sets are the sets where `μ s = 0`, where `μ` denotes the corresponding
outer measure (so `s` might not be measurable). We can then define the completion of `μ` as the
measure on the least `σ`-algebra that also contains all null sets, by defining the measure to be `0`
on the null sets.
## Main statements
* `completion` is the completion of a measure to all null measurable sets.
* `Measure.ofMeasurable` and `OuterMeasure.toMeasure` are two important ways to define a measure.
## Implementation notes
Given `μ : Measure α`, `μ s` is the value of the *outer measure* applied to `s`.
This conveniently allows us to apply the measure to sets without proving that they are measurable.
We get countable subadditivity for all sets, but only countable additivity for measurable sets.
You often don't want to define a measure via its constructor.
Two ways that are sometimes more convenient:
* `Measure.ofMeasurable` is a way to define a measure by only giving its value on measurable sets
and proving the properties (1) and (2) mentioned above.
* `OuterMeasure.toMeasure` is a way of obtaining a measure from an outer measure by showing that
all measurable sets in the measurable space are Carathéodory measurable.
To prove that two measures are equal, there are multiple options:
* `ext`: two measures are equal if they are equal on all measurable sets.
* `ext_of_generateFrom_of_iUnion`: two measures are equal if they are equal on a π-system generating
the measurable sets, if the π-system contains a spanning increasing sequence of sets where the
measures take finite value (in particular the measures are σ-finite). This is a special case of
the more general `ext_of_generateFrom_of_cover`
* `ext_of_generate_finite`: two finite measures are equal if they are equal on a π-system
generating the measurable sets. This is a special case of `ext_of_generateFrom_of_iUnion` using
`C ∪ {univ}`, but is easier to work with.
A `MeasureSpace` is a class that is a measurable space with a canonical measure.
The measure is denoted `volume`.
## References
* <https://en.wikipedia.org/wiki/Measure_(mathematics)>
* <https://en.wikipedia.org/wiki/Complete_measure>
* <https://en.wikipedia.org/wiki/Almost_everywhere>
## Tags
measure, almost everywhere, measure space, completion, null set, null measurable set
-/
noncomputable section
open Set
open Filter hiding map
open Function MeasurableSpace Topology Filter ENNReal NNReal Interval MeasureTheory
open scoped symmDiff
variable {α β γ δ ι R R' : Type*}
namespace MeasureTheory
section
variable {m : MeasurableSpace α} {μ μ₁ μ₂ : Measure α} {s s₁ s₂ t : Set α}
instance ae_isMeasurablyGenerated : IsMeasurablyGenerated (ae μ) :=
⟨fun _s hs =>
let ⟨t, hst, htm, htμ⟩ := exists_measurable_superset_of_null hs
⟨tᶜ, compl_mem_ae_iff.2 htμ, htm.compl, compl_subset_comm.1 hst⟩⟩
/-- See also `MeasureTheory.ae_restrict_uIoc_iff`. -/
theorem ae_uIoc_iff [LinearOrder α] {a b : α} {P : α → Prop} :
(∀ᵐ x ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ x ∂μ, x ∈ Ioc a b → P x) ∧ ∀ᵐ x ∂μ, x ∈ Ioc b a → P x := by
simp only [uIoc_eq_union, mem_union, or_imp, eventually_and]
theorem measure_union (hd : Disjoint s₁ s₂) (h : MeasurableSet s₂) : μ (s₁ ∪ s₂) = μ s₁ + μ s₂ :=
measure_union₀ h.nullMeasurableSet hd.aedisjoint
theorem measure_union' (hd : Disjoint s₁ s₂) (h : MeasurableSet s₁) : μ (s₁ ∪ s₂) = μ s₁ + μ s₂ :=
measure_union₀' h.nullMeasurableSet hd.aedisjoint
theorem measure_inter_add_diff (s : Set α) (ht : MeasurableSet t) : μ (s ∩ t) + μ (s \ t) = μ s :=
measure_inter_add_diff₀ _ ht.nullMeasurableSet
theorem measure_diff_add_inter (s : Set α) (ht : MeasurableSet t) : μ (s \ t) + μ (s ∩ t) = μ s :=
(add_comm _ _).trans (measure_inter_add_diff s ht)
theorem measure_diff_eq_top (hs : μ s = ∞) (ht : μ t ≠ ∞) : μ (s \ t) = ∞ := by
contrapose! hs
exact ((measure_mono (subset_diff_union s t)).trans_lt
((measure_union_le _ _).trans_lt (ENNReal.add_lt_top.2 ⟨hs.lt_top, ht.lt_top⟩))).ne
theorem measure_union_add_inter (s : Set α) (ht : MeasurableSet t) :
μ (s ∪ t) + μ (s ∩ t) = μ s + μ t := by
rw [← measure_inter_add_diff (s ∪ t) ht, Set.union_inter_cancel_right, union_diff_right, ←
measure_inter_add_diff s ht]
ac_rfl
theorem measure_union_add_inter' (hs : MeasurableSet s) (t : Set α) :
μ (s ∪ t) + μ (s ∩ t) = μ s + μ t := by
rw [union_comm, inter_comm, measure_union_add_inter t hs, add_comm]
lemma measure_symmDiff_eq (hs : NullMeasurableSet s μ) (ht : NullMeasurableSet t μ) :
μ (s ∆ t) = μ (s \ t) + μ (t \ s) := by
simpa only [symmDiff_def, sup_eq_union]
using measure_union₀ (ht.diff hs) disjoint_sdiff_sdiff.aedisjoint
lemma measure_symmDiff_le (s t u : Set α) :
μ (s ∆ u) ≤ μ (s ∆ t) + μ (t ∆ u) :=
le_trans (μ.mono <| symmDiff_triangle s t u) (measure_union_le (s ∆ t) (t ∆ u))
theorem measure_symmDiff_eq_top (hs : μ s ≠ ∞) (ht : μ t = ∞) : μ (s ∆ t) = ∞ :=
measure_mono_top subset_union_right (measure_diff_eq_top ht hs)
theorem measure_add_measure_compl (h : MeasurableSet s) : μ s + μ sᶜ = μ univ :=
measure_add_measure_compl₀ h.nullMeasurableSet
theorem measure_biUnion₀ {s : Set β} {f : β → Set α} (hs : s.Countable)
(hd : s.Pairwise (AEDisjoint μ on f)) (h : ∀ b ∈ s, NullMeasurableSet (f b) μ) :
μ (⋃ b ∈ s, f b) = ∑' p : s, μ (f p) := by
haveI := hs.toEncodable
rw [biUnion_eq_iUnion]
exact measure_iUnion₀ (hd.on_injective Subtype.coe_injective fun x => x.2) fun x => h x x.2
theorem measure_biUnion {s : Set β} {f : β → Set α} (hs : s.Countable) (hd : s.PairwiseDisjoint f)
(h : ∀ b ∈ s, MeasurableSet (f b)) : μ (⋃ b ∈ s, f b) = ∑' p : s, μ (f p) :=
measure_biUnion₀ hs hd.aedisjoint fun b hb => (h b hb).nullMeasurableSet
theorem measure_sUnion₀ {S : Set (Set α)} (hs : S.Countable) (hd : S.Pairwise (AEDisjoint μ))
(h : ∀ s ∈ S, NullMeasurableSet s μ) : μ (⋃₀ S) = ∑' s : S, μ s := by
rw [sUnion_eq_biUnion, measure_biUnion₀ hs hd h]
theorem measure_sUnion {S : Set (Set α)} (hs : S.Countable) (hd : S.Pairwise Disjoint)
(h : ∀ s ∈ S, MeasurableSet s) : μ (⋃₀ S) = ∑' s : S, μ s := by
rw [sUnion_eq_biUnion, measure_biUnion hs hd h]
theorem measure_biUnion_finset₀ {s : Finset ι} {f : ι → Set α}
(hd : Set.Pairwise (↑s) (AEDisjoint μ on f)) (hm : ∀ b ∈ s, NullMeasurableSet (f b) μ) :
μ (⋃ b ∈ s, f b) = ∑ p ∈ s, μ (f p) := by
rw [← Finset.sum_attach, Finset.attach_eq_univ, ← tsum_fintype (L := .unconditional s)]
exact measure_biUnion₀ s.countable_toSet hd hm
theorem measure_biUnion_finset {s : Finset ι} {f : ι → Set α} (hd : PairwiseDisjoint (↑s) f)
(hm : ∀ b ∈ s, MeasurableSet (f b)) : μ (⋃ b ∈ s, f b) = ∑ p ∈ s, μ (f p) :=
measure_biUnion_finset₀ hd.aedisjoint fun b hb => (hm b hb).nullMeasurableSet
/-- The measure of an a.e. disjoint union (even uncountable) of null-measurable sets is at least
the sum of the measures of the sets. -/
theorem tsum_meas_le_meas_iUnion_of_disjoint₀ {ι : Type*} {_ : MeasurableSpace α} (μ : Measure α)
{As : ι → Set α} (As_mble : ∀ i : ι, NullMeasurableSet (As i) μ)
(As_disj : Pairwise (AEDisjoint μ on As)) : (∑' i, μ (As i)) ≤ μ (⋃ i, As i) := by
rw [ENNReal.tsum_eq_iSup_sum, iSup_le_iff]
intro s
simp only [← measure_biUnion_finset₀ (fun _i _hi _j _hj hij => As_disj hij) fun i _ => As_mble i]
gcongr
exact iUnion_subset fun _ ↦ Subset.rfl
/-- The measure of a disjoint union (even uncountable) of measurable sets is at least the sum of
the measures of the sets. -/
theorem tsum_meas_le_meas_iUnion_of_disjoint {ι : Type*} {_ : MeasurableSpace α} (μ : Measure α)
{As : ι → Set α} (As_mble : ∀ i : ι, MeasurableSet (As i))
(As_disj : Pairwise (Disjoint on As)) : (∑' i, μ (As i)) ≤ μ (⋃ i, As i) :=
tsum_meas_le_meas_iUnion_of_disjoint₀ μ (fun i ↦ (As_mble i).nullMeasurableSet)
(fun _ _ h ↦ Disjoint.aedisjoint (As_disj h))
/-- If `s` is a countable set, then the measure of its preimage can be found as the sum of measures
of the fibers `f ⁻¹' {y}`. -/
theorem tsum_measure_preimage_singleton {s : Set β} (hs : s.Countable) {f : α → β}
(hf : ∀ y ∈ s, MeasurableSet (f ⁻¹' {y})) : (∑' b : s, μ (f ⁻¹' {↑b})) = μ (f ⁻¹' s) := by
rw [← Set.biUnion_preimage_singleton, measure_biUnion hs (pairwiseDisjoint_fiber f s) hf]
lemma measure_preimage_eq_zero_iff_of_countable {s : Set β} {f : α → β} (hs : s.Countable) :
μ (f ⁻¹' s) = 0 ↔ ∀ x ∈ s, μ (f ⁻¹' {x}) = 0 := by
rw [← biUnion_preimage_singleton, measure_biUnion_null_iff hs]
/-- If `s` is a `Finset`, then the measure of its preimage can be found as the sum of measures
of the fibers `f ⁻¹' {y}`. -/
theorem sum_measure_preimage_singleton (s : Finset β) {f : α → β}
(hf : ∀ y ∈ s, MeasurableSet (f ⁻¹' {y})) : (∑ b ∈ s, μ (f ⁻¹' {b})) = μ (f ⁻¹' ↑s) := by
simp only [← measure_biUnion_finset (pairwiseDisjoint_fiber f s) hf,
Finset.set_biUnion_preimage_singleton]
@[simp] lemma sum_measure_singleton {s : Finset α} [MeasurableSingletonClass α] :
∑ x ∈ s, μ {x} = μ s := by
trans ∑ x ∈ s, μ (id ⁻¹' {x})
· simp
rw [sum_measure_preimage_singleton]
· simp
· simp
theorem measure_diff_null' (h : μ (s₁ ∩ s₂) = 0) : μ (s₁ \ s₂) = μ s₁ :=
measure_congr <| diff_ae_eq_self.2 h
theorem measure_add_diff (hs : NullMeasurableSet s μ) (t : Set α) :
μ s + μ (t \ s) = μ (s ∪ t) := by
rw [← measure_union₀' hs disjoint_sdiff_right.aedisjoint, union_diff_self]
theorem measure_diff' (s : Set α) (hm : NullMeasurableSet t μ) (h_fin : μ t ≠ ∞) :
μ (s \ t) = μ (s ∪ t) - μ t :=
ENNReal.eq_sub_of_add_eq h_fin <| by rw [add_comm, measure_add_diff hm, union_comm]
theorem measure_diff (h : s₂ ⊆ s₁) (h₂ : NullMeasurableSet s₂ μ) (h_fin : μ s₂ ≠ ∞) :
μ (s₁ \ s₂) = μ s₁ - μ s₂ := by rw [measure_diff' _ h₂ h_fin, union_eq_self_of_subset_right h]
theorem le_measure_diff : μ s₁ - μ s₂ ≤ μ (s₁ \ s₂) :=
tsub_le_iff_left.2 <| (measure_le_inter_add_diff μ s₁ s₂).trans <| by
gcongr; apply inter_subset_right
/-- If the measure of the symmetric difference of two sets is finite,
then one has infinite measure if and only if the other one does. -/
theorem measure_eq_top_iff_of_symmDiff (hμst : μ (s ∆ t) ≠ ∞) : μ s = ∞ ↔ μ t = ∞ := by
suffices h : ∀ u v, μ (u ∆ v) ≠ ∞ → μ u = ∞ → μ v = ∞
from ⟨h s t hμst, h t s (symmDiff_comm s t ▸ hμst)⟩
intro u v hμuv hμu
by_contra! hμv
apply hμuv
rw [Set.symmDiff_def, eq_top_iff]
calc
∞ = μ u - μ v := by rw [ENNReal.sub_eq_top_iff.2 ⟨hμu, hμv⟩]
_ ≤ μ (u \ v) := le_measure_diff
_ ≤ μ (u \ v ∪ v \ u) := measure_mono subset_union_left
/-- If the measure of the symmetric difference of two sets is finite,
then one has finite measure if and only if the other one does. -/
theorem measure_ne_top_iff_of_symmDiff (hμst : μ (s ∆ t) ≠ ∞) : μ s ≠ ∞ ↔ μ t ≠ ∞ :=
(measure_eq_top_iff_of_symmDiff hμst).ne
theorem measure_diff_lt_of_lt_add (hs : NullMeasurableSet s μ) (hst : s ⊆ t) (hs' : μ s ≠ ∞)
{ε : ℝ≥0∞} (h : μ t < μ s + ε) : μ (t \ s) < ε := by
rw [measure_diff hst hs hs']; rw [add_comm] at h
exact ENNReal.sub_lt_of_lt_add (measure_mono hst) h
theorem measure_diff_le_iff_le_add (hs : NullMeasurableSet s μ) (hst : s ⊆ t) (hs' : μ s ≠ ∞)
{ε : ℝ≥0∞} : μ (t \ s) ≤ ε ↔ μ t ≤ μ s + ε := by
rw [measure_diff hst hs hs', tsub_le_iff_left]
theorem measure_eq_measure_of_null_diff {s t : Set α} (hst : s ⊆ t) (h_nulldiff : μ (t \ s) = 0) :
μ s = μ t := measure_congr <|
EventuallyLE.antisymm (HasSubset.Subset.eventuallyLE hst) (ae_le_set.mpr h_nulldiff)
theorem measure_eq_measure_of_between_null_diff {s₁ s₂ s₃ : Set α} (h12 : s₁ ⊆ s₂) (h23 : s₂ ⊆ s₃)
(h_nulldiff : μ (s₃ \ s₁) = 0) : μ s₁ = μ s₂ ∧ μ s₂ = μ s₃ := by
have le12 : μ s₁ ≤ μ s₂ := measure_mono h12
have le23 : μ s₂ ≤ μ s₃ := measure_mono h23
have key : μ s₃ ≤ μ s₁ :=
calc
μ s₃ = μ (s₃ \ s₁ ∪ s₁) := by rw [diff_union_of_subset (h12.trans h23)]
_ ≤ μ (s₃ \ s₁) + μ s₁ := measure_union_le _ _
_ = μ s₁ := by simp only [h_nulldiff, zero_add]
exact ⟨le12.antisymm (le23.trans key), le23.antisymm (key.trans le12)⟩
theorem measure_eq_measure_smaller_of_between_null_diff {s₁ s₂ s₃ : Set α} (h12 : s₁ ⊆ s₂)
(h23 : s₂ ⊆ s₃) (h_nulldiff : μ (s₃ \ s₁) = 0) : μ s₁ = μ s₂ :=
(measure_eq_measure_of_between_null_diff h12 h23 h_nulldiff).1
theorem measure_eq_measure_larger_of_between_null_diff {s₁ s₂ s₃ : Set α} (h12 : s₁ ⊆ s₂)
(h23 : s₂ ⊆ s₃) (h_nulldiff : μ (s₃ \ s₁) = 0) : μ s₂ = μ s₃ :=
(measure_eq_measure_of_between_null_diff h12 h23 h_nulldiff).2
lemma measure_compl₀ (h : NullMeasurableSet s μ) (hs : μ s ≠ ∞) :
μ sᶜ = μ Set.univ - μ s := by
rw [← measure_add_measure_compl₀ h, ENNReal.add_sub_cancel_left hs]
theorem measure_compl (h₁ : MeasurableSet s) (h_fin : μ s ≠ ∞) : μ sᶜ = μ univ - μ s :=
measure_compl₀ h₁.nullMeasurableSet h_fin
lemma measure_inter_conull' (ht : μ (s \ t) = 0) : μ (s ∩ t) = μ s := by
rw [← diff_compl, measure_diff_null']; rwa [← diff_eq]
lemma measure_inter_conull (ht : μ tᶜ = 0) : μ (s ∩ t) = μ s := by
rw [← diff_compl, measure_diff_null ht]
@[simp]
theorem union_ae_eq_left_iff_ae_subset : (s ∪ t : Set α) =ᵐ[μ] s ↔ t ≤ᵐ[μ] s := by
rw [ae_le_set]
refine
⟨fun h => by simpa only [union_diff_left] using (ae_eq_set.mp h).1, fun h =>
eventuallyLE_antisymm_iff.mpr
⟨by rwa [ae_le_set, union_diff_left],
HasSubset.Subset.eventuallyLE subset_union_left⟩⟩
@[simp]
theorem union_ae_eq_right_iff_ae_subset : (s ∪ t : Set α) =ᵐ[μ] t ↔ s ≤ᵐ[μ] t := by
rw [union_comm, union_ae_eq_left_iff_ae_subset]
theorem ae_eq_of_ae_subset_of_measure_ge (h₁ : s ≤ᵐ[μ] t) (h₂ : μ t ≤ μ s)
(hsm : NullMeasurableSet s μ) (ht : μ t ≠ ∞) : s =ᵐ[μ] t := by
refine eventuallyLE_antisymm_iff.mpr ⟨h₁, ae_le_set.mpr ?_⟩
replace h₂ : μ t = μ s := h₂.antisymm (measure_mono_ae h₁)
replace ht : μ s ≠ ∞ := h₂ ▸ ht
rw [measure_diff' t hsm ht, measure_congr (union_ae_eq_left_iff_ae_subset.mpr h₁), h₂, tsub_self]
/-- If `s ⊆ t`, `μ t ≤ μ s`, `μ t ≠ ∞`, and `s` is measurable, then `s =ᵐ[μ] t`. -/
theorem ae_eq_of_subset_of_measure_ge (h₁ : s ⊆ t) (h₂ : μ t ≤ μ s) (hsm : NullMeasurableSet s μ)
(ht : μ t ≠ ∞) : s =ᵐ[μ] t :=
ae_eq_of_ae_subset_of_measure_ge (HasSubset.Subset.eventuallyLE h₁) h₂ hsm ht
theorem measure_iUnion_congr_of_subset {ι : Sort*} [Countable ι] {s : ι → Set α} {t : ι → Set α}
(hsub : ∀ i, s i ⊆ t i) (h_le : ∀ i, μ (t i) ≤ μ (s i)) : μ (⋃ i, s i) = μ (⋃ i, t i) := by
refine le_antisymm (by gcongr; apply hsub) ?_
by_cases! htop : ∃ i, μ (t i) = ∞
· rcases htop with ⟨i, hi⟩
calc
μ (⋃ i, t i) ≤ ∞ := le_top
_ ≤ μ (s i) := hi ▸ h_le i
_ ≤ μ (⋃ i, s i) := measure_mono <| subset_iUnion _ _
set M := toMeasurable μ
have H : ∀ b, (M (t b) ∩ M (⋃ b, s b) : Set α) =ᵐ[μ] M (t b) := by
refine fun b => ae_eq_of_subset_of_measure_ge inter_subset_left ?_ ?_ ?_
· calc
μ (M (t b)) = μ (t b) := measure_toMeasurable _
_ ≤ μ (s b) := h_le b
_ ≤ μ (M (t b) ∩ M (⋃ b, s b)) :=
measure_mono <|
subset_inter ((hsub b).trans <| subset_toMeasurable _ _)
((subset_iUnion _ _).trans <| subset_toMeasurable _ _)
· measurability
· rw [measure_toMeasurable]
exact htop b
calc
μ (⋃ b, t b) ≤ μ (⋃ b, M (t b)) := measure_mono (iUnion_mono fun b => subset_toMeasurable _ _)
_ = μ (⋃ b, M (t b) ∩ M (⋃ b, s b)) := measure_congr (EventuallyEq.countable_iUnion H).symm
_ ≤ μ (M (⋃ b, s b)) := measure_mono (iUnion_subset fun b => inter_subset_right)
_ = μ (⋃ b, s b) := measure_toMeasurable _
theorem measure_union_congr_of_subset {t₁ t₂ : Set α} (hs : s₁ ⊆ s₂) (hsμ : μ s₂ ≤ μ s₁)
(ht : t₁ ⊆ t₂) (htμ : μ t₂ ≤ μ t₁) : μ (s₁ ∪ t₁) = μ (s₂ ∪ t₂) := by
rw [union_eq_iUnion, union_eq_iUnion]
exact measure_iUnion_congr_of_subset (Bool.forall_bool.2 ⟨ht, hs⟩) (Bool.forall_bool.2 ⟨htμ, hsμ⟩)
@[simp]
theorem measure_iUnion_toMeasurable {ι : Sort*} [Countable ι] (s : ι → Set α) :
μ (⋃ i, toMeasurable μ (s i)) = μ (⋃ i, s i) :=
Eq.symm <| measure_iUnion_congr_of_subset (fun _i => subset_toMeasurable _ _) fun _i ↦
(measure_toMeasurable _).le
theorem measure_biUnion_toMeasurable {I : Set β} (hc : I.Countable) (s : β → Set α) :
μ (⋃ b ∈ I, toMeasurable μ (s b)) = μ (⋃ b ∈ I, s b) := by
haveI := hc.toEncodable
simp only [biUnion_eq_iUnion, measure_iUnion_toMeasurable]
@[simp]
theorem measure_toMeasurable_union : μ (toMeasurable μ s ∪ t) = μ (s ∪ t) :=
Eq.symm <|
measure_union_congr_of_subset (subset_toMeasurable _ _) (measure_toMeasurable _).le Subset.rfl
le_rfl
@[simp]
theorem measure_union_toMeasurable : μ (s ∪ toMeasurable μ t) = μ (s ∪ t) :=
Eq.symm <|
measure_union_congr_of_subset Subset.rfl le_rfl (subset_toMeasurable _ _)
(measure_toMeasurable _).le
theorem sum_measure_le_measure_univ {s : Finset ι} {t : ι → Set α}
(h : ∀ i ∈ s, NullMeasurableSet (t i) μ) (H : Set.Pairwise s (AEDisjoint μ on t)) :
(∑ i ∈ s, μ (t i)) ≤ μ (univ : Set α) := by
rw [← measure_biUnion_finset₀ H h]
exact measure_mono (subset_univ _)
theorem tsum_measure_le_measure_univ {s : ι → Set α} (hs : ∀ i, NullMeasurableSet (s i) μ)
(H : Pairwise (AEDisjoint μ on s)) : ∑' i, μ (s i) ≤ μ (univ : Set α) := by
rw [ENNReal.tsum_eq_iSup_sum]
exact iSup_le fun s =>
sum_measure_le_measure_univ (fun i _hi => hs i) fun i _hi j _hj hij => H hij
/-- Pigeonhole principle for measure spaces: if `∑' i, μ (s i) > μ univ`, then
one of the intersections `s i ∩ s j` is not empty. -/
theorem exists_nonempty_inter_of_measure_univ_lt_tsum_measure {m : MeasurableSpace α}
(μ : Measure α) {s : ι → Set α} (hs : ∀ i, NullMeasurableSet (s i) μ)
(H : μ (univ : Set α) < ∑' i, μ (s i)) : ∃ i j, i ≠ j ∧ (s i ∩ s j).Nonempty := by
contrapose! H
apply tsum_measure_le_measure_univ hs
intro i j hij
exact (disjoint_iff_inter_eq_empty.mpr (H i j hij)).aedisjoint
/-- Pigeonhole principle for measure spaces: if `s` is a `Finset` and
`∑ i ∈ s, μ (t i) > μ univ`, then one of the intersections `t i ∩ t j` is not empty. -/
theorem exists_nonempty_inter_of_measure_univ_lt_sum_measure {m : MeasurableSpace α} (μ : Measure α)
{s : Finset ι} {t : ι → Set α} (h : ∀ i ∈ s, NullMeasurableSet (t i) μ)
(H : μ (univ : Set α) < ∑ i ∈ s, μ (t i)) :
∃ i ∈ s, ∃ j ∈ s, ∃ _h : i ≠ j, (t i ∩ t j).Nonempty := by
contrapose! H
apply sum_measure_le_measure_univ h
intro i hi j hj hij
exact (disjoint_iff_inter_eq_empty.mpr (H i hi j hj hij)).aedisjoint
/-- If two sets `s` and `t` are included in a set `u`, and `μ s + μ t > μ u`,
then `s` intersects `t`. Version assuming that `t` is measurable. -/
theorem nonempty_inter_of_measure_lt_add {m : MeasurableSpace α} (μ : Measure α) {s t u : Set α}
(ht : MeasurableSet t) (h's : s ⊆ u) (h't : t ⊆ u) (h : μ u < μ s + μ t) :
(s ∩ t).Nonempty := by
rw [← Set.not_disjoint_iff_nonempty_inter]
contrapose! h
calc
μ s + μ t = μ (s ∪ t) := (measure_union h ht).symm
_ ≤ μ u := measure_mono (union_subset h's h't)
/-- If two sets `s` and `t` are included in a set `u`, and `μ s + μ t > μ u`,
then `s` intersects `t`. Version assuming that `s` is measurable. -/
theorem nonempty_inter_of_measure_lt_add' {m : MeasurableSpace α} (μ : Measure α) {s t u : Set α}
(hs : MeasurableSet s) (h's : s ⊆ u) (h't : t ⊆ u) (h : μ u < μ s + μ t) :
(s ∩ t).Nonempty := by
rw [add_comm] at h
rw [inter_comm]
exact nonempty_inter_of_measure_lt_add μ hs h't h's h
/-- Continuity from below:
the measure of the union of a directed sequence of (not necessarily measurable) sets
is the supremum of the measures. -/
theorem _root_.Directed.measure_iUnion [Countable ι] {s : ι → Set α} (hd : Directed (· ⊆ ·) s) :
μ (⋃ i, s i) = ⨆ i, μ (s i) := by
-- WLOG, `ι = ℕ`
rcases Countable.exists_injective_nat ι with ⟨e, he⟩
generalize ht : Function.extend e s ⊥ = t
replace hd : Directed (· ⊆ ·) t := ht ▸ hd.extend_bot he
suffices μ (⋃ n, t n) = ⨆ n, μ (t n) by
simp only [← ht, Function.apply_extend μ, ← iSup_eq_iUnion, iSup_extend_bot he,
Function.comp_def, Pi.bot_apply, bot_eq_empty, measure_empty] at this
exact this.trans (iSup_extend_bot he _)
clear! ι
-- The `≥` inequality is trivial
refine le_antisymm ?_ (iSup_le fun i ↦ measure_mono <| subset_iUnion _ _)
-- Choose `T n ⊇ t n` of the same measure, put `Td n = disjointed T`
set T : ℕ → Set α := fun n => toMeasurable μ (t n)
set Td : ℕ → Set α := disjointed T
have hm : ∀ n, MeasurableSet (Td n) := .disjointed fun n ↦ measurableSet_toMeasurable _ _
calc
μ (⋃ n, t n) = μ (⋃ n, Td n) := by rw [iUnion_disjointed, measure_iUnion_toMeasurable]
_ ≤ ∑' n, μ (Td n) := measure_iUnion_le _
_ = ⨆ I : Finset ℕ, ∑ n ∈ I, μ (Td n) := ENNReal.tsum_eq_iSup_sum
_ ≤ ⨆ n, μ (t n) := iSup_le fun I => by
rcases hd.finset_le I with ⟨N, hN⟩
calc
(∑ n ∈ I, μ (Td n)) = μ (⋃ n ∈ I, Td n) :=
(measure_biUnion_finset ((disjoint_disjointed T).set_pairwise I) fun n _ => hm n).symm
_ ≤ μ (⋃ n ∈ I, T n) := measure_mono (iUnion₂_mono fun n _hn => disjointed_subset _ _)
_ = μ (⋃ n ∈ I, t n) := measure_biUnion_toMeasurable I.countable_toSet _
_ ≤ μ (t N) := measure_mono (iUnion₂_subset hN)
_ ≤ ⨆ n, μ (t n) := le_iSup (μ ∘ t) N
/-- Continuity from below:
the measure of the union of a monotone family of sets is equal to the supremum of their measures.
The theorem assumes that the `atTop` filter on the index set is countably generated,
so it works for a family indexed by a countable type, as well as `ℝ`. -/
theorem _root_.Monotone.measure_iUnion [Preorder ι] [IsDirected ι (· ≤ ·)]
[(atTop : Filter ι).IsCountablyGenerated] {s : ι → Set α} (hs : Monotone s) :
μ (⋃ i, s i) = ⨆ i, μ (s i) := by
cases isEmpty_or_nonempty ι with
| inl _ => simp
| inr _ =>
rcases exists_seq_monotone_tendsto_atTop_atTop ι with ⟨x, hxm, hx⟩
rw [← hs.iUnion_comp_tendsto_atTop hx, ← Monotone.iSup_comp_tendsto_atTop _ hx]
exacts [(hs.comp hxm).directed_le.measure_iUnion, fun _ _ h ↦ measure_mono (hs h)]
theorem _root_.Antitone.measure_iUnion [Preorder ι] [IsDirected ι (· ≥ ·)]
[(atBot : Filter ι).IsCountablyGenerated] {s : ι → Set α} (hs : Antitone s) :
μ (⋃ i, s i) = ⨆ i, μ (s i) :=
hs.dual_left.measure_iUnion
/-- Continuity from below: the measure of the union of a sequence of
(not necessarily measurable) sets is the supremum of the measures of the partial unions. -/
theorem measure_iUnion_eq_iSup_accumulate [Preorder ι] [IsDirected ι (· ≤ ·)]
[(atTop : Filter ι).IsCountablyGenerated] {f : ι → Set α} :
μ (⋃ i, f i) = ⨆ i, μ (Accumulate f i) := by
rw [← iUnion_accumulate]
exact monotone_accumulate.measure_iUnion
theorem measure_biUnion_eq_iSup {s : ι → Set α} {t : Set ι} (ht : t.Countable)
(hd : DirectedOn ((· ⊆ ·) on s) t) : μ (⋃ i ∈ t, s i) = ⨆ i ∈ t, μ (s i) := by
haveI := ht.to_subtype
rw [biUnion_eq_iUnion, hd.directed_val.measure_iUnion, ← iSup_subtype'']
/-- **Continuity from above**:
the measure of the intersection of a directed downwards countable family of measurable sets
is the infimum of the measures. -/
theorem _root_.Directed.measure_iInter [Countable ι] {s : ι → Set α}
(h : ∀ i, NullMeasurableSet (s i) μ) (hd : Directed (· ⊇ ·) s) (hfin : ∃ i, μ (s i) ≠ ∞) :
μ (⋂ i, s i) = ⨅ i, μ (s i) := by
rcases hfin with ⟨k, hk⟩
have : ∀ t ⊆ s k, μ t ≠ ∞ := fun t ht => ne_top_of_le_ne_top hk (measure_mono ht)
rw [← ENNReal.sub_sub_cancel hk (iInf_le (fun i => μ (s i)) k), ENNReal.sub_iInf, ←
ENNReal.sub_sub_cancel hk (measure_mono (iInter_subset _ k)), ←
measure_diff (iInter_subset _ k) (.iInter h) (this _ (iInter_subset _ k)),
diff_iInter, Directed.measure_iUnion]
· congr 1
refine le_antisymm (iSup_mono' fun i => ?_) (iSup_mono fun i => le_measure_diff)
rcases hd i k with ⟨j, hji, hjk⟩
use j
rw [← measure_diff hjk (h _) (this _ hjk)]
gcongr
· exact hd.mono_comp _ fun _ _ => diff_subset_diff_right
/-- **Continuity from above**:
the measure of the intersection of a monotone family of measurable sets
indexed by a type with countably generated `atBot` filter
is equal to the infimum of the measures. -/
theorem _root_.Monotone.measure_iInter [Preorder ι] [IsDirected ι (· ≥ ·)]
[(atBot : Filter ι).IsCountablyGenerated] {s : ι → Set α} (hs : Monotone s)
(hsm : ∀ i, NullMeasurableSet (s i) μ) (hfin : ∃ i, μ (s i) ≠ ∞) :
μ (⋂ i, s i) = ⨅ i, μ (s i) := by
refine le_antisymm (le_iInf fun i ↦ measure_mono <| iInter_subset _ _) ?_
have := hfin.nonempty
rcases exists_seq_antitone_tendsto_atTop_atBot ι with ⟨x, hxm, hx⟩
calc
⨅ i, μ (s i) ≤ ⨅ n, μ (s (x n)) := le_iInf_comp (μ ∘ s) x
_ = μ (⋂ n, s (x n)) := by
refine .symm <| (hs.comp_antitone hxm).directed_ge.measure_iInter (fun n ↦ hsm _) ?_
rcases hfin with ⟨k, hk⟩
rcases (hx.eventually_le_atBot k).exists with ⟨n, hn⟩
exact ⟨n, ne_top_of_le_ne_top hk <| measure_mono <| hs hn⟩
_ ≤ μ (⋂ i, s i) := by
refine measure_mono <| iInter_mono' fun i ↦ ?_
rcases (hx.eventually_le_atBot i).exists with ⟨n, hn⟩
exact ⟨n, hs hn⟩
/-- **Continuity from above**:
the measure of the intersection of an antitone family of measurable sets
indexed by a type with countably generated `atTop` filter
is equal to the infimum of the measures. -/
theorem _root_.Antitone.measure_iInter [Preorder ι] [IsDirected ι (· ≤ ·)]
[(atTop : Filter ι).IsCountablyGenerated] {s : ι → Set α} (hs : Antitone s)
(hsm : ∀ i, NullMeasurableSet (s i) μ) (hfin : ∃ i, μ (s i) ≠ ∞) :
μ (⋂ i, s i) = ⨅ i, μ (s i) :=
hs.dual_left.measure_iInter hsm hfin
/-- Continuity from above: the measure of the intersection of a sequence of
measurable sets is the infimum of the measures of the partial intersections. -/
theorem measure_iInter_eq_iInf_measure_iInter_le {α ι : Type*} {_ : MeasurableSpace α}
{μ : Measure α} [Countable ι] [Preorder ι] [IsDirected ι (· ≤ ·)]
{f : ι → Set α} (h : ∀ i, NullMeasurableSet (f i) μ) (hfin : ∃ i, μ (f i) ≠ ∞) :
μ (⋂ i, f i) = ⨅ i, μ (⋂ j ≤ i, f j) := by
rw [← Antitone.measure_iInter]
· rw [iInter_comm]
exact congrArg μ <| iInter_congr fun i ↦ (biInf_const nonempty_Ici).symm
· exact fun i j h ↦ biInter_mono (Iic_subset_Iic.2 h) fun _ _ ↦ Set.Subset.rfl
· exact fun i ↦ .biInter (to_countable _) fun _ _ ↦ h _
· refine hfin.imp fun k hk ↦ ne_top_of_le_ne_top hk <| measure_mono <| iInter₂_subset k ?_
rfl
/-- Continuity from below: the measure of the union of an increasing sequence of (not necessarily
measurable) sets is the limit of the measures. -/
theorem tendsto_measure_iUnion_atTop [Preorder ι] [IsCountablyGenerated (atTop : Filter ι)]
{s : ι → Set α} (hm : Monotone s) : Tendsto (μ ∘ s) atTop (𝓝 (μ (⋃ n, s n))) := by
refine .of_neBot_imp fun h ↦ ?_
have := (atTop_neBot_iff.1 h).2
rw [hm.measure_iUnion]
exact tendsto_atTop_iSup fun n m hnm => measure_mono <| hm hnm
theorem tendsto_measure_iUnion_atBot [Preorder ι] [IsCountablyGenerated (atBot : Filter ι)]
{s : ι → Set α} (hm : Antitone s) : Tendsto (μ ∘ s) atBot (𝓝 (μ (⋃ n, s n))) :=
tendsto_measure_iUnion_atTop (ι := ιᵒᵈ) hm.dual_left
/-- Continuity from below: the measure of the union of a sequence of (not necessarily measurable)
sets is the limit of the measures of the partial unions. -/
theorem tendsto_measure_iUnion_accumulate {α ι : Type*}
[Preorder ι] [IsCountablyGenerated (atTop : Filter ι)]
{_ : MeasurableSpace α} {μ : Measure α} {f : ι → Set α} :
Tendsto (fun i ↦ μ (Accumulate f i)) atTop (𝓝 (μ (⋃ i, f i))) := by
refine .of_neBot_imp fun h ↦ ?_
have := (atTop_neBot_iff.1 h).2
rw [measure_iUnion_eq_iSup_accumulate]
exact tendsto_atTop_iSup fun i j hij ↦ by gcongr
/-- Continuity from above: the measure of the intersection of a decreasing sequence of measurable
sets is the limit of the measures. -/
theorem tendsto_measure_iInter_atTop [Preorder ι]
[IsCountablyGenerated (atTop : Filter ι)] {s : ι → Set α}
(hs : ∀ i, NullMeasurableSet (s i) μ) (hm : Antitone s) (hf : ∃ i, μ (s i) ≠ ∞) :
Tendsto (μ ∘ s) atTop (𝓝 (μ (⋂ n, s n))) := by
refine .of_neBot_imp fun h ↦ ?_
have := (atTop_neBot_iff.1 h).2
rw [hm.measure_iInter hs hf]
exact tendsto_atTop_iInf fun n m hnm => measure_mono <| hm hnm
/-- Continuity from above: the measure of the intersection of an increasing sequence of measurable
sets is the limit of the measures. -/
theorem tendsto_measure_iInter_atBot [Preorder ι] [IsCountablyGenerated (atBot : Filter ι)]
{s : ι → Set α} (hs : ∀ i, NullMeasurableSet (s i) μ) (hm : Monotone s)
(hf : ∃ i, μ (s i) ≠ ∞) : Tendsto (μ ∘ s) atBot (𝓝 (μ (⋂ n, s n))) :=
tendsto_measure_iInter_atTop (ι := ιᵒᵈ) hs hm.dual_left hf
/-- Continuity from above: the measure of the intersection of a sequence of measurable
sets such that one has finite measure is the limit of the measures of the partial intersections. -/
theorem tendsto_measure_iInter_le {α ι : Type*} {_ : MeasurableSpace α} {μ : Measure α}
[Countable ι] [Preorder ι] {f : ι → Set α} (hm : ∀ i, NullMeasurableSet (f i) μ)
(hf : ∃ i, μ (f i) ≠ ∞) :
Tendsto (fun i ↦ μ (⋂ j ≤ i, f j)) atTop (𝓝 (μ (⋂ i, f i))) := by
refine .of_neBot_imp fun hne ↦ ?_
cases atTop_neBot_iff.mp hne
rw [measure_iInter_eq_iInf_measure_iInter_le hm hf]
exact tendsto_atTop_iInf
fun i j hij ↦ measure_mono <| biInter_subset_biInter_left fun k hki ↦ le_trans hki hij
/-- Some version of continuity of a measure in the empty set using the intersection along a set of
sets. -/
theorem exists_measure_iInter_lt {α ι : Type*} {_ : MeasurableSpace α} {μ : Measure α}
[SemilatticeSup ι] [Countable ι] {f : ι → Set α}
(hm : ∀ i, NullMeasurableSet (f i) μ) {ε : ℝ≥0∞} (hε : 0 < ε) (hfin : ∃ i, μ (f i) ≠ ∞)
(hfem : ⋂ n, f n = ∅) : ∃ m, μ (⋂ n ≤ m, f n) < ε := by
let F m := μ (⋂ n ≤ m, f n)
have hFAnti : Antitone F :=
fun i j hij => measure_mono (biInter_subset_biInter_left fun k hki => le_trans hki hij)
suffices Filter.Tendsto F Filter.atTop (𝓝 0) by
let _ := hfin.nonempty
rw [ENNReal.tendsto_atTop_zero_iff_lt_of_antitone hFAnti] at this
exact this ε hε
have hzero : μ (⋂ n, f n) = 0 := by
simp only [hfem, measure_empty]
rw [← hzero]
exact tendsto_measure_iInter_le hm hfin
/-- The measure of the intersection of a decreasing sequence of measurable
sets indexed by a linear order with first countable topology is the limit of the measures. -/
theorem tendsto_measure_biInter_gt {ι : Type*} [LinearOrder ι] [TopologicalSpace ι]
[OrderTopology ι] [DenselyOrdered ι] [FirstCountableTopology ι] {s : ι → Set α}
{a : ι} (hs : ∀ r > a, NullMeasurableSet (s r) μ) (hm : ∀ i j, a < i → i ≤ j → s i ⊆ s j)
(hf : ∃ r > a, μ (s r) ≠ ∞) : Tendsto (μ ∘ s) (𝓝[Ioi a] a) (𝓝 (μ (⋂ r > a, s r))) := by
have : (atBot : Filter (Ioi a)).IsCountablyGenerated := by
rw [← comap_coe_Ioi_nhdsGT]
infer_instance
simp_rw [← map_coe_Ioi_atBot, tendsto_map'_iff, ← mem_Ioi, biInter_eq_iInter]
apply tendsto_measure_iInter_atBot
· rwa [Subtype.forall]
· exact fun i j h ↦ hm i j i.2 h
· simpa only [Subtype.exists, exists_prop]
theorem measure_if {x : β} {t : Set β} {s : Set α} [Decidable (x ∈ t)] :
μ (if x ∈ t then s else ∅) = indicator t (fun _ => μ s) x := by split_ifs with h <;> simp [h]
/-- On a countable space, two measures are equal if they agree on measurable atoms. -/
lemma ext_of_measurableAtoms [Countable α] {μ ν : Measure α}
(h : ∀ x, μ (measurableAtom x) = ν (measurableAtom x)) : μ = ν := by
ext s hs
have h1 : s = ⋃ x ∈ s, measurableAtom x := by
ext y
simp only [mem_iUnion, exists_prop]
refine ⟨fun hy ↦ ?_, fun ⟨x, hx, hy⟩ ↦ ?_⟩
· exact ⟨y, hy, mem_measurableAtom_self y⟩
· exact mem_of_mem_measurableAtom hy hs hx
rw [← sUnion_image] at h1
rw [h1]
have h_count : (measurableAtom '' s).Countable := s.to_countable.image _
have h_disj : (measurableAtom '' s).Pairwise Disjoint := by
intro t ht t' ht' h_eq
obtain ⟨y, hys, hy⟩ := ht
obtain ⟨y', hy's, hy'⟩ := ht'
rw [← hy, ← hy'] at h_eq ⊢
refine disjoint_measurableAtom_of_notMem fun hyy' ↦ h_eq ?_
exact measurableAtom_eq_of_mem hyy'
have h_meas (t) (ht : t ∈ measurableAtom '' s) : MeasurableSet t := by
obtain ⟨x, hxs, hx⟩ := ht
rw [← hx]
exact MeasurableSet.measurableAtom_of_countable x
rw [measure_sUnion h_count h_disj h_meas, measure_sUnion h_count h_disj h_meas]
congr with s'
have hs' := s'.2
obtain ⟨x, hxs, hx⟩ := hs'
rw [← hx]
exact h x
end
section OuterMeasure
variable [ms : MeasurableSpace α] {s t : Set α}
/-- Obtain a measure by giving an outer measure where all sets in the σ-algebra are
Carathéodory measurable. -/
def OuterMeasure.toMeasure (m : OuterMeasure α) (h : ms ≤ m.caratheodory) : Measure α :=
Measure.ofMeasurable (fun s _ => m s) m.empty fun _f hf hd =>
m.iUnion_eq_of_caratheodory (fun i => h _ (hf i)) hd
theorem le_toOuterMeasure_caratheodory (μ : Measure α) : ms ≤ μ.toOuterMeasure.caratheodory :=
fun _s hs _t => (measure_inter_add_diff _ hs).symm
@[simp]
theorem toMeasure_toOuterMeasure (m : OuterMeasure α) (h : ms ≤ m.caratheodory) :
(m.toMeasure h).toOuterMeasure = m.trim :=
rfl
@[simp]
theorem toMeasure_apply (m : OuterMeasure α) (h : ms ≤ m.caratheodory) {s : Set α}
(hs : MeasurableSet s) : m.toMeasure h s = m s :=
m.trim_eq hs
theorem le_toMeasure_apply (m : OuterMeasure α) (h : ms ≤ m.caratheodory) (s : Set α) :
m s ≤ m.toMeasure h s :=
m.le_trim s
theorem toMeasure_apply₀ (m : OuterMeasure α) (h : ms ≤ m.caratheodory) {s : Set α}
(hs : NullMeasurableSet s (m.toMeasure h)) : m.toMeasure h s = m s := by
refine le_antisymm ?_ (le_toMeasure_apply _ _ _)
rcases hs.exists_measurable_subset_ae_eq with ⟨t, hts, htm, heq⟩
calc
m.toMeasure h s = m.toMeasure h t := measure_congr heq.symm
_ = m t := toMeasure_apply m h htm
_ ≤ m s := m.mono hts
@[simp]
theorem toOuterMeasure_toMeasure {μ : Measure α} :
μ.toOuterMeasure.toMeasure (le_toOuterMeasure_caratheodory _) = μ :=
Measure.ext fun _s => μ.toOuterMeasure.trim_eq
@[simp]
theorem boundedBy_measure (μ : Measure α) : OuterMeasure.boundedBy μ = μ.toOuterMeasure :=
μ.toOuterMeasure.boundedBy_eq_self
end OuterMeasure
section
variable {m0 : MeasurableSpace α} {mβ : MeasurableSpace β} [MeasurableSpace γ]
variable {μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α} {s s' t : Set α}
namespace Measure
/-- If `u` is a superset of `t` with the same (finite) measure (both sets possibly non-measurable),
then for any measurable set `s` one also has `μ (t ∩ s) = μ (u ∩ s)`. -/
theorem measure_inter_eq_of_measure_eq {s t u : Set α} (hs : MeasurableSet s) (h : μ t = μ u)
(htu : t ⊆ u) (ht_ne_top : μ t ≠ ∞) : μ (t ∩ s) = μ (u ∩ s) := by
rw [h] at ht_ne_top
refine le_antisymm (by gcongr) ?_
have A : μ (u ∩ s) + μ (u \ s) ≤ μ (t ∩ s) + μ (u \ s) :=
calc
μ (u ∩ s) + μ (u \ s) = μ u := measure_inter_add_diff _ hs
_ = μ t := h.symm
_ = μ (t ∩ s) + μ (t \ s) := (measure_inter_add_diff _ hs).symm
_ ≤ μ (t ∩ s) + μ (u \ s) := by gcongr
have B : μ (u \ s) ≠ ∞ := (lt_of_le_of_lt (measure_mono diff_subset) ht_ne_top.lt_top).ne
exact ENNReal.le_of_add_le_add_right B A
lemma measure_inter_eq_of_ae {s t : Set α} (h : ∀ᵐ a ∂μ, a ∈ t) :
μ (t ∩ s) = μ s := by
refine le_antisymm (measure_mono inter_subset_right) ?_
apply EventuallyLE.measure_le
filter_upwards [h] with x hx h'x using ⟨hx, h'x⟩
/-- The measurable superset `toMeasurable μ t` of `t` (which has the same measure as `t`)
satisfies, for any measurable set `s`, the equality `μ (toMeasurable μ t ∩ s) = μ (u ∩ s)`.
Here, we require that the measure of `t` is finite. The conclusion holds without this assumption
when the measure is s-finite (for example when it is σ-finite),
see `measure_toMeasurable_inter_of_sFinite`. -/
theorem measure_toMeasurable_inter {s t : Set α} (hs : MeasurableSet s) (ht : μ t ≠ ∞) :
μ (toMeasurable μ t ∩ s) = μ (t ∩ s) :=
(measure_inter_eq_of_measure_eq hs (measure_toMeasurable t).symm (subset_toMeasurable μ t)
ht).symm
/-! ### The `ℝ≥0∞`-module of measures -/
instance instZero {_ : MeasurableSpace α} : Zero (Measure α) :=
⟨{ toOuterMeasure := 0
m_iUnion := fun _f _hf _hd => tsum_zero.symm
trim_le := OuterMeasure.trim_zero.le }⟩
@[simp]
theorem zero_toOuterMeasure {_m : MeasurableSpace α} : (0 : Measure α).toOuterMeasure = 0 :=
rfl
@[simp, norm_cast]
theorem coe_zero {_m : MeasurableSpace α} : ⇑(0 : Measure α) = 0 :=
rfl
@[simp] lemma _root_.MeasureTheory.OuterMeasure.toMeasure_zero
[ms : MeasurableSpace α] (h : ms ≤ (0 : OuterMeasure α).caratheodory) :
(0 : OuterMeasure α).toMeasure h = 0 := by
ext s hs
simp [hs]
@[simp] lemma _root_.MeasureTheory.OuterMeasure.toMeasure_eq_zero {ms : MeasurableSpace α}
{μ : OuterMeasure α} (h : ms ≤ μ.caratheodory) : μ.toMeasure h = 0 ↔ μ = 0 where
mp hμ := by ext s; exact le_bot_iff.1 <| (le_toMeasure_apply _ _ _).trans_eq congr($hμ s)
mpr := by rintro rfl; simp
@[nontriviality]
lemma apply_eq_zero_of_isEmpty [IsEmpty α] {_ : MeasurableSpace α} (μ : Measure α) (s : Set α) :
μ s = 0 := by
rw [eq_empty_of_isEmpty s, measure_empty]
instance instSubsingleton [IsEmpty α] {m : MeasurableSpace α} : Subsingleton (Measure α) :=
⟨fun μ ν => by ext1 s _; rw [apply_eq_zero_of_isEmpty, apply_eq_zero_of_isEmpty]⟩
theorem eq_zero_of_isEmpty [IsEmpty α] {_m : MeasurableSpace α} (μ : Measure α) : μ = 0 :=
Subsingleton.elim μ 0
instance instInhabited {_ : MeasurableSpace α} : Inhabited (Measure α) :=
⟨0⟩
instance instAdd {_ : MeasurableSpace α} : Add (Measure α) :=
⟨fun μ₁ μ₂ =>
{ toOuterMeasure := μ₁.toOuterMeasure + μ₂.toOuterMeasure
m_iUnion := fun s hs hd =>
show μ₁ (⋃ i, s i) + μ₂ (⋃ i, s i) = ∑' i, (μ₁ (s i) + μ₂ (s i)) by
rw [ENNReal.tsum_add, measure_iUnion hd hs, measure_iUnion hd hs]
trim_le := by rw [OuterMeasure.trim_add, μ₁.trimmed, μ₂.trimmed] }⟩
@[simp]
theorem add_toOuterMeasure {_m : MeasurableSpace α} (μ₁ μ₂ : Measure α) :
(μ₁ + μ₂).toOuterMeasure = μ₁.toOuterMeasure + μ₂.toOuterMeasure :=
rfl
@[simp, norm_cast]
theorem coe_add {_m : MeasurableSpace α} (μ₁ μ₂ : Measure α) : ⇑(μ₁ + μ₂) = μ₁ + μ₂ :=
rfl
theorem add_apply {_m : MeasurableSpace α} (μ₁ μ₂ : Measure α) (s : Set α) :
(μ₁ + μ₂) s = μ₁ s + μ₂ s :=
rfl
section SMul
variable [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
variable [SMul R' ℝ≥0∞] [IsScalarTower R' ℝ≥0∞ ℝ≥0∞]
instance instSMul {_ : MeasurableSpace α} : SMul R (Measure α) :=
⟨fun c μ =>
{ toOuterMeasure := c • μ.toOuterMeasure
m_iUnion := fun s hs hd => by
simp only [OuterMeasure.smul_apply, coe_toOuterMeasure, ENNReal.tsum_const_smul,
measure_iUnion hd hs]
trim_le := by rw [OuterMeasure.trim_smul, μ.trimmed] }⟩
@[simp]
theorem smul_toOuterMeasure {_m : MeasurableSpace α} (c : R) (μ : Measure α) :
(c • μ).toOuterMeasure = c • μ.toOuterMeasure :=
rfl
@[simp, norm_cast]
theorem coe_smul {_m : MeasurableSpace α} (c : R) (μ : Measure α) : ⇑(c • μ) = c • ⇑μ :=
rfl
@[simp]
theorem smul_apply {_m : MeasurableSpace α} (c : R) (μ : Measure α) (s : Set α) :
(c • μ) s = c • μ s :=
rfl
instance instSMulCommClass [SMulCommClass R R' ℝ≥0∞] {_ : MeasurableSpace α} :
SMulCommClass R R' (Measure α) :=
⟨fun _ _ _ => ext fun _ _ => smul_comm _ _ _⟩
instance instIsScalarTower [SMul R R'] [IsScalarTower R R' ℝ≥0∞] {_ : MeasurableSpace α} :
IsScalarTower R R' (Measure α) :=
⟨fun _ _ _ => ext fun _ _ => smul_assoc _ _ _⟩
instance instIsCentralScalar [SMul Rᵐᵒᵖ ℝ≥0∞] [IsCentralScalar R ℝ≥0∞] {_ : MeasurableSpace α} :
IsCentralScalar R (Measure α) :=
⟨fun _ _ => ext fun _ _ => op_smul_eq_smul _ _⟩
end SMul
instance instNoZeroSMulDivisors [Zero R] [SMulWithZero R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
[NoZeroSMulDivisors R ℝ≥0∞] : NoZeroSMulDivisors R (Measure α) where
eq_zero_or_eq_zero_of_smul_eq_zero h := by simpa [Ne, ext_iff', forall_or_left] using h
instance instMulAction [Monoid R] [MulAction R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
{_ : MeasurableSpace α} : MulAction R (Measure α) :=
Injective.mulAction _ toOuterMeasure_injective smul_toOuterMeasure
instance instAddCommMonoid {_ : MeasurableSpace α} : AddCommMonoid (Measure α) :=
toOuterMeasure_injective.addCommMonoid toOuterMeasure zero_toOuterMeasure add_toOuterMeasure
fun _ _ => smul_toOuterMeasure _ _
/-- Coercion to function as an additive monoid homomorphism. -/
def coeAddHom {_ : MeasurableSpace α} : Measure α →+ Set α → ℝ≥0∞ where
toFun := (⇑)
map_zero' := coe_zero
map_add' := coe_add
@[simp]
theorem coeAddHom_apply {_ : MeasurableSpace α} (μ : Measure α) : coeAddHom μ = ⇑μ := rfl
@[simp]
theorem coe_finset_sum {_m : MeasurableSpace α} (I : Finset ι) (μ : ι → Measure α) :
⇑(∑ i ∈ I, μ i) = ∑ i ∈ I, ⇑(μ i) := map_sum coeAddHom μ I
theorem finset_sum_apply {m : MeasurableSpace α} (I : Finset ι) (μ : ι → Measure α) (s : Set α) :
(∑ i ∈ I, μ i) s = ∑ i ∈ I, μ i s := by rw [coe_finset_sum, Finset.sum_apply]
instance instDistribMulAction [Monoid R] [DistribMulAction R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
{_ : MeasurableSpace α} : DistribMulAction R (Measure α) :=
Injective.distribMulAction ⟨⟨toOuterMeasure, zero_toOuterMeasure⟩, add_toOuterMeasure⟩
toOuterMeasure_injective smul_toOuterMeasure
instance instModule [Semiring R] [Module R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
{_ : MeasurableSpace α} : Module R (Measure α) :=
Injective.module R ⟨⟨toOuterMeasure, zero_toOuterMeasure⟩, add_toOuterMeasure⟩
toOuterMeasure_injective smul_toOuterMeasure
@[simp]
theorem coe_nnreal_smul_apply {_m : MeasurableSpace α} (c : ℝ≥0) (μ : Measure α) (s : Set α) :
(c • μ) s = c * μ s :=
rfl
@[simp]
theorem nnreal_smul_coe_apply {_m : MeasurableSpace α} (c : ℝ≥0) (μ : Measure α) (s : Set α) :
c • μ s = c * μ s :=
rfl
theorem ae_smul_measure {p : α → Prop} [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
(h : ∀ᵐ x ∂μ, p x) (c : R) : ∀ᵐ x ∂c • μ, p x :=
ae_iff.2 <| by rw [smul_apply, ae_iff.1 h, ← smul_one_smul ℝ≥0∞, smul_zero]
theorem ae_smul_measure_le [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞] (c : R) :
ae (c • μ) ≤ ae μ := fun _ h ↦ ae_smul_measure h c
section SMulWithZero
variable {R : Type*} [Zero R] [SMulWithZero R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
[NoZeroSMulDivisors R ℝ≥0∞] {c : R} {p : α → Prop}
lemma ae_smul_measure_iff (hc : c ≠ 0) {μ : Measure α} : (∀ᵐ x ∂c • μ, p x) ↔ ∀ᵐ x ∂μ, p x := by
simp [ae_iff, hc]
@[simp] lemma ae_smul_measure_eq (hc : c ≠ 0) (μ : Measure α) : ae (c • μ) = ae μ := by
ext; exact ae_smul_measure_iff hc
end SMulWithZero
theorem measure_eq_left_of_subset_of_measure_add_eq {s t : Set α} (h : (μ + ν) t ≠ ∞) (h' : s ⊆ t)
(h'' : (μ + ν) s = (μ + ν) t) : μ s = μ t := by
refine le_antisymm (measure_mono h') ?_
have : μ t + ν t ≤ μ s + ν t :=
calc
μ t + ν t = μ s + ν s := h''.symm
_ ≤ μ s + ν t := by gcongr
apply ENNReal.le_of_add_le_add_right _ this
exact ne_top_of_le_ne_top h (le_add_left le_rfl)
theorem measure_eq_right_of_subset_of_measure_add_eq {s t : Set α} (h : (μ + ν) t ≠ ∞) (h' : s ⊆ t)
(h'' : (μ + ν) s = (μ + ν) t) : ν s = ν t := by
rw [add_comm] at h'' h
exact measure_eq_left_of_subset_of_measure_add_eq h h' h''
theorem measure_toMeasurable_add_inter_left {s t : Set α} (hs : MeasurableSet s)
(ht : (μ + ν) t ≠ ∞) : μ (toMeasurable (μ + ν) t ∩ s) = μ (t ∩ s) := by
refine (measure_inter_eq_of_measure_eq hs ?_ (subset_toMeasurable _ _) ?_).symm
· refine
measure_eq_left_of_subset_of_measure_add_eq ?_ (subset_toMeasurable _ _)
(measure_toMeasurable t).symm
rwa [measure_toMeasurable t]
· simp only [not_or, ENNReal.add_eq_top, Pi.add_apply, Ne, coe_add] at ht
exact ht.1
theorem measure_toMeasurable_add_inter_right {s t : Set α} (hs : MeasurableSet s)
(ht : (μ + ν) t ≠ ∞) : ν (toMeasurable (μ + ν) t ∩ s) = ν (t ∩ s) := by
rw [add_comm] at ht ⊢
exact measure_toMeasurable_add_inter_left hs ht
/-! ### The complete lattice of measures -/
/-- Measures are partially ordered. -/
instance instPartialOrder {_ : MeasurableSpace α} : PartialOrder (Measure α) where
le m₁ m₂ := ∀ s, m₁ s ≤ m₂ s
le_refl _ _ := le_rfl
le_trans _ _ _ h₁ h₂ s := le_trans (h₁ s) (h₂ s)
le_antisymm _ _ h₁ h₂ := ext fun s _ => le_antisymm (h₁ s) (h₂ s)
theorem toOuterMeasure_le : μ₁.toOuterMeasure ≤ μ₂.toOuterMeasure ↔ μ₁ ≤ μ₂ := .rfl
theorem le_iff : μ₁ ≤ μ₂ ↔ ∀ s, MeasurableSet s → μ₁ s ≤ μ₂ s := outerMeasure_le_iff
theorem le_intro (h : ∀ s, MeasurableSet s → s.Nonempty → μ₁ s ≤ μ₂ s) : μ₁ ≤ μ₂ :=
le_iff.2 fun s hs ↦ s.eq_empty_or_nonempty.elim (by rintro rfl; simp) (h s hs)
theorem le_iff' : μ₁ ≤ μ₂ ↔ ∀ s, μ₁ s ≤ μ₂ s := .rfl
theorem lt_iff : μ < ν ↔ μ ≤ ν ∧ ∃ s, MeasurableSet s ∧ μ s < ν s :=
lt_iff_le_not_ge.trans <|
and_congr Iff.rfl <| by simp only [le_iff, not_forall, not_le, exists_prop]
theorem lt_iff' : μ < ν ↔ μ ≤ ν ∧ ∃ s, μ s < ν s :=
lt_iff_le_not_ge.trans <| and_congr Iff.rfl <| by simp only [le_iff', not_forall, not_le]
instance instIsOrderedAddMonoid {_ : MeasurableSpace α} : IsOrderedAddMonoid (Measure α) where
add_le_add_left _ _ h _ s := add_le_add_left (h s) _
protected theorem le_add_left (h : μ ≤ ν) : μ ≤ ν' + ν := fun s => le_add_left (h s)
protected theorem le_add_right (h : μ ≤ ν) : μ ≤ ν + ν' := fun s => le_add_right (h s)
section sInf
variable {m : Set (Measure α)}
theorem sInf_caratheodory (s : Set α) (hs : MeasurableSet s) :
MeasurableSet[(sInf (toOuterMeasure '' m)).caratheodory] s := by
rw [OuterMeasure.sInf_eq_boundedBy_sInfGen]
refine OuterMeasure.boundedBy_caratheodory fun t => ?_
simp only [OuterMeasure.sInfGen, le_iInf_iff, forall_mem_image, measure_eq_iInf t,
coe_toOuterMeasure]
intro μ hμ u htu _hu
have hm : ∀ {s t}, s ⊆ t → OuterMeasure.sInfGen (toOuterMeasure '' m) s ≤ μ t := by
intro s t hst
rw [OuterMeasure.sInfGen_def, iInf_image]
exact iInf₂_le_of_le μ hμ <| measure_mono hst
rw [← measure_inter_add_diff u hs]
exact add_le_add (hm <| inter_subset_inter_left _ htu) (hm <| diff_subset_diff_left htu)
instance {_ : MeasurableSpace α} : InfSet (Measure α) :=
⟨fun m => (sInf (toOuterMeasure '' m)).toMeasure <| sInf_caratheodory⟩
theorem sInf_apply (hs : MeasurableSet s) : sInf m s = sInf (toOuterMeasure '' m) s :=
toMeasure_apply _ _ hs
private theorem measure_sInf_le (h : μ ∈ m) : sInf m ≤ μ :=
have : sInf (toOuterMeasure '' m) ≤ μ.toOuterMeasure := sInf_le (mem_image_of_mem _ h)
le_iff.2 fun s hs => by rw [sInf_apply hs]; exact this s
private theorem measure_le_sInf (h : ∀ μ' ∈ m, μ ≤ μ') : μ ≤ sInf m :=
have : μ.toOuterMeasure ≤ sInf (toOuterMeasure '' m) :=
le_sInf <| forall_mem_image.2 fun _ hμ ↦ toOuterMeasure_le.2 <| h _ hμ
le_iff.2 fun s hs => by rw [sInf_apply hs]; exact this s
instance instCompleteSemilatticeInf {_ : MeasurableSpace α} : CompleteSemilatticeInf (Measure α) :=
{ (by infer_instance : PartialOrder (Measure α)),
(by infer_instance : InfSet (Measure α)) with
sInf_le := fun _s _a => measure_sInf_le
le_sInf := fun _s _a => measure_le_sInf }
instance instCompleteLattice {_ : MeasurableSpace α} : CompleteLattice (Measure α) :=
{ completeLatticeOfCompleteSemilatticeInf (Measure α) with
top :=
{ toOuterMeasure := ⊤,
m_iUnion := by
intro f _ _
refine (measure_iUnion_le _).antisymm ?_
if hne : (⋃ i, f i).Nonempty then
rw [OuterMeasure.top_apply hne]
exact le_top
else
simp_all [Set.not_nonempty_iff_eq_empty]
trim_le := le_top },
le_top := fun _ => toOuterMeasure_le.mp le_top
bot := 0
bot_le := fun _a _s => bot_le }
end sInf
lemma inf_apply {s : Set α} (hs : MeasurableSet s) :
(μ ⊓ ν) s = sInf {m | ∃ t, m = μ (t ∩ s) + ν (tᶜ ∩ s)} := by
-- `(μ ⊓ ν) s` is defined as `⊓ (t : ℕ → Set α) (ht : s ⊆ ⋃ n, t n), ∑' n, μ (t n) ⊓ ν (t n)`
rw [← sInf_pair, Measure.sInf_apply hs, OuterMeasure.sInf_apply
(image_nonempty.2 <| insert_nonempty μ {ν})]
refine le_antisymm (le_sInf fun m ⟨t, ht₁⟩ ↦ ?_) (le_iInf₂ fun t' ht' ↦ ?_)
· subst ht₁
-- We first show `(μ ⊓ ν) s ≤ μ (t ∩ s) + ν (tᶜ ∩ s)` for any `t : Set α`
-- For this, define the sequence `t' : ℕ → Set α` where `t' 0 = t ∩ s`, `t' 1 = tᶜ ∩ s` and
-- `∅` otherwise. Then, we have by construction
-- `(μ ⊓ ν) s ≤ ∑' n, μ (t' n) ⊓ ν (t' n) ≤ μ (t' 0) + ν (t' 1) = μ (t ∩ s) + ν (tᶜ ∩ s)`.
set t' : ℕ → Set α := fun n ↦ if n = 0 then t ∩ s else if n = 1 then tᶜ ∩ s else ∅ with ht'
refine (iInf₂_le t' fun x hx ↦ ?_).trans ?_
· by_cases hxt : x ∈ t
· refine mem_iUnion.2 ⟨0, ?_⟩
simp [hx, hxt]
· refine mem_iUnion.2 ⟨1, ?_⟩
simp [hx, hxt]
· simp only [iInf_image, coe_toOuterMeasure, iInf_pair]
rw [tsum_eq_add_tsum_ite 0, tsum_eq_add_tsum_ite 1, if_neg zero_ne_one.symm,
ENNReal.summable.tsum_eq_zero_iff.2 _, add_zero]
· exact add_le_add (inf_le_left.trans <| by simp [ht']) (inf_le_right.trans <| by simp [ht'])
· simp only [ite_eq_left_iff]
intro n hn₁ hn₀
simp only [ht', if_neg hn₀, if_neg hn₁, measure_empty, le_refl, inf_of_le_left]
· simp only [iInf_image, coe_toOuterMeasure, iInf_pair]
-- Conversely, fixing `t' : ℕ → Set α` such that `s ⊆ ⋃ n, t' n`, we construct `t : Set α`
-- for which `μ (t ∩ s) + ν (tᶜ ∩ s) ≤ ∑' n, μ (t' n) ⊓ ν (t' n)`.
-- Denoting `I := {n | μ (t' n) ≤ ν (t' n)}`, we set `t = ⋃ n ∈ I, t' n`.
-- Clearly `μ (t ∩ s) ≤ ∑' n ∈ I, μ (t' n)` and `ν (tᶜ ∩ s) ≤ ∑' n ∉ I, ν (t' n)`, so
-- `μ (t ∩ s) + ν (tᶜ ∩ s) ≤ ∑' n ∈ I, μ (t' n) + ∑' n ∉ I, ν (t' n)`
-- where the RHS equals `∑' n, μ (t' n) ⊓ ν (t' n)` by the choice of `I`.
set t := ⋃ n ∈ {k : ℕ | μ (t' k) ≤ ν (t' k)}, t' n with ht
suffices hadd : μ (t ∩ s) + ν (tᶜ ∩ s) ≤ ∑' n, μ (t' n) ⊓ ν (t' n) by
exact le_trans (sInf_le ⟨t, rfl⟩) hadd
have hle₁ : μ (t ∩ s) ≤ ∑' (n : {k | μ (t' k) ≤ ν (t' k)}), μ (t' n) :=
(measure_mono inter_subset_left).trans <| measure_biUnion_le _ (to_countable _) _
have hcap : tᶜ ∩ s ⊆ ⋃ n ∈ {k | ν (t' k) < μ (t' k)}, t' n := by
simp_rw [ht, compl_iUnion]
refine fun x ⟨hx₁, hx₂⟩ ↦ mem_iUnion₂.2 ?_
obtain ⟨i, hi⟩ := mem_iUnion.1 <| ht' hx₂
refine ⟨i, ?_, hi⟩
by_contra h
simp only [mem_setOf_eq, not_lt] at h
exact mem_iInter₂.1 hx₁ i h hi
have hle₂ : ν (tᶜ ∩ s) ≤ ∑' (n : {k | ν (t' k) < μ (t' k)}), ν (t' n) :=
(measure_mono hcap).trans (measure_biUnion_le ν (to_countable {k | ν (t' k) < μ (t' k)}) _)
refine (add_le_add hle₁ hle₂).trans ?_
have heq : {k | μ (t' k) ≤ ν (t' k)} ∪ {k | ν (t' k) < μ (t' k)} = univ := by
ext k; simp [le_or_gt]
conv in ∑' (n : ℕ), μ (t' n) ⊓ ν (t' n) => rw [← tsum_univ, ← heq]
rw [ENNReal.summable.tsum_union_disjoint (f := fun n ↦ μ (t' n) ⊓ ν (t' n)) ?_ ENNReal.summable]
· refine add_le_add (tsum_congr ?_).le (tsum_congr ?_).le
· rw [Subtype.forall]
intro n hn; simpa
· rw [Subtype.forall]
intro n hn
rw [mem_setOf_eq] at hn
simp [le_of_lt hn]
· rw [Set.disjoint_iff]
rintro k ⟨hk₁, hk₂⟩
rw [mem_setOf_eq] at hk₁ hk₂
exact False.elim <| hk₂.not_ge hk₁
@[simp]
theorem _root_.MeasureTheory.OuterMeasure.toMeasure_top :
(⊤ : OuterMeasure α).toMeasure (by rw [OuterMeasure.top_caratheodory]; exact le_top) =
(⊤ : Measure α) :=
toOuterMeasure_toMeasure (μ := ⊤)
@[simp]
theorem toOuterMeasure_top {_ : MeasurableSpace α} :
(⊤ : Measure α).toOuterMeasure = (⊤ : OuterMeasure α) :=
rfl
@[simp]
theorem top_add : ⊤ + μ = ⊤ :=
top_unique <| Measure.le_add_right le_rfl
@[simp]
theorem add_top : μ + ⊤ = ⊤ :=
top_unique <| Measure.le_add_left le_rfl
protected theorem zero_le {_m0 : MeasurableSpace α} (μ : Measure α) : 0 ≤ μ :=
bot_le
theorem nonpos_iff_eq_zero' : μ ≤ 0 ↔ μ = 0 :=
μ.zero_le.ge_iff_eq'
@[simp]
theorem measure_univ_eq_zero : μ univ = 0 ↔ μ = 0 :=
⟨fun h => bot_unique fun s => (h ▸ measure_mono (subset_univ s) : μ s ≤ 0), fun h =>
h.symm ▸ rfl⟩
theorem measure_univ_ne_zero : μ univ ≠ 0 ↔ μ ≠ 0 :=
measure_univ_eq_zero.not
instance [NeZero μ] : NeZero (μ univ) := ⟨measure_univ_ne_zero.2 <| NeZero.ne μ⟩
@[simp]
theorem measure_univ_pos : 0 < μ univ ↔ μ ≠ 0 :=
pos_iff_ne_zero.trans measure_univ_ne_zero
lemma nonempty_of_neZero (μ : Measure α) [NeZero μ] : Nonempty α :=
(isEmpty_or_nonempty α).resolve_left fun h ↦ by
simpa [eq_empty_of_isEmpty] using NeZero.ne (μ univ)
section Sum
variable {f : ι → Measure α}
/-- Sum of an indexed family of measures. -/
noncomputable def sum (f : ι → Measure α) : Measure α :=
(OuterMeasure.sum fun i => (f i).toOuterMeasure).toMeasure <|
le_trans (le_iInf fun _ => le_toOuterMeasure_caratheodory _)
(OuterMeasure.le_sum_caratheodory _)
theorem le_sum_apply (f : ι → Measure α) (s : Set α) : ∑' i, f i s ≤ sum f s :=
le_toMeasure_apply _ _ _
@[simp]
theorem sum_apply (f : ι → Measure α) {s : Set α} (hs : MeasurableSet s) :
sum f s = ∑' i, f i s :=
toMeasure_apply _ _ hs
theorem sum_apply₀ (f : ι → Measure α) {s : Set α} (hs : NullMeasurableSet s (sum f)) :
sum f s = ∑' i, f i s := by
apply le_antisymm ?_ (le_sum_apply _ _)
rcases hs.exists_measurable_subset_ae_eq with ⟨t, ts, t_meas, ht⟩
calc
sum f s = sum f t := measure_congr ht.symm
_ = ∑' i, f i t := sum_apply _ t_meas
_ ≤ ∑' i, f i s := ENNReal.tsum_le_tsum fun i ↦ measure_mono ts
/-! For the next theorem, the countability assumption is necessary. For a counterexample, consider
an uncountable space, with a distinguished point `x₀`, and the sigma-algebra made of countable sets
not containing `x₀`, and their complements. All points but `x₀` are measurable.
Consider the sum of the Dirac masses at points different from `x₀`, and `s = {x₀}`. For any Dirac
mass `δ_x`, we have `δ_x (x₀) = 0`, so `∑' x, δ_x (x₀) = 0`. On the other hand, the measure
`sum δ_x` gives mass one to each point different from `x₀`, so it gives infinite mass to any
measurable set containing `x₀` (as such a set is uncountable), and by outer regularity one gets
`sum δ_x {x₀} = ∞`.
-/
theorem sum_apply_of_countable [Countable ι] (f : ι → Measure α) (s : Set α) :
sum f s = ∑' i, f i s := by
apply le_antisymm ?_ (le_sum_apply _ _)
rcases exists_measurable_superset_forall_eq f s with ⟨t, hst, htm, ht⟩
calc
sum f s ≤ sum f t := measure_mono hst
_ = ∑' i, f i t := sum_apply _ htm
_ = ∑' i, f i s := by simp [ht]
theorem le_sum (μ : ι → Measure α) (i : ι) : μ i ≤ sum μ :=
le_iff.2 fun s hs ↦ by simpa only [sum_apply μ hs] using ENNReal.le_tsum i
@[simp]
theorem sum_apply_eq_zero [Countable ι] {μ : ι → Measure α} {s : Set α} :
sum μ s = 0 ↔ ∀ i, μ i s = 0 := by
simp [sum_apply_of_countable]
theorem sum_apply_eq_zero' {μ : ι → Measure α} {s : Set α} (hs : MeasurableSet s) :
sum μ s = 0 ↔ ∀ i, μ i s = 0 := by simp [hs]
@[simp] lemma sum_eq_zero : sum f = 0 ↔ ∀ i, f i = 0 := by
simp +contextual [Measure.ext_iff, forall_swap (α := ι)]
@[simp]
lemma sum_zero : Measure.sum (fun (_ : ι) ↦ (0 : Measure α)) = 0 := by
ext s hs
simp [Measure.sum_apply _ hs]
theorem sum_sum {ι' : Type*} (μ : ι → ι' → Measure α) :
(sum fun n => sum (μ n)) = sum (fun (p : ι × ι') ↦ μ p.1 p.2) := by
ext1 s hs
simp [sum_apply _ hs, ENNReal.tsum_prod']
theorem sum_comm {ι' : Type*} (μ : ι → ι' → Measure α) :
(sum fun n => sum (μ n)) = sum fun m => sum fun n => μ n m := by
ext1 s hs
simp_rw [sum_apply _ hs]
rw [ENNReal.tsum_comm]
theorem ae_sum_iff [Countable ι] {μ : ι → Measure α} {p : α → Prop} :
(∀ᵐ x ∂sum μ, p x) ↔ ∀ i, ∀ᵐ x ∂μ i, p x :=
sum_apply_eq_zero
theorem ae_sum_iff' {μ : ι → Measure α} {p : α → Prop} (h : MeasurableSet { x | p x }) :
(∀ᵐ x ∂sum μ, p x) ↔ ∀ i, ∀ᵐ x ∂μ i, p x :=
sum_apply_eq_zero' h.compl
@[simp]
theorem sum_fintype [Fintype ι] (μ : ι → Measure α) : sum μ = ∑ i, μ i := by
ext1 s hs
simp only [sum_apply, finset_sum_apply, hs, tsum_fintype]
theorem sum_coe_finset (s : Finset ι) (μ : ι → Measure α) :
(sum fun i : s => μ i) = ∑ i ∈ s, μ i := by rw [sum_fintype, Finset.sum_coe_sort s μ]
@[simp]
theorem ae_sum_eq [Countable ι] (μ : ι → Measure α) : ae (sum μ) = ⨆ i, ae (μ i) :=
Filter.ext fun _ => ae_sum_iff.trans mem_iSup.symm
theorem sum_bool (f : Bool → Measure α) : sum f = f true + f false := by
rw [sum_fintype, Fintype.sum_bool]
theorem sum_cond (μ ν : Measure α) : (sum fun b => cond b μ ν) = μ + ν :=
sum_bool _
@[simp]
theorem sum_of_isEmpty [IsEmpty ι] (μ : ι → Measure α) : sum μ = 0 := by
rw [← measure_univ_eq_zero, sum_apply _ MeasurableSet.univ, tsum_empty]
theorem sum_add_sum_compl (s : Set ι) (μ : ι → Measure α) :
((sum fun i : s => μ i) + sum fun i : ↥sᶜ => μ i) = sum μ := by
ext1 t ht
simp only [add_apply, sum_apply _ ht]
exact ENNReal.summable.tsum_add_tsum_compl (f := fun i => μ i t) ENNReal.summable
theorem sum_congr {μ ν : ℕ → Measure α} (h : ∀ n, μ n = ν n) : sum μ = sum ν :=
congr_arg sum (funext h)
theorem sum_add_sum {ι : Type*} (μ ν : ι → Measure α) : sum μ + sum ν = sum fun n => μ n + ν n := by
ext1 s hs
simp only [add_apply, sum_apply _ hs,
ENNReal.summable.tsum_add ENNReal.summable]
@[simp] lemma sum_comp_equiv {ι ι' : Type*} (e : ι' ≃ ι) (m : ι → Measure α) :
sum (m ∘ e) = sum m := by
ext s hs
simpa [hs, sum_apply] using e.tsum_eq (fun n ↦ m n s)
@[simp] lemma sum_extend_zero {ι ι' : Type*} {f : ι → ι'} (hf : Injective f) (m : ι → Measure α) :
sum (Function.extend f m 0) = sum m := by
ext s hs
simp [*, Function.apply_extend (fun μ : Measure α ↦ μ s)]
end Sum
/-! ### The `cofinite` filter -/
/-- The filter of sets `s` such that `sᶜ` has finite measure. -/
def cofinite {m0 : MeasurableSpace α} (μ : Measure α) : Filter α :=
comk (μ · < ∞) (by simp) (fun _ ht _ hs ↦ (measure_mono hs).trans_lt ht) fun s hs t ht ↦
(measure_union_le s t).trans_lt <| ENNReal.add_lt_top.2 ⟨hs, ht⟩
theorem mem_cofinite : s ∈ μ.cofinite ↔ μ sᶜ < ∞ :=
Iff.rfl
theorem compl_mem_cofinite : sᶜ ∈ μ.cofinite ↔ μ s < ∞ := by rw [mem_cofinite, compl_compl]
theorem eventually_cofinite {p : α → Prop} : (∀ᶠ x in μ.cofinite, p x) ↔ μ { x | ¬p x } < ∞ :=
Iff.rfl
instance cofinite.instIsMeasurablyGenerated : IsMeasurablyGenerated μ.cofinite where
exists_measurable_subset s hs := by
refine ⟨(toMeasurable μ sᶜ)ᶜ, ?_, (measurableSet_toMeasurable _ _).compl, ?_⟩
· rwa [compl_mem_cofinite, measure_toMeasurable]
· rw [compl_subset_comm]
apply subset_toMeasurable
end Measure
open Measure
open MeasureTheory
protected theorem _root_.AEMeasurable.nullMeasurable {f : α → β} (h : AEMeasurable f μ) :
NullMeasurable f μ :=
let ⟨_g, hgm, hg⟩ := h; hgm.nullMeasurable.congr hg.symm
lemma _root_.AEMeasurable.nullMeasurableSet_preimage {f : α → β} {s : Set β}
(hf : AEMeasurable f μ) (hs : MeasurableSet s) : NullMeasurableSet (f ⁻¹' s) μ :=
hf.nullMeasurable hs
@[simp]
theorem ae_eq_bot : ae μ = ⊥ ↔ μ = 0 := by
rw [← empty_mem_iff_bot, mem_ae_iff, compl_empty, measure_univ_eq_zero]
@[simp]
theorem ae_neBot : (ae μ).NeBot ↔ μ ≠ 0 :=
neBot_iff.trans (not_congr ae_eq_bot)
instance Measure.ae.neBot [NeZero μ] : (ae μ).NeBot := ae_neBot.2 <| NeZero.ne μ
@[simp]
theorem ae_zero {_m0 : MeasurableSpace α} : ae (0 : Measure α) = ⊥ :=
ae_eq_bot.2 rfl
section Intervals
theorem biSup_measure_Iic [Preorder α] {s : Set α} (hsc : s.Countable)
(hst : ∀ x : α, ∃ y ∈ s, x ≤ y) (hdir : DirectedOn (· ≤ ·) s) :
⨆ x ∈ s, μ (Iic x) = μ univ := by
rw [← measure_biUnion_eq_iSup hsc]
· congr
simp only [← bex_def] at hst
exact iUnion₂_eq_univ_iff.2 hst
· exact directedOn_iff_directed.2 (hdir.directed_val.mono_comp _ fun x y => Iic_subset_Iic.2)
theorem tendsto_measure_Ico_atTop [Preorder α] [NoMaxOrder α]
[(atTop : Filter α).IsCountablyGenerated] (μ : Measure α) (a : α) :
Tendsto (fun x => μ (Ico a x)) atTop (𝓝 (μ (Ici a))) := by
rw [← iUnion_Ico_right]
exact tendsto_measure_iUnion_atTop (antitone_const.Ico monotone_id)
theorem tendsto_measure_Ioc_atBot [Preorder α] [NoMinOrder α]
[(atBot : Filter α).IsCountablyGenerated] (μ : Measure α) (a : α) :
Tendsto (fun x => μ (Ioc x a)) atBot (𝓝 (μ (Iic a))) := by
rw [← iUnion_Ioc_left]
exact tendsto_measure_iUnion_atBot (monotone_id.Ioc antitone_const)
theorem tendsto_measure_Iic_atTop [Preorder α] [(atTop : Filter α).IsCountablyGenerated]
(μ : Measure α) : Tendsto (fun x => μ (Iic x)) atTop (𝓝 (μ univ)) := by
rw [← iUnion_Iic]
exact tendsto_measure_iUnion_atTop monotone_Iic
theorem tendsto_measure_Ici_atBot [Preorder α] [(atBot : Filter α).IsCountablyGenerated]
(μ : Measure α) : Tendsto (fun x => μ (Ici x)) atBot (𝓝 (μ univ)) :=
tendsto_measure_Iic_atTop (α := αᵒᵈ) μ
variable [PartialOrder α] {a b : α}
theorem Iio_ae_eq_Iic' (ha : μ {a} = 0) : Iio a =ᵐ[μ] Iic a := by
rw [← Iic_diff_right, diff_ae_eq_self, measure_mono_null Set.inter_subset_right ha]
theorem Ioi_ae_eq_Ici' (ha : μ {a} = 0) : Ioi a =ᵐ[μ] Ici a :=
Iio_ae_eq_Iic' (α := αᵒᵈ) ha
theorem Ioo_ae_eq_Ioc' (hb : μ {b} = 0) : Ioo a b =ᵐ[μ] Ioc a b :=
(ae_eq_refl _).inter (Iio_ae_eq_Iic' hb)
theorem Ioc_ae_eq_Icc' (ha : μ {a} = 0) : Ioc a b =ᵐ[μ] Icc a b :=
(Ioi_ae_eq_Ici' ha).inter (ae_eq_refl _)
theorem Ioo_ae_eq_Ico' (ha : μ {a} = 0) : Ioo a b =ᵐ[μ] Ico a b :=
(Ioi_ae_eq_Ici' ha).inter (ae_eq_refl _)
theorem Ioo_ae_eq_Icc' (ha : μ {a} = 0) (hb : μ {b} = 0) : Ioo a b =ᵐ[μ] Icc a b :=
(Ioi_ae_eq_Ici' ha).inter (Iio_ae_eq_Iic' hb)
theorem Ico_ae_eq_Icc' (hb : μ {b} = 0) : Ico a b =ᵐ[μ] Icc a b :=
(ae_eq_refl _).inter (Iio_ae_eq_Iic' hb)
theorem Ico_ae_eq_Ioc' (ha : μ {a} = 0) (hb : μ {b} = 0) : Ico a b =ᵐ[μ] Ioc a b :=
(Ioo_ae_eq_Ico' ha).symm.trans (Ioo_ae_eq_Ioc' hb)
end Intervals
end
end MeasureTheory
end |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Prod.lean | import Mathlib.MeasureTheory.Measure.GiryMonad
import Mathlib.MeasureTheory.Measure.OpenPos
/-!
# The product measure
In this file we define and prove properties about the binary product measure. If `α` and `β` have
s-finite measures `μ` resp. `ν` then `α × β` can be equipped with a s-finite measure `μ.prod ν` that
satisfies `(μ.prod ν) s = ∫⁻ x, ν {y | (x, y) ∈ s} ∂μ`.
We also have `(μ.prod ν) (s ×ˢ t) = μ s * ν t`, i.e. the measure of a rectangle is the product of
the measures of the sides.
We also prove Tonelli's theorem.
## Main definition
* `MeasureTheory.Measure.prod`: The product of two measures.
## Main results
* `MeasureTheory.Measure.prod_apply` states `μ.prod ν s = ∫⁻ x, ν {y | (x, y) ∈ s} ∂μ`
for measurable `s`. `MeasureTheory.Measure.prod_apply_symm` is the reversed version.
* `MeasureTheory.Measure.prod_prod` states `μ.prod ν (s ×ˢ t) = μ s * ν t` for measurable sets
`s` and `t`.
* `MeasureTheory.lintegral_prod`: Tonelli's theorem. It states that for a measurable function
`α × β → ℝ≥0∞` we have `∫⁻ z, f z ∂(μ.prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ`. The version
for functions `α → β → ℝ≥0∞` is reversed, and called `lintegral_lintegral`. Both versions have
a variant with `_symm` appended, where the order of integration is reversed.
The lemma `Measurable.lintegral_prod_right'` states that the inner integral of the right-hand side
is measurable.
## Implementation Notes
Many results are proven twice, once for functions in curried form (`α → β → γ`) and one for
functions in uncurried form (`α × β → γ`). The former often has an assumption
`Measurable (uncurry f)`, which could be inconvenient to discharge, but for the latter it is more
common that the function has to be given explicitly, since Lean cannot synthesize the function by
itself. We name the lemmas about the uncurried form with a prime.
Tonelli's theorem has a different naming scheme, since the version for the uncurried version is
reversed.
## Tags
product measure, Tonelli's theorem, Fubini-Tonelli theorem
-/
noncomputable section
open Topology ENNReal MeasureTheory Set Function Real ENNReal MeasurableSpace MeasureTheory.Measure
open TopologicalSpace hiding generateFrom
open Filter hiding prod_eq map
variable {α β γ : Type*}
variable [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ]
variable {μ μ' : Measure α} {ν ν' : Measure β} {τ : Measure γ}
/-- If `ν` is a finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is
a measurable function. `measurable_measure_prodMk_left` is strictly more general. -/
theorem measurable_measure_prodMk_left_finite [IsFiniteMeasure ν] {s : Set (α × β)}
(hs : MeasurableSet s) : Measurable fun x => ν (Prod.mk x ⁻¹' s) := by
induction s, hs using induction_on_inter generateFrom_prod.symm isPiSystem_prod with
| empty => simp
| basic s hs =>
obtain ⟨s, hs, t, -, rfl⟩ := hs
classical simpa only [mk_preimage_prod_right_eq_if, measure_if]
using measurable_const.indicator hs
| compl s hs ihs =>
simp_rw [preimage_compl, measure_compl (measurable_prodMk_left hs) (measure_ne_top ν _)]
exact ihs.const_sub _
| iUnion f hfd hfm ihf =>
have (a : α) : ν (Prod.mk a ⁻¹' ⋃ i, f i) = ∑' i, ν (Prod.mk a ⁻¹' f i) := by
rw [preimage_iUnion, measure_iUnion]
exacts [hfd.mono fun _ _ ↦ .preimage _, fun i ↦ measurable_prodMk_left (hfm i)]
simpa only [this] using Measurable.ennreal_tsum ihf
/-- If `ν` is an s-finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }`
is a measurable function.
Not true without the s-finite assumption: on `ℝ × ℝ` with the product sigma-algebra, let `s` be the
diagonal and let `ν` be an uncountable sum of Dirac measures (all Dirac measures for points in a
set `t`). Then `ν (Prod.mk x ⁻¹' s) = ν {x} = if x ∈ t then 1 else 0`. If `t` is chosen
non-measurable, this will not be measurable. -/
theorem measurable_measure_prodMk_left [SFinite ν] {s : Set (α × β)} (hs : MeasurableSet s) :
Measurable fun x => ν (Prod.mk x ⁻¹' s) := by
rw [← sum_sfiniteSeq ν]
simp_rw [Measure.sum_apply_of_countable]
exact Measurable.ennreal_tsum (fun i ↦ measurable_measure_prodMk_left_finite hs)
/-- If `μ` is an s-finite measure, and `s ⊆ α × β` is measurable, then `y ↦ μ { x | (x, y) ∈ s }` is
a measurable function. -/
theorem measurable_measure_prodMk_right {μ : Measure α} [SFinite μ] {s : Set (α × β)}
(hs : MeasurableSet s) : Measurable fun y => μ ((fun x => (x, y)) ⁻¹' s) :=
measurable_measure_prodMk_left (measurableSet_swap_iff.mpr hs)
theorem Measurable.map_prodMk_left [SFinite ν] :
Measurable fun x : α => map (Prod.mk x) ν := by
apply measurable_of_measurable_coe; intro s hs
simp_rw [map_apply measurable_prodMk_left hs]
exact measurable_measure_prodMk_left hs
theorem Measurable.map_prodMk_right {μ : Measure α} [SFinite μ] :
Measurable fun y : β => map (fun x : α => (x, y)) μ := by
apply measurable_of_measurable_coe; intro s hs
simp_rw [map_apply measurable_prodMk_right hs]
exact measurable_measure_prodMk_right hs
/-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
Tonelli's theorem is measurable. -/
@[fun_prop, measurability]
theorem Measurable.lintegral_prod_right' [SFinite ν] :
∀ {f : α × β → ℝ≥0∞}, Measurable f → Measurable fun x => ∫⁻ y, f (x, y) ∂ν := by
have m := @measurable_prodMk_left
refine Measurable.ennreal_induction (motive := fun f ↦ Measurable fun (x : α) ↦ ∫⁻ y, f (x, y) ∂ν)
?_ ?_ ?_
· intro c s hs
simp only [← indicator_comp_right]
suffices Measurable fun x => c * ν (Prod.mk x ⁻¹' s) by simpa [lintegral_indicator (m hs)]
exact (measurable_measure_prodMk_left hs).const_mul _
· rintro f g - hf - h2f h2g
simp only [Pi.add_apply]
conv => enter [1, x]; erw [lintegral_add_left (hf.comp m)]
exact h2f.add h2g
· intro f hf h2f h3f
have : ∀ x, Monotone fun n y => f n (x, y) := fun x i j hij y => h2f hij (x, y)
conv => enter [1, x]; erw [lintegral_iSup (fun n => (hf n).comp m) (this x)]
exact .iSup h3f
/-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
Tonelli's theorem is measurable.
This version has the argument `f` in curried form. -/
@[fun_prop, measurability]
theorem Measurable.lintegral_prod_right [SFinite ν] {f : α → β → ℝ≥0∞}
(hf : Measurable (uncurry f)) : Measurable fun x => ∫⁻ y, f x y ∂ν :=
hf.lintegral_prod_right'
/-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
the symmetric version of Tonelli's theorem is measurable. -/
@[fun_prop, measurability]
theorem Measurable.lintegral_prod_left' [SFinite μ] {f : α × β → ℝ≥0∞} (hf : Measurable f) :
Measurable fun y => ∫⁻ x, f (x, y) ∂μ :=
(measurable_swap_iff.mpr hf).lintegral_prod_right'
/-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
the symmetric version of Tonelli's theorem is measurable.
This version has the argument `f` in curried form. -/
@[fun_prop, measurability]
theorem Measurable.lintegral_prod_left [SFinite μ] {f : α → β → ℝ≥0∞}
(hf : Measurable (uncurry f)) : Measurable fun y => ∫⁻ x, f x y ∂μ :=
hf.lintegral_prod_left'
/-! ### The product measure -/
namespace MeasureTheory
namespace Measure
/-- The binary product of measures. They are defined for arbitrary measures, but we basically
prove all properties under the assumption that at least one of them is s-finite. -/
protected irreducible_def prod (μ : Measure α) (ν : Measure β) : Measure (α × β) :=
bind μ fun x : α => map (Prod.mk x) ν
instance prod.measureSpace {α β} [MeasureSpace α] [MeasureSpace β] : MeasureSpace (α × β) where
volume := volume.prod volume
theorem volume_eq_prod (α β) [MeasureSpace α] [MeasureSpace β] :
(volume : Measure (α × β)) = (volume : Measure α).prod (volume : Measure β) :=
rfl
/-- For an s-finite measure `ν`, see `prod_apply` below. -/
theorem prod_apply_le {s : Set (α × β)} (hs : MeasurableSet s) :
μ.prod ν s ≤ ∫⁻ x, ν (Prod.mk x ⁻¹' s) ∂μ := by
simp only [Measure.prod, ← map_apply measurable_prodMk_left hs]
exact bind_apply_le _ hs
/-- For any measures `μ` and `ν` and any sets `s` and `t`,
we have `μ.prod ν (s ×ˢ t) ≤ μ s * ν t`.
If `ν` is an s-finite measure (which is usually true),
then this inequality becomes an equality, see `prod_prod` below. -/
theorem prod_prod_le (s : Set α) (t : Set β) : μ.prod ν (s ×ˢ t) ≤ μ s * ν t := by
set S := toMeasurable μ s
set T := toMeasurable ν t
calc
μ.prod ν (s ×ˢ t) ≤ μ.prod ν (S ×ˢ T) := by gcongr <;> apply subset_toMeasurable
_ ≤ ∫⁻ x, ν (Prod.mk x ⁻¹' (S ×ˢ T)) ∂μ := prod_apply_le (by measurability)
_ = μ S * ν T := by
classical
simp_rw [S, mk_preimage_prod_right_eq_if, measure_if,
lintegral_indicator (measurableSet_toMeasurable _ _), lintegral_const,
restrict_apply_univ, mul_comm]
_ = μ s * ν t := by rw [measure_toMeasurable, measure_toMeasurable]
instance prod.instNoAtoms_fst [NoAtoms μ] :
NoAtoms (Measure.prod μ ν) where
measure_singleton
| (x, y) => nonpos_iff_eq_zero.mp <| calc
μ.prod ν {(x, y)} = μ.prod ν ({x} ×ˢ {y}) := by rw [singleton_prod_singleton]
_ ≤ μ {x} * ν {y} := prod_prod_le _ _
_ = 0 := by simp
instance prod.instNoAtoms_snd [NoAtoms ν] :
NoAtoms (Measure.prod μ ν) where
measure_singleton
| (x, y) => nonpos_iff_eq_zero.mp <| calc
μ.prod ν {(x, y)} = μ.prod ν ({x} ×ˢ {y}) := by rw [singleton_prod_singleton]
_ ≤ μ {x} * ν {y} := prod_prod_le _ _
_ = 0 := by simp
variable [SFinite ν]
theorem prod_apply {s : Set (α × β)} (hs : MeasurableSet s) :
μ.prod ν s = ∫⁻ x, ν (Prod.mk x ⁻¹' s) ∂μ := by
simp_rw [Measure.prod, bind_apply hs (Measurable.map_prodMk_left (ν := ν)).aemeasurable,
map_apply measurable_prodMk_left hs]
/-- The product measure of the product of two sets is the product of their measures. Note that we
do not need the sets to be measurable. -/
@[simp]
theorem prod_prod (s : Set α) (t : Set β) : μ.prod ν (s ×ˢ t) = μ s * ν t := by
apply (prod_prod_le s t).antisymm
-- Formalization is based on https://mathoverflow.net/a/254134/136589
set ST := toMeasurable (μ.prod ν) (s ×ˢ t)
have hSTm : MeasurableSet ST := measurableSet_toMeasurable _ _
have hST : s ×ˢ t ⊆ ST := subset_toMeasurable _ _
set f : α → ℝ≥0∞ := fun x => ν (Prod.mk x ⁻¹' ST)
have hfm : Measurable f := measurable_measure_prodMk_left hSTm
set s' : Set α := { x | ν t ≤ f x }
have hss' : s ⊆ s' := fun x hx => measure_mono fun y hy => hST <| mk_mem_prod hx hy
calc
μ s * ν t ≤ μ s' * ν t := by gcongr
_ = ∫⁻ _ in s', ν t ∂μ := by rw [setLIntegral_const, mul_comm]
_ ≤ ∫⁻ x in s', f x ∂μ := setLIntegral_mono hfm fun x => id
_ ≤ ∫⁻ x, f x ∂μ := lintegral_mono' restrict_le_self le_rfl
_ = μ.prod ν ST := (prod_apply hSTm).symm
_ = μ.prod ν (s ×ˢ t) := measure_toMeasurable _
@[simp]
theorem _root_.MeasureTheory.measureReal_prod_prod (s : Set α) (t : Set β) :
(μ.prod ν).real (s ×ˢ t) = μ.real s * ν.real t := by
simp only [measureReal_def, prod_prod, ENNReal.toReal_mul]
@[simp] lemma map_fst_prod : Measure.map Prod.fst (μ.prod ν) = (ν univ) • μ := by
ext s hs
simp [Measure.map_apply measurable_fst hs, ← prod_univ, mul_comm]
lemma _root_.MeasureTheory.measurePreserving_fst [IsProbabilityMeasure ν] :
MeasurePreserving Prod.fst (μ.prod ν) μ :=
⟨measurable_fst, by rw [map_fst_prod, measure_univ, one_smul]⟩
@[simp] lemma map_snd_prod : Measure.map Prod.snd (μ.prod ν) = (μ univ) • ν := by
ext s hs
simp [Measure.map_apply measurable_snd hs, ← univ_prod]
lemma _root_.MeasureTheory.measurePreserving_snd [IsProbabilityMeasure μ] :
MeasurePreserving Prod.snd (μ.prod ν) ν :=
⟨measurable_snd, by rw [map_snd_prod, measure_univ, one_smul]⟩
instance prod.instIsOpenPosMeasure {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
{m : MeasurableSpace X} {μ : Measure X} [IsOpenPosMeasure μ] {m' : MeasurableSpace Y}
{ν : Measure Y} [IsOpenPosMeasure ν] [SFinite ν] : IsOpenPosMeasure (μ.prod ν) := by
constructor
rintro U U_open ⟨⟨x, y⟩, hxy⟩
rcases isOpen_prod_iff.1 U_open x y hxy with ⟨u, v, u_open, v_open, xu, yv, huv⟩
refine ne_of_gt (lt_of_lt_of_le ?_ (measure_mono huv))
simp only [prod_prod, CanonicallyOrderedAdd.mul_pos]
constructor
· exact u_open.measure_pos μ ⟨x, xu⟩
· exact v_open.measure_pos ν ⟨y, yv⟩
instance {X Y : Type*}
[TopologicalSpace X] [MeasureSpace X] [IsOpenPosMeasure (volume : Measure X)]
[TopologicalSpace Y] [MeasureSpace Y] [IsOpenPosMeasure (volume : Measure Y)]
[SFinite (volume : Measure Y)] : IsOpenPosMeasure (volume : Measure (X × Y)) :=
prod.instIsOpenPosMeasure
instance prod.instIsFiniteMeasure {α β : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
(μ : Measure α) (ν : Measure β) [IsFiniteMeasure μ] [IsFiniteMeasure ν] :
IsFiniteMeasure (μ.prod ν) := by
constructor
rw [← univ_prod_univ, prod_prod]
finiteness
instance {α β : Type*} [MeasureSpace α] [MeasureSpace β] [IsFiniteMeasure (volume : Measure α)]
[IsFiniteMeasure (volume : Measure β)] : IsFiniteMeasure (volume : Measure (α × β)) :=
prod.instIsFiniteMeasure _ _
instance prod.instIsProbabilityMeasure {α β : Type*} {mα : MeasurableSpace α}
{mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β) [IsProbabilityMeasure μ]
[IsProbabilityMeasure ν] : IsProbabilityMeasure (μ.prod ν) :=
⟨by rw [← univ_prod_univ, prod_prod, measure_univ, measure_univ, mul_one]⟩
instance {α β : Type*} [MeasureSpace α] [MeasureSpace β]
[IsProbabilityMeasure (volume : Measure α)] [IsProbabilityMeasure (volume : Measure β)] :
IsProbabilityMeasure (volume : Measure (α × β)) :=
prod.instIsProbabilityMeasure _ _
instance prod.instIsFiniteMeasureOnCompacts {α β : Type*} [TopologicalSpace α] [TopologicalSpace β]
{mα : MeasurableSpace α} {mβ : MeasurableSpace β} (μ : Measure α) (ν : Measure β)
[IsFiniteMeasureOnCompacts μ] [IsFiniteMeasureOnCompacts ν] :
IsFiniteMeasureOnCompacts (μ.prod ν) where
lt_top_of_isCompact K hK := calc
μ.prod ν K ≤ μ.prod ν ((Prod.fst '' K) ×ˢ (Prod.snd '' K)) := measure_mono subset_prod
_ ≤ μ (Prod.fst '' K) * ν (Prod.snd '' K) := prod_prod_le _ _
_ < ∞ :=
mul_lt_top (hK.image continuous_fst).measure_lt_top (hK.image continuous_snd).measure_lt_top
instance {X Y : Type*}
[TopologicalSpace X] [MeasureSpace X] [IsFiniteMeasureOnCompacts (volume : Measure X)]
[TopologicalSpace Y] [MeasureSpace Y] [IsFiniteMeasureOnCompacts (volume : Measure Y)] :
IsFiniteMeasureOnCompacts (volume : Measure (X × Y)) :=
prod.instIsFiniteMeasureOnCompacts _ _
theorem ae_measure_lt_top {s : Set (α × β)} (hs : MeasurableSet s) (h2s : (μ.prod ν) s ≠ ∞) :
∀ᵐ x ∂μ, ν (Prod.mk x ⁻¹' s) < ∞ := by
rw [prod_apply hs] at h2s
exact ae_lt_top (measurable_measure_prodMk_left hs) h2s
omit [SFinite ν] in
/-- If `μ`-a.e. section `{y | (x, y) ∈ s}` of a measurable set have `ν` measure zero,
then `s` has `μ.prod ν` measure zero.
This implication requires `s` to be measurable but does not require `ν` to be s-finite.
See also `measure_prod_null` and `measure_ae_null_of_prod_null` below. -/
theorem measure_prod_null_of_ae_null {s : Set (α × β)} (hsm : MeasurableSet s)
(hs : (fun x => ν (Prod.mk x ⁻¹' s)) =ᵐ[μ] 0) : μ.prod ν s = 0 := by
rw [← nonpos_iff_eq_zero]
calc
μ.prod ν s ≤ ∫⁻ x, ν (Prod.mk x ⁻¹' s) ∂μ := prod_apply_le hsm
_ = 0 := by simp [lintegral_congr_ae hs]
/-- A measurable set `s` has `μ.prod ν` measure zero, where `ν` is an s-finite measure,
if and only if `μ`-a.e. section `{y | (x, y) ∈ s}` of `s` have `ν` measure zero.
See `measure_ae_null_of_prod_null` for the forward implication without the measurability assumption
and `measure_prod_null_of_ae_null` for the reverse implication without the s-finiteness assumption.
Note: the assumption `hs` cannot be dropped. For a counterexample, see
Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/
theorem measure_prod_null {s : Set (α × β)} (hs : MeasurableSet s) :
μ.prod ν s = 0 ↔ (fun x => ν (Prod.mk x ⁻¹' s)) =ᵐ[μ] 0 := by
rw [prod_apply hs, lintegral_eq_zero_iff (measurable_measure_prodMk_left hs)]
/-- Note: the converse is not true without assuming that `s` is measurable. For a counterexample,
see Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/
theorem measure_ae_null_of_prod_null {s : Set (α × β)} (h : μ.prod ν s = 0) :
(fun x => ν (Prod.mk x ⁻¹' s)) =ᵐ[μ] 0 := by
obtain ⟨t, hst, mt, ht⟩ := exists_measurable_superset_of_null h
rw [measure_prod_null mt] at ht
rw [eventuallyLE_antisymm_iff]
exact
⟨EventuallyLE.trans_eq (Eventually.of_forall fun x => measure_mono (preimage_mono hst))
ht,
Eventually.of_forall fun x => zero_le _⟩
omit [SFinite ν] in
theorem AbsolutelyContinuous.prod [SFinite ν'] (h1 : μ ≪ μ') (h2 : ν ≪ ν') :
μ.prod ν ≪ μ'.prod ν' := by
refine AbsolutelyContinuous.mk fun s hs h2s => ?_
apply measure_prod_null_of_ae_null hs
rw [measure_prod_null hs] at h2s
exact (h2s.filter_mono h1.ae_le).mono fun _ h => h2 h
/-- Note: the converse is not true. For a counterexample, see
Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. It is true if the set is
measurable, see `ae_prod_mem_iff_ae_ae_mem`. -/
theorem ae_ae_of_ae_prod {p : α × β → Prop} (h : ∀ᵐ z ∂μ.prod ν, p z) :
∀ᵐ x ∂μ, ∀ᵐ y ∂ν, p (x, y) :=
measure_ae_null_of_prod_null h
theorem ae_ae_eq_curry_of_prod {γ : Type*} {f g : α × β → γ} (h : f =ᵐ[μ.prod ν] g) :
∀ᵐ x ∂μ, curry f x =ᵐ[ν] curry g x :=
ae_ae_of_ae_prod h
theorem ae_ae_eq_of_ae_eq_uncurry {γ : Type*} {f g : α → β → γ}
(h : uncurry f =ᵐ[μ.prod ν] uncurry g) : ∀ᵐ x ∂μ, f x =ᵐ[ν] g x :=
ae_ae_eq_curry_of_prod h
theorem ae_prod_iff_ae_ae {p : α × β → Prop} (hp : MeasurableSet {x | p x}) :
(∀ᵐ z ∂μ.prod ν, p z) ↔ ∀ᵐ x ∂μ, ∀ᵐ y ∂ν, p (x, y) :=
measure_prod_null hp.compl
theorem ae_prod_mem_iff_ae_ae_mem {s : Set (α × β)} (hs : MeasurableSet s) :
(∀ᵐ z ∂μ.prod ν, z ∈ s) ↔ ∀ᵐ x ∂μ, ∀ᵐ y ∂ν, (x, y) ∈ s :=
measure_prod_null hs.compl
omit [SFinite ν] in
@[fun_prop]
theorem quasiMeasurePreserving_fst : QuasiMeasurePreserving Prod.fst (μ.prod ν) μ := by
refine ⟨measurable_fst, AbsolutelyContinuous.mk fun s hs h2s => ?_⟩
rw [map_apply measurable_fst hs, ← prod_univ, ← nonpos_iff_eq_zero]
refine (prod_prod_le _ _).trans_eq ?_
rw [h2s, zero_mul]
omit [SFinite ν] in
@[fun_prop]
theorem quasiMeasurePreserving_snd : QuasiMeasurePreserving Prod.snd (μ.prod ν) ν := by
refine ⟨measurable_snd, AbsolutelyContinuous.mk fun s hs h2s => ?_⟩
rw [map_apply measurable_snd hs, ← univ_prod, ← nonpos_iff_eq_zero]
refine (prod_prod_le _ _).trans_eq ?_
rw [h2s, mul_zero]
omit [SFinite ν] in
lemma set_prod_ae_eq {s s' : Set α} {t t' : Set β} (hs : s =ᵐ[μ] s') (ht : t =ᵐ[ν] t') :
(s ×ˢ t : Set (α × β)) =ᵐ[μ.prod ν] (s' ×ˢ t' : Set (α × β)) :=
(quasiMeasurePreserving_fst.preimage_ae_eq hs).inter
(quasiMeasurePreserving_snd.preimage_ae_eq ht)
lemma measure_prod_compl_eq_zero {s : Set α} {t : Set β}
(s_ae_univ : μ sᶜ = 0) (t_ae_univ : ν tᶜ = 0) :
μ.prod ν (s ×ˢ t)ᶜ = 0 := by
rw [Set.compl_prod_eq_union, measure_union_null_iff]
simp [s_ae_univ, t_ae_univ]
omit [SFinite ν] in
lemma _root_.MeasureTheory.NullMeasurableSet.prod {s : Set α} {t : Set β}
(s_mble : NullMeasurableSet s μ) (t_mble : NullMeasurableSet t ν) :
NullMeasurableSet (s ×ˢ t) (μ.prod ν) :=
let ⟨s₀, mble_s₀, s_aeeq_s₀⟩ := s_mble
let ⟨t₀, mble_t₀, t_aeeq_t₀⟩ := t_mble
⟨s₀ ×ˢ t₀, ⟨mble_s₀.prod mble_t₀, set_prod_ae_eq s_aeeq_s₀ t_aeeq_t₀⟩⟩
/-- If `s ×ˢ t` is a null measurable set and `μ s ≠ 0`, then `t` is a null measurable set. -/
lemma _root_.MeasureTheory.NullMeasurableSet.right_of_prod {s : Set α} {t : Set β}
(h : NullMeasurableSet (s ×ˢ t) (μ.prod ν)) (hs : μ s ≠ 0) : NullMeasurableSet t ν := by
rcases h with ⟨u, hum, hu⟩
obtain ⟨x, hxs, hx⟩ : ∃ x ∈ s, (Prod.mk x ⁻¹' (s ×ˢ t)) =ᵐ[ν] (Prod.mk x ⁻¹' u) :=
((frequently_ae_iff.2 hs).and_eventually (ae_ae_eq_curry_of_prod hu)).exists
refine ⟨Prod.mk x ⁻¹' u, measurable_prodMk_left hum, ?_⟩
rwa [mk_preimage_prod_right hxs] at hx
/-- If `Prod.snd ⁻¹' t` is a null measurable set and `μ ≠ 0`, then `t` is a null measurable set. -/
lemma _root_.MeasureTheory.NullMeasurableSet.of_preimage_snd [NeZero μ] {t : Set β}
(h : NullMeasurableSet (Prod.snd ⁻¹' t) (μ.prod ν)) : NullMeasurableSet t ν :=
.right_of_prod (by rwa [univ_prod]) (NeZero.ne (μ univ))
/-- `Prod.snd ⁻¹' t` is null measurable w.r.t. `μ.prod ν` iff `t` is null measurable w.r.t. `ν`
provided that `μ ≠ 0`. -/
lemma nullMeasurableSet_preimage_snd [NeZero μ] {t : Set β} :
NullMeasurableSet (Prod.snd ⁻¹' t) (μ.prod ν) ↔ NullMeasurableSet t ν :=
⟨.of_preimage_snd, (.preimage · quasiMeasurePreserving_snd)⟩
lemma nullMeasurable_comp_snd [NeZero μ] {f : β → γ} :
NullMeasurable (f ∘ Prod.snd) (μ.prod ν) ↔ NullMeasurable f ν :=
forall₂_congr fun s _ ↦ nullMeasurableSet_preimage_snd (t := f ⁻¹' s)
/-- `μ.prod ν` has finite spanning sets in rectangles of finite spanning sets. -/
noncomputable def FiniteSpanningSetsIn.prod {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)}
(hμ : μ.FiniteSpanningSetsIn C) (hν : ν.FiniteSpanningSetsIn D) :
(μ.prod ν).FiniteSpanningSetsIn (image2 (· ×ˢ ·) C D) := by
haveI := hν.sigmaFinite
refine
⟨fun n => hμ.set n.unpair.1 ×ˢ hν.set n.unpair.2, fun n =>
mem_image2_of_mem (hμ.set_mem _) (hν.set_mem _), fun n => ?_, ?_⟩
· rw [prod_prod]
exact mul_lt_top (hμ.finite _) (hν.finite _)
· simp_rw [iUnion_unpair_prod, hμ.spanning, hν.spanning, univ_prod_univ]
lemma prod_sum_left {ι : Type*} (m : ι → Measure α) (μ : Measure β) [SFinite μ] :
(Measure.sum m).prod μ = Measure.sum (fun i ↦ (m i).prod μ) := by
ext s hs
simp only [prod_apply hs, lintegral_sum_measure, hs, sum_apply]
lemma prod_sum_right {ι' : Type*} [Countable ι'] (m : Measure α) (m' : ι' → Measure β)
[∀ n, SFinite (m' n)] :
m.prod (Measure.sum m') = Measure.sum (fun p ↦ m.prod (m' p)) := by
ext s hs
simp only [prod_apply hs, hs, sum_apply]
have M : ∀ x, MeasurableSet (Prod.mk x ⁻¹' s) := fun x => measurable_prodMk_left hs
simp_rw [Measure.sum_apply _ (M _)]
rw [lintegral_tsum (fun i ↦ (measurable_measure_prodMk_left hs).aemeasurable)]
lemma prod_sum {ι ι' : Type*} [Countable ι'] (m : ι → Measure α) (m' : ι' → Measure β)
[∀ n, SFinite (m' n)] :
(Measure.sum m).prod (Measure.sum m') =
Measure.sum (fun (p : ι × ι') ↦ (m p.1).prod (m' p.2)) := by
simp_rw [prod_sum_left, prod_sum_right, sum_sum]
instance prod.instSigmaFinite {α β : Type*} {_ : MeasurableSpace α} {μ : Measure α}
[SigmaFinite μ] {_ : MeasurableSpace β} {ν : Measure β} [SigmaFinite ν] :
SigmaFinite (μ.prod ν) :=
(μ.toFiniteSpanningSetsIn.prod ν.toFiniteSpanningSetsIn).sigmaFinite
instance prod.instSFinite {α β : Type*} {_ : MeasurableSpace α} {μ : Measure α}
[SFinite μ] {_ : MeasurableSpace β} {ν : Measure β} [SFinite ν] :
SFinite (μ.prod ν) := by
have : μ.prod ν =
Measure.sum (fun (p : ℕ × ℕ) ↦ (sfiniteSeq μ p.1).prod (sfiniteSeq ν p.2)) := by
conv_lhs => rw [← sum_sfiniteSeq μ, ← sum_sfiniteSeq ν]
apply prod_sum
rw [this]
infer_instance
instance {α β} [MeasureSpace α] [SigmaFinite (volume : Measure α)]
[MeasureSpace β] [SigmaFinite (volume : Measure β)] : SigmaFinite (volume : Measure (α × β)) :=
prod.instSigmaFinite
instance {α β} [MeasureSpace α] [SFinite (volume : Measure α)]
[MeasureSpace β] [SFinite (volume : Measure β)] : SFinite (volume : Measure (α × β)) :=
prod.instSFinite
/-- A measure on a product space equals the product measure if they are equal on rectangles
with as sides sets that generate the corresponding σ-algebras. -/
theorem prod_eq_generateFrom {μ : Measure α} {ν : Measure β} {C : Set (Set α)} {D : Set (Set β)}
(hC : generateFrom C = ‹_›) (hD : generateFrom D = ‹_›) (h2C : IsPiSystem C)
(h2D : IsPiSystem D) (h3C : μ.FiniteSpanningSetsIn C) (h3D : ν.FiniteSpanningSetsIn D)
{μν : Measure (α × β)} (h₁ : ∀ s ∈ C, ∀ t ∈ D, μν (s ×ˢ t) = μ s * ν t) : μ.prod ν = μν := by
refine
(h3C.prod h3D).ext
(generateFrom_eq_prod hC hD h3C.isCountablySpanning h3D.isCountablySpanning).symm
(h2C.prod h2D) ?_
rintro _ ⟨s, hs, t, ht, rfl⟩
haveI := h3D.sigmaFinite
rw [h₁ s hs t ht, prod_prod]
/- Note that the next theorem is not true for s-finite measures: let `μ = ν = ∞ • Leb` on `[0,1]`
(they are s-finite as countable sums of the finite Lebesgue measure), and let `μν = μ.prod ν + λ`
where `λ` is Lebesgue measure on the diagonal. Then both measures give infinite mass to rectangles
`s × t` whose sides have positive Lebesgue measure, and `0` measure when one of the sides has zero
Lebesgue measure. And yet they do not coincide, as the first one gives zero mass to the diagonal,
and the second one gives mass one.
-/
/-- A measure on a product space equals the product measure of sigma-finite measures if they are
equal on rectangles. -/
theorem prod_eq {μ : Measure α} [SigmaFinite μ] {ν : Measure β} [SigmaFinite ν]
{μν : Measure (α × β)}
(h : ∀ s t, MeasurableSet s → MeasurableSet t → μν (s ×ˢ t) = μ s * ν t) : μ.prod ν = μν :=
prod_eq_generateFrom generateFrom_measurableSet generateFrom_measurableSet
isPiSystem_measurableSet isPiSystem_measurableSet μ.toFiniteSpanningSetsIn
ν.toFiniteSpanningSetsIn fun s hs t ht => h s t hs ht
-- This is not true for σ-finite measures. See the discussion at
-- https://leanprover.zulipchat.com/#narrow/channel/116395-maths/topic/Uniqueness.20of.20sigma-finite.20measures.20on.20a.20product.20space/with/541741071
/-- Two finite measures on a product that are equal on products of sets are equal. -/
lemma ext_prod {α β : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
{μ ν : Measure (α × β)} [IsFiniteMeasure μ]
(h : ∀ {s : Set α} {t : Set β}, MeasurableSet s → MeasurableSet t → μ (s ×ˢ t) = ν (s ×ˢ t)) :
μ = ν := by
ext s hs
have h_univ : μ univ = ν univ := by
rw [← univ_prod_univ]
exact h .univ .univ
have : IsFiniteMeasure ν := ⟨by simp [← h_univ]⟩
refine MeasurableSpace.induction_on_inter generateFrom_prod.symm isPiSystem_prod (by simp)
?_ ?_ ?_ s hs
· rintro - ⟨s, hs, t, ht, rfl⟩
exact h hs ht
· intro t ht h
simp_rw [measure_compl ht (measure_ne_top _ _), h, h_univ]
· intro f h_disj hf h_eq
simp_rw [measure_iUnion h_disj hf, h_eq]
/-- Two finite measures on a product are equal iff they are equal on products of sets. -/
lemma ext_prod_iff {α β : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
{μ ν : Measure (α × β)} [IsFiniteMeasure μ] :
μ = ν
↔ ∀ {s : Set α} {t : Set β}, MeasurableSet s → MeasurableSet t → μ (s ×ˢ t) = ν (s ×ˢ t) :=
⟨fun h s t hs ht ↦ by rw [h], Measure.ext_prod⟩
/-- Two finite measures on a product `α × β × γ` that are equal on products of sets are equal.
See `ext_prod₃'` for the same statement for `(α × β) × γ`. -/
lemma ext_prod₃ {α β γ : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
{mγ : MeasurableSpace γ} {μ ν : Measure (α × β × γ)} [IsFiniteMeasure μ]
(h : ∀ {s : Set α} {t : Set β} {u : Set γ},
MeasurableSet s → MeasurableSet t → MeasurableSet u → μ (s ×ˢ t ×ˢ u) = ν (s ×ˢ t ×ˢ u)) :
μ = ν := by
ext s hs
have h_univ : μ univ = ν univ := by
simp_rw [← univ_prod_univ]
exact h .univ .univ .univ
have : IsFiniteMeasure ν := ⟨by simp [← h_univ]⟩
let C₂ := image2 (· ×ˢ ·) { t : Set β | MeasurableSet t } { u : Set γ | MeasurableSet u }
let C := image2 (· ×ˢ ·) { s : Set α | MeasurableSet s } C₂
refine MeasurableSpace.induction_on_inter (s := C) ?_ ?_ (by simp) ?_ ?_ ?_ s hs
· refine (generateFrom_eq_prod (C := { s : Set α | MeasurableSet s }) (D := C₂) (by simp)
generateFrom_prod isCountablySpanning_measurableSet ?_).symm
exact isCountablySpanning_measurableSet.prod isCountablySpanning_measurableSet
· exact MeasurableSpace.isPiSystem_measurableSet.prod isPiSystem_prod
· rintro - ⟨s, hs, -, ⟨t, ht, u, hu, rfl⟩, rfl⟩
exact h hs ht hu
· intro t ht h
simp_rw [measure_compl ht (measure_ne_top _ _), h, h_univ]
· intro f h_disj hf h_eq
simp_rw [measure_iUnion h_disj hf, h_eq]
/-- Two finite measures on a product `α × β × γ` are equal iff they are equal on products of sets.
See `ext_prod₃_iff'` for the same statement for `(α × β) × γ`. -/
lemma ext_prod₃_iff {α β γ : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
{mγ : MeasurableSpace γ} {μ ν : Measure (α × β × γ)} [IsFiniteMeasure μ] :
μ = ν ↔ (∀ {s : Set α} {t : Set β} {u : Set γ},
MeasurableSet s → MeasurableSet t → MeasurableSet u → μ (s ×ˢ t ×ˢ u) = ν (s ×ˢ t ×ˢ u)) :=
⟨fun h s t u hs ht hu ↦ by rw [h], Measure.ext_prod₃⟩
/-- Two finite measures on a product `(α × β) × γ` are equal iff they are equal on products of sets.
See `ext_prod₃_iff` for the same statement for `α × β × γ`. -/
lemma ext_prod₃_iff' {α β γ : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
{mγ : MeasurableSpace γ} {μ ν : Measure ((α × β) × γ)} [IsFiniteMeasure μ] :
μ = ν ↔ (∀ {s : Set α} {t : Set β} {u : Set γ},
MeasurableSet s → MeasurableSet t → MeasurableSet u →
μ ((s ×ˢ t) ×ˢ u) = ν ((s ×ˢ t) ×ˢ u)) := by
rw [← MeasurableEquiv.prodAssoc.map_measurableEquiv_injective.eq_iff, ext_prod₃_iff]
have h_eq (ν : Measure ((α × β) × γ)) {s : Set α} {t : Set β} {u : Set γ}
(hs : MeasurableSet s) (ht : MeasurableSet t) (hu : MeasurableSet u) :
ν.map MeasurableEquiv.prodAssoc (s ×ˢ (t ×ˢ u)) = ν ((s ×ˢ t) ×ˢ u) := by
rw [map_apply (by fun_prop) (hs.prod (ht.prod hu))]
congr 1 with x
simp [MeasurableEquiv.prodAssoc]
refine ⟨fun h s t u hs ht hu ↦ ?_, fun h s t u hs ht hu ↦ ?_⟩ <;> specialize h hs ht hu
· rwa [h_eq μ hs ht hu, h_eq ν hs ht hu] at h
· rwa [h_eq μ hs ht hu, h_eq ν hs ht hu]
/-- Two finite measures on a product `(α × β) × γ` that are equal on products of sets are equal.
See `ext_prod₃` for the same statement for `α × β × γ`. -/
alias ⟨_, ext_prod₃'⟩ := ext_prod₃_iff'
variable [SFinite μ]
theorem prod_swap : map Prod.swap (μ.prod ν) = ν.prod μ := by
have : sum (fun (i : ℕ × ℕ) ↦ map Prod.swap ((sfiniteSeq μ i.1).prod (sfiniteSeq ν i.2)))
= sum (fun (i : ℕ × ℕ) ↦ map Prod.swap ((sfiniteSeq μ i.2).prod (sfiniteSeq ν i.1))) := by
ext s hs
rw [sum_apply _ hs, sum_apply _ hs]
exact ((Equiv.prodComm ℕ ℕ).tsum_eq _).symm
rw [← sum_sfiniteSeq μ, ← sum_sfiniteSeq ν, prod_sum, prod_sum,
map_sum measurable_swap.aemeasurable, this]
congr 1
ext1 i
refine (prod_eq ?_).symm
intro s t hs ht
simp_rw [map_apply measurable_swap (hs.prod ht), preimage_swap_prod, prod_prod, mul_comm]
theorem measurePreserving_swap : MeasurePreserving Prod.swap (μ.prod ν) (ν.prod μ) :=
⟨measurable_swap, prod_swap⟩
theorem prod_apply_symm {s : Set (α × β)} (hs : MeasurableSet s) :
μ.prod ν s = ∫⁻ y, μ ((fun x => (x, y)) ⁻¹' s) ∂ν := by
rw [← prod_swap, map_apply measurable_swap hs, prod_apply (measurable_swap hs)]
rfl
theorem ae_ae_comm {p : α → β → Prop} (h : MeasurableSet {x : α × β | p x.1 x.2}) :
(∀ᵐ x ∂μ, ∀ᵐ y ∂ν, p x y) ↔ ∀ᵐ y ∂ν, ∀ᵐ x ∂μ, p x y := calc
_ ↔ ∀ᵐ x ∂μ.prod ν, p x.1 x.2 := .symm <| ae_prod_iff_ae_ae h
_ ↔ ∀ᵐ x ∂ν.prod μ, p x.2 x.1 := by rw [← prod_swap, ae_map_iff (by fun_prop) h]; simp
_ ↔ ∀ᵐ y ∂ν, ∀ᵐ x ∂μ, p x y := ae_prod_iff_ae_ae <| measurable_swap h
/-- If `s ×ˢ t` is a null measurable set and `ν t ≠ 0`, then `s` is a null measurable set. -/
lemma _root_.MeasureTheory.NullMeasurableSet.left_of_prod {s : Set α} {t : Set β}
(h : NullMeasurableSet (s ×ˢ t) (μ.prod ν)) (ht : ν t ≠ 0) : NullMeasurableSet s μ := by
refine .right_of_prod ?_ ht
rw [← preimage_swap_prod]
exact h.preimage measurePreserving_swap.quasiMeasurePreserving
/-- If `Prod.fst ⁻¹' s` is a null measurable set and `ν ≠ 0`, then `s` is a null measurable set. -/
lemma _root_.MeasureTheory.NullMeasurableSet.of_preimage_fst [NeZero ν] {s : Set α}
(h : NullMeasurableSet (Prod.fst ⁻¹' s) (μ.prod ν)) : NullMeasurableSet s μ :=
.left_of_prod (by rwa [prod_univ]) (NeZero.ne (ν univ))
/-- `Prod.fst ⁻¹' s` is null measurable w.r.t. `μ.prod ν` iff `s` is null measurable w.r.t. `μ`
provided that `ν ≠ 0`. -/
lemma nullMeasurableSet_preimage_fst [NeZero ν] {s : Set α} :
NullMeasurableSet (Prod.fst ⁻¹' s) (μ.prod ν) ↔ NullMeasurableSet s μ :=
⟨.of_preimage_fst, (.preimage · quasiMeasurePreserving_fst)⟩
lemma nullMeasurable_comp_fst [NeZero ν] {f : α → γ} :
NullMeasurable (f ∘ Prod.fst) (μ.prod ν) ↔ NullMeasurable f μ :=
forall₂_congr fun s _ ↦ nullMeasurableSet_preimage_fst (s := f ⁻¹' s)
/-- The product of two non-null sets is null measurable
if and only if both of them are null measurable. -/
lemma nullMeasurableSet_prod_of_ne_zero {s : Set α} {t : Set β} (hs : μ s ≠ 0) (ht : ν t ≠ 0) :
NullMeasurableSet (s ×ˢ t) (μ.prod ν) ↔ NullMeasurableSet s μ ∧ NullMeasurableSet t ν :=
⟨fun h ↦ ⟨h.left_of_prod ht, h.right_of_prod hs⟩, fun ⟨hs, ht⟩ ↦ hs.prod ht⟩
/-- The product of two sets is null measurable
if and only if both of them are null measurable or one of them has measure zero. -/
lemma nullMeasurableSet_prod {s : Set α} {t : Set β} :
NullMeasurableSet (s ×ˢ t) (μ.prod ν) ↔
NullMeasurableSet s μ ∧ NullMeasurableSet t ν ∨ μ s = 0 ∨ ν t = 0 := by
rcases eq_or_ne (μ s) 0 with hs | hs; · simp [NullMeasurableSet.of_null, *]
rcases eq_or_ne (ν t) 0 with ht | ht; · simp [NullMeasurableSet.of_null, *]
simp [*, nullMeasurableSet_prod_of_ne_zero]
theorem prodAssoc_prod [SFinite τ] :
map MeasurableEquiv.prodAssoc ((μ.prod ν).prod τ) = μ.prod (ν.prod τ) := by
have : sum (fun (p : ℕ × ℕ × ℕ) ↦
(sfiniteSeq μ p.1).prod ((sfiniteSeq ν p.2.1).prod (sfiniteSeq τ p.2.2)))
= sum (fun (p : (ℕ × ℕ) × ℕ) ↦
(sfiniteSeq μ p.1.1).prod ((sfiniteSeq ν p.1.2).prod (sfiniteSeq τ p.2))) := by
ext s hs
rw [sum_apply _ hs, sum_apply _ hs, ← (Equiv.prodAssoc _ _ _).tsum_eq]
simp only [Equiv.prodAssoc_apply]
rw [← sum_sfiniteSeq μ, ← sum_sfiniteSeq ν, ← sum_sfiniteSeq τ, prod_sum, prod_sum,
map_sum MeasurableEquiv.prodAssoc.measurable.aemeasurable, prod_sum, prod_sum, this]
congr
ext1 i
refine (prod_eq_generateFrom generateFrom_measurableSet generateFrom_prod
isPiSystem_measurableSet isPiSystem_prod ((sfiniteSeq μ i.1.1)).toFiniteSpanningSetsIn
((sfiniteSeq ν i.1.2).toFiniteSpanningSetsIn.prod (sfiniteSeq τ i.2).toFiniteSpanningSetsIn)
?_).symm
rintro s hs _ ⟨t, ht, u, hu, rfl⟩; rw [mem_setOf_eq] at hs ht hu
simp_rw [map_apply (MeasurableEquiv.measurable _) (hs.prod (ht.prod hu)),
MeasurableEquiv.prodAssoc, MeasurableEquiv.coe_mk, Equiv.prod_assoc_preimage, prod_prod,
mul_assoc]
/-! ### The product of specific measures -/
theorem prod_restrict (s : Set α) (t : Set β) :
(μ.restrict s).prod (ν.restrict t) = (μ.prod ν).restrict (s ×ˢ t) := by
rw [← sum_sfiniteSeq μ, ← sum_sfiniteSeq ν, restrict_sum_of_countable, restrict_sum_of_countable,
prod_sum, prod_sum, restrict_sum_of_countable]
congr 1
ext1 i
refine prod_eq fun s' t' hs' ht' => ?_
rw [restrict_apply (hs'.prod ht'), prod_inter_prod, prod_prod, restrict_apply hs',
restrict_apply ht']
theorem restrict_prod_eq_prod_univ (s : Set α) :
(μ.restrict s).prod ν = (μ.prod ν).restrict (s ×ˢ univ) := by
have : ν = ν.restrict Set.univ := Measure.restrict_univ.symm
rw [this, Measure.prod_restrict, ← this]
theorem prod_dirac (y : β) : μ.prod (dirac y) = map (fun x => (x, y)) μ := by
classical
rw [← sum_sfiniteSeq μ, prod_sum_left, map_sum measurable_prodMk_right.aemeasurable]
congr
ext1 i
refine prod_eq fun s t hs ht => ?_
simp_rw [map_apply measurable_prodMk_right (hs.prod ht), mk_preimage_prod_left_eq_if, measure_if,
dirac_apply' _ ht, ← indicator_mul_right _ fun _ => sfiniteSeq μ i s, Pi.one_apply, mul_one]
theorem dirac_prod (x : α) : (dirac x).prod ν = map (Prod.mk x) ν := by
classical
rw [← sum_sfiniteSeq ν, prod_sum_right, map_sum measurable_prodMk_left.aemeasurable]
congr
ext1 i
refine prod_eq fun s t hs ht => ?_
simp_rw [map_apply measurable_prodMk_left (hs.prod ht), mk_preimage_prod_right_eq_if, measure_if,
dirac_apply' _ hs, ← indicator_mul_left _ _ fun _ => sfiniteSeq ν i t, Pi.one_apply, one_mul]
theorem dirac_prod_dirac {x : α} {y : β} : (dirac x).prod (dirac y) = dirac (x, y) := by
rw [prod_dirac, map_dirac measurable_prodMk_right]
theorem prod_add (ν' : Measure β) [SFinite ν'] : μ.prod (ν + ν') = μ.prod ν + μ.prod ν' := by
simp_rw [← sum_sfiniteSeq ν, ← sum_sfiniteSeq ν', sum_add_sum, ← sum_sfiniteSeq μ, prod_sum,
sum_add_sum]
congr
ext1 i
refine prod_eq fun s t _ _ => ?_
simp_rw [add_apply, prod_prod, left_distrib]
theorem add_prod (μ' : Measure α) [SFinite μ'] : (μ + μ').prod ν = μ.prod ν + μ'.prod ν := by
simp_rw [← sum_sfiniteSeq μ, ← sum_sfiniteSeq μ', sum_add_sum, ← sum_sfiniteSeq ν, prod_sum,
sum_add_sum]
congr
ext1 i
refine prod_eq fun s t _ _ => ?_
simp_rw [add_apply, prod_prod, right_distrib]
@[simp]
theorem zero_prod (ν : Measure β) : (0 : Measure α).prod ν = 0 := by
rw [Measure.prod]
exact bind_zero_left _
@[simp]
theorem prod_zero (μ : Measure α) : μ.prod (0 : Measure β) = 0 := by simp [Measure.prod]
theorem map_prod_map {δ} [MeasurableSpace δ] {f : α → β} {g : γ → δ} (μa : Measure α)
(μc : Measure γ) [SFinite μa] [SFinite μc] (hf : Measurable f) (hg : Measurable g) :
(map f μa).prod (map g μc) = map (Prod.map f g) (μa.prod μc) := by
simp_rw [← sum_sfiniteSeq μa, ← sum_sfiniteSeq μc, map_sum hf.aemeasurable,
map_sum hg.aemeasurable, prod_sum, map_sum (hf.prodMap hg).aemeasurable]
congr
ext1 i
refine prod_eq fun s t hs ht => ?_
rw [map_apply (hf.prodMap hg) (hs.prod ht), map_apply hf hs, map_apply hg ht]
exact prod_prod (f ⁻¹' s) (g ⁻¹' t)
-- `prod_smul_right` needs an instance to get `SFinite (c • ν)` from `SFinite ν`,
-- hence it is placed in the `WithDensity` file, where the instance is defined.
lemma prod_smul_left {μ : Measure α} (c : ℝ≥0∞) : (c • μ).prod ν = c • (μ.prod ν) := by
ext s hs
rw [Measure.prod_apply hs, Measure.smul_apply, Measure.prod_apply hs]
simp
end Measure
open Measure
namespace MeasurePreserving
variable {δ : Type*} [MeasurableSpace δ] {μa : Measure α} {μb : Measure β} {μc : Measure γ}
{μd : Measure δ}
/-- Let `f : α → β` be a measure-preserving map.
For a.e. all `a`, let `g a : γ → δ` be a measure-preserving map.
Also suppose that `g` is measurable as a function of two arguments.
Then the map `fun (a, c) ↦ (f a, g a c)` is a measure-preserving map
for the product measures on `α × γ` and `β × δ`.
Some authors call a map of the form `fun (a, c) ↦ (f a, g a c)` a *skew product* over `f`,
thus the choice of a name.
-/
theorem skew_product [SFinite μa] [SFinite μc] {f : α → β} (hf : MeasurePreserving f μa μb)
{g : α → γ → δ} (hgm : Measurable (uncurry g)) (hg : ∀ᵐ a ∂μa, map (g a) μc = μd) :
MeasurePreserving (fun p : α × γ => (f p.1, g p.1 p.2)) (μa.prod μc) (μb.prod μd) := by
have : Measurable fun p : α × γ => (f p.1, g p.1 p.2) := (hf.1.comp measurable_fst).prodMk hgm
use this
/- if `μa = 0`, then the lemma is trivial, otherwise we can use `hg`
to deduce `SFinite μd`. -/
rcases eq_zero_or_neZero μa with rfl | _
· simp [← hf.map_eq]
have sf : SFinite μd := by
obtain ⟨a, ha⟩ : ∃ a, map (g a) μc = μd := hg.exists
rw [← ha]
infer_instance
-- Thus we can use the integral formula for the product measure, and compute things explicitly
ext s hs
rw [map_apply this hs, prod_apply (this hs), prod_apply hs,
← hf.lintegral_comp (measurable_measure_prodMk_left hs)]
apply lintegral_congr_ae
filter_upwards [hg] with a ha
rw [← ha, map_apply hgm.of_uncurry_left (measurable_prodMk_left hs), preimage_preimage,
preimage_preimage]
/-- If `f : α → β` sends the measure `μa` to `μb` and `g : γ → δ` sends the measure `μc` to `μd`,
then `Prod.map f g` sends `μa.prod μc` to `μb.prod μd`. -/
protected theorem prod [SFinite μa] [SFinite μc] {f : α → β} {g : γ → δ}
(hf : MeasurePreserving f μa μb) (hg : MeasurePreserving g μc μd) :
MeasurePreserving (Prod.map f g) (μa.prod μc) (μb.prod μd) :=
have : Measurable (uncurry fun _ : α => g) := hg.1.comp measurable_snd
hf.skew_product this <| ae_of_all _ fun _ => hg.map_eq
end MeasurePreserving
namespace QuasiMeasurePreserving
theorem prod_of_right {f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ}
(hf : Measurable f) [SFinite ν]
(h2f : ∀ᵐ x ∂μ, QuasiMeasurePreserving (fun y => f (x, y)) ν τ) :
QuasiMeasurePreserving f (μ.prod ν) τ := by
refine ⟨hf, ?_⟩
refine AbsolutelyContinuous.mk fun s hs h2s => ?_
rw [map_apply hf hs, prod_apply (hf hs)]; simp_rw [preimage_preimage]
rw [lintegral_congr_ae (h2f.mono fun x hx => hx.preimage_null h2s), lintegral_zero]
theorem prod_of_left {α β γ} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ]
{f : α × β → γ} {μ : Measure α} {ν : Measure β} {τ : Measure γ} (hf : Measurable f)
[SFinite μ] [SFinite ν]
(h2f : ∀ᵐ y ∂ν, QuasiMeasurePreserving (fun x => f (x, y)) μ τ) :
QuasiMeasurePreserving f (μ.prod ν) τ := by
rw [← prod_swap]
convert (QuasiMeasurePreserving.prod_of_right (hf.comp measurable_swap) h2f).comp
((measurable_swap.measurePreserving (ν.prod μ)).symm
MeasurableEquiv.prodComm).quasiMeasurePreserving
@[fun_prop]
protected theorem fst {f : α → β × γ} (hf : QuasiMeasurePreserving f μ (ν.prod τ)) :
QuasiMeasurePreserving (fun x ↦ (f x).1) μ ν :=
(quasiMeasurePreserving_fst (μ := ν) (ν := τ)).comp hf
@[fun_prop]
protected theorem snd {f : α → β × γ} (hf : QuasiMeasurePreserving f μ (ν.prod τ)) :
QuasiMeasurePreserving (fun x ↦ (f x).2) μ τ :=
(quasiMeasurePreserving_snd (μ := ν) (ν := τ)).comp hf
@[fun_prop]
protected theorem prodMap {ω : Type*} {mω : MeasurableSpace ω} {υ : Measure ω}
[SFinite μ] [SFinite τ] [SFinite υ] {f : α → β} {g : γ → ω}
(hf : QuasiMeasurePreserving f μ ν) (hg : QuasiMeasurePreserving g τ υ) :
QuasiMeasurePreserving (Prod.map f g) (μ.prod τ) (ν.prod υ) := by
refine ⟨by fun_prop, ?_⟩
rw [← map_prod_map _ _ (by fun_prop) (by fun_prop)]
exact hf.absolutelyContinuous.prod hg.absolutelyContinuous
end QuasiMeasurePreserving
end MeasureTheory
open MeasureTheory.Measure
section
theorem AEMeasurable.prod_swap [SFinite μ] [SFinite ν] {f : β × α → γ}
(hf : AEMeasurable f (ν.prod μ)) : AEMeasurable (fun z : α × β => f z.swap) (μ.prod ν) := by
rw [← Measure.prod_swap] at hf
exact hf.comp_measurable measurable_swap
theorem MeasureTheory.NullMeasurable.comp_fst {f : α → γ} (hf : NullMeasurable f μ) :
NullMeasurable (fun z : α × β => f z.1) (μ.prod ν) :=
hf.comp_quasiMeasurePreserving quasiMeasurePreserving_fst
theorem AEMeasurable.comp_fst {f : α → γ} (hf : AEMeasurable f μ) :
AEMeasurable (fun z : α × β => f z.1) (μ.prod ν) :=
hf.comp_quasiMeasurePreserving quasiMeasurePreserving_fst
theorem MeasureTheory.NullMeasurable.comp_snd {f : β → γ} (hf : NullMeasurable f ν) :
NullMeasurable (fun z : α × β => f z.2) (μ.prod ν) :=
hf.comp_quasiMeasurePreserving quasiMeasurePreserving_snd
theorem AEMeasurable.comp_snd {f : β → γ} (hf : AEMeasurable f ν) :
AEMeasurable (fun z : α × β => f z.2) (μ.prod ν) :=
hf.comp_quasiMeasurePreserving quasiMeasurePreserving_snd
@[fun_prop, measurability]
theorem AEMeasurable.lintegral_prod_right' [SFinite ν] {f : α × β → ℝ≥0∞}
(hf : AEMeasurable f (μ.prod ν)) : AEMeasurable (fun x ↦ ∫⁻ y, f (x, y) ∂ν) μ := by
obtain ⟨g, hg, hfg⟩ := hf
refine ⟨fun x ↦ ∫⁻ y, g (x, y) ∂ν, by fun_prop, ?_⟩
exact (ae_ae_of_ae_prod hfg).mono fun x hfg' ↦ lintegral_congr_ae hfg'
@[fun_prop, measurability]
theorem AEMeasurable.lintegral_prod_right [SFinite ν] {f : α → β → ℝ≥0∞}
(hf : AEMeasurable f.uncurry (μ.prod ν)) : AEMeasurable (fun x ↦ ∫⁻ y, f x y ∂ν) μ :=
hf.lintegral_prod_right'
@[fun_prop, measurability]
theorem AEMeasurable.lintegral_prod_left' [SFinite ν] [SFinite μ] {f : α × β → ℝ≥0∞}
(hf : AEMeasurable f (μ.prod ν)) : AEMeasurable (fun y ↦ ∫⁻ x, f (x, y) ∂μ) ν :=
hf.prod_swap.lintegral_prod_right'
@[fun_prop, measurability]
theorem AEMeasurable.lintegral_prod_left [SFinite ν] [SFinite μ] {f : α → β → ℝ≥0∞}
(hf : AEMeasurable f.uncurry (μ.prod ν)) : AEMeasurable (fun y ↦ ∫⁻ x, f x y ∂μ) ν :=
hf.lintegral_prod_left'
end
namespace MeasureTheory
/-! ### The Lebesgue integral on a product -/
variable [SFinite ν]
theorem lintegral_prod_swap [SFinite μ] (f : α × β → ℝ≥0∞) :
∫⁻ z, f z.swap ∂ν.prod μ = ∫⁻ z, f z ∂μ.prod ν :=
measurePreserving_swap.lintegral_comp_emb MeasurableEquiv.prodComm.measurableEmbedding f
/-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued almost everywhere measurable functions on `α × β`,
the integral of `f` is equal to the iterated integral. -/
theorem lintegral_prod (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
∫⁻ z, f z ∂μ.prod ν = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ := by
rw [Measure.prod] at *
rw [lintegral_bind Measurable.map_prodMk_left.aemeasurable hf]
apply lintegral_congr_ae
filter_upwards [Measurable.map_prodMk_left.aemeasurable.ae_of_bind hf] with a ha
exact lintegral_map' ha (by fun_prop)
omit [SFinite ν] in
theorem lintegral_prod_le (f : α × β → ℝ≥0∞) :
∫⁻ z, f z ∂μ.prod ν ≤ ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ := by
rw [Measure.prod]
exact (lintegral_bind_le _ _ _).trans <| lintegral_mono fun a ↦ lintegral_map_le _ _
/-- **Tonelli's Theorem for set integrals**: For `ℝ≥0∞`-valued almost everywhere measurable
functions on `s ×ˢ t`, the integral of `f` on `s ×ˢ t` is equal to the iterated integral on `s`
and `t` respectively. -/
theorem setLIntegral_prod [SFinite μ] {s : Set α} {t : Set β} (f : α × β → ℝ≥0∞)
(hf : AEMeasurable f ((μ.prod ν).restrict (s ×ˢ t))) :
∫⁻ z in s ×ˢ t, f z ∂μ.prod ν = ∫⁻ x in s, ∫⁻ y in t, f (x, y) ∂ν ∂μ := by
rw [← Measure.prod_restrict, lintegral_prod _ (by rwa [Measure.prod_restrict])]
/-- The symmetric version of Tonelli's Theorem: For `ℝ≥0∞`-valued almost everywhere measurable
functions on `α × β`, the integral of `f` is equal to the iterated integral, in reverse order. -/
theorem lintegral_prod_symm [SFinite μ] (f : α × β → ℝ≥0∞) (hf : AEMeasurable f (μ.prod ν)) :
∫⁻ z, f z ∂μ.prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν := by
simp_rw [← lintegral_prod_swap f]
exact lintegral_prod _ hf.prod_swap
/-- The symmetric version of Tonelli's Theorem: For `ℝ≥0∞`-valued measurable
functions on `α × β`, the integral of `f` is equal to the iterated integral, in reverse order. -/
theorem lintegral_prod_symm' [SFinite μ] (f : α × β → ℝ≥0∞) (hf : Measurable f) :
∫⁻ z, f z ∂μ.prod ν = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
lintegral_prod_symm f hf.aemeasurable
/-- The symmetric version of Tonelli's Theorem for set integrals: For `ℝ≥0∞`-valued almost
everywhere measurable functions on `s ×ˢ t`, the integral of `f` on `s ×ˢ t` is equal to the
iterated integral on `t` and `s` respectively. -/
theorem setLIntegral_prod_symm [SFinite μ] {s : Set α} {t : Set β} (f : α × β → ℝ≥0∞)
(hf : AEMeasurable f ((μ.prod ν).restrict (s ×ˢ t))) :
∫⁻ z in s ×ˢ t, f z ∂μ.prod ν = ∫⁻ y in t, ∫⁻ x in s, f (x, y) ∂μ ∂ν := by
rw [← Measure.prod_restrict, ← lintegral_prod_swap, Measure.prod_restrict,
setLIntegral_prod]
· rfl
· refine AEMeasurable.comp_measurable ?_ measurable_swap
convert hf
rw [← Measure.prod_restrict, Measure.prod_swap, Measure.prod_restrict]
/-- The reversed version of **Tonelli's Theorem**. In this version `f` is in curried form, which
makes it easier for the elaborator to figure out `f` automatically. -/
theorem lintegral_lintegral ⦃f : α → β → ℝ≥0∞⦄ (hf : AEMeasurable (uncurry f) (μ.prod ν)) :
∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ z, f z.1 z.2 ∂μ.prod ν :=
(lintegral_prod _ hf).symm
/-- The reversed version of **Tonelli's Theorem** (symmetric version). In this version `f` is in
curried form, which makes it easier for the elaborator to figure out `f` automatically. -/
theorem lintegral_lintegral_symm [SFinite μ] ⦃f : α → β → ℝ≥0∞⦄
(hf : AEMeasurable (uncurry f) (μ.prod ν)) :
∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ z, f z.2 z.1 ∂ν.prod μ :=
(lintegral_prod_symm _ hf.prod_swap).symm
/-- Change the order of Lebesgue integration. -/
theorem lintegral_lintegral_swap [SFinite μ] ⦃f : α → β → ℝ≥0∞⦄
(hf : AEMeasurable (uncurry f) (μ.prod ν)) :
∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ y, ∫⁻ x, f x y ∂μ ∂ν :=
(lintegral_lintegral hf).trans (lintegral_prod_symm _ hf)
theorem lintegral_prod_mul {f : α → ℝ≥0∞} {g : β → ℝ≥0∞} (hf : AEMeasurable f μ)
(hg : AEMeasurable g ν) : ∫⁻ z, f z.1 * g z.2 ∂μ.prod ν = (∫⁻ x, f x ∂μ) * ∫⁻ y, g y ∂ν := by
rw [lintegral_prod _ (by fun_prop)]
simp [lintegral_lintegral_mul hf hg]
/-! ### Marginals of a measure defined on a product -/
namespace Measure
variable {ρ : Measure (α × β)}
/-- Marginal measure on `α` obtained from a measure `ρ` on `α × β`, defined by `ρ.map Prod.fst`. -/
noncomputable def fst (ρ : Measure (α × β)) : Measure α :=
ρ.map Prod.fst
theorem fst_apply {s : Set α} (hs : MeasurableSet s) : ρ.fst s = ρ (Prod.fst ⁻¹' s) := by
rw [fst, Measure.map_apply measurable_fst hs]
theorem fst_univ : ρ.fst univ = ρ univ := by rw [fst_apply MeasurableSet.univ, preimage_univ]
@[simp] theorem fst_zero : fst (0 : Measure (α × β)) = 0 := by simp [fst]
instance [SFinite ρ] : SFinite ρ.fst := by
rw [fst]
infer_instance
instance fst.instIsFiniteMeasure [IsFiniteMeasure ρ] : IsFiniteMeasure ρ.fst := by
rw [fst]
infer_instance
instance fst.instIsProbabilityMeasure [IsProbabilityMeasure ρ] : IsProbabilityMeasure ρ.fst where
measure_univ := by
rw [fst_univ]
exact measure_univ
instance fst.instIsZeroOrProbabilityMeasure [IsZeroOrProbabilityMeasure ρ] :
IsZeroOrProbabilityMeasure ρ.fst := by
rcases eq_zero_or_isProbabilityMeasure ρ with h | h
· simp only [h, fst_zero]
infer_instance
· infer_instance
@[simp]
lemma fst_prod [IsProbabilityMeasure ν] : (μ.prod ν).fst = μ := by
ext1 s hs
rw [fst_apply hs, ← prod_univ, prod_prod, measure_univ, mul_one]
theorem fst_map_prodMk₀ {X : α → β} {Y : α → γ} {μ : Measure α}
(hY : AEMeasurable Y μ) : (μ.map fun a => (X a, Y a)).fst = μ.map X := by
by_cases hX : AEMeasurable X μ
· ext1 s hs
rw [Measure.fst_apply hs, Measure.map_apply_of_aemeasurable (hX.prodMk hY) (measurable_fst hs),
Measure.map_apply_of_aemeasurable hX hs, ← prod_univ, mk_preimage_prod, preimage_univ,
inter_univ]
· have : ¬AEMeasurable (fun x ↦ (X x, Y x)) μ := by
contrapose! hX
exact measurable_fst.comp_aemeasurable hX
simp [map_of_not_aemeasurable, hX, this]
theorem fst_map_prodMk {X : α → β} {Y : α → γ} {μ : Measure α}
(hY : Measurable Y) : (μ.map fun a => (X a, Y a)).fst = μ.map X :=
fst_map_prodMk₀ hY.aemeasurable
@[simp]
lemma fst_add {μ ν : Measure (α × β)} : (μ + ν).fst = μ.fst + ν.fst :=
Measure.map_add _ _ measurable_fst
lemma fst_sum {ι : Type*} (μ : ι → Measure (α × β)) : (sum μ).fst = sum (fun n ↦ (μ n).fst) :=
Measure.map_sum measurable_fst.aemeasurable
@[gcongr]
theorem fst_mono {μ : Measure (α × β)} (h : ρ ≤ μ) : ρ.fst ≤ μ.fst := map_mono h measurable_fst
/-- Marginal measure on `β` obtained from a measure on `ρ` `α × β`, defined by `ρ.map Prod.snd`. -/
noncomputable def snd (ρ : Measure (α × β)) : Measure β :=
ρ.map Prod.snd
theorem snd_apply {s : Set β} (hs : MeasurableSet s) : ρ.snd s = ρ (Prod.snd ⁻¹' s) := by
rw [snd, Measure.map_apply measurable_snd hs]
theorem snd_univ : ρ.snd univ = ρ univ := by rw [snd_apply MeasurableSet.univ, preimage_univ]
@[simp] theorem snd_zero : snd (0 : Measure (α × β)) = 0 := by simp [snd]
instance [SFinite ρ] : SFinite ρ.snd := by
rw [snd]
infer_instance
instance snd.instIsFiniteMeasure [IsFiniteMeasure ρ] : IsFiniteMeasure ρ.snd := by
rw [snd]
infer_instance
instance snd.instIsProbabilityMeasure [IsProbabilityMeasure ρ] : IsProbabilityMeasure ρ.snd where
measure_univ := by
rw [snd_univ]
exact measure_univ
instance snd.instIsZeroOrProbabilityMeasure [IsZeroOrProbabilityMeasure ρ] :
IsZeroOrProbabilityMeasure ρ.snd := by
rcases eq_zero_or_isProbabilityMeasure ρ with h | h
· simp only [h, snd_zero]
infer_instance
· infer_instance
@[simp]
lemma snd_prod [IsProbabilityMeasure μ] : (μ.prod ν).snd = ν := by
ext1 s hs
rw [snd_apply hs, ← univ_prod, prod_prod, measure_univ, one_mul]
theorem snd_map_prodMk₀ {X : α → β} {Y : α → γ} {μ : Measure α} (hX : AEMeasurable X μ) :
(μ.map fun a => (X a, Y a)).snd = μ.map Y := by
by_cases hY : AEMeasurable Y μ
· ext1 s hs
rw [Measure.snd_apply hs, Measure.map_apply_of_aemeasurable (hX.prodMk hY) (measurable_snd hs),
Measure.map_apply_of_aemeasurable hY hs, ← univ_prod, mk_preimage_prod, preimage_univ,
univ_inter]
· have : ¬AEMeasurable (fun x ↦ (X x, Y x)) μ := by
contrapose! hY
exact measurable_snd.comp_aemeasurable hY
simp [map_of_not_aemeasurable, hY, this]
theorem snd_map_prodMk {X : α → β} {Y : α → γ} {μ : Measure α} (hX : Measurable X) :
(μ.map fun a => (X a, Y a)).snd = μ.map Y :=
snd_map_prodMk₀ hX.aemeasurable
@[simp]
lemma snd_add {μ ν : Measure (α × β)} : (μ + ν).snd = μ.snd + ν.snd :=
Measure.map_add _ _ measurable_snd
lemma snd_sum {ι : Type*} (μ : ι → Measure (α × β)) : (sum μ).snd = sum (fun n ↦ (μ n).snd) :=
map_sum measurable_snd.aemeasurable
@[gcongr]
theorem snd_mono {μ : Measure (α × β)} (h : ρ ≤ μ) : ρ.snd ≤ μ.snd := map_mono h measurable_snd
@[simp] lemma fst_map_swap : (ρ.map Prod.swap).fst = ρ.snd := by
rw [Measure.fst, Measure.map_map measurable_fst measurable_swap]
rfl
@[simp] lemma snd_map_swap : (ρ.map Prod.swap).snd = ρ.fst := by
rw [Measure.snd, Measure.map_map measurable_snd measurable_swap]
rfl
end Measure
section MeasurePreserving
-- Note that these results cannot be put in the previous `measurePreserving` section since
-- they use `lintegral_prod`.
/-- The measurable equiv induced by the equiv `(α × β) × γ ≃ α × (β × γ)` is measure preserving. -/
theorem _root_.MeasureTheory.measurePreserving_prodAssoc (μa : Measure α) (μb : Measure β)
(μc : Measure γ) [SFinite μb] [SFinite μc] :
MeasurePreserving (MeasurableEquiv.prodAssoc : (α × β) × γ ≃ᵐ α × β × γ)
((μa.prod μb).prod μc) (μa.prod (μb.prod μc)) where
measurable := MeasurableEquiv.prodAssoc.measurable
map_eq := by
ext s hs
have A (x : α) : MeasurableSet (Prod.mk x ⁻¹' s) := measurable_prodMk_left hs
have B : MeasurableSet (MeasurableEquiv.prodAssoc ⁻¹' s) :=
MeasurableEquiv.prodAssoc.measurable hs
simp_rw [map_apply MeasurableEquiv.prodAssoc.measurable hs, prod_apply hs, prod_apply (A _),
prod_apply B, lintegral_prod _ (measurable_measure_prodMk_left B).aemeasurable]
rfl
theorem _root_.MeasureTheory.volume_preserving_prodAssoc {α₁ β₁ γ₁ : Type*} [MeasureSpace α₁]
[MeasureSpace β₁] [MeasureSpace γ₁] [SFinite (volume : Measure β₁)]
[SFinite (volume : Measure γ₁)] :
MeasurePreserving (MeasurableEquiv.prodAssoc : (α₁ × β₁) × γ₁ ≃ᵐ α₁ × β₁ × γ₁) :=
MeasureTheory.measurePreserving_prodAssoc volume volume volume
end MeasurePreserving
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Tight.lean | import Mathlib.MeasureTheory.Measure.RegularityCompacts
import Mathlib.Topology.Order.Lattice
/-!
# Tight sets of measures
A set of measures is tight if for all `0 < ε`, there exists a compact set `K` such that for all
measures in the set, the complement of `K` has measure at most `ε`.
## Main definitions
* `MeasureTheory.IsTightMeasureSet`: A set of measures `S` is tight if for all `0 < ε`, there exists
a compact set `K` such that for all `μ ∈ S`, `μ Kᶜ ≤ ε`.
The definition uses an equivalent formulation with filters: `⨆ μ ∈ S, μ` tends to `0` along the
filter of cocompact sets.
`isTightMeasureSet_iff_exists_isCompact_measure_compl_le` establishes equivalence between
the two definitions.
## Main statements
* `isTightMeasureSet_singleton_of_innerRegularWRT`: every finite, inner-regular measure is tight.
-/
open Filter Set
open scoped ENNReal NNReal Topology
namespace MeasureTheory
variable {𝓧 𝓨 : Type*} [TopologicalSpace 𝓧] {m𝓧 : MeasurableSpace 𝓧}
{μ ν : Measure 𝓧} {S T : Set (Measure 𝓧)}
/-- A set of measures `S` is tight if for all `0 < ε`, there exists a compact set `K` such that
for all `μ ∈ S`, `μ Kᶜ ≤ ε`.
This is formulated in terms of filters, and proven equivalent to the definition above
in `IsTightMeasureSet_iff_exists_isCompact_measure_compl_le`. -/
def IsTightMeasureSet (S : Set (Measure 𝓧)) : Prop :=
Tendsto (⨆ μ ∈ S, μ) (cocompact 𝓧).smallSets (𝓝 0)
/-- A set of measures `S` is tight if for all `0 < ε`, there exists a compact set `K` such that
for all `μ ∈ S`, `μ Kᶜ ≤ ε`. -/
lemma IsTightMeasureSet_iff_exists_isCompact_measure_compl_le :
IsTightMeasureSet S ↔ ∀ ε, 0 < ε → ∃ K : Set 𝓧, IsCompact K ∧ ∀ μ ∈ S, μ (Kᶜ) ≤ ε := by
simp only [IsTightMeasureSet, ENNReal.tendsto_nhds ENNReal.zero_ne_top, gt_iff_lt, zero_add,
iSup_apply, mem_Icc, tsub_le_iff_right, zero_le, iSup_le_iff, true_and, eventually_smallSets,
mem_cocompact]
refine ⟨fun h ε hε ↦ ?_, fun h ε hε ↦ ?_⟩
· obtain ⟨A, ⟨K, h1, h2⟩, hA⟩ := h ε hε
exact ⟨K, h1, hA Kᶜ h2⟩
· obtain ⟨K, h1, h2⟩ := h ε hε
exact ⟨Kᶜ, ⟨K, h1, subset_rfl⟩, fun A hA μ hμS ↦ (μ.mono hA).trans (h2 μ hμS)⟩
/-- Finite measures that are inner regular with respect to closed compact sets are tight. -/
theorem isTightMeasureSet_singleton_of_innerRegularWRT [OpensMeasurableSpace 𝓧] [IsFiniteMeasure μ]
(h : μ.InnerRegularWRT (fun s ↦ IsCompact s ∧ IsClosed s) MeasurableSet) :
IsTightMeasureSet {μ} := by
rw [IsTightMeasureSet_iff_exists_isCompact_measure_compl_le]
intro ε hε
let r := μ Set.univ
cases lt_or_ge ε r with
| inl hεr =>
have hεr' : r - ε < r := ENNReal.sub_lt_self (measure_ne_top μ _) (zero_le'.trans_lt hεr).ne'
hε.ne'
obtain ⟨K, _, ⟨hK_compact, hK_closed⟩, hKμ⟩ := h .univ (r - ε) hεr'
refine ⟨K, hK_compact, ?_⟩
simp only [mem_singleton_iff, forall_eq]
rw [measure_compl hK_closed.measurableSet (measure_ne_top μ _), tsub_le_iff_right]
rw [ENNReal.sub_lt_iff_lt_right (ne_top_of_lt hεr) hεr.le, add_comm] at hKμ
exact hKμ.le
| inr hεr => exact ⟨∅, isCompact_empty, by simpa⟩
/-- Inner regular finite measures on T2 spaces are tight. -/
lemma isTightMeasureSet_singleton_of_innerRegular [T2Space 𝓧] [OpensMeasurableSpace 𝓧]
[IsFiniteMeasure μ] [h : μ.InnerRegular] :
IsTightMeasureSet {μ} := by
refine isTightMeasureSet_singleton_of_innerRegularWRT ?_
intro s hs r hr
obtain ⟨K, hKs, hK_compact, hμK⟩ := h.innerRegular hs r hr
exact ⟨K, hKs, ⟨hK_compact, hK_compact.isClosed⟩, hμK⟩
/-- In a complete second-countable pseudo-metric space, finite measures are tight. -/
theorem isTightMeasureSet_singleton {α : Type*} {mα : MeasurableSpace α}
[PseudoEMetricSpace α] [CompleteSpace α] [SecondCountableTopology α] [BorelSpace α]
{μ : Measure α} [IsFiniteMeasure μ] :
IsTightMeasureSet {μ} :=
isTightMeasureSet_singleton_of_innerRegularWRT
(innerRegular_isCompact_isClosed_measurableSet_of_finite _)
namespace IsTightMeasureSet
/-- In a compact space, every set of measures is tight. -/
lemma of_compactSpace [CompactSpace 𝓧] : IsTightMeasureSet S := by
simp only [IsTightMeasureSet, cocompact_eq_bot, smallSets_bot, tendsto_pure_left, iSup_apply,
measure_empty, ENNReal.iSup_zero, ciSup_const]
exact fun _ ↦ mem_of_mem_nhds
protected lemma subset (hT : IsTightMeasureSet T) (hST : S ⊆ T) :
IsTightMeasureSet S :=
tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds hT (fun _ ↦ by simp)
(iSup_le_iSup_of_subset hST)
protected lemma union (hS : IsTightMeasureSet S) (hT : IsTightMeasureSet T) :
IsTightMeasureSet (S ∪ T) := by
rw [IsTightMeasureSet, iSup_union]
convert Tendsto.sup_nhds hS hT
simp
protected lemma inter (hS : IsTightMeasureSet S) (T : Set (Measure 𝓧)) :
IsTightMeasureSet (S ∩ T) :=
hS.subset inter_subset_left
lemma map [TopologicalSpace 𝓨] [MeasurableSpace 𝓨] [OpensMeasurableSpace 𝓨] [T2Space 𝓨]
(hS : IsTightMeasureSet S) {f : 𝓧 → 𝓨} (hf : Continuous f) :
IsTightMeasureSet (Measure.map f '' S) := by
rw [IsTightMeasureSet_iff_exists_isCompact_measure_compl_le] at hS ⊢
simp only [mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
intro ε hε
obtain ⟨K, hK_compact, hKS⟩ := hS ε hε
refine ⟨f '' K, hK_compact.image hf, fun μ hμS ↦ ?_⟩
by_cases hf_meas : AEMeasurable f μ
swap; · simp [Measure.map_of_not_aemeasurable hf_meas]
rw [Measure.map_apply_of_aemeasurable hf_meas (hK_compact.image hf).measurableSet.compl]
refine (measure_mono ?_).trans (hKS μ hμS)
simp only [preimage_compl, compl_subset_compl]
exact subset_preimage_image f K
end IsTightMeasureSet
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Portmanteau.lean | import Mathlib.MeasureTheory.Measure.ProbabilityMeasure
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
import Mathlib.MeasureTheory.Integral.Layercake
import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction
/-!
# Characterizations of weak convergence of finite measures and probability measures
This file will provide portmanteau characterizations of the weak convergence of finite measures
and of probability measures, i.e., the standard characterizations of convergence in distribution.
## Main definitions
The topologies of weak convergence on the types of finite measures and probability measures are
already defined in their corresponding files; no substantial new definitions are introduced here.
## Main results
The main result will be the portmanteau theorem providing various characterizations of the
weak convergence of measures (probability measures or finite measures). Given measures μs
and μ on a topological space Ω, the conditions that will be proven equivalent (under quite
general hypotheses) are:
(T) The measures μs tend to the measure μ weakly.
(C) For any closed set F, the limsup of the measures of F under μs is at most
the measure of F under μ, i.e., limsupᵢ μsᵢ(F) ≤ μ(F).
(O) For any open set G, the liminf of the measures of G under μs is at least
the measure of G under μ, i.e., μ(G) ≤ liminfᵢ μsᵢ(G).
(B) For any Borel set B whose boundary carries no mass under μ, i.e. μ(∂B) = 0,
the measures of B under μs tend to the measure of B under μ, i.e., limᵢ μsᵢ(B) = μ(B).
The separate implications are:
* `MeasureTheory.FiniteMeasure.limsup_measure_closed_le_of_tendsto` is the implication (T) → (C).
* `MeasureTheory.limsup_measure_closed_le_iff_liminf_measure_open_ge` is the equivalence (C) ↔ (O).
* `MeasureTheory.tendsto_measure_of_null_frontier` is the implication (O) → (B).
* `MeasureTheory.limsup_measure_closed_le_of_forall_tendsto_measure` is the implication (B) → (C).
* `MeasureTheory.tendsto_of_forall_isOpen_le_liminf` gives the implication (O) → (T) for
any sequence of Borel probability measures.
* `MeasureTheory.tendsto_of_limsup_measure_closed_le` gives the implication (C) → (T).
We also deduce a practical convergence criterion for probability measures, in
`IsPiSystem.tendsto_probabilityMeasure_of_tendsto_of_mem`.
Assume that, applied to all the elements of a π-system, a sequence of probability measures
converges to a limiting probability measure. Assume also that the π-system contains arbitrarily
small neighborhoods of any point. Then the sequence of probability measures converges for the
weak topology.
## Implementation notes
Many of the characterizations of weak convergence hold for finite measures and are proven in that
generality and then specialized to probability measures. Some implications hold with slightly
more general assumptions than in the usual statement of portmanteau theorem. The full portmanteau
theorem, however, is most convenient for probability measures on pseudo-emetrizable spaces with
their Borel sigma algebras.
Some specific considerations on the assumptions in the different implications:
* `MeasureTheory.FiniteMeasure.limsup_measure_closed_le_of_tendsto`, i.e., implication (T) → (C),
assumes that in the underlying topological space, indicator functions of closed sets have
decreasing bounded continuous pointwise approximating sequences. The assumption is in the form
of the type class `HasOuterApproxClosed`. Type class inference knows that for example the more
common assumptions of metrizability or pseudo-emetrizability suffice.
* Where formulations are currently only provided for probability measures, one can obtain the
finite measure formulations using the characterization of convergence of finite measures by
their total masses and their probability-normalized versions, i.e., by
`MeasureTheory.FiniteMeasure.tendsto_normalize_iff_tendsto`.
## References
* [Billingsley, *Convergence of probability measures*][billingsley1999]
## Tags
weak convergence of measures, convergence in distribution, convergence in law, finite measure,
probability measure
-/
noncomputable section
open MeasureTheory Set Filter BoundedContinuousFunction
open scoped Topology ENNReal NNReal BoundedContinuousFunction
namespace MeasureTheory
section LimsupClosedLEAndLELiminfOpen
/-! ### Portmanteau: limsup condition for closed sets iff liminf condition for open sets
In this section we prove that for a sequence of Borel probability measures on a topological space
and its candidate limit measure, the following two conditions are equivalent:
(C) For any closed set F, the limsup of the measures of F under μs is at most
the measure of F under μ, i.e., limsupᵢ μsᵢ(F) ≤ μ(F);
(O) For any open set G, the liminf of the measures of G under μs is at least
the measure of G under μ, i.e., μ(G) ≤ liminfᵢ μsᵢ(G).
Either of these will later be shown to be equivalent to the weak convergence of the sequence
of measures.
-/
variable {Ω : Type*} [MeasurableSpace Ω]
theorem le_measure_compl_liminf_of_limsup_measure_le {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : (L.limsup fun i ↦ μs i E) ≤ μ E) :
μ Eᶜ ≤ L.liminf fun i ↦ μs i Eᶜ := by
rcases L.eq_or_neBot with rfl | hne
· simp only [liminf_bot, le_top]
have meas_Ec : μ Eᶜ = 1 - μ E := by
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top μ E).ne
have meas_i_Ec : ∀ i, μs i Eᶜ = 1 - μs i E := by
intro i
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top (μs i) E).ne
simp_rw [meas_Ec, meas_i_Ec]
rw [show (L.liminf fun i : ι ↦ 1 - μs i E) = L.liminf ((fun x ↦ 1 - x) ∘ fun i : ι ↦ μs i E)
from rfl]
have key := antitone_const_tsub.map_limsup_of_continuousAt (F := L)
(fun i ↦ μs i E) (ENNReal.continuous_sub_left ENNReal.one_ne_top).continuousAt
simpa [← key] using antitone_const_tsub h
theorem le_measure_liminf_of_limsup_measure_compl_le {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : (L.limsup fun i ↦ μs i Eᶜ) ≤ μ Eᶜ) :
μ E ≤ L.liminf fun i ↦ μs i E :=
compl_compl E ▸ le_measure_compl_liminf_of_limsup_measure_le (MeasurableSet.compl E_mble) h
theorem limsup_measure_compl_le_of_le_liminf_measure {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : μ E ≤ L.liminf fun i ↦ μs i E) :
(L.limsup fun i ↦ μs i Eᶜ) ≤ μ Eᶜ := by
rcases L.eq_or_neBot with rfl | hne
· simp only [limsup_bot, bot_le]
have meas_Ec : μ Eᶜ = 1 - μ E := by
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top μ E).ne
have meas_i_Ec : ∀ i, μs i Eᶜ = 1 - μs i E := by
intro i
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top (μs i) E).ne
simp_rw [meas_Ec, meas_i_Ec]
rw [show (L.limsup fun i : ι ↦ 1 - μs i E) = L.limsup ((fun x ↦ 1 - x) ∘ fun i : ι ↦ μs i E)
from rfl]
have key := antitone_const_tsub.map_liminf_of_continuousAt (F := L)
(fun i ↦ μs i E) (ENNReal.continuous_sub_left ENNReal.one_ne_top).continuousAt
simpa [← key] using antitone_const_tsub h
theorem limsup_measure_le_of_le_liminf_measure_compl {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : μ Eᶜ ≤ L.liminf fun i ↦ μs i Eᶜ) :
(L.limsup fun i ↦ μs i E) ≤ μ E :=
compl_compl E ▸ limsup_measure_compl_le_of_le_liminf_measure (MeasurableSet.compl E_mble) h
variable [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
/-- One pair of implications of the portmanteau theorem:
For a sequence of Borel probability measures, the following two are equivalent:
(C) The limsup of the measures of any closed set is at most the measure of the closed set
under a candidate limit measure.
(O) The liminf of the measures of any open set is at least the measure of the open set
under a candidate limit measure.
-/
theorem limsup_measure_closed_le_iff_liminf_measure_open_ge {ι : Type*} {L : Filter ι}
{μ : Measure Ω} {μs : ι → Measure Ω} [IsProbabilityMeasure μ]
[∀ i, IsProbabilityMeasure (μs i)] :
(∀ F, IsClosed F → (L.limsup fun i ↦ μs i F) ≤ μ F) ↔
∀ G, IsOpen G → μ G ≤ L.liminf fun i ↦ μs i G := by
constructor
· intro h G G_open
exact le_measure_liminf_of_limsup_measure_compl_le
G_open.measurableSet (h Gᶜ (isClosed_compl_iff.mpr G_open))
· intro h F F_closed
exact limsup_measure_le_of_le_liminf_measure_compl
F_closed.measurableSet (h Fᶜ (isOpen_compl_iff.mpr F_closed))
end LimsupClosedLEAndLELiminfOpen -- section
section TendstoOfNullFrontier
/-! ### Portmanteau: limit of measures of Borel sets whose boundary carries no mass in the limit
In this section we prove that for a sequence of Borel probability measures on a topological space
and its candidate limit measure, either of the following equivalent conditions:
(C) For any closed set F, the limsup of the measures of F under μs is at most
the measure of F under μ, i.e., limsupᵢ μsᵢ(F) ≤ μ(F);
(O) For any open set G, the liminf of the measures of G under μs is at least
the measure of G under μ, i.e., μ(G) ≤ liminfᵢ μsᵢ(G).
implies that
(B) For any Borel set B whose boundary carries no mass under μ, i.e. μ(∂B) = 0,
the measures of B under μs tend to the measure of B under μ, i.e., limᵢ μsᵢ(B) = μ(B).
-/
variable {Ω : Type*} [MeasurableSpace Ω]
theorem tendsto_measure_of_le_liminf_measure_of_limsup_measure_le {ι : Type*} {L : Filter ι}
{μ : Measure Ω} {μs : ι → Measure Ω} {E₀ E E₁ : Set Ω} (E₀_subset : E₀ ⊆ E) (subset_E₁ : E ⊆ E₁)
(nulldiff : μ (E₁ \ E₀) = 0) (h_E₀ : μ E₀ ≤ L.liminf fun i ↦ μs i E₀)
(h_E₁ : (L.limsup fun i ↦ μs i E₁) ≤ μ E₁) : L.Tendsto (fun i ↦ μs i E) (𝓝 (μ E)) := by
apply tendsto_of_le_liminf_of_limsup_le
· have E₀_ae_eq_E : E₀ =ᵐ[μ] E :=
EventuallyLE.antisymm E₀_subset.eventuallyLE
(subset_E₁.eventuallyLE.trans (ae_le_set.mpr nulldiff))
calc
μ E = μ E₀ := measure_congr E₀_ae_eq_E.symm
_ ≤ L.liminf fun i ↦ μs i E₀ := h_E₀
_ ≤ L.liminf fun i ↦ μs i E :=
liminf_le_liminf (.of_forall fun _ ↦ measure_mono E₀_subset)
· have E_ae_eq_E₁ : E =ᵐ[μ] E₁ :=
EventuallyLE.antisymm subset_E₁.eventuallyLE
((ae_le_set.mpr nulldiff).trans E₀_subset.eventuallyLE)
calc
(L.limsup fun i ↦ μs i E) ≤ L.limsup fun i ↦ μs i E₁ :=
limsup_le_limsup (.of_forall fun _ ↦ measure_mono subset_E₁)
_ ≤ μ E₁ := h_E₁
_ = μ E := measure_congr E_ae_eq_E₁.symm
· infer_param
· infer_param
variable [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
/-- One implication of the portmanteau theorem:
For a sequence of Borel probability measures, if the liminf of the measures of any open set is at
least the measure of the open set under a candidate limit measure, then for any set whose
boundary carries no probability mass under the candidate limit measure, then its measures under the
sequence converge to its measure under the candidate limit measure.
-/
theorem tendsto_measure_of_null_frontier {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)]
(h_opens : ∀ G, IsOpen G → μ G ≤ L.liminf fun i ↦ μs i G) {E : Set Ω}
(E_nullbdry : μ (frontier E) = 0) : L.Tendsto (fun i ↦ μs i E) (𝓝 (μ E)) :=
haveI h_closeds : ∀ F, IsClosed F → (L.limsup fun i ↦ μs i F) ≤ μ F :=
limsup_measure_closed_le_iff_liminf_measure_open_ge.mpr h_opens
tendsto_measure_of_le_liminf_measure_of_limsup_measure_le interior_subset subset_closure
E_nullbdry (h_opens _ isOpen_interior) (h_closeds _ isClosed_closure)
end TendstoOfNullFrontier --section
section ConvergenceImpliesLimsupClosedLE
/-! ### Portmanteau implication: weak convergence implies a limsup condition for closed sets
In this section we prove, under the assumption that the underlying topological space `Ω` is
pseudo-emetrizable, that
(T) The measures μs tend to the measure μ weakly
implies
(C) For any closed set F, the limsup of the measures of F under μs is at most
the measure of F under μ, i.e., limsupᵢ μsᵢ(F) ≤ μ(F).
Combining with a earlier proven implications, we get that (T) implies also both
(O) For any open set G, the liminf of the measures of G under μs is at least
the measure of G under μ, i.e., μ(G) ≤ liminfᵢ μsᵢ(G);
(B) For any Borel set B whose boundary carries no mass under μ, i.e. μ(∂B) = 0,
the measures of B under μs tend to the measure of B under μ, i.e., limᵢ μsᵢ(B) = μ(B).
-/
/-- One implication of the portmanteau theorem:
Weak convergence of finite measures implies that the limsup of the measures of any closed set is
at most the measure of the closed set under the limit measure.
-/
theorem FiniteMeasure.limsup_measure_closed_le_of_tendsto {Ω ι : Type*} {L : Filter ι}
[MeasurableSpace Ω] [TopologicalSpace Ω] [HasOuterApproxClosed Ω]
[OpensMeasurableSpace Ω] {μ : FiniteMeasure Ω}
{μs : ι → FiniteMeasure Ω} (μs_lim : Tendsto μs L (𝓝 μ)) {F : Set Ω} (F_closed : IsClosed F) :
(L.limsup fun i ↦ (μs i : Measure Ω) F) ≤ (μ : Measure Ω) F := by
rcases L.eq_or_neBot with rfl | hne
· simp only [limsup_bot, bot_le]
apply ENNReal.le_of_forall_pos_le_add
intro ε ε_pos _
have ε_pos' := (ENNReal.half_pos (ENNReal.coe_ne_zero.mpr ε_pos.ne.symm)).ne.symm
let fs := F_closed.apprSeq
have key₁ : Tendsto (fun n ↦ ∫⁻ ω, (fs n ω : ℝ≥0∞) ∂μ) atTop (𝓝 ((μ : Measure Ω) F)) :=
HasOuterApproxClosed.tendsto_lintegral_apprSeq F_closed (μ : Measure Ω)
have room₁ : (μ : Measure Ω) F < (μ : Measure Ω) F + ε / 2 :=
ENNReal.lt_add_right (measure_lt_top (μ : Measure Ω) F).ne ε_pos'
obtain ⟨M, hM⟩ := eventually_atTop.mp <| key₁.eventually_lt_const room₁
have key₂ := FiniteMeasure.tendsto_iff_forall_lintegral_tendsto.mp μs_lim (fs M)
have room₂ :
(lintegral (μ : Measure Ω) fun a ↦ fs M a) <
(lintegral (μ : Measure Ω) fun a ↦ fs M a) + ε / 2 :=
ENNReal.lt_add_right (ne_of_lt ((fs M).lintegral_lt_top_of_nnreal _)) ε_pos'
have ev_near := key₂.eventually_le_const room₂
have ev_near' := ev_near.mono
(fun n ↦ le_trans (HasOuterApproxClosed.measure_le_lintegral F_closed (μs n) M))
apply (Filter.limsup_le_limsup ev_near').trans
rw [limsup_const]
apply le_trans (add_le_add (hM M rfl.le).le (le_refl (ε / 2 : ℝ≥0∞)))
simp only [add_assoc, ENNReal.add_halves, le_refl]
/-- One implication of the portmanteau theorem:
Weak convergence of probability measures implies that the limsup of the measures of any closed
set is at most the measure of the closed set under the limit probability measure.
-/
theorem ProbabilityMeasure.limsup_measure_closed_le_of_tendsto {Ω ι : Type*} {L : Filter ι}
[MeasurableSpace Ω] [TopologicalSpace Ω] [OpensMeasurableSpace Ω] [HasOuterApproxClosed Ω]
{μ : ProbabilityMeasure Ω} {μs : ι → ProbabilityMeasure Ω} (μs_lim : Tendsto μs L (𝓝 μ))
{F : Set Ω} (F_closed : IsClosed F) :
(L.limsup fun i ↦ (μs i : Measure Ω) F) ≤ (μ : Measure Ω) F := by
apply FiniteMeasure.limsup_measure_closed_le_of_tendsto
((tendsto_nhds_iff_toFiniteMeasure_tendsto_nhds L).mp μs_lim) F_closed
/-- One implication of the portmanteau theorem:
Weak convergence of probability measures implies that the liminf of the measures of any open set
is at least the measure of the open set under the limit probability measure.
-/
theorem ProbabilityMeasure.le_liminf_measure_open_of_tendsto {Ω ι : Type*} {L : Filter ι}
[MeasurableSpace Ω] [TopologicalSpace Ω] [OpensMeasurableSpace Ω] [HasOuterApproxClosed Ω]
{μ : ProbabilityMeasure Ω} {μs : ι → ProbabilityMeasure Ω} (μs_lim : Tendsto μs L (𝓝 μ))
{G : Set Ω} (G_open : IsOpen G) :
(μ : Measure Ω) G ≤ L.liminf fun i ↦ (μs i : Measure Ω) G :=
haveI h_closeds : ∀ F, IsClosed F → (L.limsup fun i ↦ (μs i : Measure Ω) F) ≤ (μ : Measure Ω) F :=
fun _ F_closed ↦ limsup_measure_closed_le_of_tendsto μs_lim F_closed
le_measure_liminf_of_limsup_measure_compl_le G_open.measurableSet
(h_closeds _ (isClosed_compl_iff.mpr G_open))
theorem ProbabilityMeasure.tendsto_measure_of_null_frontier_of_tendsto' {Ω ι : Type*}
{L : Filter ι} [MeasurableSpace Ω] [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
[HasOuterApproxClosed Ω] {μ : ProbabilityMeasure Ω} {μs : ι → ProbabilityMeasure Ω}
(μs_lim : Tendsto μs L (𝓝 μ)) {E : Set Ω} (E_nullbdry : (μ : Measure Ω) (frontier E) = 0) :
Tendsto (fun i ↦ (μs i : Measure Ω) E) L (𝓝 ((μ : Measure Ω) E)) :=
haveI h_opens : ∀ G, IsOpen G → (μ : Measure Ω) G ≤ L.liminf fun i ↦ (μs i : Measure Ω) G :=
fun _ G_open ↦ le_liminf_measure_open_of_tendsto μs_lim G_open
tendsto_measure_of_null_frontier h_opens E_nullbdry
/-- One implication of the portmanteau theorem:
Weak convergence of probability measures implies that if the boundary of a Borel set
carries no probability mass under the limit measure, then the limit of the measures of the set
equals the measure of the set under the limit probability measure.
A version with coercions to ordinary `ℝ≥0∞`-valued measures is
`MeasureTheory.ProbabilityMeasure.tendsto_measure_of_null_frontier_of_tendsto'`.
-/
theorem ProbabilityMeasure.tendsto_measure_of_null_frontier_of_tendsto {Ω ι : Type*} {L : Filter ι}
[MeasurableSpace Ω] [TopologicalSpace Ω] [OpensMeasurableSpace Ω] [HasOuterApproxClosed Ω]
{μ : ProbabilityMeasure Ω} {μs : ι → ProbabilityMeasure Ω} (μs_lim : Tendsto μs L (𝓝 μ))
{E : Set Ω} (E_nullbdry : μ (frontier E) = 0) : Tendsto (fun i ↦ μs i E) L (𝓝 (μ E)) := by
have key := tendsto_measure_of_null_frontier_of_tendsto' μs_lim (by simpa using E_nullbdry)
exact (ENNReal.tendsto_toNNReal (measure_ne_top (↑μ) E)).comp key
/-- One implication of the portmanteau theorem:
Weak convergence of probability measures implies that if a set is clopen, then the limit of the
measures of the set equals the measure of the set under the limit probability measure.
-/
theorem ProbabilityMeasure.tendsto_measure_of_isClopen_of_tendsto {Ω ι : Type*} {L : Filter ι}
[MeasurableSpace Ω] [TopologicalSpace Ω] [OpensMeasurableSpace Ω] [HasOuterApproxClosed Ω]
{μ : ProbabilityMeasure Ω} {μs : ι → ProbabilityMeasure Ω} (μs_lim : Tendsto μs L (𝓝 μ))
{E : Set Ω} (hE : IsClopen E) : Tendsto (fun i ↦ μs i E) L (𝓝 (μ E)) :=
ProbabilityMeasure.tendsto_measure_of_null_frontier_of_tendsto μs_lim (by simp [hE])
end ConvergenceImpliesLimsupClosedLE --section
section LimitBorelImpliesLimsupClosedLE
/-! ### Portmanteau implication: limit condition for Borel sets implies limsup for closed sets
In this section we prove, under the assumption that the underlying topological space `Ω` is
pseudo-emetrizable, that
(B) For any Borel set B whose boundary carries no mass under μ, i.e. μ(∂B) = 0,
the measures of B under μs tend to the measure of B under μ, i.e., limᵢ μsᵢ(B) = μ(B)
implies
(C) For any closed set F, the limsup of the measures of F under μs is at most
the measure of F under μ, i.e., limsupᵢ μsᵢ(F) ≤ μ(F).
Combining with a earlier proven implications, we get that (B) implies also
(O) For any open set G, the liminf of the measures of G under μs is at least
the measure of G under μ, i.e., μ(G) ≤ liminfᵢ μsᵢ(G).
-/
open ENNReal
section PseudoMetricSpace
variable {Ω : Type*} [PseudoMetricSpace Ω] [MeasurableSpace Ω] [OpensMeasurableSpace Ω]
theorem exists_null_frontier_thickening (μ : Measure Ω) [SFinite μ] (s : Set Ω) {a b : ℝ}
(hab : a < b) : ∃ r ∈ Ioo a b, μ (frontier (Metric.thickening r s)) = 0 := by
have mbles : ∀ r : ℝ, MeasurableSet (frontier (Metric.thickening r s)) :=
fun r ↦ isClosed_frontier.measurableSet
have disjs := Metric.frontier_thickening_disjoint s
have key := Measure.countable_meas_pos_of_disjoint_iUnion (μ := μ) mbles disjs
have aux := measure_diff_null (s := Ioo a b) (Set.Countable.measure_zero key volume)
have len_pos : 0 < ENNReal.ofReal (b - a) := by simp only [hab, ENNReal.ofReal_pos, sub_pos]
rw [← Real.volume_Ioo, ← aux] at len_pos
rcases nonempty_of_measure_ne_zero len_pos.ne.symm with ⟨r, ⟨r_in_Ioo, hr⟩⟩
refine ⟨r, r_in_Ioo, ?_⟩
simpa only [mem_setOf_eq, not_lt, le_zero_iff] using hr
theorem exists_null_frontiers_thickening (μ : Measure Ω) [SFinite μ] (s : Set Ω) :
∃ rs : ℕ → ℝ,
Tendsto rs atTop (𝓝 0) ∧ ∀ n, 0 < rs n ∧ μ (frontier (Metric.thickening (rs n) s)) = 0 := by
rcases exists_seq_strictAnti_tendsto (0 : ℝ) with ⟨Rs, ⟨_, ⟨Rs_pos, Rs_lim⟩⟩⟩
have obs := fun n : ℕ => exists_null_frontier_thickening μ s (Rs_pos n)
refine ⟨fun n : ℕ => (obs n).choose, ⟨?_, ?_⟩⟩
· exact tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds Rs_lim
(fun n ↦ (obs n).choose_spec.1.1.le) fun n ↦ (obs n).choose_spec.1.2.le
· exact fun n ↦ ⟨(obs n).choose_spec.1.1, (obs n).choose_spec.2⟩
end PseudoMetricSpace
open TopologicalSpace
/-- One implication of the portmanteau theorem:
Assuming that for all Borel sets E whose boundary ∂E carries no probability mass under a
candidate limit probability measure μ we have convergence of the measures μsᵢ(E) to μ(E),
then for all closed sets F we have the limsup condition limsup μsᵢ(F) ≤ μ(F). -/
lemma limsup_measure_closed_le_of_forall_tendsto_measure
{Ω ι : Type*} {L : Filter ι} [MeasurableSpace Ω] [TopologicalSpace Ω]
[PseudoMetrizableSpace Ω] [OpensMeasurableSpace Ω]
{μ : Measure Ω} [IsFiniteMeasure μ] {μs : ι → Measure Ω}
(h : ∀ {E : Set Ω}, MeasurableSet E → μ (frontier E) = 0 →
Tendsto (fun i ↦ μs i E) L (𝓝 (μ E)))
(F : Set Ω) (F_closed : IsClosed F) :
L.limsup (fun i ↦ μs i F) ≤ μ F := by
letI : PseudoMetricSpace Ω := TopologicalSpace.pseudoMetrizableSpacePseudoMetric Ω
rcases L.eq_or_neBot with rfl | _
· simp only [limsup_bot, bot_eq_zero', zero_le]
have ex := exists_null_frontiers_thickening μ F
let rs := Classical.choose ex
have rs_lim : Tendsto rs atTop (𝓝 0) := (Classical.choose_spec ex).1
have rs_pos : ∀ n, 0 < rs n := fun n ↦ ((Classical.choose_spec ex).2 n).1
have rs_null : ∀ n, μ (frontier (Metric.thickening (rs n) F)) = 0 :=
fun n ↦ ((Classical.choose_spec ex).2 n).2
have Fthicks_open : ∀ n, IsOpen (Metric.thickening (rs n) F) :=
fun n ↦ Metric.isOpen_thickening
have key := fun (n : ℕ) ↦ h (Fthicks_open n).measurableSet (rs_null n)
apply ENNReal.le_of_forall_pos_le_add
intro ε ε_pos μF_finite
have keyB := tendsto_measure_cthickening_of_isClosed (μ := μ) (s := F)
⟨1, ⟨by simp only [gt_iff_lt, zero_lt_one], measure_ne_top _ _⟩⟩ F_closed
have nhds : Iio (μ F + ε) ∈ 𝓝 (μ F) :=
Iio_mem_nhds <| ENNReal.lt_add_right μF_finite.ne (ENNReal.coe_pos.mpr ε_pos).ne'
specialize rs_lim (keyB nhds)
simp only [mem_map, mem_atTop_sets, ge_iff_le, mem_preimage, mem_Iio] at rs_lim
obtain ⟨m, hm⟩ := rs_lim
have aux : (fun i ↦ (μs i F)) ≤ᶠ[L] (fun i ↦ μs i (Metric.thickening (rs m) F)) :=
.of_forall <| fun i ↦ measure_mono (Metric.self_subset_thickening (rs_pos m) F)
refine (limsup_le_limsup aux).trans ?_
rw [Tendsto.limsup_eq (key m)]
apply (measure_mono (Metric.thickening_subset_cthickening (rs m) F)).trans (hm m rfl.le).le
/-- One implication of the portmanteau theorem:
Assuming that for all Borel sets E whose boundary ∂E carries no probability mass under a
candidate limit probability measure μ we have convergence of the measures μsᵢ(E) to μ(E),
then for all open sets G we have the limsup condition μ(G) ≤ liminf μsᵢ(G). -/
lemma le_liminf_measure_open_of_forall_tendsto_measure
{Ω ι : Type*} {L : Filter ι} [MeasurableSpace Ω] [TopologicalSpace Ω]
[PseudoMetrizableSpace Ω] [OpensMeasurableSpace Ω]
{μ : Measure Ω} [IsProbabilityMeasure μ] {μs : ι → Measure Ω} [∀ i, IsProbabilityMeasure (μs i)]
(h : ∀ {E}, MeasurableSet E → μ (frontier E) = 0 → Tendsto (fun i ↦ μs i E) L (𝓝 (μ E)))
(G : Set Ω) (G_open : IsOpen G) :
μ G ≤ L.liminf (fun i ↦ μs i G) := by
apply le_measure_liminf_of_limsup_measure_compl_le G_open.measurableSet
exact limsup_measure_closed_le_of_forall_tendsto_measure h _ (isClosed_compl_iff.mpr G_open)
end LimitBorelImpliesLimsupClosedLE --section
section le_liminf_open_implies_convergence
/-! ### Portmanteau implication: liminf condition for open sets implies weak convergence
In this section we prove for a sequence (μsₙ)ₙ Borel probability measures that
(O) For any open set G, the liminf of the measures of G under μsₙ is at least
the measure of G under μ, i.e., μ(G) ≤ liminfₙ μsₙ(G).
implies
(T) The measures μsₙ converge weakly to the measure μ.
-/
variable {Ω : Type*} [MeasurableSpace Ω] [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
lemma lintegral_le_liminf_lintegral_of_forall_isOpen_measure_le_liminf_measure
{μ : Measure Ω} {μs : ℕ → Measure Ω} {f : Ω → ℝ} (f_cont : Continuous f) (f_nn : 0 ≤ f)
(h_opens : ∀ G, IsOpen G → μ G ≤ atTop.liminf (fun i ↦ μs i G)) :
∫⁻ x, ENNReal.ofReal (f x) ∂μ ≤ atTop.liminf (fun i ↦ ∫⁻ x, ENNReal.ofReal (f x) ∂(μs i)) := by
simp_rw [lintegral_eq_lintegral_meas_lt _ (Eventually.of_forall f_nn) f_cont.aemeasurable]
calc ∫⁻ (t : ℝ) in Set.Ioi 0, μ {a | t < f a}
≤ ∫⁻ (t : ℝ) in Set.Ioi 0, atTop.liminf (fun i ↦ (μs i) {a | t < f a}) := ?_ -- (i)
_ ≤ atTop.liminf (fun i ↦ ∫⁻ (t : ℝ) in Set.Ioi 0, (μs i) {a | t < f a}) := ?_ -- (ii)
· -- (i)
exact (lintegral_mono (fun t ↦ h_opens _ (continuous_def.mp f_cont _ isOpen_Ioi))).trans
(le_refl _)
· -- (ii)
exact lintegral_liminf_le (fun n ↦ Antitone.measurable (fun s t hst ↦
measure_mono (fun ω hω ↦ lt_of_le_of_lt hst hω)))
lemma integral_le_liminf_integral_of_forall_isOpen_measure_le_liminf_measure
{μ : Measure Ω} {μs : ℕ → Measure Ω} [∀ i, IsProbabilityMeasure (μs i)]
{f : Ω →ᵇ ℝ} (f_nn : 0 ≤ f)
(h_opens : ∀ G, IsOpen G → μ G ≤ atTop.liminf (fun i ↦ μs i G)) :
∫ x, (f x) ∂μ ≤ atTop.liminf (fun i ↦ ∫ x, (f x) ∂(μs i)) := by
have same := lintegral_le_liminf_lintegral_of_forall_isOpen_measure_le_liminf_measure
f.continuous f_nn h_opens
rw [@integral_eq_lintegral_of_nonneg_ae Ω _ μ f (Eventually.of_forall f_nn)
f.continuous.measurable.aestronglyMeasurable]
convert ENNReal.toReal_mono ?_ same
· simp only [fun i ↦ @integral_eq_lintegral_of_nonneg_ae Ω _ (μs i) f (Eventually.of_forall f_nn)
f.continuous.measurable.aestronglyMeasurable]
let g := BoundedContinuousFunction.comp _ Real.lipschitzWith_toNNReal f
have bound : ∀ i, ∫⁻ x, ENNReal.ofReal (f x) ∂(μs i) ≤ nndist 0 g := fun i ↦ by
simpa only [coe_nnreal_ennreal_nndist, measure_univ, mul_one, ge_iff_le] using
BoundedContinuousFunction.lintegral_le_edist_mul (μ := μs i) g
apply ENNReal.liminf_toReal_eq ENNReal.coe_ne_top (Eventually.of_forall bound)
· apply ne_of_lt
have obs := fun (i : ℕ) ↦ @BoundedContinuousFunction.lintegral_nnnorm_le Ω _ _ (μs i) ℝ _ f
simp only [measure_univ, mul_one] at obs
apply lt_of_le_of_lt _ (show (‖f‖₊ : ℝ≥0∞) < ∞ from ENNReal.coe_lt_top)
apply liminf_le_of_le
· refine ⟨0, .of_forall (by simp only [ge_iff_le, zero_le, forall_const])⟩
· intro x hx
obtain ⟨i, hi⟩ := hx.exists
apply le_trans hi
convert obs i with x
have aux := ENNReal.ofReal_eq_coe_nnreal (f_nn x)
simp only [ContinuousMap.toFun_eq_coe, BoundedContinuousFunction.coe_toContinuousMap] at aux
rw [aux]
congr
exact (Real.norm_of_nonneg (f_nn x)).symm
theorem tendsto_of_forall_isOpen_le_liminf_nat' {μ : ProbabilityMeasure Ω}
{μs : ℕ → ProbabilityMeasure Ω}
(h_opens : ∀ G, IsOpen G → (μ : Measure Ω) G ≤ liminf (fun i ↦ (μs i : Measure Ω) G) atTop) :
atTop.Tendsto (fun i ↦ μs i) (𝓝 μ) := by
refine ProbabilityMeasure.tendsto_iff_forall_integral_tendsto.mpr ?_
refine tendsto_integral_of_forall_integral_le_liminf_integral fun f f_nn ↦ ?_
exact integral_le_liminf_integral_of_forall_isOpen_measure_le_liminf_measure f_nn h_opens
/-- One implication of the portmanteau theorem: if for all open sets `G` we have the liminf
condition `μ(G) ≤ liminf μsₙ(G)`, then the measures `μsₙ` converge weakly to the measure `μ`.
Superseded by `tendsto_of_forall_isOpen_le_liminf` which works for all countably
generated filters. -/
theorem tendsto_of_forall_isOpen_le_liminf_nat {μ : ProbabilityMeasure Ω}
{μs : ℕ → ProbabilityMeasure Ω}
(h_opens : ∀ G, IsOpen G → μ G ≤ atTop.liminf (fun i ↦ μs i G)) :
atTop.Tendsto (fun i ↦ μs i) (𝓝 μ) := by
refine tendsto_of_forall_isOpen_le_liminf_nat' fun G G_open ↦ ?_
specialize h_opens G G_open
have aux : ENNReal.ofNNReal (liminf (fun i ↦ μs i G) atTop) =
liminf (ENNReal.ofNNReal ∘ fun i ↦ μs i G) atTop := by
refine Monotone.map_liminf_of_continuousAt (F := atTop) ENNReal.coe_mono (μs · G) ?_ ?_ ?_
· exact ENNReal.continuous_coe.continuousAt
· exact IsBoundedUnder.isCoboundedUnder_ge ⟨1, by simp⟩
· exact ⟨0, by simp⟩
have obs := ENNReal.coe_mono h_opens
simp only [ProbabilityMeasure.ennreal_coeFn_eq_coeFn_toMeasure, aux] at obs
convert obs
simp only [Function.comp_apply, ProbabilityMeasure.ennreal_coeFn_eq_coeFn_toMeasure]
/-- One implication of the portmanteau theorem: if for all open sets `G` we have the liminf
condition `μ(G) ≤ liminf μsₙ(G)`, then the measures `μsₙ` converge weakly to the measure `μ`.
This lemma uses a coercion from `ProbabilityMeasure` to `Measure` in the hypothesis.
See `tendsto_of_forall_isOpen_le_liminf` for the version without coercion. -/
theorem tendsto_of_forall_isOpen_le_liminf' {ι : Type*} {μ : ProbabilityMeasure Ω}
{μs : ι → ProbabilityMeasure Ω} {L : Filter ι} [L.IsCountablyGenerated]
(h_opens : ∀ G, IsOpen G → (μ : Measure Ω) G ≤ L.liminf (fun i ↦ (μs i : Measure Ω) G)) :
L.Tendsto (fun i ↦ μs i) (𝓝 μ) := by
apply Filter.tendsto_of_seq_tendsto fun u hu ↦ ?_
apply tendsto_of_forall_isOpen_le_liminf_nat' fun G hG ↦ ?_
exact (h_opens G hG).trans (liminf_le_liminf_of_le hu)
/-- One implication of the portmanteau theorem: if for all open sets `G` we have the liminf
condition `μ(G) ≤ liminf μsₙ(G)`, then the measures `μsₙ` converge weakly to the measure `μ`.
Formulated here for countably generated filters. -/
theorem tendsto_of_forall_isOpen_le_liminf {ι : Type*} {μ : ProbabilityMeasure Ω}
{μs : ι → ProbabilityMeasure Ω} {L : Filter ι} [L.IsCountablyGenerated]
(h_opens : ∀ G, IsOpen G → μ G ≤ L.liminf (fun i ↦ μs i G)) :
L.Tendsto (fun i ↦ μs i) (𝓝 μ) := by
apply Filter.tendsto_of_seq_tendsto fun u hu ↦ ?_
apply tendsto_of_forall_isOpen_le_liminf_nat fun G hG ↦ (h_opens G hG).trans ?_
change _ ≤ atTop.liminf ((fun i ↦ μs i G) ∘ u)
rw [liminf_comp]
refine liminf_le_liminf_of_le hu (by isBoundedDefault) ?_
exact isBoundedUnder_of ⟨1, by simp⟩ |>.isCoboundedUnder_ge
end le_liminf_open_implies_convergence
section Closed
variable {Ω ι : Type*} {mΩ : MeasurableSpace Ω} [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
{μ : ProbabilityMeasure Ω} {μs : ι → ProbabilityMeasure Ω}
{L : Filter ι} [L.IsCountablyGenerated]
/-- One implication of the portmanteau theorem: if for all closed sets `F` we have the limsup
condition `limsup μsₙ(F) ≤ μ(F)`, then the measures `μsₙ` converge weakly to the measure `μ`.
Formulated here for countably generated filters.
This lemma uses a coercion from `ProbabilityMeasure` to `Measure` in the hypothesis.
See `tendsto_of_forall_isClosed_limsup_le` for the version without coercion. -/
lemma tendsto_of_forall_isClosed_limsup_le'
(h : ∀ F : Set Ω, IsClosed F → limsup (fun i ↦ (μs i : Measure Ω) F) L ≤ (μ : Measure Ω) F) :
Tendsto μs L (𝓝 μ) := by
refine tendsto_of_forall_isOpen_le_liminf' ?_
rwa [← limsup_measure_closed_le_iff_liminf_measure_open_ge]
lemma tendsto_of_forall_isClosed_limsup_le_nat {μs : ℕ → ProbabilityMeasure Ω}
(h : ∀ F : Set Ω, IsClosed F → limsup (fun i ↦ μs i F) atTop ≤ μ F) :
Tendsto μs atTop (𝓝 μ) := by
refine tendsto_of_forall_isClosed_limsup_le' fun F hF_closed ↦ ?_
specialize h F hF_closed
have aux : ENNReal.ofNNReal (limsup (fun i ↦ μs i F) atTop) =
limsup (ENNReal.ofNNReal ∘ fun i ↦ μs i F) atTop :=
Monotone.map_limsup_of_continuousAt (F := atTop) ENNReal.coe_mono (μs · F) (by fun_prop)
⟨1, by simp⟩ ⟨0, by simp⟩
have obs := ENNReal.coe_mono h
simp only [ProbabilityMeasure.ennreal_coeFn_eq_coeFn_toMeasure, aux] at obs
convert obs
simp
/-- One implication of the portmanteau theorem: if for all closed sets `F` we have the limsup
condition `limsup μsₙ(F) ≤ μ(F)`, then the measures `μsₙ` converge weakly to the measure `μ`.
Formulated here for countably generated filters. -/
theorem tendsto_of_forall_isClosed_limsup_le
(h : ∀ F : Set Ω, IsClosed F → limsup (fun i ↦ μs i F) L ≤ μ F) :
Tendsto μs L (𝓝 μ) := by
apply Filter.tendsto_of_seq_tendsto fun u hu ↦ ?_
apply tendsto_of_forall_isClosed_limsup_le_nat fun F hF ↦ le_trans ?_ (h F hF)
exact (limsup_comp (fun i ↦ μs i F) u _).trans_le
(limsup_le_limsup_of_le hu (by isBoundedDefault) ⟨1, by simp⟩)
lemma tendsto_of_forall_isClosed_limsup_real_le' {L : Filter ι} [L.IsCountablyGenerated]
(h : ∀ F : Set Ω, IsClosed F →
limsup (fun i ↦ (μs i : Measure Ω).real F) L ≤ (μ : Measure Ω).real F) :
Tendsto μs L (𝓝 μ) := by
refine tendsto_of_forall_isClosed_limsup_le' fun F hF ↦ ?_
rcases L.eq_or_neBot with rfl | hne
· simp
specialize h F hF
simp only [Measure.real_def] at h
rwa [ENNReal.limsup_toReal_eq (b := 1) (by simp) (.of_forall fun i ↦ prob_le_one),
ENNReal.toReal_le_toReal _ (by finiteness)] at h
refine ne_top_of_le_ne_top (b := 1) (by simp) ?_
refine limsup_le_of_le ?_ (.of_forall fun i ↦ prob_le_one)
exact isCoboundedUnder_le_of_le L (x := 0) (by simp)
end Closed
section Lipschitz
/-- Weak convergence of probability measures is equivalent to the property that the integrals of
every bounded Lipschitz function converge to the integral of the function against
the limit measure. -/
theorem tendsto_iff_forall_lipschitz_integral_tendsto {γ Ω : Type*} {mΩ : MeasurableSpace Ω}
[PseudoEMetricSpace Ω] [OpensMeasurableSpace Ω] {F : Filter γ} [F.IsCountablyGenerated]
{μs : γ → ProbabilityMeasure Ω} {μ : ProbabilityMeasure Ω} :
Tendsto μs F (𝓝 μ) ↔
∀ f : Ω → ℝ, (∃ (C : ℝ), ∀ x y, dist (f x) (f y) ≤ C) → (∃ L, LipschitzWith L f) →
Tendsto (fun i ↦ ∫ ω, f ω ∂(μs i)) F (𝓝 (∫ ω, f ω ∂μ)) := by
constructor
· -- A bounded Lipschitz function is in particular a bounded continuous function, and we already
-- know that weak convergence implies convergence of their integrals
intro h f hf_bounded hf_lip
simp_rw [ProbabilityMeasure.tendsto_iff_forall_integral_tendsto] at h
let f' : BoundedContinuousFunction Ω ℝ :=
{ toFun := f
continuous_toFun := hf_lip.choose_spec.continuous
map_bounded' := hf_bounded }
simpa using h f'
-- To prove the other direction, we prove convergence of the measure of closed sets.
-- We approximate the indicator function of a closed set by bounded Lipschitz functions.
rcases F.eq_or_neBot with rfl | hne
· simp
refine fun h ↦ tendsto_of_forall_isClosed_limsup_real_le' fun s hs ↦ ?_
refine le_of_forall_pos_le_add fun ε ε_pos ↦ ?_
let fs : ℕ → Ω → ℝ := fun n ω ↦ thickenedIndicator (δ := (1 : ℝ) / (n + 1)) (by positivity) s ω
have key₁ : Tendsto (fun n ↦ ∫ ω, fs n ω ∂μ) atTop (𝓝 ((μ : Measure Ω).real s)) :=
tendsto_integral_thickenedIndicator_of_isClosed μ hs (δs := fun n ↦ (1 : ℝ) / (n + 1))
(fun _ ↦ by positivity) tendsto_one_div_add_atTop_nhds_zero_nat
have room₁ : (μ : Measure Ω).real s < (μ : Measure Ω).real s + ε / 2 := by simp [ε_pos]
obtain ⟨M, hM⟩ := eventually_atTop.mp <| key₁.eventually_lt_const room₁
have key₂ : Tendsto (fun i ↦ ∫ ω, fs M ω ∂(μs i)) F (𝓝 (∫ ω, fs M ω ∂μ)) :=
h (fs M) ⟨1, fun x y ↦ ?_⟩
⟨_, lipschitzWith_thickenedIndicator (δ := (1 : ℝ) / (M + 1)) (by positivity) s⟩
swap
· simp only [Real.dist_eq, abs_le]
have h1 x : fs M x ≤ 1 := thickenedIndicator_le_one _ _ _
have h2 x : 0 ≤ fs M x := by simp [fs]
grind
have room₂ : ∫ a, fs M a ∂μ < ∫ a, fs M a ∂μ + ε / 2 := by simp [ε_pos]
have ev_near : ∀ᶠ x in F, (μs x : Measure Ω).real s ≤ ∫ a, fs M a ∂μ + ε / 2 := by
refine (key₂.eventually_le_const room₂).mono fun x hx ↦ le_trans ?_ hx
rw [← integral_indicator_one hs.measurableSet]
refine integral_mono ?_ (integrable_thickenedIndicator _ _) ?_
· exact (integrable_indicator_iff hs.measurableSet).mpr (integrable_const _).integrableOn
· have h : _ ≤ fs M :=
indicator_le_thickenedIndicator (δ := (1 : ℝ) / (M + 1)) (by positivity) s
simpa using h
apply (Filter.limsup_le_of_le ?_ ev_near).trans
· apply (add_le_add (hM M rfl.le).le (le_refl (ε / 2))).trans_eq
ring
· exact isCoboundedUnder_le_of_le F (x := 0) (by simp)
end Lipschitz
section convergenceCriterion
open scoped Finset
variable {Ω ι : Type*} [MeasurableSpace Ω]
/-- Given a π-system, if a sequence of measures converges along all elements of the π-system, then
it also converges along finite unions of elements of the π-system. -/
lemma _root_.IsPiSystem.tendsto_measureReal_biUnion
{S : Set (Set Ω)} (hS : IsPiSystem S) {μ : ι → Measure Ω} {ν : Measure Ω} {l : Filter ι}
{t : Finset (Set Ω)} (ht : ∀ s ∈ t, s ∈ S)
(hmeas : ∀ s ∈ S, MeasurableSet s)
(h : ∀ s ∈ S, Tendsto (fun i ↦ (μ i).real s) l (𝓝 (ν.real s)))
(hν : ∀ s ∈ S, ν s ≠ ∞ := by finiteness)
(hμ : ∀ s ∈ S, ∀ i, μ i s ≠ ∞ := by finiteness) :
Tendsto (fun i ↦ (μ i).real (⋃ s ∈ t, s)) l (𝓝 (ν.real (⋃ s ∈ t, s))) := by
/- This statement is not completely obvious, as `⋃ s ∈ t, s` does not belong to the π-system `S`.
However, thanks to the inclusion-exclusion formula one may express its measure in terms of
measures of elements of `S`, from which the result follows. -/
have A (i) : (μ i).real (⋃ s ∈ t, s) = ∑ u ∈ t.powerset with u.Nonempty,
(-1 : ℝ) ^ (#u + 1) * (μ i).real (⋂ s ∈ u, s) :=
measureReal_biUnion_eq_sum_powerset (fun s hs ↦ hmeas _ (ht _ hs))
(fun s hs ↦ hμ _ (ht _ hs) i)
simp_rw [A, measureReal_biUnion_eq_sum_powerset (fun s hs ↦ hmeas _ (ht _ hs))
(fun s hs ↦ hν _ (ht _ hs))]
refine tendsto_finset_sum _ (fun u hu ↦ ?_)
simp only [Finset.mem_filter, Finset.mem_powerset] at hu
apply Filter.Tendsto.const_mul
rcases eq_empty_or_nonempty (⋂ s ∈ u, s) with h'u | h'u
· simpa [h'u] using tendsto_const_nhds
apply h
exact hS.biInter_mem hu.2 (fun s hs ↦ ht _ (hu.1 hs)) h'u
/-- Given a π-system, if a sequence of probability measures converges along all elements of
the π-system, then it also converges along finite unions of elements of the π-system. -/
lemma _root_.IsPiSystem.tendsto_probabilityMeasure_biUnion
{S : Set (Set Ω)} (hS : IsPiSystem S) {μ : ι → ProbabilityMeasure Ω} {ν : ProbabilityMeasure Ω}
{l : Filter ι} {t : Finset (Set Ω)} (ht : ∀ s ∈ t, s ∈ S) (hmeas : ∀ s ∈ S, MeasurableSet s)
(h : ∀ s ∈ S, Tendsto (fun i ↦ μ i s) l (𝓝 (ν s))) :
Tendsto (fun i ↦ μ i (⋃ s ∈ t, s)) l (𝓝 (ν (⋃ s ∈ t, s))) := by
have : Tendsto (fun i ↦ (μ i : Measure Ω).real (⋃ s ∈ t, s)) l
(𝓝 ((ν : Measure Ω).real (⋃ s ∈ t, s))) := by
apply hS.tendsto_measureReal_biUnion ht hmeas
simpa using h
simpa using this
/-- Consider a set of sets `S` containing arbitrarily small neighborhoods of any point, and a
probability measure. Then any open set can be approximated arbitrarily well in measure from inside
by a finite union of elements of `S`.
This is a technical lemma for `IsPiSystem.tendsto_probabilityMeasure_of_tendsto_of_mem`, which is
why it is formulated for a `ProbabilityMeasure`. If needed, this could be generalized to finite
measures or to general measures.
-/
lemma ProbabilityMeasure.exists_lt_measure_biUnion_of_isOpen
[TopologicalSpace Ω] [SecondCountableTopology Ω]
{S : Set (Set Ω)} (ν : ProbabilityMeasure Ω)
(h : ∀ (u : Set Ω), IsOpen u → ∀ x ∈ u, ∃ s ∈ S, s ∈ 𝓝 x ∧ s ⊆ u)
{G : Set Ω} (hG : IsOpen G) {r : ℝ≥0} (hr : r < ν G) :
∃ T : Finset (Set Ω), (∀ t ∈ T, t ∈ S) ∧ (r < ν (⋃ t ∈ T, t)) ∧ (⋃ t ∈ T, t) ⊆ G := by
classical
obtain ⟨T, TS, T_count, hT⟩ : ∃ T : Set (Set Ω), T ⊆ S ∧ T.Countable ∧ ⋃ t ∈ T, t = G := by
have : ∀ (x : G), ∃ s ∈ S, s ∈ 𝓝 (x : Ω) ∧ s ⊆ G := fun x ↦ h G hG x x.2
choose! s hsS hs_nhds hsG using this
rcases TopologicalSpace.isOpen_iUnion_countable (fun i ↦ interior (s i))
(fun i ↦ isOpen_interior) with ⟨T₀, T₀_count, hT₀⟩
refine ⟨s '' T₀, by grind, T₀_count.image s, ?_⟩
refine Subset.antisymm (by simp; grind) ?_
have : G ⊆ ⋃ i, interior (s i) := by
intro y hy
simpa using ⟨y, hy, mem_interior_iff_mem_nhds.2 (hs_nhds ⟨y, hy⟩)⟩
apply this.trans
rw [← hT₀, biUnion_image]
exact iUnion₂_mono fun i j ↦ interior_subset
have : T.Nonempty := by
contrapose! hr
simp [← hT, hr]
rcases T_count.exists_eq_range this with ⟨f, hf⟩
have G_eq : G = ⋃ n, f n := by simp [← hT, hf]
have : Tendsto (fun i ↦ ν (Accumulate f i)) atTop (𝓝 (ν (⋃ i, f i))) :=
(ENNReal.tendsto_toNNReal_iff (by simp) (by simp)).2 tendsto_measure_iUnion_accumulate
rw [← G_eq] at this
rcases ((tendsto_order.1 this).1 r hr).exists with ⟨n, hn⟩
refine ⟨(Finset.range (n + 1)).image f, by grind, ?_, ?_⟩
· convert hn
simp [accumulate_def]
grind
· simpa [G_eq] using fun i _ ↦ subset_iUnion f i
/-- Assume that, applied to all the elements of a π-system, a sequence of probability measures
converges to a limiting probability measure. Assume also that the π-system contains arbitrarily
small neighborhoods of any point. Then the sequence of probability measures converges for the
weak topology. -/
lemma _root_.IsPiSystem.tendsto_probabilityMeasure_of_tendsto_of_mem
[TopologicalSpace Ω] [SecondCountableTopology Ω] [OpensMeasurableSpace Ω]
{S : Set (Set Ω)} (hS : IsPiSystem S) {μ : ι → ProbabilityMeasure Ω} {ν : ProbabilityMeasure Ω}
{l : Filter ι} [l.IsCountablyGenerated]
(hmeas : ∀ s ∈ S, MeasurableSet s)
(h : ∀ (u : Set Ω), IsOpen u → ∀ x ∈ u, ∃ s ∈ S, s ∈ 𝓝 x ∧ s ⊆ u)
(h' : ∀ s ∈ S, Tendsto (fun i ↦ μ i s) l (𝓝 (ν s))) :
Tendsto μ l (𝓝 ν) := by
/- We apply the portmanteau theorem: it suffices to show that, given an open set `G`
and `r < ν G`, then for large `i` one has `r < μᵢ G`. For this, we approximate `G` from inside by
a finite union `G'` of elements of `S`, still with measure `> r`, by Lemma
`ProbabilityMeasure.exists_lt_measure_biUnion_of_isOpen`. If we have `μᵢ G' → ν G'`,
then we deduce `r < μᵢ G'` for large `i`, and therefore `r < μᵢ G`.
Our assumption does not give directly `μᵢ G' → ν G'`, as `G'` does not belong to the π-system `S`.
However, the inclusion-exclusion formula makes it possible to express `μᵢ G'` and `ν G'` in terms
of the measures of intersections of elements of `S`, for which we have the convergence. It follows
that `μᵢ G' → ν G'` holds, concluding the proof. This second step is already formalized in the
lemma `IsPiSystem.tendsto_probabilityMeasure_biUnion`. -/
rcases l.eq_or_neBot with rfl | hl
· simp
apply tendsto_of_forall_isOpen_le_liminf
intro G hG
refine (le_liminf_iff (isCoboundedUnder_ge_of_le (x := 1) l (by simp)) (by isBoundedDefault)).2
(fun r hr ↦ ?_)
obtain ⟨T, TS, T_meas, TG⟩ :
∃ T : Finset (Set Ω), (∀ t ∈ T, t ∈ S) ∧ (r < ν (⋃ t ∈ T, t)) ∧ (⋃ t ∈ T, t) ⊆ G :=
ν.exists_lt_measure_biUnion_of_isOpen h hG hr
have : Tendsto (fun i ↦ μ i (⋃ t ∈ T, t)) l (𝓝 (ν (⋃ t ∈ T, t))) :=
hS.tendsto_probabilityMeasure_biUnion TS hmeas h'
filter_upwards [(tendsto_order.1 this).1 r T_meas] with i hi
exact hi.trans_le <| ProbabilityMeasure.apply_mono _ TG
end convergenceCriterion
end MeasureTheory --namespace |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/FiniteMeasure.lean | import Mathlib.Analysis.RCLike.Lemmas
import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap
import Mathlib.MeasureTheory.Measure.HasOuterApproxClosed
import Mathlib.MeasureTheory.Measure.Prod
import Mathlib.Topology.Algebra.Module.WeakDual
/-!
# Finite measures
This file defines the type of finite measures on a given measurable space. When the underlying
space has a topology and the measurable space structure (sigma algebra) is finer than the Borel
sigma algebra, then the type of finite measures is equipped with the topology of weak convergence
of measures. The topology of weak convergence is the coarsest topology w.r.t. which
for every bounded continuous `ℝ≥0`-valued function `f`, the integration of `f` against the
measure is continuous.
## Main definitions
The main definitions are
* `MeasureTheory.FiniteMeasure Ω`: The type of finite measures on `Ω` with the topology of weak
convergence of measures.
* `MeasureTheory.FiniteMeasure.toWeakDualBCNN : FiniteMeasure Ω → (WeakDual ℝ≥0 (Ω →ᵇ ℝ≥0))`:
Interpret a finite measure as a continuous linear functional on the space of
bounded continuous nonnegative functions on `Ω`. This is used for the definition of the
topology of weak convergence.
* `MeasureTheory.FiniteMeasure.map`: The push-forward `f* μ` of a finite measure `μ` on `Ω`
along a measurable function `f : Ω → Ω'`.
* `MeasureTheory.FiniteMeasure.mapCLM`: The push-forward along a given continuous `f : Ω → Ω'`
as a continuous linear map `f* : FiniteMeasure Ω →L[ℝ≥0] FiniteMeasure Ω'`.
## Main results
* Finite measures `μ` on `Ω` give rise to continuous linear functionals on the space of
bounded continuous nonnegative functions on `Ω` via integration:
`MeasureTheory.FiniteMeasure.toWeakDualBCNN : FiniteMeasure Ω → (WeakDual ℝ≥0 (Ω →ᵇ ℝ≥0))`
* `MeasureTheory.FiniteMeasure.tendsto_iff_forall_integral_tendsto`: Convergence of finite
measures is characterized by the convergence of integrals of all bounded continuous functions.
This shows that the chosen definition of topology coincides with the common textbook definition
of weak convergence of measures. A similar characterization by the convergence of integrals (in
the `MeasureTheory.lintegral` sense) of all bounded continuous nonnegative functions is
`MeasureTheory.FiniteMeasure.tendsto_iff_forall_lintegral_tendsto`.
* `MeasureTheory.FiniteMeasure.continuous_map`: For a continuous function `f : Ω → Ω'`, the
push-forward of finite measures `f* : FiniteMeasure Ω → FiniteMeasure Ω'` is continuous.
* `MeasureTheory.FiniteMeasure.t2Space`: The topology of weak convergence of finite Borel measures
is Hausdorff on spaces where indicators of closed sets have continuous decreasing approximating
sequences (in particular on any pseudo-metrizable spaces).
## Implementation notes
The topology of weak convergence of finite Borel measures is defined using a mapping from
`MeasureTheory.FiniteMeasure Ω` to `WeakDual ℝ≥0 (Ω →ᵇ ℝ≥0)`, inheriting the topology from the
latter.
The implementation of `MeasureTheory.FiniteMeasure Ω` and is directly as a subtype of
`MeasureTheory.Measure Ω`, and the coercion to a function is the composition `ENNReal.toNNReal`
and the coercion to function of `MeasureTheory.Measure Ω`. Another alternative would have been to
use a bijection with `MeasureTheory.VectorMeasure Ω ℝ≥0` as an intermediate step. Some
considerations:
* Potential advantages of using the `NNReal`-valued vector measure alternative:
* The coercion to function would avoid need to compose with `ENNReal.toNNReal`, the
`NNReal`-valued API could be more directly available.
* Potential drawbacks of the vector measure alternative:
* The coercion to function would lose monotonicity, as non-measurable sets would be defined to
have measure 0.
* No integration theory directly. E.g., the topology definition requires
`MeasureTheory.lintegral` w.r.t. a coercion to `MeasureTheory.Measure Ω` in any case.
## References
* [Billingsley, *Convergence of probability measures*][billingsley1999]
## Tags
weak convergence of measures, finite measure
-/
noncomputable section
open BoundedContinuousFunction Filter MeasureTheory Set Topology
open scoped ENNReal NNReal
namespace MeasureTheory
namespace FiniteMeasure
section FiniteMeasure
/-! ### Finite measures
In this section we define the `Type` of `MeasureTheory.FiniteMeasure Ω`, when `Ω` is a measurable
space. Finite measures on `Ω` are a module over `ℝ≥0`.
If `Ω` is moreover a topological space and the sigma algebra on `Ω` is finer than the Borel sigma
algebra (i.e. `[OpensMeasurableSpace Ω]`), then `MeasureTheory.FiniteMeasure Ω` is equipped with
the topology of weak convergence of measures. This is implemented by defining a pairing of finite
measures `μ` on `Ω` with continuous bounded nonnegative functions `f : Ω →ᵇ ℝ≥0` via integration,
and using the associated weak topology (essentially the weak-star topology on the dual of
`Ω →ᵇ ℝ≥0`).
-/
variable {Ω : Type*} [MeasurableSpace Ω]
/-- Finite measures are defined as the subtype of measures that have the property of being finite
measures (i.e., their total mass is finite). -/
def _root_.MeasureTheory.FiniteMeasure (Ω : Type*) [MeasurableSpace Ω] : Type _ :=
{ μ : Measure Ω // IsFiniteMeasure μ }
/-- Coercion from `MeasureTheory.FiniteMeasure Ω` to `MeasureTheory.Measure Ω`. -/
@[coe]
def toMeasure : FiniteMeasure Ω → Measure Ω := Subtype.val
/-- A finite measure can be interpreted as a measure. -/
instance instCoe : Coe (FiniteMeasure Ω) (MeasureTheory.Measure Ω) := { coe := toMeasure }
instance isFiniteMeasure (μ : FiniteMeasure Ω) : IsFiniteMeasure (μ : Measure Ω) := μ.prop
@[simp]
theorem val_eq_toMeasure (ν : FiniteMeasure Ω) : ν.val = (ν : Measure Ω) := rfl
theorem toMeasure_injective : Function.Injective ((↑) : FiniteMeasure Ω → Measure Ω) :=
Subtype.coe_injective
instance instFunLike : FunLike (FiniteMeasure Ω) (Set Ω) ℝ≥0 where
coe μ s := ((μ : Measure Ω) s).toNNReal
coe_injective' μ ν h := toMeasure_injective <| Measure.ext fun s _ ↦ by
simpa [ENNReal.toNNReal_eq_toNNReal_iff, measure_ne_top] using congr_fun h s
lemma coeFn_def (μ : FiniteMeasure Ω) : μ = fun s ↦ ((μ : Measure Ω) s).toNNReal := rfl
lemma coeFn_mk (μ : Measure Ω) (hμ) :
DFunLike.coe (F := FiniteMeasure Ω) ⟨μ, hμ⟩ = fun s ↦ (μ s).toNNReal := rfl
@[simp, norm_cast]
lemma mk_apply (μ : Measure Ω) (hμ) (s : Set Ω) :
DFunLike.coe (F := FiniteMeasure Ω) ⟨μ, hμ⟩ s = (μ s).toNNReal := rfl
@[simp]
theorem ennreal_coeFn_eq_coeFn_toMeasure (ν : FiniteMeasure Ω) (s : Set Ω) :
(ν s : ℝ≥0∞) = (ν : Measure Ω) s :=
ENNReal.coe_toNNReal (measure_lt_top (↑ν) s).ne
@[simp]
theorem null_iff_toMeasure_null (ν : FiniteMeasure Ω) (s : Set Ω) :
ν s = 0 ↔ (ν : Measure Ω) s = 0 :=
⟨fun h ↦ by rw [← ennreal_coeFn_eq_coeFn_toMeasure, h, ENNReal.coe_zero],
fun h ↦ congrArg ENNReal.toNNReal h⟩
theorem apply_mono (μ : FiniteMeasure Ω) {s₁ s₂ : Set Ω} (h : s₁ ⊆ s₂) : μ s₁ ≤ μ s₂ :=
ENNReal.toNNReal_mono (measure_ne_top _ s₂) ((μ : Measure Ω).mono h)
theorem apply_union_le (μ : FiniteMeasure Ω) {s₁ s₂ : Set Ω} : μ (s₁ ∪ s₂) ≤ μ s₁ + μ s₂ := by
have := measure_union_le (μ := (μ : Measure Ω)) s₁ s₂
apply (ENNReal.toNNReal_mono (by finiteness) this).trans_eq
rw [ENNReal.toNNReal_add (by finiteness) (by finiteness), coeFn_def]
/-- Continuity from below: the measure of the union of a sequence of (not necessarily measurable)
sets is the limit of the measures of the partial unions. -/
protected lemma tendsto_measure_iUnion_accumulate {ι : Type*} [Preorder ι]
[IsCountablyGenerated (atTop : Filter ι)] {μ : FiniteMeasure Ω} {f : ι → Set Ω} :
Tendsto (fun i ↦ μ (Accumulate f i)) atTop (𝓝 (μ (⋃ i, f i))) := by
simpa [← ennreal_coeFn_eq_coeFn_toMeasure]
using tendsto_measure_iUnion_accumulate (μ := μ.toMeasure) (ι := ι)
/-- The (total) mass of a finite measure `μ` is `μ univ`, i.e., the cast to `NNReal` of
`(μ : measure Ω) univ`. -/
def mass (μ : FiniteMeasure Ω) : ℝ≥0 := μ univ
@[simp] theorem apply_le_mass (μ : FiniteMeasure Ω) (s : Set Ω) : μ s ≤ μ.mass := by
simpa using apply_mono μ (subset_univ s)
@[simp]
theorem ennreal_mass {μ : FiniteMeasure Ω} : (μ.mass : ℝ≥0∞) = (μ : Measure Ω) univ :=
ennreal_coeFn_eq_coeFn_toMeasure μ Set.univ
instance instZero : Zero (FiniteMeasure Ω) where zero := ⟨0, MeasureTheory.isFiniteMeasureZero⟩
@[simp, norm_cast] lemma coeFn_zero : ⇑(0 : FiniteMeasure Ω) = 0 := rfl
@[simp]
theorem zero_mass : (0 : FiniteMeasure Ω).mass = 0 := rfl
@[simp]
theorem mass_zero_iff (μ : FiniteMeasure Ω) : μ.mass = 0 ↔ μ = 0 := by
refine ⟨fun μ_mass => ?_, fun hμ => by simp only [hμ, zero_mass]⟩
apply toMeasure_injective
apply Measure.measure_univ_eq_zero.mp
rwa [← ennreal_mass, ENNReal.coe_eq_zero]
theorem mass_nonzero_iff (μ : FiniteMeasure Ω) : μ.mass ≠ 0 ↔ μ ≠ 0 :=
not_iff_not.mpr <| FiniteMeasure.mass_zero_iff μ
@[ext]
theorem eq_of_forall_toMeasure_apply_eq (μ ν : FiniteMeasure Ω)
(h : ∀ s : Set Ω, MeasurableSet s → (μ : Measure Ω) s = (ν : Measure Ω) s) : μ = ν := by
apply Subtype.ext
ext1 s s_mble
exact h s s_mble
theorem eq_of_forall_apply_eq (μ ν : FiniteMeasure Ω)
(h : ∀ s : Set Ω, MeasurableSet s → μ s = ν s) : μ = ν := by
ext1 s s_mble
simpa [ennreal_coeFn_eq_coeFn_toMeasure] using congr_arg ((↑) : ℝ≥0 → ℝ≥0∞) (h s s_mble)
instance instInhabited : Inhabited (FiniteMeasure Ω) := ⟨0⟩
instance instAdd : Add (FiniteMeasure Ω) where add μ ν := ⟨μ + ν, MeasureTheory.isFiniteMeasureAdd⟩
variable {R : Type*} [SMul R ℝ≥0] [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0 ℝ≥0∞]
[IsScalarTower R ℝ≥0∞ ℝ≥0∞]
instance instSMul : SMul R (FiniteMeasure Ω) where
smul (c : R) μ := ⟨c • (μ : Measure Ω), MeasureTheory.isFiniteMeasureSMulOfNNRealTower⟩
@[simp, norm_cast]
theorem toMeasure_zero : ((↑) : FiniteMeasure Ω → Measure Ω) 0 = 0 := rfl
@[simp, norm_cast]
theorem toMeasure_add (μ ν : FiniteMeasure Ω) : ↑(μ + ν) = (↑μ + ↑ν : Measure Ω) := rfl
@[simp, norm_cast]
theorem toMeasure_smul (c : R) (μ : FiniteMeasure Ω) : ↑(c • μ) = c • (μ : Measure Ω) :=
rfl
@[simp, norm_cast]
theorem coeFn_add (μ ν : FiniteMeasure Ω) : (⇑(μ + ν) : Set Ω → ℝ≥0) = (⇑μ + ⇑ν : Set Ω → ℝ≥0) := by
funext
simp only [Pi.add_apply, ← ENNReal.coe_inj, ennreal_coeFn_eq_coeFn_toMeasure,
ENNReal.coe_add]
norm_cast
@[simp, norm_cast]
theorem coeFn_smul [IsScalarTower R ℝ≥0 ℝ≥0] (c : R) (μ : FiniteMeasure Ω) :
(⇑(c • μ) : Set Ω → ℝ≥0) = c • (⇑μ : Set Ω → ℝ≥0) := by
funext; simp [← ENNReal.coe_inj, ENNReal.coe_smul]
instance instAddCommMonoid : AddCommMonoid (FiniteMeasure Ω) :=
toMeasure_injective.addCommMonoid _ toMeasure_zero toMeasure_add fun _ _ ↦ toMeasure_smul _ _
/-- Coercion is an `AddMonoidHom`. -/
@[simps]
def toMeasureAddMonoidHom : FiniteMeasure Ω →+ Measure Ω where
toFun := (↑)
map_zero' := toMeasure_zero
map_add' := toMeasure_add
instance {Ω : Type*} [MeasurableSpace Ω] : Module ℝ≥0 (FiniteMeasure Ω) :=
Function.Injective.module _ toMeasureAddMonoidHom toMeasure_injective toMeasure_smul
@[simp]
theorem smul_apply [IsScalarTower R ℝ≥0 ℝ≥0] (c : R) (μ : FiniteMeasure Ω) (s : Set Ω) :
(c • μ) s = c • μ s := by
rw [coeFn_smul, Pi.smul_apply]
/-- Restrict a finite measure μ to a set A. -/
def restrict (μ : FiniteMeasure Ω) (A : Set Ω) : FiniteMeasure Ω where
val := (μ : Measure Ω).restrict A
property := MeasureTheory.isFiniteMeasureRestrict (μ : Measure Ω) A
theorem restrict_measure_eq (μ : FiniteMeasure Ω) (A : Set Ω) :
(μ.restrict A : Measure Ω) = (μ : Measure Ω).restrict A := rfl
theorem restrict_apply_measure (μ : FiniteMeasure Ω) (A : Set Ω) {s : Set Ω}
(s_mble : MeasurableSet s) : (μ.restrict A : Measure Ω) s = (μ : Measure Ω) (s ∩ A) :=
Measure.restrict_apply s_mble
theorem restrict_apply (μ : FiniteMeasure Ω) (A : Set Ω) {s : Set Ω} (s_mble : MeasurableSet s) :
(μ.restrict A) s = μ (s ∩ A) := by
apply congr_arg ENNReal.toNNReal
exact Measure.restrict_apply s_mble
theorem restrict_mass (μ : FiniteMeasure Ω) (A : Set Ω) : (μ.restrict A).mass = μ A := by
simp only [mass, restrict_apply μ A MeasurableSet.univ, univ_inter]
theorem restrict_eq_zero_iff (μ : FiniteMeasure Ω) (A : Set Ω) : μ.restrict A = 0 ↔ μ A = 0 := by
rw [← mass_zero_iff, restrict_mass]
theorem restrict_nonzero_iff (μ : FiniteMeasure Ω) (A : Set Ω) : μ.restrict A ≠ 0 ↔ μ A ≠ 0 := by
rw [← mass_nonzero_iff, restrict_mass]
/-- The type of finite measures is a measurable space when equipped with the Giry monad. -/
instance : MeasurableSpace (FiniteMeasure Ω) := Subtype.instMeasurableSpace
/-- The set of all finite measures is a measurable set in the Giry monad. -/
lemma measurableSet_isFiniteMeasure : MeasurableSet { μ : Measure Ω | IsFiniteMeasure μ } := by
suffices { μ : Measure Ω | IsFiniteMeasure μ } = (fun μ => μ univ) ⁻¹' (Set.Ico 0 ∞) by
rw [this]
exact Measure.measurable_coe MeasurableSet.univ measurableSet_Ico
ext μ
simp only [mem_setOf_eq, mem_preimage, mem_Ico, zero_le, true_and]
exact isFiniteMeasure_iff μ
/-- The monoidal product is a measurable function from the product of finite measures over
`α` and `β` into the type of finite measures over `α × β`. -/
theorem measurable_fun_prod {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] :
Measurable (fun (μ : FiniteMeasure α × FiniteMeasure β)
↦ μ.1.toMeasure.prod μ.2.toMeasure) := by
have Heval {u v} (Hu : MeasurableSet u) (Hv : MeasurableSet v) :
Measurable fun a : (FiniteMeasure α × FiniteMeasure β) ↦
a.1.toMeasure u * a.2.toMeasure v :=
Measurable.mul
((Measure.measurable_coe Hu).comp (measurable_subtype_coe.comp measurable_fst))
((Measure.measurable_coe Hv).comp (measurable_subtype_coe.comp measurable_snd))
apply Measurable.measure_of_isPiSystem generateFrom_prod.symm isPiSystem_prod _
· simp_rw [← Set.univ_prod_univ, Measure.prod_prod, Heval MeasurableSet.univ MeasurableSet.univ]
simp only [mem_image2, mem_setOf_eq, forall_exists_index, and_imp]
intro _ _ Hu _ Hv Heq
simp_rw [← Heq, Measure.prod_prod, Heval Hu Hv]
lemma apply_iUnion_le {μ : FiniteMeasure Ω} {f : ℕ → Set Ω}
(hf : Summable fun n ↦ μ (f n)) :
μ (⋃ n, f n) ≤ ∑' n, μ (f n) := by
simpa [← ENNReal.coe_le_coe, ENNReal.coe_tsum hf] using MeasureTheory.measure_iUnion_le f
variable [TopologicalSpace Ω]
/-- Two finite Borel measures are equal if the integrals of all non-negative bounded continuous
functions with respect to both agree. -/
theorem ext_of_forall_lintegral_eq [HasOuterApproxClosed Ω] [BorelSpace Ω]
{μ ν : FiniteMeasure Ω} (h : ∀ (f : Ω →ᵇ ℝ≥0), ∫⁻ x, f x ∂μ = ∫⁻ x, f x ∂ν) :
μ = ν := by
apply Subtype.ext
change (μ : Measure Ω) = (ν : Measure Ω)
exact ext_of_forall_lintegral_eq_of_IsFiniteMeasure h
/-- Two finite Borel measures are equal if the integrals of all bounded continuous functions with
respect to both agree. -/
theorem ext_of_forall_integral_eq [HasOuterApproxClosed Ω] [BorelSpace Ω]
{μ ν : FiniteMeasure Ω} (h : ∀ (f : Ω →ᵇ ℝ), ∫ x, f x ∂μ = ∫ x, f x ∂ν) :
μ = ν := by
apply ext_of_forall_lintegral_eq
intro f
apply (ENNReal.toReal_eq_toReal_iff' (lintegral_lt_top_of_nnreal μ f).ne
(lintegral_lt_top_of_nnreal ν f).ne).mp
rw [toReal_lintegral_coe_eq_integral f μ, toReal_lintegral_coe_eq_integral f ν]
exact h ⟨⟨fun x => (f x).toReal, Continuous.comp' NNReal.continuous_coe f.continuous⟩,
f.map_bounded'⟩
/-- The pairing of a finite (Borel) measure `μ` with a nonnegative bounded continuous
function is obtained by (Lebesgue) integrating the (test) function against the measure.
This is `MeasureTheory.FiniteMeasure.testAgainstNN`. -/
def testAgainstNN (μ : FiniteMeasure Ω) (f : Ω →ᵇ ℝ≥0) : ℝ≥0 :=
(∫⁻ ω, f ω ∂(μ : Measure Ω)).toNNReal
@[simp]
theorem testAgainstNN_coe_eq {μ : FiniteMeasure Ω} {f : Ω →ᵇ ℝ≥0} :
(μ.testAgainstNN f : ℝ≥0∞) = ∫⁻ ω, f ω ∂(μ : Measure Ω) :=
ENNReal.coe_toNNReal (f.lintegral_lt_top_of_nnreal _).ne
theorem testAgainstNN_const (μ : FiniteMeasure Ω) (c : ℝ≥0) :
μ.testAgainstNN (BoundedContinuousFunction.const Ω c) = c * μ.mass := by
simp [← ENNReal.coe_inj]
theorem testAgainstNN_mono (μ : FiniteMeasure Ω) {f g : Ω →ᵇ ℝ≥0} (f_le_g : (f : Ω → ℝ≥0) ≤ g) :
μ.testAgainstNN f ≤ μ.testAgainstNN g := by
simp only [← ENNReal.coe_le_coe, testAgainstNN_coe_eq]
gcongr
apply f_le_g
@[simp]
theorem testAgainstNN_zero (μ : FiniteMeasure Ω) : μ.testAgainstNN 0 = 0 := by
simpa only [zero_mul] using μ.testAgainstNN_const 0
@[simp]
theorem testAgainstNN_one (μ : FiniteMeasure Ω) : μ.testAgainstNN 1 = μ.mass := by
simp only [testAgainstNN, coe_one, Pi.one_apply, ENNReal.coe_one, lintegral_one]
rfl
@[simp]
theorem zero_testAgainstNN_apply (f : Ω →ᵇ ℝ≥0) : (0 : FiniteMeasure Ω).testAgainstNN f = 0 := by
simp only [testAgainstNN, toMeasure_zero, lintegral_zero_measure, ENNReal.toNNReal_zero]
theorem zero_testAgainstNN : (0 : FiniteMeasure Ω).testAgainstNN = 0 := by
funext
simp only [zero_testAgainstNN_apply, Pi.zero_apply]
@[simp]
theorem smul_testAgainstNN_apply (c : ℝ≥0) (μ : FiniteMeasure Ω) (f : Ω →ᵇ ℝ≥0) :
(c • μ).testAgainstNN f = c • μ.testAgainstNN f := by
simp only [testAgainstNN, toMeasure_smul, smul_eq_mul, ← ENNReal.smul_toNNReal, ENNReal.smul_def,
lintegral_smul_measure]
section weak_convergence
variable [OpensMeasurableSpace Ω]
theorem testAgainstNN_add (μ : FiniteMeasure Ω) (f₁ f₂ : Ω →ᵇ ℝ≥0) :
μ.testAgainstNN (f₁ + f₂) = μ.testAgainstNN f₁ + μ.testAgainstNN f₂ := by
simp only [← ENNReal.coe_inj, BoundedContinuousFunction.coe_add, ENNReal.coe_add, Pi.add_apply,
testAgainstNN_coe_eq]
exact lintegral_add_left (BoundedContinuousFunction.measurable_coe_ennreal_comp _) _
theorem testAgainstNN_smul [IsScalarTower R ℝ≥0 ℝ≥0] [PseudoMetricSpace R] [Zero R]
[IsBoundedSMul R ℝ≥0] (μ : FiniteMeasure Ω) (c : R) (f : Ω →ᵇ ℝ≥0) :
μ.testAgainstNN (c • f) = c • μ.testAgainstNN f := by
simp only [← ENNReal.coe_inj, BoundedContinuousFunction.coe_smul, testAgainstNN_coe_eq,
ENNReal.coe_smul]
simp_rw [← smul_one_smul ℝ≥0∞ c (f _ : ℝ≥0∞), ← smul_one_smul ℝ≥0∞ c (lintegral _ _ : ℝ≥0∞),
smul_eq_mul]
exact lintegral_const_mul (c • (1 : ℝ≥0∞)) f.measurable_coe_ennreal_comp
theorem testAgainstNN_lipschitz_estimate (μ : FiniteMeasure Ω) (f g : Ω →ᵇ ℝ≥0) :
μ.testAgainstNN f ≤ μ.testAgainstNN g + nndist f g * μ.mass := by
simp only [← μ.testAgainstNN_const (nndist f g), ← testAgainstNN_add, ← ENNReal.coe_le_coe,
BoundedContinuousFunction.coe_add, const_apply, ENNReal.coe_add, Pi.add_apply,
coe_nnreal_ennreal_nndist, testAgainstNN_coe_eq]
apply lintegral_mono
have le_dist : ∀ ω, dist (f ω) (g ω) ≤ nndist f g := BoundedContinuousFunction.dist_coe_le_dist
intro ω
have le' : f ω ≤ g ω + nndist f g := by
calc f ω
_ ≤ g ω + nndist (f ω) (g ω) := NNReal.le_add_nndist (f ω) (g ω)
_ ≤ g ω + nndist f g := (add_le_add_iff_left (g ω)).mpr (le_dist ω)
have le : (f ω : ℝ≥0∞) ≤ (g ω : ℝ≥0∞) + nndist f g := by
simpa only [← ENNReal.coe_add] using (by exact_mod_cast le')
rwa [coe_nnreal_ennreal_nndist] at le
theorem testAgainstNN_lipschitz (μ : FiniteMeasure Ω) :
LipschitzWith μ.mass fun f : Ω →ᵇ ℝ≥0 ↦ μ.testAgainstNN f := by
rw [lipschitzWith_iff_dist_le_mul]
intro f₁ f₂
suffices abs (μ.testAgainstNN f₁ - μ.testAgainstNN f₂ : ℝ) ≤ μ.mass * dist f₁ f₂ by
rwa [NNReal.dist_eq]
apply abs_le.mpr
constructor
· have key := μ.testAgainstNN_lipschitz_estimate f₂ f₁
rw [mul_comm] at key
suffices ↑(μ.testAgainstNN f₂) ≤ ↑(μ.testAgainstNN f₁) + ↑μ.mass * dist f₁ f₂ by linarith
simpa [nndist_comm] using NNReal.coe_mono key
· have key := μ.testAgainstNN_lipschitz_estimate f₁ f₂
rw [mul_comm] at key
suffices ↑(μ.testAgainstNN f₁) ≤ ↑(μ.testAgainstNN f₂) + ↑μ.mass * dist f₁ f₂ by linarith
simpa using NNReal.coe_mono key
/-- Finite measures yield elements of the `WeakDual` of bounded continuous nonnegative
functions via `MeasureTheory.FiniteMeasure.testAgainstNN`, i.e., integration. -/
def toWeakDualBCNN (μ : FiniteMeasure Ω) : WeakDual ℝ≥0 (Ω →ᵇ ℝ≥0) where
toFun f := μ.testAgainstNN f
map_add' := testAgainstNN_add μ
map_smul' := testAgainstNN_smul μ
cont := μ.testAgainstNN_lipschitz.continuous
@[simp]
theorem coe_toWeakDualBCNN (μ : FiniteMeasure Ω) : ⇑μ.toWeakDualBCNN = μ.testAgainstNN :=
rfl
@[simp]
theorem toWeakDualBCNN_apply (μ : FiniteMeasure Ω) (f : Ω →ᵇ ℝ≥0) :
μ.toWeakDualBCNN f = (∫⁻ x, f x ∂(μ : Measure Ω)).toNNReal := rfl
/-- The topology of weak convergence on `MeasureTheory.FiniteMeasure Ω` is inherited (induced)
from the weak-* topology on `WeakDual ℝ≥0 (Ω →ᵇ ℝ≥0)` via the function
`MeasureTheory.FiniteMeasure.toWeakDualBCNN`. -/
instance instTopologicalSpace : TopologicalSpace (FiniteMeasure Ω) :=
TopologicalSpace.induced toWeakDualBCNN inferInstance
theorem toWeakDualBCNN_continuous : Continuous (@toWeakDualBCNN Ω _ _ _) :=
continuous_induced_dom
/-- Integration of (nonnegative bounded continuous) test functions against finite Borel measures
depends continuously on the measure. -/
theorem continuous_testAgainstNN_eval (f : Ω →ᵇ ℝ≥0) :
Continuous fun μ : FiniteMeasure Ω ↦ μ.testAgainstNN f := by
change Continuous ((fun φ : WeakDual ℝ≥0 (Ω →ᵇ ℝ≥0) ↦ φ f) ∘ toWeakDualBCNN)
refine Continuous.comp ?_ (toWeakDualBCNN_continuous (Ω := Ω))
exact WeakBilin.eval_continuous _ _
/-- The total mass of a finite measure depends continuously on the measure. -/
theorem continuous_mass : Continuous fun μ : FiniteMeasure Ω ↦ μ.mass := by
simp_rw [← testAgainstNN_one]; exact continuous_testAgainstNN_eval 1
/-- Convergence of finite measures implies the convergence of their total masses. -/
theorem _root_.Filter.Tendsto.mass {γ : Type*} {F : Filter γ} {μs : γ → FiniteMeasure Ω}
{μ : FiniteMeasure Ω} (h : Tendsto μs F (𝓝 μ)) : Tendsto (fun i ↦ (μs i).mass) F (𝓝 μ.mass) :=
(continuous_mass.tendsto μ).comp h
theorem tendsto_iff_weakDual_tendsto {γ : Type*} {F : Filter γ} {μs : γ → FiniteMeasure Ω}
{μ : FiniteMeasure Ω} :
Tendsto μs F (𝓝 μ) ↔ Tendsto (fun i ↦ (μs i).toWeakDualBCNN) F (𝓝 μ.toWeakDualBCNN) :=
IsInducing.tendsto_nhds_iff ⟨rfl⟩
theorem tendsto_iff_forall_toWeakDualBCNN_tendsto {γ : Type*} {F : Filter γ}
{μs : γ → FiniteMeasure Ω} {μ : FiniteMeasure Ω} :
Tendsto μs F (𝓝 μ) ↔
∀ f : Ω →ᵇ ℝ≥0, Tendsto (fun i ↦ (μs i).toWeakDualBCNN f) F (𝓝 (μ.toWeakDualBCNN f)) := by
rw [tendsto_iff_weakDual_tendsto, tendsto_iff_forall_eval_tendsto_topDualPairing]; rfl
theorem tendsto_iff_forall_testAgainstNN_tendsto {γ : Type*} {F : Filter γ}
{μs : γ → FiniteMeasure Ω} {μ : FiniteMeasure Ω} :
Tendsto μs F (𝓝 μ) ↔
∀ f : Ω →ᵇ ℝ≥0, Tendsto (fun i ↦ (μs i).testAgainstNN f) F (𝓝 (μ.testAgainstNN f)) := by
rw [FiniteMeasure.tendsto_iff_forall_toWeakDualBCNN_tendsto]; rfl
/-- If the total masses of finite measures tend to zero, then the measures tend to
zero. This formulation concerns the associated functionals on bounded continuous
nonnegative test functions. See `MeasureTheory.FiniteMeasure.tendsto_zero_of_tendsto_zero_mass` for
a formulation stating the weak convergence of measures. -/
theorem tendsto_zero_testAgainstNN_of_tendsto_zero_mass {γ : Type*} {F : Filter γ}
{μs : γ → FiniteMeasure Ω} (mass_lim : Tendsto (fun i ↦ (μs i).mass) F (𝓝 0)) (f : Ω →ᵇ ℝ≥0) :
Tendsto (fun i ↦ (μs i).testAgainstNN f) F (𝓝 0) := by
apply tendsto_iff_dist_tendsto_zero.mpr
have obs := fun i ↦ (μs i).testAgainstNN_lipschitz_estimate f 0
simp_rw [testAgainstNN_zero, zero_add] at obs
simp_rw [show ∀ i, dist ((μs i).testAgainstNN f) 0 = (μs i).testAgainstNN f by
simp only [dist_nndist, NNReal.nndist_zero_eq_val', imp_true_iff]]
apply squeeze_zero (fun i ↦ NNReal.coe_nonneg _) obs
have lim_pair : Tendsto (fun i ↦ (⟨nndist f 0, (μs i).mass⟩ : ℝ × ℝ)) F (𝓝 ⟨nndist f 0, 0⟩) :=
(Prod.tendsto_iff _ _).mpr ⟨tendsto_const_nhds, (NNReal.continuous_coe.tendsto 0).comp mass_lim⟩
simpa using tendsto_mul.comp lim_pair
/-- If the total masses of finite measures tend to zero, then the measures tend to zero. -/
theorem tendsto_zero_of_tendsto_zero_mass {γ : Type*} {F : Filter γ} {μs : γ → FiniteMeasure Ω}
(mass_lim : Tendsto (fun i ↦ (μs i).mass) F (𝓝 0)) : Tendsto μs F (𝓝 0) := by
rw [tendsto_iff_forall_testAgainstNN_tendsto]
intro f
convert tendsto_zero_testAgainstNN_of_tendsto_zero_mass mass_lim f
rw [zero_testAgainstNN_apply]
/-- A characterization of weak convergence in terms of integrals of bounded continuous
nonnegative functions. -/
theorem tendsto_iff_forall_lintegral_tendsto {γ : Type*} {F : Filter γ} {μs : γ → FiniteMeasure Ω}
{μ : FiniteMeasure Ω} :
Tendsto μs F (𝓝 μ) ↔
∀ f : Ω →ᵇ ℝ≥0,
Tendsto (fun i ↦ ∫⁻ x, f x ∂(μs i : Measure Ω)) F (𝓝 (∫⁻ x, f x ∂(μ : Measure Ω))) := by
rw [tendsto_iff_forall_toWeakDualBCNN_tendsto]
simp_rw [toWeakDualBCNN_apply _ _, ← testAgainstNN_coe_eq, ENNReal.tendsto_coe,
ENNReal.toNNReal_coe]
end weak_convergence -- section
section Hausdorff
variable [HasOuterApproxClosed Ω] [BorelSpace Ω]
open Function
/-- The mapping `toWeakDualBCNN` from finite Borel measures to the weak dual of `Ω →ᵇ ℝ≥0` is
injective, if in the underlying space `Ω`, indicator functions of closed sets have decreasing
approximations by sequences of continuous functions (in particular if `Ω` is pseudometrizable). -/
lemma injective_toWeakDualBCNN :
Injective (toWeakDualBCNN : FiniteMeasure Ω → WeakDual ℝ≥0 (Ω →ᵇ ℝ≥0)) := by
intro μ ν hμν
apply ext_of_forall_lintegral_eq
intro f
have key := congr_fun (congrArg DFunLike.coe hμν) f
apply (ENNReal.toNNReal_eq_toNNReal_iff' ?_ ?_).mp key
· exact (lintegral_lt_top_of_nnreal μ f).ne
· exact (lintegral_lt_top_of_nnreal ν f).ne
variable (Ω)
lemma isEmbedding_toWeakDualBCNN :
IsEmbedding (toWeakDualBCNN : FiniteMeasure Ω → WeakDual ℝ≥0 (Ω →ᵇ ℝ≥0)) where
eq_induced := rfl
injective := injective_toWeakDualBCNN
/-- On topological spaces where indicators of closed sets have decreasing approximating sequences of
continuous functions (`HasOuterApproxClosed`), the topology of weak convergence of finite Borel
measures is Hausdorff (`T2Space`). -/
instance t2Space : T2Space (FiniteMeasure Ω) := (isEmbedding_toWeakDualBCNN Ω).t2Space
end Hausdorff -- section
end FiniteMeasure
-- section
section FiniteMeasureBoundedConvergence
/-! ### Bounded convergence results for finite measures
This section is about bounded convergence theorems for finite measures.
-/
variable {Ω : Type*} [MeasurableSpace Ω] [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
/-- A bounded convergence theorem for a finite measure:
If a sequence of bounded continuous non-negative functions are uniformly bounded by a constant
and tend pointwise to a limit, then their integrals (`MeasureTheory.lintegral`) against the finite
measure tend to the integral of the limit.
A related result with more general assumptions is
`MeasureTheory.tendsto_lintegral_nn_filter_of_le_const`.
-/
theorem tendsto_lintegral_nn_of_le_const (μ : FiniteMeasure Ω) {fs : ℕ → Ω →ᵇ ℝ≥0} {c : ℝ≥0}
(fs_le_const : ∀ n ω, fs n ω ≤ c) {f : Ω → ℝ≥0}
(fs_lim : ∀ ω, Tendsto (fun n ↦ fs n ω) atTop (𝓝 (f ω))) :
Tendsto (fun n ↦ ∫⁻ ω, fs n ω ∂(μ : Measure Ω)) atTop (𝓝 (∫⁻ ω, f ω ∂(μ : Measure Ω))) :=
tendsto_lintegral_nn_filter_of_le_const μ
(.of_forall fun n ↦ .of_forall (fs_le_const n))
(.of_forall fs_lim)
/-- A bounded convergence theorem for a finite measure:
If bounded continuous non-negative functions are uniformly bounded by a constant and tend to a
limit, then their integrals against the finite measure tend to the integral of the limit.
This formulation assumes:
* the functions tend to a limit along a countably generated filter;
* the limit is in the almost everywhere sense;
* boundedness holds almost everywhere;
* integration is the pairing against non-negative continuous test functions
(`MeasureTheory.FiniteMeasure.testAgainstNN`).
A related result using `MeasureTheory.lintegral` for integration is
`MeasureTheory.FiniteMeasure.tendsto_lintegral_nn_filter_of_le_const`.
-/
theorem tendsto_testAgainstNN_filter_of_le_const {ι : Type*} {L : Filter ι}
[L.IsCountablyGenerated] {μ : FiniteMeasure Ω} {fs : ι → Ω →ᵇ ℝ≥0} {c : ℝ≥0}
(fs_le_const : ∀ᶠ i in L, ∀ᵐ ω : Ω ∂(μ : Measure Ω), fs i ω ≤ c) {f : Ω →ᵇ ℝ≥0}
(fs_lim : ∀ᵐ ω : Ω ∂(μ : Measure Ω), Tendsto (fun i ↦ fs i ω) L (𝓝 (f ω))) :
Tendsto (fun i ↦ μ.testAgainstNN (fs i)) L (𝓝 (μ.testAgainstNN f)) := by
apply (ENNReal.tendsto_toNNReal (f.lintegral_lt_top_of_nnreal (μ : Measure Ω)).ne).comp
exact tendsto_lintegral_nn_filter_of_le_const (Ω := Ω) μ fs_le_const fs_lim
/-- A bounded convergence theorem for a finite measure:
If a sequence of bounded continuous non-negative functions are uniformly bounded by a constant and
tend pointwise to a limit, then their integrals (`MeasureTheory.FiniteMeasure.testAgainstNN`)
against the finite measure tend to the integral of the limit.
Related results:
* `MeasureTheory.FiniteMeasure.tendsto_testAgainstNN_filter_of_le_const`:
more general assumptions
* `MeasureTheory.FiniteMeasure.tendsto_lintegral_nn_of_le_const`:
using `MeasureTheory.lintegral` for integration.
-/
theorem tendsto_testAgainstNN_of_le_const {μ : FiniteMeasure Ω} {fs : ℕ → Ω →ᵇ ℝ≥0} {c : ℝ≥0}
(fs_le_const : ∀ n ω, fs n ω ≤ c) {f : Ω →ᵇ ℝ≥0}
(fs_lim : ∀ ω, Tendsto (fun n ↦ fs n ω) atTop (𝓝 (f ω))) :
Tendsto (fun n ↦ μ.testAgainstNN (fs n)) atTop (𝓝 (μ.testAgainstNN f)) :=
tendsto_testAgainstNN_filter_of_le_const
(.of_forall fun n ↦ .of_forall (fs_le_const n))
(.of_forall fs_lim)
end FiniteMeasureBoundedConvergence
-- section
section FiniteMeasureConvergenceByBoundedContinuousFunctions
/-! ### Weak convergence of finite measures with bounded continuous real-valued functions
In this section we characterize the weak convergence of finite measures by the usual (defining)
condition that the integrals of all bounded continuous real-valued functions converge.
-/
variable {Ω : Type*} [MeasurableSpace Ω] [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
theorem tendsto_of_forall_integral_tendsto {γ : Type*} {F : Filter γ} {μs : γ → FiniteMeasure Ω}
{μ : FiniteMeasure Ω}
(h : ∀ f : Ω →ᵇ ℝ,
Tendsto (fun i ↦ ∫ x, f x ∂(μs i : Measure Ω)) F (𝓝 (∫ x, f x ∂(μ : Measure Ω)))) :
Tendsto μs F (𝓝 μ) := by
apply tendsto_iff_forall_lintegral_tendsto.mpr
intro f
apply (ENNReal.tendsto_toReal_iff (fi := F)
(fun i ↦ (f.lintegral_lt_top_of_nnreal (μs i)).ne) (f.lintegral_lt_top_of_nnreal μ).ne).mp
have lip : LipschitzWith 1 ((↑) : ℝ≥0 → ℝ) := isometry_subtype_coe.lipschitz
set f₀ := BoundedContinuousFunction.comp _ lip f with _def_f₀
have f₀_eq : ⇑f₀ = ((↑) : ℝ≥0 → ℝ) ∘ ⇑f := rfl
have f₀_nn : 0 ≤ ⇑f₀ := fun _ ↦ by
simp only [f₀_eq, Pi.zero_apply, Function.comp_apply, NNReal.zero_le_coe]
have f₀_ae_nn : 0 ≤ᵐ[(μ : Measure Ω)] ⇑f₀ := .of_forall f₀_nn
have f₀_ae_nns : ∀ i, 0 ≤ᵐ[(μs i : Measure Ω)] ⇑f₀ := fun i ↦ .of_forall f₀_nn
have aux :=
integral_eq_lintegral_of_nonneg_ae f₀_ae_nn f₀.continuous.measurable.aestronglyMeasurable
have auxs := fun i ↦
integral_eq_lintegral_of_nonneg_ae (f₀_ae_nns i) f₀.continuous.measurable.aestronglyMeasurable
simp_rw [f₀_eq, Function.comp_apply, ENNReal.ofReal_coe_nnreal] at aux auxs
simpa only [← aux, ← auxs] using h f₀
/-- A characterization of weak convergence in terms of integrals of bounded continuous
real-valued functions. -/
theorem tendsto_iff_forall_integral_tendsto {γ : Type*} {F : Filter γ} {μs : γ → FiniteMeasure Ω}
{μ : FiniteMeasure Ω} :
Tendsto μs F (𝓝 μ) ↔
∀ f : Ω →ᵇ ℝ,
Tendsto (fun i ↦ ∫ x, f x ∂(μs i : Measure Ω)) F (𝓝 (∫ x, f x ∂(μ : Measure Ω))) := by
refine ⟨?_, tendsto_of_forall_integral_tendsto⟩
rw [tendsto_iff_forall_lintegral_tendsto]
intro h f
simp_rw [BoundedContinuousFunction.integral_eq_integral_nnrealPart_sub]
set f_pos := f.nnrealPart with _def_f_pos
set f_neg := (-f).nnrealPart with _def_f_neg
have tends_pos := (ENNReal.tendsto_toReal (f_pos.lintegral_lt_top_of_nnreal μ).ne).comp (h f_pos)
have tends_neg := (ENNReal.tendsto_toReal (f_neg.lintegral_lt_top_of_nnreal μ).ne).comp (h f_neg)
have aux :
∀ g : Ω →ᵇ ℝ≥0,
(ENNReal.toReal ∘ fun i : γ ↦ ∫⁻ x : Ω, ↑(g x) ∂(μs i : Measure Ω)) =
fun i : γ ↦ (∫⁻ x : Ω, ↑(g x) ∂(μs i : Measure Ω)).toReal :=
fun _ ↦ rfl
simp_rw [aux, BoundedContinuousFunction.toReal_lintegral_coe_eq_integral] at tends_pos tends_neg
exact Tendsto.sub tends_pos tends_neg
theorem tendsto_iff_forall_integral_rclike_tendsto {γ : Type*} (𝕜 : Type*) [RCLike 𝕜]
{F : Filter γ} {μs : γ → FiniteMeasure Ω} {μ : FiniteMeasure Ω} :
Tendsto μs F (𝓝 μ) ↔
∀ f : Ω →ᵇ 𝕜,
Tendsto (fun i ↦ ∫ ω, f ω ∂(μs i : Measure Ω)) F (𝓝 (∫ ω, f ω ∂(μ : Measure Ω))) := by
rw [tendsto_iff_forall_integral_tendsto]
refine ⟨fun h f ↦ ?_, fun h f ↦ ?_⟩
· rw [← integral_re_add_im (integrable μ f)]
simp_rw [← integral_re_add_im (integrable (μs _) f)]
refine Tendsto.add ?_ ?_
· exact (RCLike.continuous_ofReal.tendsto _).comp (h (f.comp RCLike.re RCLike.lipschitzWith_re))
· exact (Tendsto.comp (RCLike.continuous_ofReal.tendsto _)
(h (f.comp RCLike.im RCLike.lipschitzWith_im))).mul_const _
· specialize h ((RCLike.ofRealAm (K := 𝕜)).compLeftContinuousBounded ℝ
RCLike.lipschitzWith_ofReal f)
simp only [AlgHom.compLeftContinuousBounded_apply_apply, RCLike.ofRealAm_coe,
integral_ofReal] at h
exact tendsto_ofReal_iff'.mp h
lemma continuous_integral_boundedContinuousFunction
{α : Type*} [TopologicalSpace α] [MeasurableSpace α] [OpensMeasurableSpace α] (f : α →ᵇ ℝ) :
Continuous fun μ : FiniteMeasure α ↦ ∫ x, f x ∂μ := by
rw [continuous_iff_continuousAt]
intro μ
exact continuousAt_of_tendsto_nhds
(FiniteMeasure.tendsto_iff_forall_integral_tendsto.mp tendsto_id f)
end FiniteMeasureConvergenceByBoundedContinuousFunctions -- section
section map
variable {Ω Ω' : Type*} [MeasurableSpace Ω] [MeasurableSpace Ω']
/-- The push-forward of a finite measure by a function between measurable spaces. -/
noncomputable def map (ν : FiniteMeasure Ω) (f : Ω → Ω') : FiniteMeasure Ω' :=
⟨(ν : Measure Ω).map f, (ν : Measure Ω).isFiniteMeasure_map f⟩
@[simp] lemma toMeasure_map (ν : FiniteMeasure Ω) (f : Ω → Ω') :
(ν.map f).toMeasure = ν.toMeasure.map f := rfl
/-- Note that this is an equality of elements of `ℝ≥0∞`. See also
`MeasureTheory.FiniteMeasure.map_apply` for the corresponding equality as elements of `ℝ≥0`. -/
lemma map_apply' (ν : FiniteMeasure Ω) {f : Ω → Ω'} (f_aemble : AEMeasurable f ν)
{A : Set Ω'} (A_mble : MeasurableSet A) :
(ν.map f : Measure Ω') A = (ν : Measure Ω) (f ⁻¹' A) :=
Measure.map_apply_of_aemeasurable f_aemble A_mble
lemma map_apply_of_aemeasurable (ν : FiniteMeasure Ω) {f : Ω → Ω'} (f_aemble : AEMeasurable f ν)
{A : Set Ω'} (A_mble : MeasurableSet A) :
ν.map f A = ν (f ⁻¹' A) := by
have key := ν.map_apply' f_aemble A_mble
exact (ENNReal.toNNReal_eq_toNNReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mpr key
lemma map_apply (ν : FiniteMeasure Ω) {f : Ω → Ω'} (f_mble : Measurable f)
{A : Set Ω'} (A_mble : MeasurableSet A) :
ν.map f A = ν (f ⁻¹' A) :=
map_apply_of_aemeasurable ν f_mble.aemeasurable A_mble
@[simp] lemma map_add {f : Ω → Ω'} (f_mble : Measurable f) (ν₁ ν₂ : FiniteMeasure Ω) :
(ν₁ + ν₂).map f = ν₁.map f + ν₂.map f := by ext; simp [*]
@[simp] lemma map_smul {f : Ω → Ω'} (c : ℝ≥0) (ν : FiniteMeasure Ω) :
(c • ν).map f = c • (ν.map f) := by
ext s _
simp [toMeasure_smul]
/-- The push-forward of a finite measure by a function between measurable spaces as a linear map. -/
noncomputable def mapHom {f : Ω → Ω'} (f_mble : Measurable f) :
FiniteMeasure Ω →ₗ[ℝ≥0] FiniteMeasure Ω' where
toFun := fun ν ↦ ν.map f
map_add' := map_add f_mble
map_smul' := map_smul
variable [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
variable [TopologicalSpace Ω'] [BorelSpace Ω']
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
(weak) convergence of `FiniteMeasure`s on `X` implies (weak) convergence of the push-forwards
of these measures by `f`. -/
lemma tendsto_map_of_tendsto_of_continuous {ι : Type*} {L : Filter ι}
(νs : ι → FiniteMeasure Ω) (ν : FiniteMeasure Ω) (lim : Tendsto νs L (𝓝 ν))
{f : Ω → Ω'} (f_cont : Continuous f) :
Tendsto (fun i ↦ (νs i).map f) L (𝓝 (ν.map f)) := by
rw [FiniteMeasure.tendsto_iff_forall_lintegral_tendsto] at lim ⊢
intro g
convert lim (g.compContinuous ⟨f, f_cont⟩) <;>
· simp only [map, compContinuous_apply, ContinuousMap.coe_mk]
refine lintegral_map ?_ f_cont.measurable
exact (ENNReal.continuous_coe.comp g.continuous).measurable
/-- If `f : X → Y` is continuous and `Y` is equipped with the Borel sigma algebra, then
the push-forward of finite measures `f* : FiniteMeasure X → FiniteMeasure Y` is continuous
(in the topologies of weak convergence of measures). -/
lemma continuous_map {f : Ω → Ω'} (f_cont : Continuous f) :
Continuous (fun ν ↦ FiniteMeasure.map ν f) := by
rw [continuous_iff_continuousAt]
exact fun _ ↦ tendsto_map_of_tendsto_of_continuous _ _ continuous_id.continuousAt f_cont
/-- The push-forward of a finite measure by a continuous function between Borel spaces as
a continuous linear map. -/
noncomputable def mapCLM {f : Ω → Ω'} (f_cont : Continuous f) :
FiniteMeasure Ω →L[ℝ≥0] FiniteMeasure Ω' where
toFun := fun ν ↦ ν.map f
map_add' := map_add f_cont.measurable
map_smul' := map_smul
cont := continuous_map f_cont
end map -- section
end FiniteMeasure -- namespace
end MeasureTheory -- namespace |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/FiniteMeasureExt.lean | import Mathlib.Analysis.RCLike.BoundedContinuous
import Mathlib.Analysis.SpecialFunctions.MulExpNegMulSqIntegral
import Mathlib.MeasureTheory.Measure.HasOuterApproxClosed
/-!
# Extensionality of finite measures
The main Result is `ext_of_forall_mem_subalgebra_integral_eq_of_pseudoEMetric_complete_countable`:
Let `A` be a StarSubalgebra of `C(E, 𝕜)` that separates points and whose elements are bounded. If
the integrals of all elements of `A` with respect to two finite measures `P, P'`coincide, then the
measures coincide. In other words: If a Subalgebra separates points, it separates finite measures.
-/
open MeasureTheory Filter Real RCLike BoundedContinuousFunction
open scoped Topology
variable {E 𝕜 : Type*} [RCLike 𝕜]
namespace MeasureTheory
variable [MeasurableSpace E]
/-- If the integrals of all elements of a subalgebra `A` of continuous and bounded functions with
respect to two finite measures `P, P'` coincide, then the measures coincide. In other words: If a
subalgebra separates points, it separates finite measures. -/
theorem ext_of_forall_mem_subalgebra_integral_eq_of_pseudoEMetric_complete_countable
[PseudoEMetricSpace E] [BorelSpace E] [CompleteSpace E] [SecondCountableTopology E]
{P P' : Measure E} [IsFiniteMeasure P] [IsFiniteMeasure P']
{A : StarSubalgebra 𝕜 (E →ᵇ 𝕜)} (hA : (A.map (toContinuousMapStarₐ 𝕜)).SeparatesPoints)
(heq : ∀ g ∈ A, ∫ x, (g : E → 𝕜) x ∂P = ∫ x, (g : E → 𝕜) x ∂P') : P = P' := by
--consider the real subalgebra of the purely real-valued elements of A
let A_toReal := (A.restrictScalars ℝ).comap
(ofRealAm.compLeftContinuousBounded ℝ lipschitzWith_ofReal)
--the real subalgebra separates points
have hA_toReal : (A_toReal.map (toContinuousMapₐ ℝ)).SeparatesPoints := by
rw [RCLike.restrict_toContinuousMap_eq_toContinuousMapStar_restrict]
exact Subalgebra.SeparatesPoints.rclike_to_real hA
--integrals of elements of the real subalgebra w.r.t. P, P', respectively, coincide
have heq' : ∀ g ∈ A_toReal, ∫ x, (g : E → ℝ) x ∂P = ∫ x, (g : E → ℝ) x ∂P' := by
intro g hgA_toReal
rw [← @ofReal_inj 𝕜, ← integral_ofReal, ← integral_ofReal]
exact heq _ hgA_toReal
apply ext_of_forall_integral_eq_of_IsFiniteMeasure
intro f
have h0 : Tendsto (fun ε : ℝ => 6 * √ε) (𝓝[>] 0) (𝓝 0) := by
nth_rewrite 3 [← mul_zero 6]
apply tendsto_nhdsWithin_of_tendsto_nhds (Tendsto.const_mul 6 _)
nth_rewrite 2 [← sqrt_zero]
exact Continuous.tendsto continuous_sqrt 0
have lim1 : Tendsto (fun ε => |∫ x, mulExpNegMulSq ε (f x) ∂P - ∫ x, mulExpNegMulSq ε (f x) ∂P'|)
(𝓝[>] 0) (𝓝 0) := by
apply squeeze_zero' (eventually_nhdsWithin_of_forall (fun x _ => abs_nonneg _))
(eventually_nhdsWithin_of_forall _) h0
exact fun ε hε => dist_integral_mulExpNegMulSq_comp_le f hA_toReal heq' hε
have lim2 : Tendsto (fun ε => |∫ x, mulExpNegMulSq ε (f x) ∂P
- ∫ x, mulExpNegMulSq ε (f x) ∂P'|) (𝓝[>] 0)
(𝓝 |∫ x, f x ∂↑P - ∫ x, f x ∂↑P'|) :=
Tendsto.abs (Tendsto.sub (tendsto_integral_mulExpNegMulSq_comp f)
(tendsto_integral_mulExpNegMulSq_comp f))
exact eq_of_abs_sub_eq_zero (tendsto_nhds_unique lim2 lim1)
theorem ext_of_forall_mem_subalgebra_integral_eq_of_polish [TopologicalSpace E] [PolishSpace E]
[BorelSpace E] {P P' : Measure E} [IsFiniteMeasure P] [IsFiniteMeasure P']
{A : StarSubalgebra 𝕜 (E →ᵇ 𝕜)} (hA : (A.map (toContinuousMapStarₐ 𝕜)).SeparatesPoints)
(heq : ∀ g ∈ A, ∫ x, (g : E → 𝕜) x ∂P = ∫ x, (g : E → 𝕜) x ∂P') : P = P' := by
letI := TopologicalSpace.upgradeIsCompletelyMetrizable E
exact ext_of_forall_mem_subalgebra_integral_eq_of_pseudoEMetric_complete_countable hA heq
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/LogLikelihoodRatio.lean | import Mathlib.MeasureTheory.Measure.Tilted
/-!
# Log-likelihood Ratio
The likelihood ratio between two measures `μ` and `ν` is their Radon-Nikodym derivative
`μ.rnDeriv ν`. The logarithm of that function is often used instead: this is the log-likelihood
ratio.
This file contains a definition of the log-likelihood ratio (llr) and its properties.
## Main definitions
* `llr μ ν`: Log-Likelihood Ratio between `μ` and `ν`, defined as the function
`x ↦ log (μ.rnDeriv ν x).toReal`.
-/
open Real
open scoped ENNReal NNReal Topology
namespace MeasureTheory
variable {α : Type*} {mα : MeasurableSpace α} {μ ν : Measure α} {f : α → ℝ}
/-- Log-Likelihood Ratio between two measures. -/
noncomputable def llr (μ ν : Measure α) (x : α) : ℝ := log (μ.rnDeriv ν x).toReal
lemma llr_def (μ ν : Measure α) : llr μ ν = fun x ↦ log (μ.rnDeriv ν x).toReal := rfl
lemma llr_self (μ : Measure α) [SigmaFinite μ] : llr μ μ =ᵐ[μ] 0 := by
filter_upwards [μ.rnDeriv_self] with a ha using by simp [llr, ha]
lemma exp_llr (μ ν : Measure α) [SigmaFinite μ] :
(fun x ↦ exp (llr μ ν x))
=ᵐ[ν] fun x ↦ if μ.rnDeriv ν x = 0 then 1 else (μ.rnDeriv ν x).toReal := by
filter_upwards [Measure.rnDeriv_lt_top μ ν] with x hx
by_cases h_zero : μ.rnDeriv ν x = 0
· simp only [llr, h_zero, ENNReal.toReal_zero, log_zero, exp_zero, ite_true]
· rw [llr, exp_log, if_neg h_zero]
exact ENNReal.toReal_pos h_zero hx.ne
lemma exp_llr_of_ac (μ ν : Measure α) [SigmaFinite μ] [Measure.HaveLebesgueDecomposition μ ν]
(hμν : μ ≪ ν) :
(fun x ↦ exp (llr μ ν x)) =ᵐ[μ] fun x ↦ (μ.rnDeriv ν x).toReal := by
filter_upwards [hμν.ae_le (exp_llr μ ν), Measure.rnDeriv_pos hμν] with x hx_eq hx_pos
rw [hx_eq, if_neg hx_pos.ne']
lemma exp_llr_of_ac' (μ ν : Measure α) [SigmaFinite μ] [SigmaFinite ν] (hμν : ν ≪ μ) :
(fun x ↦ exp (llr μ ν x)) =ᵐ[ν] fun x ↦ (μ.rnDeriv ν x).toReal := by
filter_upwards [exp_llr μ ν, Measure.rnDeriv_pos' hμν] with x hx hx_pos
rwa [if_neg hx_pos.ne'] at hx
lemma neg_llr [SigmaFinite μ] [SigmaFinite ν] (hμν : μ ≪ ν) :
-llr μ ν =ᵐ[μ] llr ν μ := by
filter_upwards [Measure.inv_rnDeriv hμν] with x hx
rw [Pi.neg_apply, llr, llr, ← log_inv, ← ENNReal.toReal_inv]
congr
lemma exp_neg_llr [SigmaFinite μ] [SigmaFinite ν] (hμν : μ ≪ ν) :
(fun x ↦ exp (-llr μ ν x)) =ᵐ[μ] fun x ↦ (ν.rnDeriv μ x).toReal := by
filter_upwards [neg_llr hμν, exp_llr_of_ac' ν μ hμν] with x hx hx_exp_log
rw [Pi.neg_apply] at hx
rw [hx, hx_exp_log]
lemma exp_neg_llr' [SigmaFinite μ] [SigmaFinite ν] (hμν : ν ≪ μ) :
(fun x ↦ exp (-llr μ ν x)) =ᵐ[ν] fun x ↦ (ν.rnDeriv μ x).toReal := by
filter_upwards [neg_llr hμν, exp_llr_of_ac ν μ hμν] with x hx hx_exp_log
rw [Pi.neg_apply, neg_eq_iff_eq_neg] at hx
rw [← hx, hx_exp_log]
@[measurability, fun_prop]
lemma measurable_llr (μ ν : Measure α) : Measurable (llr μ ν) :=
(Measure.measurable_rnDeriv μ ν).ennreal_toReal.log
@[measurability]
lemma stronglyMeasurable_llr (μ ν : Measure α) : StronglyMeasurable (llr μ ν) :=
(measurable_llr μ ν).stronglyMeasurable
lemma llr_smul_left [IsFiniteMeasure μ] [Measure.HaveLebesgueDecomposition μ ν]
(hμν : μ ≪ ν) (c : ℝ≥0∞) (hc : c ≠ 0) (hc_ne_top : c ≠ ∞) :
llr (c • μ) ν =ᵐ[μ] fun x ↦ llr μ ν x + log c.toReal := by
simp only [llr, llr_def]
have h := Measure.rnDeriv_smul_left_of_ne_top μ ν hc_ne_top
filter_upwards [hμν.ae_le h, Measure.rnDeriv_pos hμν, hμν.ae_le (Measure.rnDeriv_lt_top μ ν)]
with x hx_eq hx_pos hx_ne_top
rw [hx_eq]
simp only [Pi.smul_apply, smul_eq_mul, ENNReal.toReal_mul]
rw [log_mul]
rotate_left
· rw [ENNReal.toReal_ne_zero]
simp [hc, hc_ne_top]
· rw [ENNReal.toReal_ne_zero]
simp [hx_pos.ne', hx_ne_top.ne]
ring
lemma llr_smul_right [IsFiniteMeasure μ] [Measure.HaveLebesgueDecomposition μ ν]
(hμν : μ ≪ ν) (c : ℝ≥0∞) (hc : c ≠ 0) (hc_ne_top : c ≠ ∞) :
llr μ (c • ν) =ᵐ[μ] fun x ↦ llr μ ν x - log c.toReal := by
simp only [llr, llr_def]
have h := Measure.rnDeriv_smul_right_of_ne_top μ ν hc hc_ne_top
filter_upwards [hμν.ae_le h, Measure.rnDeriv_pos hμν, hμν.ae_le (Measure.rnDeriv_lt_top μ ν)]
with x hx_eq hx_pos hx_ne_top
rw [hx_eq]
simp only [Pi.smul_apply, smul_eq_mul, ENNReal.toReal_mul]
rw [log_mul]
rotate_left
· rw [ENNReal.toReal_ne_zero]
simp [hc, hc_ne_top]
· rw [ENNReal.toReal_ne_zero]
simp [hx_pos.ne', hx_ne_top.ne]
rw [ENNReal.toReal_inv, log_inv]
ring
lemma integrable_rnDeriv_mul_log_iff [SigmaFinite μ] [μ.HaveLebesgueDecomposition ν] (hμν : μ ≪ ν) :
Integrable (fun a ↦ (μ.rnDeriv ν a).toReal * log (μ.rnDeriv ν a).toReal) ν
↔ Integrable (llr μ ν) μ :=
integrable_rnDeriv_smul_iff hμν
lemma integral_rnDeriv_mul_log [SigmaFinite μ] [μ.HaveLebesgueDecomposition ν] (hμν : μ ≪ ν) :
∫ a, (μ.rnDeriv ν a).toReal * log (μ.rnDeriv ν a).toReal ∂ν = ∫ a, llr μ ν a ∂μ := by
simp_rw [← smul_eq_mul, integral_rnDeriv_smul hμν, llr]
section llr_tilted
lemma llr_tilted_left [SigmaFinite μ] [SigmaFinite ν] (hμν : μ ≪ ν)
(hf : Integrable (fun x ↦ exp (f x)) μ) (hfν : AEMeasurable f ν) :
(llr (μ.tilted f) ν) =ᵐ[μ] fun x ↦ f x - log (∫ z, exp (f z) ∂μ) + llr μ ν x := by
cases eq_zero_or_neZero μ with
| inl hμ =>
simp only [hμ, ae_zero, Filter.EventuallyEq, Filter.eventually_bot]
| inr h0 =>
filter_upwards [hμν.ae_le (toReal_rnDeriv_tilted_left μ hfν), Measure.rnDeriv_pos hμν,
hμν.ae_le (Measure.rnDeriv_lt_top μ ν)] with x hx hx_pos hx_lt_top
rw [llr, hx, log_mul, div_eq_mul_inv, log_mul (exp_pos _).ne', log_exp, log_inv, llr,
← sub_eq_add_neg]
· simp only [ne_eq, inv_eq_zero]
exact (integral_exp_pos hf).ne'
· simp only [ne_eq, div_eq_zero_iff]
push_neg
exact ⟨(exp_pos _).ne', (integral_exp_pos hf).ne'⟩
· simp [ENNReal.toReal_eq_zero_iff, hx_lt_top.ne, hx_pos.ne']
lemma integrable_llr_tilted_left [IsFiniteMeasure μ] [SigmaFinite ν]
(hμν : μ ≪ ν) (hf : Integrable f μ) (h_int : Integrable (llr μ ν) μ)
(hfμ : Integrable (fun x ↦ exp (f x)) μ) (hfν : AEMeasurable f ν) :
Integrable (llr (μ.tilted f) ν) μ := by
rw [integrable_congr (llr_tilted_left hμν hfμ hfν)]
exact Integrable.add (hf.sub (integrable_const _)) h_int
lemma integral_llr_tilted_left [IsProbabilityMeasure μ] [SigmaFinite ν]
(hμν : μ ≪ ν) (hf : Integrable f μ) (h_int : Integrable (llr μ ν) μ)
(hfμ : Integrable (fun x ↦ exp (f x)) μ) (hfν : AEMeasurable f ν) :
∫ x, llr (μ.tilted f) ν x ∂μ = ∫ x, llr μ ν x ∂μ + ∫ x, f x ∂μ - log (∫ x, exp (f x) ∂μ) := by
calc ∫ x, llr (μ.tilted f) ν x ∂μ
= ∫ x, f x - log (∫ x, exp (f x) ∂μ) + llr μ ν x ∂μ :=
integral_congr_ae (llr_tilted_left hμν hfμ hfν)
_ = ∫ x, f x ∂μ - log (∫ x, exp (f x) ∂μ) + ∫ x, llr μ ν x ∂μ := by
rw [integral_add ?_ h_int]
swap; · exact hf.sub (integrable_const _)
rw [integral_sub hf (integrable_const _)]
simp only [integral_const, measureReal_univ_eq_one, smul_eq_mul, one_mul]
_ = ∫ x, llr μ ν x ∂μ + ∫ x, f x ∂μ - log (∫ x, exp (f x) ∂μ) := by abel
lemma llr_tilted_right [SigmaFinite μ] [SigmaFinite ν]
(hμν : μ ≪ ν) (hf : Integrable (fun x ↦ exp (f x)) ν) :
(llr μ (ν.tilted f)) =ᵐ[μ] fun x ↦ -f x + log (∫ z, exp (f z) ∂ν) + llr μ ν x := by
cases eq_zero_or_neZero ν with
| inl h =>
have hμ : μ = 0 := by ext s _; exact hμν (by simp [h])
simp only [hμ, ae_zero, Filter.EventuallyEq, Filter.eventually_bot]
| inr h0 =>
filter_upwards [hμν.ae_le (toReal_rnDeriv_tilted_right μ ν hf), Measure.rnDeriv_pos hμν,
hμν.ae_le (Measure.rnDeriv_lt_top μ ν)] with x hx hx_pos hx_lt_top
rw [llr, hx, log_mul, log_mul (exp_pos _).ne', log_exp, llr]
· exact (integral_exp_pos hf).ne'
· refine (mul_pos (exp_pos _) (integral_exp_pos hf)).ne'
· simp [ENNReal.toReal_eq_zero_iff, hx_lt_top.ne, hx_pos.ne']
lemma integrable_llr_tilted_right [IsFiniteMeasure μ] [SigmaFinite ν]
(hμν : μ ≪ ν) (hfμ : Integrable f μ)
(h_int : Integrable (llr μ ν) μ) (hfν : Integrable (fun x ↦ exp (f x)) ν) :
Integrable (llr μ (ν.tilted f)) μ := by
rw [integrable_congr (llr_tilted_right hμν hfν)]
exact Integrable.add (hfμ.neg.add (integrable_const _)) h_int
lemma integral_llr_tilted_right [IsProbabilityMeasure μ] [SigmaFinite ν]
(hμν : μ ≪ ν) (hfμ : Integrable f μ) (hfν : Integrable (fun x ↦ exp (f x)) ν)
(h_int : Integrable (llr μ ν) μ) :
∫ x, llr μ (ν.tilted f) x ∂μ = ∫ x, llr μ ν x ∂μ - ∫ x, f x ∂μ + log (∫ x, exp (f x) ∂ν) := by
calc ∫ x, llr μ (ν.tilted f) x ∂μ
= ∫ x, -f x + log (∫ x, exp (f x) ∂ν) + llr μ ν x ∂μ :=
integral_congr_ae (llr_tilted_right hμν hfν)
_ = -∫ x, f x ∂μ + log (∫ x, exp (f x) ∂ν) + ∫ x, llr μ ν x ∂μ := by
rw [← integral_neg, integral_add ?_ h_int]
swap; · exact hfμ.neg.add (integrable_const _)
rw [integral_add ?_ (integrable_const _)]
swap; · exact hfμ.neg
simp only [integral_const, measureReal_univ_eq_one, smul_eq_mul, one_mul]
_ = ∫ x, llr μ ν x ∂μ - ∫ x, f x ∂μ + log (∫ x, exp (f x) ∂ν) := by abel
end llr_tilted
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Map.lean | import Mathlib.MeasureTheory.MeasurableSpace.Embedding
import Mathlib.MeasureTheory.Measure.MeasureSpace
/-!
# Pushforward of a measure
In this file we define the pushforward `MeasureTheory.Measure.map f μ`
of a measure `μ` along an almost everywhere measurable map `f`.
If `f` is not a.e. measurable, then we define `map f μ` to be zero.
## Main definitions
* `MeasureTheory.Measure.map f μ`: map of the measure `μ` along the map `f`.
## Main statements
* `map_apply`: for `s` a measurable set, `μ.map f s = μ (f ⁻¹' s)`
* `map_map`: `(μ.map f).map g = μ.map (g ∘ f)`
-/
variable {α β γ : Type*}
open Set Function ENNReal NNReal
open Filter hiding map
namespace MeasureTheory
variable {mα : MeasurableSpace α} {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ}
{μ ν : Measure α} {s : Set α}
namespace Measure
/-- Lift a linear map between `OuterMeasure` spaces such that for each measure `μ` every measurable
set is caratheodory-measurable w.r.t. `f μ` to a linear map between `Measure` spaces. -/
noncomputable
def liftLinear [MeasurableSpace β] (f : OuterMeasure α →ₗ[ℝ≥0∞] OuterMeasure β)
(hf : ∀ μ : Measure α, ‹_› ≤ (f μ.toOuterMeasure).caratheodory) :
Measure α →ₗ[ℝ≥0∞] Measure β where
toFun μ := (f μ.toOuterMeasure).toMeasure (hf μ)
map_add' μ₁ μ₂ := ext fun s hs => by
simp only [map_add, coe_add, Pi.add_apply, toMeasure_apply, add_toOuterMeasure,
OuterMeasure.coe_add, hs]
map_smul' c μ := ext fun s hs => by
simp only [LinearMap.map_smulₛₗ, Pi.smul_apply,
toMeasure_apply, smul_toOuterMeasure (R := ℝ≥0∞), OuterMeasure.coe_smul (R := ℝ≥0∞),
smul_apply, hs]
lemma liftLinear_apply₀ {f : OuterMeasure α →ₗ[ℝ≥0∞] OuterMeasure β} (hf) {s : Set β}
(hs : NullMeasurableSet s (liftLinear f hf μ)) : liftLinear f hf μ s = f μ.toOuterMeasure s :=
toMeasure_apply₀ _ (hf μ) hs
@[simp]
theorem liftLinear_apply {f : OuterMeasure α →ₗ[ℝ≥0∞] OuterMeasure β} (hf) {s : Set β}
(hs : MeasurableSet s) : liftLinear f hf μ s = f μ.toOuterMeasure s :=
toMeasure_apply _ (hf μ) hs
theorem le_liftLinear_apply {f : OuterMeasure α →ₗ[ℝ≥0∞] OuterMeasure β} (hf) (s : Set β) :
f μ.toOuterMeasure s ≤ liftLinear f hf μ s :=
le_toMeasure_apply _ (hf μ) s
open Classical in
/-- The pushforward of a measure as a linear map. It is defined to be `0` if `f` is not
a measurable function. -/
noncomputable
def mapₗ [MeasurableSpace α] [MeasurableSpace β] (f : α → β) : Measure α →ₗ[ℝ≥0∞] Measure β :=
if hf : Measurable f then
liftLinear (OuterMeasure.map f) fun μ _s hs t =>
le_toOuterMeasure_caratheodory μ _ (hf hs) (f ⁻¹' t)
else 0
theorem mapₗ_congr {f g : α → β} (hf : Measurable f) (hg : Measurable g) (h : f =ᵐ[μ] g) :
mapₗ f μ = mapₗ g μ := by
ext1 s hs
simpa only [mapₗ, hf, hg, hs, dif_pos, liftLinear_apply, OuterMeasure.map_apply]
using measure_congr (h.preimage s)
open Classical in
/-- The pushforward of a measure. It is defined to be `0` if `f` is not an almost everywhere
measurable function. -/
noncomputable
irreducible_def map [MeasurableSpace α] [MeasurableSpace β] (f : α → β) (μ : Measure α) :
Measure β :=
if hf : AEMeasurable f μ then mapₗ (hf.mk f) μ else 0
theorem mapₗ_mk_apply_of_aemeasurable {f : α → β} (hf : AEMeasurable f μ) :
mapₗ (hf.mk f) μ = map f μ := by simp [map, hf]
theorem mapₗ_apply_of_measurable {f : α → β} (hf : Measurable f) (μ : Measure α) :
mapₗ f μ = map f μ := by
simp only [← mapₗ_mk_apply_of_aemeasurable hf.aemeasurable]
exact mapₗ_congr hf hf.aemeasurable.measurable_mk hf.aemeasurable.ae_eq_mk
@[simp]
protected theorem map_add (μ ν : Measure α) {f : α → β} (hf : Measurable f) :
(μ + ν).map f = μ.map f + ν.map f := by simp [← mapₗ_apply_of_measurable hf]
@[simp]
protected theorem map_zero (f : α → β) : (0 : Measure α).map f = 0 := by
by_cases hf : AEMeasurable f (0 : Measure α) <;> simp [map, hf]
@[simp]
theorem map_of_not_aemeasurable {f : α → β} {μ : Measure α} (hf : ¬AEMeasurable f μ) :
μ.map f = 0 := by simp [map, hf]
theorem _root_.AEMeasurable.of_map_ne_zero {f : α → β} {μ : Measure α} (hf : μ.map f ≠ 0) :
AEMeasurable f μ := not_imp_comm.1 map_of_not_aemeasurable hf
theorem map_congr {f g : α → β} (h : f =ᵐ[μ] g) : Measure.map f μ = Measure.map g μ := by
by_cases hf : AEMeasurable f μ
· have hg : AEMeasurable g μ := hf.congr h
simp only [← mapₗ_mk_apply_of_aemeasurable hf, ← mapₗ_mk_apply_of_aemeasurable hg]
exact
mapₗ_congr hf.measurable_mk hg.measurable_mk (hf.ae_eq_mk.symm.trans (h.trans hg.ae_eq_mk))
· have hg : ¬AEMeasurable g μ := by simpa [← aemeasurable_congr h] using hf
simp [map_of_not_aemeasurable, hf, hg]
@[simp]
protected theorem map_smul {R : Type*} [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
(c : R) (μ : Measure α) (f : α → β) : (c • μ).map f = c • μ.map f := by
suffices ∀ c : ℝ≥0∞, (c • μ).map f = c • μ.map f by simpa using this (c • 1)
clear c; intro c
rcases eq_or_ne c 0 with (rfl | hc); · simp
by_cases hf : AEMeasurable f μ
· have hfc : AEMeasurable f (c • μ) :=
⟨hf.mk f, hf.measurable_mk, (ae_smul_measure_iff hc).2 hf.ae_eq_mk⟩
simp only [← mapₗ_mk_apply_of_aemeasurable hf, ← mapₗ_mk_apply_of_aemeasurable hfc,
LinearMap.map_smulₛₗ, RingHom.id_apply]
congr 1
apply mapₗ_congr hfc.measurable_mk hf.measurable_mk
exact EventuallyEq.trans ((ae_smul_measure_iff hc).1 hfc.ae_eq_mk.symm) hf.ae_eq_mk
· have hfc : ¬AEMeasurable f (c • μ) := by
intro hfc
exact hf ⟨hfc.mk f, hfc.measurable_mk, (ae_smul_measure_iff hc).1 hfc.ae_eq_mk⟩
simp [map_of_not_aemeasurable hf, map_of_not_aemeasurable hfc]
variable {f : α → β}
lemma map_apply₀ {f : α → β} (hf : AEMeasurable f μ) {s : Set β}
(hs : NullMeasurableSet s (map f μ)) : μ.map f s = μ (f ⁻¹' s) := by
rw [map, dif_pos hf, mapₗ, dif_pos hf.measurable_mk] at hs ⊢
rw [liftLinear_apply₀ _ hs, measure_congr (hf.ae_eq_mk.preimage s)]
rfl
/-- We can evaluate the pushforward on measurable sets. For non-measurable sets, see
`MeasureTheory.Measure.le_map_apply` and `MeasurableEquiv.map_apply`. -/
@[simp]
theorem map_apply_of_aemeasurable (hf : AEMeasurable f μ) {s : Set β} (hs : MeasurableSet s) :
μ.map f s = μ (f ⁻¹' s) := map_apply₀ hf hs.nullMeasurableSet
@[simp]
theorem map_apply (hf : Measurable f) {s : Set β} (hs : MeasurableSet s) :
μ.map f s = μ (f ⁻¹' s) :=
map_apply_of_aemeasurable hf.aemeasurable hs
theorem map_toOuterMeasure (hf : AEMeasurable f μ) :
(μ.map f).toOuterMeasure = (OuterMeasure.map f μ.toOuterMeasure).trim := by
rw [← trimmed, OuterMeasure.trim_eq_trim_iff]
intro s hs
simp [hf, hs]
@[simp] lemma map_eq_zero_iff (hf : AEMeasurable f μ) : μ.map f = 0 ↔ μ = 0 := by
simp_rw [← measure_univ_eq_zero, map_apply_of_aemeasurable hf .univ, preimage_univ]
@[simp] lemma mapₗ_eq_zero_iff (hf : Measurable f) : Measure.mapₗ f μ = 0 ↔ μ = 0 := by
rw [mapₗ_apply_of_measurable hf, map_eq_zero_iff hf.aemeasurable]
/-- If `map f μ = μ`, then the measure of the preimage of any null measurable set `s`
is equal to the measure of `s`.
Note that this lemma does not assume (a.e.) measurability of `f`. -/
lemma measure_preimage_of_map_eq_self {f : α → α} (hf : map f μ = μ)
{s : Set α} (hs : NullMeasurableSet s μ) : μ (f ⁻¹' s) = μ s := by
if hfm : AEMeasurable f μ then
rw [← map_apply₀ hfm, hf]
rwa [hf]
else
rw [map_of_not_aemeasurable hfm] at hf
simp [← hf]
lemma map_ne_zero_iff (hf : AEMeasurable f μ) : μ.map f ≠ 0 ↔ μ ≠ 0 := (map_eq_zero_iff hf).not
lemma mapₗ_ne_zero_iff (hf : Measurable f) : Measure.mapₗ f μ ≠ 0 ↔ μ ≠ 0 :=
(mapₗ_eq_zero_iff hf).not
@[simp]
theorem map_id : map id μ = μ :=
ext fun _ => map_apply measurable_id
@[simp]
theorem map_id' : map (fun x => x) μ = μ :=
map_id
/-- Mapping a measure twice is the same as mapping the measure with the composition. This version is
for measurable functions. See `map_map_of_aemeasurable` when they are just ae measurable. -/
theorem map_map {g : β → γ} {f : α → β} (hg : Measurable g) (hf : Measurable f) :
(μ.map f).map g = μ.map (g ∘ f) :=
ext fun s hs => by simp [hf, hg, hs, hg hs, hg.comp hf, ← preimage_comp]
@[mono]
theorem map_mono {f : α → β} (h : μ ≤ ν) (hf : Measurable f) : μ.map f ≤ ν.map f :=
le_iff.2 fun s hs ↦ by simp [hf.aemeasurable, hs, h _]
/-- Even if `s` is not measurable, we can bound `map f μ s` from below.
See also `MeasurableEquiv.map_apply`. -/
theorem le_map_apply {f : α → β} (hf : AEMeasurable f μ) (s : Set β) : μ (f ⁻¹' s) ≤ μ.map f s :=
calc
μ (f ⁻¹' s) ≤ μ (f ⁻¹' toMeasurable (μ.map f) s) := by gcongr; apply subset_toMeasurable
_ = μ.map f (toMeasurable (μ.map f) s) :=
(map_apply_of_aemeasurable hf <| measurableSet_toMeasurable _ _).symm
_ = μ.map f s := measure_toMeasurable _
theorem le_map_apply_image {f : α → β} (hf : AEMeasurable f μ) (s : Set α) :
μ s ≤ μ.map f (f '' s) :=
(measure_mono (subset_preimage_image f s)).trans (le_map_apply hf _)
/-- Even if `s` is not measurable, `map f μ s = 0` implies that `μ (f ⁻¹' s) = 0`. -/
theorem preimage_null_of_map_null {f : α → β} (hf : AEMeasurable f μ) {s : Set β}
(hs : μ.map f s = 0) : μ (f ⁻¹' s) = 0 :=
nonpos_iff_eq_zero.mp <| (le_map_apply hf s).trans_eq hs
theorem tendsto_ae_map {f : α → β} (hf : AEMeasurable f μ) : Tendsto f (ae μ) (ae (μ.map f)) :=
fun _ hs => preimage_null_of_map_null hf hs
end Measure
open Measure
theorem mem_ae_map_iff {f : α → β} (hf : AEMeasurable f μ) {s : Set β} (hs : MeasurableSet s) :
s ∈ ae (μ.map f) ↔ f ⁻¹' s ∈ ae μ := by
simp only [mem_ae_iff, map_apply_of_aemeasurable hf hs.compl, preimage_compl]
theorem mem_ae_of_mem_ae_map {f : α → β} (hf : AEMeasurable f μ) {s : Set β}
(hs : s ∈ ae (μ.map f)) : f ⁻¹' s ∈ ae μ :=
(tendsto_ae_map hf).eventually hs
theorem ae_map_iff {f : α → β} (hf : AEMeasurable f μ) {p : β → Prop}
(hp : MeasurableSet { x | p x }) : (∀ᵐ y ∂μ.map f, p y) ↔ ∀ᵐ x ∂μ, p (f x) :=
mem_ae_map_iff hf hp
theorem ae_of_ae_map {f : α → β} (hf : AEMeasurable f μ) {p : β → Prop} (h : ∀ᵐ y ∂μ.map f, p y) :
∀ᵐ x ∂μ, p (f x) :=
mem_ae_of_mem_ae_map hf h
theorem ae_map_mem_range {m0 : MeasurableSpace α} (f : α → β) (hf : MeasurableSet (range f))
(μ : Measure α) : ∀ᵐ x ∂μ.map f, x ∈ range f := by
by_cases h : AEMeasurable f μ
· change range f ∈ ae (μ.map f)
rw [mem_ae_map_iff h hf]
filter_upwards using mem_range_self
· simp [map_of_not_aemeasurable h]
end MeasureTheory
namespace MeasurableEmbedding
open MeasureTheory Measure
variable {m0 : MeasurableSpace α} {m1 : MeasurableSpace β} {f : α → β} {μ ν : Measure α}
nonrec theorem map_apply (hf : MeasurableEmbedding f) (μ : Measure α) (s : Set β) :
μ.map f s = μ (f ⁻¹' s) := by
refine le_antisymm ?_ (le_map_apply hf.measurable.aemeasurable s)
set t := f '' toMeasurable μ (f ⁻¹' s) ∪ (range f)ᶜ
have htm : MeasurableSet t :=
(hf.measurableSet_image.2 <| measurableSet_toMeasurable _ _).union
hf.measurableSet_range.compl
have hst : s ⊆ t := by
rw [subset_union_compl_iff_inter_subset, ← image_preimage_eq_inter_range]
exact image_mono (subset_toMeasurable _ _)
have hft : f ⁻¹' t = toMeasurable μ (f ⁻¹' s) := by
rw [preimage_union, preimage_compl, preimage_range, compl_univ, union_empty,
hf.injective.preimage_image]
calc
μ.map f s ≤ μ.map f t := by gcongr
_ = μ (f ⁻¹' s) := by rw [map_apply hf.measurable htm, hft, measure_toMeasurable]
end MeasurableEmbedding
namespace MeasurableEquiv
/-! Interactions of measurable equivalences and measures -/
open Equiv MeasureTheory MeasureTheory.Measure
variable {_ : MeasurableSpace α} [MeasurableSpace β] {μ : Measure α} {ν : Measure β}
/-- If we map a measure along a measurable equivalence, we can compute the measure on all sets
(not just the measurable ones). -/
protected theorem map_apply (f : α ≃ᵐ β) (s : Set β) : μ.map f s = μ (f ⁻¹' s) :=
f.measurableEmbedding.map_apply _ _
@[simp]
theorem map_symm_map (e : α ≃ᵐ β) : (μ.map e).map e.symm = μ := by
simp [map_map e.symm.measurable e.measurable]
@[simp]
theorem map_map_symm (e : α ≃ᵐ β) : (ν.map e.symm).map e = ν := by
simp [map_map e.measurable e.symm.measurable]
theorem map_measurableEquiv_injective (e : α ≃ᵐ β) : Injective (Measure.map e) := by
intro μ₁ μ₂ hμ
apply_fun Measure.map e.symm at hμ
simpa [map_symm_map e] using hμ
theorem map_apply_eq_iff_map_symm_apply_eq (e : α ≃ᵐ β) : μ.map e = ν ↔ μ = ν.map e.symm := by
rw [← (map_measurableEquiv_injective e).eq_iff, map_map_symm]
theorem map_ae (f : α ≃ᵐ β) (μ : Measure α) : Filter.map f (ae μ) = ae (map f μ) := by
ext s
simp_rw [mem_map, mem_ae_iff, ← preimage_compl, f.map_apply]
end MeasurableEquiv |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/FiniteMeasureProd.lean | import Mathlib.MeasureTheory.Measure.LevyProkhorovMetric
import Mathlib.MeasureTheory.Measure.Prod
/-!
# Products of finite measures and probability measures
This file introduces binary products of finite measures and probability measures. The constructions
are obtained from special cases of products of general measures. Taking products nevertheless has
specific properties in the cases of finite measures and probability measures, notably the fact that
the product measures depend continuously on their factors in the topology of weak convergence when
the underlying space is metrizable and separable.
## Main definitions
* `MeasureTheory.FiniteMeasure.prod`: The product of two finite measures.
* `MeasureTheory.ProbabilityMeasure.prod`: The product of two probability measures.
## Main results
`MeasureTheory.ProbabilityMeasure.continuous_prod`: the product probability measure depends
continuously on the factors.
-/
open MeasureTheory Topology Metric Filter Set ENNReal NNReal
open scoped Topology ENNReal NNReal BoundedContinuousFunction
namespace MeasureTheory
section FiniteMeasure_product
namespace FiniteMeasure
variable {α : Type*} [MeasurableSpace α] {β : Type*} [MeasurableSpace β]
/-- The binary product of finite measures. -/
noncomputable def prod (μ : FiniteMeasure α) (ν : FiniteMeasure β) : FiniteMeasure (α × β) :=
⟨μ.toMeasure.prod ν.toMeasure, inferInstance⟩
variable (μ : FiniteMeasure α) (ν : FiniteMeasure β)
@[simp] lemma toMeasure_prod : (μ.prod ν).toMeasure = μ.toMeasure.prod ν.toMeasure := rfl
lemma prod_apply (s : Set (α × β)) (s_mble : MeasurableSet s) :
μ.prod ν s = ENNReal.toNNReal (∫⁻ x, ν.toMeasure (Prod.mk x ⁻¹' s) ∂μ) := by
simp [coeFn_def, Measure.prod_apply s_mble]
lemma prod_apply_symm (s : Set (α × β)) (s_mble : MeasurableSet s) :
μ.prod ν s = ENNReal.toNNReal (∫⁻ y, μ.toMeasure ((fun x ↦ ⟨x, y⟩) ⁻¹' s) ∂ν) := by
simp [coeFn_def, Measure.prod_apply_symm s_mble]
@[simp] lemma prod_prod (s : Set α) (t : Set β) : μ.prod ν (s ×ˢ t) = μ s * ν t := by
simp [coeFn_def]
@[simp] lemma mass_prod : (μ.prod ν).mass = μ.mass * ν.mass := by
simp only [coeFn_def, mass, univ_prod_univ.symm, toMeasure_prod]
rw [← ENNReal.toNNReal_mul]
exact congr_arg ENNReal.toNNReal (Measure.prod_prod univ univ)
@[simp] lemma zero_prod : (0 : FiniteMeasure α).prod ν = 0 := by
rw [← mass_zero_iff, mass_prod, zero_mass, zero_mul]
@[simp] lemma prod_zero : μ.prod (0 : FiniteMeasure β) = 0 := by
rw [← mass_zero_iff, mass_prod, zero_mass, mul_zero]
@[simp] lemma map_fst_prod : (μ.prod ν).map Prod.fst = ν univ • μ := by ext; simp
@[simp] lemma map_snd_prod : (μ.prod ν).map Prod.snd = μ univ • ν := by ext; simp
lemma map_prod_map {α' : Type*} [MeasurableSpace α'] {β' : Type*} [MeasurableSpace β']
{f : α → α'} {g : β → β'} (f_mble : Measurable f) (g_mble : Measurable g) :
(μ.map f).prod (ν.map g) = (μ.prod ν).map (Prod.map f g) := by
apply Subtype.ext
simp only [val_eq_toMeasure, toMeasure_prod, toMeasure_map]
rw [Measure.map_prod_map _ _ f_mble g_mble]
lemma prod_swap : (μ.prod ν).map Prod.swap = ν.prod μ := by
apply Subtype.ext
simp [Measure.prod_swap]
end FiniteMeasure -- namespace
end FiniteMeasure_product -- section
section ProbabilityMeasure_product
namespace ProbabilityMeasure
variable {α : Type*} [MeasurableSpace α] {β : Type*} [MeasurableSpace β]
/-- The binary product of probability measures. -/
noncomputable def prod (μ : ProbabilityMeasure α) (ν : ProbabilityMeasure β) :
ProbabilityMeasure (α × β) :=
⟨μ.toMeasure.prod ν.toMeasure, by infer_instance⟩
variable (μ : ProbabilityMeasure α) (ν : ProbabilityMeasure β)
@[simp] lemma toMeasure_prod : (μ.prod ν).toMeasure = μ.toMeasure.prod ν.toMeasure := rfl
lemma prod_apply (s : Set (α × β)) (s_mble : MeasurableSet s) :
μ.prod ν s = ENNReal.toNNReal (∫⁻ x, ν.toMeasure (Prod.mk x ⁻¹' s) ∂μ) := by
simp [coeFn_def, Measure.prod_apply s_mble]
lemma prod_apply_symm (s : Set (α × β)) (s_mble : MeasurableSet s) :
μ.prod ν s = ENNReal.toNNReal (∫⁻ y, μ.toMeasure ((fun x ↦ ⟨x, y⟩) ⁻¹' s) ∂ν) := by
simp [coeFn_def, Measure.prod_apply_symm s_mble]
@[simp] lemma prod_prod (s : Set α) (t : Set β) : μ.prod ν (s ×ˢ t) = μ s * ν t := by
simp [coeFn_def]
/-- The first marginal of a product probability measure is the first probability measure. -/
@[simp] lemma map_fst_prod : (μ.prod ν).map measurable_fst.aemeasurable = μ := by
apply Subtype.ext
simp only [val_eq_to_measure, toMeasure_map, toMeasure_prod, Measure.map_fst_prod,
measure_univ, one_smul]
/-- The second marginal of a product probability measure is the second probability measure. -/
@[simp] lemma map_snd_prod : (μ.prod ν).map measurable_snd.aemeasurable = ν := by
apply Subtype.ext
simp only [val_eq_to_measure, toMeasure_map, toMeasure_prod, Measure.map_snd_prod,
measure_univ, one_smul]
lemma map_prod_map {α' : Type*} [MeasurableSpace α'] {β' : Type*} [MeasurableSpace β']
{f : α → α'} {g : β → β'} (f_mble : Measurable f) (g_mble : Measurable g) :
(μ.map f_mble.aemeasurable).prod (ν.map g_mble.aemeasurable)
= (μ.prod ν).map (f_mble.prodMap g_mble).aemeasurable := by
apply Subtype.ext
simp only [val_eq_to_measure, toMeasure_prod, toMeasure_map]
rw [Measure.map_prod_map _ _ f_mble g_mble]
lemma prod_swap : (μ.prod ν).map measurable_swap.aemeasurable = ν.prod μ := by
apply Subtype.ext
simp [Measure.prod_swap]
open TopologicalSpace
/-- The map associating to two probability measures their product is a continuous map. -/
@[fun_prop]
theorem continuous_prod [TopologicalSpace α] [TopologicalSpace β] [SecondCountableTopology α]
[SecondCountableTopology β] [PseudoMetrizableSpace α] [PseudoMetrizableSpace β]
[OpensMeasurableSpace α] [OpensMeasurableSpace β] :
Continuous (fun (μ : ProbabilityMeasure α × ProbabilityMeasure β) ↦ μ.1.prod μ.2) := by
refine continuous_iff_continuousAt.2 (fun μ ↦ ?_)
/- It suffices to check the convergence along elements of a π-system containing arbitrarily
small neighborhoods of any point, by `tendsto_probabilityMeasure_of_tendsto_of_mem`.
We take as a π-system the sets of the form `a ×ˢ b` where `a` and `b` have null frontier. -/
let S : Set (Set (α × β)) := {t | ∃ (a : Set α) (b : Set β),
MeasurableSet a ∧ μ.1 (frontier a) = 0 ∧ MeasurableSet b ∧ μ.2 (frontier b) = 0
∧ t = a ×ˢ b}
have : IsPiSystem S := by
rintro - ⟨a, b, ameas, ha, bmeas, hb, rfl⟩ - ⟨a', b', a'meas, ha', b'meas, hb', rfl⟩ -
refine ⟨a ∩ a', b ∩ b', ameas.inter a'meas, ?_, bmeas.inter b'meas, ?_, prod_inter_prod⟩
· rw [null_iff_toMeasure_null] at ha ha' ⊢
exact null_frontier_inter ha ha'
· rw [null_iff_toMeasure_null] at hb hb' ⊢
exact null_frontier_inter hb hb'
apply this.tendsto_probabilityMeasure_of_tendsto_of_mem
· rintro s ⟨a, b, ameas, -, bmeas, -, rfl⟩
exact ameas.prod bmeas
· letI : PseudoMetricSpace α := TopologicalSpace.pseudoMetrizableSpacePseudoMetric α
letI : PseudoMetricSpace β := TopologicalSpace.pseudoMetrizableSpacePseudoMetric β
intro u u_open x xu
obtain ⟨ε, εpos, hε⟩ : ∃ ε > 0, ball x ε ⊆ u := Metric.isOpen_iff.1 u_open x xu
rcases exists_null_frontier_thickening (μ.1 : Measure α) {x.1} εpos with ⟨r, hr, μr⟩
rcases exists_null_frontier_thickening (μ.2 : Measure β) {x.2} εpos with ⟨r', hr', μr'⟩
simp only [thickening_singleton] at μr μr'
refine ⟨ball x.1 r ×ˢ ball x.2 r', ⟨ball x.1 r, ball x.2 r', measurableSet_ball,
by simp [coeFn_def, μr], measurableSet_ball, by simp [coeFn_def, μr'], rfl⟩, ?_, ?_⟩
· exact (isOpen_ball.prod isOpen_ball).mem_nhds (by simp [hr.1, hr'.1])
· calc ball x.1 r ×ˢ ball x.2 r'
_ ⊆ ball x.1 ε ×ˢ ball x.2 ε := by gcongr; exacts [hr.2.le, hr'.2.le]
_ ⊆ _ := by rwa [ball_prod_same]
· rintro s ⟨a, b, ameas, ha, bmeas, hb, rfl⟩
simp only [prod_prod]
apply Filter.Tendsto.mul
· exact tendsto_measure_of_null_frontier_of_tendsto tendsto_id.fst_nhds ha
· exact tendsto_measure_of_null_frontier_of_tendsto tendsto_id.snd_nhds hb
end ProbabilityMeasure -- namespace
end ProbabilityMeasure_product -- section
end MeasureTheory -- namespace |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Dirac.lean | import Mathlib.MeasureTheory.MeasurableSpace.CountablyGenerated
import Mathlib.MeasureTheory.Measure.MutuallySingular
import Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms
import Mathlib.MeasureTheory.Measure.Typeclasses.Probability
import Mathlib.MeasureTheory.Measure.Typeclasses.SFinite
/-!
# Dirac measure
In this file we define the Dirac measure `MeasureTheory.Measure.dirac a`
and prove some basic facts about it.
-/
open Function Set
open scoped ENNReal
noncomputable section
variable {α β δ : Type*} [MeasurableSpace α] [MeasurableSpace β] {s : Set α} {a : α}
namespace MeasureTheory
namespace Measure
/-- The dirac measure. -/
def dirac (a : α) : Measure α := (OuterMeasure.dirac a).toMeasure (by simp)
instance : MeasureSpace PUnit :=
⟨dirac PUnit.unit⟩
theorem le_dirac_apply {a} : s.indicator 1 a ≤ dirac a s :=
OuterMeasure.dirac_apply a s ▸ le_toMeasure_apply _ _ _
@[simp]
theorem dirac_apply' (a : α) (hs : MeasurableSet s) : dirac a s = s.indicator 1 a :=
toMeasure_apply _ _ hs
theorem dirac_apply_eq_zero_or_one :
dirac a s = 0 ∨ dirac a s = 1 := by
rw [← measure_toMeasurable s, dirac_apply' a (measurableSet_toMeasurable ..), indicator]
simp only [Pi.one_apply, ite_eq_right_iff, one_ne_zero, imp_false, ite_eq_left_iff, zero_ne_one,
not_not]
tauto
@[simp]
theorem dirac_apply_ne_zero_iff_eq_one :
dirac a s ≠ 0 ↔ dirac a s = 1 where
mp := dirac_apply_eq_zero_or_one.resolve_left
mpr := ne_zero_of_eq_one
@[simp]
theorem dirac_apply_ne_one_iff_eq_zero :
dirac a s ≠ 1 ↔ dirac a s = 0 where
mp := dirac_apply_eq_zero_or_one.resolve_right
mpr h := h ▸ zero_ne_one
@[simp]
theorem dirac_apply_of_mem {a : α} (h : a ∈ s) : dirac a s = 1 := by
have : ∀ t : Set α, a ∈ t → t.indicator (1 : α → ℝ≥0∞) a = 1 := fun t ht => indicator_of_mem ht 1
refine le_antisymm (this univ trivial ▸ ?_) (this s h ▸ le_dirac_apply)
rw [← dirac_apply' a MeasurableSet.univ]
exact measure_mono (subset_univ s)
@[simp]
theorem dirac_apply [MeasurableSingletonClass α] (a : α) (s : Set α) :
dirac a s = s.indicator 1 a := by
by_cases h : a ∈ s; · rw [dirac_apply_of_mem h, indicator_of_mem h, Pi.one_apply]
rw [indicator_of_notMem h, ← nonpos_iff_eq_zero]
calc
dirac a s ≤ dirac a {a}ᶜ := measure_mono (subset_compl_comm.1 <| singleton_subset_iff.2 h)
_ = 0 := by simp [dirac_apply' _ (measurableSet_singleton _).compl]
@[simp] lemma dirac_ne_zero : dirac a ≠ 0 :=
fun h ↦ by simpa [h] using dirac_apply_of_mem (mem_univ a)
theorem map_dirac {f : α → β} (hf : Measurable f) (a : α) : (dirac a).map f = dirac (f a) := by
classical
exact ext fun s hs => by simp [hs, map_apply hf hs, hf hs, indicator_apply]
@[simp]
lemma map_const (μ : Measure α) (c : β) : μ.map (fun _ ↦ c) = (μ Set.univ) • dirac c := by
ext s hs
simp only [Measure.coe_smul, Pi.smul_apply,
dirac_apply' _ hs, smul_eq_mul]
classical
rw [Measure.map_apply measurable_const hs, Set.preimage_const]
by_cases hsc : c ∈ s
· rw [(Set.indicator_eq_one_iff_mem _).mpr hsc, mul_one, if_pos hsc]
· rw [if_neg hsc, (Set.indicator_eq_zero_iff_notMem _).mpr hsc, measure_empty, mul_zero]
@[simp]
theorem restrict_singleton (μ : Measure α) (a : α) : μ.restrict {a} = μ {a} • dirac a := by
ext1 s hs
by_cases ha : a ∈ s
· have : s ∩ {a} = {a} := by simpa
simp [*]
· have : s ∩ {a} = ∅ := inter_singleton_eq_empty.2 ha
simp [*]
/-- Two measures on a countable space are equal if they agree on singletons. -/
theorem ext_of_singleton [Countable α] {μ ν : Measure α} (h : ∀ a, μ {a} = ν {a}) : μ = ν :=
ext_of_sUnion_eq_univ (countable_range singleton) (by aesop) (by simp_all)
/-- Two measures on a countable space are equal if and only if they agree on singletons. -/
theorem ext_iff_singleton [Countable α] {μ ν : Measure α} : μ = ν ↔ ∀ a, μ {a} = ν {a} :=
⟨fun h _ ↦ h ▸ rfl, ext_of_singleton⟩
theorem _root_.MeasureTheory.ext_iff_measureReal_singleton [Countable α]
{μ1 μ2 : Measure α} [SigmaFinite μ1] [SigmaFinite μ2] :
μ1 = μ2 ↔ ∀ x, μ1.real {x} = μ2.real {x} := by
rw [Measure.ext_iff_singleton]
congr! with x
rw [measureReal_def, measureReal_def, ENNReal.toReal_eq_toReal_iff]
simp [measure_singleton_lt_top, ne_of_lt]
/-- If `f` is a map with countable codomain, then `μ.map f` is a sum of Dirac measures. -/
theorem map_eq_sum [Countable β] [MeasurableSingletonClass β] (μ : Measure α) (f : α → β)
(hf : Measurable f) : μ.map f = sum fun b : β => μ (f ⁻¹' {b}) • dirac b := by
ext s
have : ∀ y ∈ s, MeasurableSet (f ⁻¹' {y}) := fun y _ => hf (measurableSet_singleton _)
simp [← tsum_measure_preimage_singleton (to_countable s) this, *,
tsum_subtype s fun b => μ (f ⁻¹' {b}), ← indicator_mul_right s fun b => μ (f ⁻¹' {b})]
/-- A measure on a countable type is a sum of Dirac measures. -/
@[simp]
theorem sum_smul_dirac [Countable α] [MeasurableSingletonClass α] (μ : Measure α) :
(sum fun a => μ {a} • dirac a) = μ := by simpa using (map_eq_sum μ id measurable_id).symm
/-- A measure on a countable type is a sum of Dirac measures.
If `α` has measurable singletons, `sum_smul_dirac` gives a simpler sum. -/
lemma exists_sum_smul_dirac [Countable α] (μ : Measure α) :
∃ s : Set α, μ = Measure.sum (fun x : s ↦ μ (measurableAtom x) • dirac (x : α)) := by
let measurableAtoms := measurableAtom '' (Set.univ : Set α)
have h_nonempty (s : measurableAtoms) : Set.Nonempty s.1 := by
obtain ⟨y, _, hy⟩ := s.2
rw [← hy]
exact ⟨y, mem_measurableAtom_self y⟩
let points : measurableAtoms → α := fun s ↦ (h_nonempty s).some
have h_points_mem (s : measurableAtoms) : points s ∈ s.1 := (h_nonempty s).some_mem
refine ⟨Set.range points, ext_of_measurableAtoms fun x ↦ ?_⟩
rw [sum_apply _ (MeasurableSet.measurableAtom_of_countable x)]
simp only [Measure.smul_apply, smul_eq_mul]
simp_rw [dirac_apply' _ (MeasurableSet.measurableAtom_of_countable x)]
rw [tsum_eq_single ⟨points ⟨measurableAtom x, by simp [measurableAtoms]⟩, by simp⟩]
· rw [indicator_of_mem]
· simp only [Pi.one_apply, mul_one]
congr 1
refine (measurableAtom_eq_of_mem ?_).symm
convert h_points_mem _
simp
· convert h_points_mem _
simp
· simp only [ne_eq, mul_eq_zero, indicator_apply_eq_zero, Pi.one_apply, one_ne_zero, imp_false,
Subtype.forall, Set.mem_range, Subtype.exists, Subtype.mk.injEq, forall_exists_index]
refine fun y s hs hsy hyx ↦ .inr fun hyx' ↦ hyx ?_
rw [← hsy]
congr
have h1 : measurableAtom y = measurableAtom x := measurableAtom_eq_of_mem hyx'
have h2 : measurableAtom y = s := by
specialize h_points_mem ⟨s, hs⟩
obtain ⟨z, _, hz⟩ := hs
simp only at h_points_mem
rw [← hz, ← hsy]
refine measurableAtom_eq_of_mem ?_
convert h_points_mem
rw [← h2, h1]
/-- Given that `α` is a countable, measurable space with all singleton sets measurable,
write the measure of a set `s` as the sum of the measure of `{x}` for all `x ∈ s`. -/
theorem tsum_indicator_apply_singleton [Countable α] [MeasurableSingletonClass α] (μ : Measure α)
(s : Set α) (hs : MeasurableSet s) : (∑' x : α, s.indicator (fun x => μ {x}) x) = μ s := by
classical
calc
(∑' x : α, s.indicator (fun x => μ {x}) x) =
Measure.sum (fun a => μ {a} • Measure.dirac a) s := by
simp only [Measure.sum_apply _ hs, Measure.smul_apply, smul_eq_mul, Measure.dirac_apply,
Set.indicator_apply, mul_ite, Pi.one_apply, mul_one, mul_zero]
_ = μ s := by rw [μ.sum_smul_dirac]
end Measure
open Measure
theorem mem_ae_dirac_iff {a : α} (hs : MeasurableSet s) : s ∈ ae (dirac a) ↔ a ∈ s := by
by_cases a ∈ s <;> simp [mem_ae_iff, dirac_apply', hs.compl, *]
theorem ae_dirac_iff {a : α} {p : α → Prop} (hp : MeasurableSet { x | p x }) :
(∀ᵐ x ∂dirac a, p x) ↔ p a :=
mem_ae_dirac_iff hp
@[simp]
theorem ae_dirac_eq [MeasurableSingletonClass α] (a : α) : ae (dirac a) = pure a := by
ext s
simp [mem_ae_iff, imp_false]
theorem ae_eq_dirac' [MeasurableSingletonClass β] {a : α} {f : α → β} (hf : Measurable f) :
f =ᵐ[dirac a] const α (f a) :=
(ae_dirac_iff <| show MeasurableSet (f ⁻¹' {f a}) from hf <| measurableSet_singleton _).2 rfl
theorem ae_eq_dirac [MeasurableSingletonClass α] {a : α} (f : α → δ) :
f =ᵐ[dirac a] const α (f a) := by simp [Filter.EventuallyEq]
@[fun_prop]
lemma aemeasurable_dirac [MeasurableSingletonClass α] {a : α} {f : α → β} :
AEMeasurable f (Measure.dirac a) :=
⟨fun _ ↦ f a, measurable_const, ae_eq_dirac f⟩
instance Measure.dirac.isProbabilityMeasure {x : α} : IsProbabilityMeasure (dirac x) :=
⟨dirac_apply_of_mem <| mem_univ x⟩
instance [hα : Nonempty α] : Nonempty {μ : Measure α // IsProbabilityMeasure μ} :=
⟨Measure.dirac hα.some, inferInstance⟩
/-! Extra instances to short-circuit type class resolution -/
instance Measure.dirac.instIsFiniteMeasure {a : α} : IsFiniteMeasure (dirac a) := inferInstance
instance Measure.dirac.instSigmaFinite {a : α} : SigmaFinite (dirac a) := inferInstance
theorem dirac_eq_one_iff_mem (hs : MeasurableSet s) : dirac a s = 1 ↔ a ∈ s := by
rw [← prob_compl_eq_zero_iff hs, ← mem_ae_iff]
apply mem_ae_dirac_iff hs
theorem dirac_eq_zero_iff_not_mem (hs : MeasurableSet s) : dirac a s = 0 ↔ a ∉ s := by
rw [← compl_compl s, ← mem_ae_iff, notMem_compl_iff]
apply mem_ae_dirac_iff (MeasurableSet.compl_iff.mpr hs)
theorem restrict_dirac' (hs : MeasurableSet s) [Decidable (a ∈ s)] :
(Measure.dirac a).restrict s = if a ∈ s then Measure.dirac a else 0 := by
split_ifs with has
· apply restrict_eq_self_of_ae_mem
rw [ae_dirac_iff] <;> assumption
· rw [restrict_eq_zero, dirac_apply' _ hs, indicator_of_notMem has]
theorem restrict_dirac [MeasurableSingletonClass α] [Decidable (a ∈ s)] :
(Measure.dirac a).restrict s = if a ∈ s then Measure.dirac a else 0 := by
split_ifs with has
· apply restrict_eq_self_of_ae_mem
rwa [ae_dirac_eq]
· rw [restrict_eq_zero, dirac_apply, indicator_of_notMem has]
lemma mutuallySingular_dirac [MeasurableSingletonClass α] (x : α) (μ : Measure α) [NoAtoms μ] :
Measure.dirac x ⟂ₘ μ :=
⟨{x}ᶜ, (MeasurableSet.singleton x).compl, by simp, by simp⟩
section dirac_injective
/-- Dirac delta measures at two points are equal if every measurable set contains either both or
neither of the points. -/
lemma dirac_eq_dirac_iff_forall_mem_iff_mem {x y : α} :
Measure.dirac x = Measure.dirac y ↔ ∀ A, MeasurableSet A → (x ∈ A ↔ y ∈ A) := by
constructor
· intro h A A_mble
have obs := congr_arg (fun μ ↦ μ A) h
simp only [Measure.dirac_apply' _ A_mble] at obs
by_cases x_in_A : x ∈ A
· simpa only [x_in_A, indicator_of_mem, Pi.one_apply, true_iff, Eq.comm (a := (1 : ℝ≥0∞)),
indicator_eq_one_iff_mem] using obs
· simpa only [x_in_A, indicator_of_notMem, Eq.comm (a := (0 : ℝ≥0∞)), indicator_apply_eq_zero,
false_iff, not_false_eq_true, Pi.one_apply, one_ne_zero, imp_false] using obs
· intro h
ext A A_mble
by_cases x_in_A : x ∈ A
· simp only [Measure.dirac_apply' _ A_mble, x_in_A, indicator_of_mem, Pi.one_apply,
(h A A_mble).mp x_in_A]
· have y_notin_A : y ∉ A := by simp_all only [not_false_eq_true]
simp only [Measure.dirac_apply' _ A_mble, x_in_A, y_notin_A,
not_false_eq_true, indicator_of_notMem]
/-- Dirac delta measures at two points are different if and only if there is a measurable set
containing one of the points but not the other. -/
lemma dirac_ne_dirac_iff_exists_measurableSet {x y : α} :
Measure.dirac x ≠ Measure.dirac y ↔ ∃ A, MeasurableSet A ∧ x ∈ A ∧ y ∉ A := by
apply not_iff_not.mp
simp only [ne_eq, not_not, not_exists, not_and, dirac_eq_dirac_iff_forall_mem_iff_mem]
refine ⟨fun h A A_mble ↦ by simp only [h A A_mble, imp_self], fun h A A_mble ↦ ?_⟩
by_cases x_in_A : x ∈ A
· simp only [x_in_A, h A A_mble x_in_A]
· simpa only [x_in_A, false_iff] using h Aᶜ (MeasurableSet.compl_iff.mpr A_mble) x_in_A
open MeasurableSpace
/-- Dirac delta measures at two different points are different, assuming the measurable space
separates points. -/
lemma dirac_ne_dirac [SeparatesPoints α] {x y : α} (x_ne_y : x ≠ y) :
Measure.dirac x ≠ Measure.dirac y := by
obtain ⟨A, A_mble, x_in_A, y_notin_A⟩ := exists_measurableSet_of_ne x_ne_y
exact dirac_ne_dirac_iff_exists_measurableSet.mpr ⟨A, A_mble, x_in_A, y_notin_A⟩
/-- Dirac delta measures at two points are different if and only if the two points are different,
assuming the measurable space separates points. -/
lemma dirac_ne_dirac_iff [SeparatesPoints α] {x y : α} :
Measure.dirac x ≠ Measure.dirac y ↔ x ≠ y :=
⟨fun h x_eq_y ↦ h <| congrArg dirac x_eq_y, fun h ↦ dirac_ne_dirac h⟩
/-- Dirac delta measures at two points are equal if and only if the two points are equal,
assuming the measurable space separates points. -/
lemma dirac_eq_dirac_iff [SeparatesPoints α] {x y : α} :
Measure.dirac x = Measure.dirac y ↔ x = y := not_iff_not.mp dirac_ne_dirac_iff
/-- The assignment `x ↦ dirac x` is injective, assuming the measurable space separates points. -/
lemma injective_dirac [SeparatesPoints α] :
Function.Injective (fun (x : α) ↦ dirac x) := fun x y x_ne_y ↦ by rwa [← dirac_eq_dirac_iff]
end dirac_injective
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Restrict.lean | import Mathlib.MeasureTheory.Measure.Comap
import Mathlib.MeasureTheory.Measure.QuasiMeasurePreserving
import Mathlib.Data.Set.Card
/-!
# Restricting a measure to a subset or a subtype
Given a measure `μ` on a type `α` and a subset `s` of `α`, we define a measure `μ.restrict s` as
the restriction of `μ` to `s` (still as a measure on `α`).
We investigate how this notion interacts with usual operations on measures (sum, pushforward,
pullback), and on sets (inclusion, union, Union).
We also study the relationship between the restriction of a measure to a subtype (given by the
pullback under `Subtype.val`) and the restriction to a set as above.
-/
open scoped ENNReal NNReal Topology
open Set MeasureTheory Measure Filter MeasurableSpace ENNReal Function
variable {R α β δ γ ι : Type*}
namespace MeasureTheory
variable {m0 : MeasurableSpace α} [MeasurableSpace β] [MeasurableSpace γ]
variable {μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α} {s s' t : Set α}
namespace Measure
/-! ### Restricting a measure -/
/-- Restrict a measure `μ` to a set `s` as an `ℝ≥0∞`-linear map. -/
@[irreducible]
noncomputable def restrictₗ {m0 : MeasurableSpace α} (s : Set α) : Measure α →ₗ[ℝ≥0∞] Measure α :=
liftLinear (OuterMeasure.restrict s) fun μ s' hs' t => by
suffices μ (s ∩ t) = μ (s ∩ t ∩ s') + μ ((s ∩ t) \ s') by
simpa [← Set.inter_assoc, Set.inter_comm _ s, ← inter_diff_assoc]
exact le_toOuterMeasure_caratheodory _ _ hs' _
/-- Restrict a measure `μ` to a set `s`. -/
noncomputable def restrict {_m0 : MeasurableSpace α} (μ : Measure α) (s : Set α) : Measure α :=
restrictₗ s μ
@[simp]
theorem restrictₗ_apply {_m0 : MeasurableSpace α} (s : Set α) (μ : Measure α) :
restrictₗ s μ = μ.restrict s :=
rfl
/-- This lemma shows that `restrict` and `toOuterMeasure` commute. Note that the LHS has a
restrict on measures and the RHS has a restrict on outer measures. -/
theorem restrict_toOuterMeasure_eq_toOuterMeasure_restrict (h : MeasurableSet s) :
(μ.restrict s).toOuterMeasure = OuterMeasure.restrict s μ.toOuterMeasure := by
simp_rw [restrict, restrictₗ, liftLinear, LinearMap.coe_mk, AddHom.coe_mk,
toMeasure_toOuterMeasure, OuterMeasure.restrict_trim h, μ.trimmed]
theorem restrict_apply₀ (ht : NullMeasurableSet t (μ.restrict s)) : μ.restrict s t = μ (t ∩ s) := by
rw [restrict, restrictₗ] at ht
rw [← restrictₗ_apply, restrictₗ, liftLinear_apply₀ _ ht, OuterMeasure.restrict_apply,
coe_toOuterMeasure]
/-- If `t` is a measurable set, then the measure of `t` with respect to the restriction of
the measure to `s` equals the outer measure of `t ∩ s`. An alternate version requiring that `s`
be measurable instead of `t` exists as `Measure.restrict_apply'`. -/
@[simp]
theorem restrict_apply (ht : MeasurableSet t) : μ.restrict s t = μ (t ∩ s) :=
restrict_apply₀ ht.nullMeasurableSet
/-- Restriction of a measure to a subset is monotone both in set and in measure. -/
theorem restrict_mono' {_m0 : MeasurableSpace α} ⦃s s' : Set α⦄ ⦃μ ν : Measure α⦄ (hs : s ≤ᵐ[μ] s')
(hμν : μ ≤ ν) : μ.restrict s ≤ ν.restrict s' :=
Measure.le_iff.2 fun t ht => calc
μ.restrict s t = μ (t ∩ s) := restrict_apply ht
_ ≤ μ (t ∩ s') := (measure_mono_ae <| hs.mono fun _x hx ⟨hxt, hxs⟩ => ⟨hxt, hx hxs⟩)
_ ≤ ν (t ∩ s') := le_iff'.1 hμν (t ∩ s')
_ = ν.restrict s' t := (restrict_apply ht).symm
/-- Restriction of a measure to a subset is monotone both in set and in measure. -/
@[mono, gcongr]
theorem restrict_mono {_m0 : MeasurableSpace α} ⦃s s' : Set α⦄ (hs : s ⊆ s') ⦃μ ν : Measure α⦄
(hμν : μ ≤ ν) : μ.restrict s ≤ ν.restrict s' :=
restrict_mono' (ae_of_all _ hs) hμν
theorem restrict_mono_measure {_ : MeasurableSpace α} {μ ν : Measure α} (h : μ ≤ ν) (s : Set α) :
μ.restrict s ≤ ν.restrict s :=
restrict_mono subset_rfl h
theorem restrict_mono_set {_ : MeasurableSpace α} (μ : Measure α) {s t : Set α} (h : s ⊆ t) :
μ.restrict s ≤ μ.restrict t :=
restrict_mono h le_rfl
theorem restrict_mono_ae (h : s ≤ᵐ[μ] t) : μ.restrict s ≤ μ.restrict t :=
restrict_mono' h (le_refl μ)
theorem restrict_congr_set (h : s =ᵐ[μ] t) : μ.restrict s = μ.restrict t :=
le_antisymm (restrict_mono_ae h.le) (restrict_mono_ae h.symm.le)
/-- If `s` is a measurable set, then the outer measure of `t` with respect to the restriction of
the measure to `s` equals the outer measure of `t ∩ s`. This is an alternate version of
`Measure.restrict_apply`, requiring that `s` is measurable instead of `t`. -/
@[simp]
theorem restrict_apply' (hs : MeasurableSet s) : μ.restrict s t = μ (t ∩ s) := by
rw [← toOuterMeasure_apply,
Measure.restrict_toOuterMeasure_eq_toOuterMeasure_restrict hs,
OuterMeasure.restrict_apply s t _, toOuterMeasure_apply]
theorem restrict_apply₀' (hs : NullMeasurableSet s μ) : μ.restrict s t = μ (t ∩ s) := by
rw [← restrict_congr_set hs.toMeasurable_ae_eq,
restrict_apply' (measurableSet_toMeasurable _ _),
measure_congr ((ae_eq_refl t).inter hs.toMeasurable_ae_eq)]
theorem restrict_le_self : μ.restrict s ≤ μ :=
Measure.le_iff.2 fun t ht => calc
μ.restrict s t = μ (t ∩ s) := restrict_apply ht
_ ≤ μ t := measure_mono inter_subset_left
theorem absolutelyContinuous_restrict : μ.restrict s ≪ μ :=
Measure.absolutelyContinuous_of_le Measure.restrict_le_self
variable (μ)
theorem restrict_eq_self (h : s ⊆ t) : μ.restrict t s = μ s :=
(le_iff'.1 restrict_le_self s).antisymm <|
calc
μ s ≤ μ (toMeasurable (μ.restrict t) s ∩ t) :=
measure_mono (subset_inter (subset_toMeasurable _ _) h)
_ = μ.restrict t s := by
rw [← restrict_apply (measurableSet_toMeasurable _ _), measure_toMeasurable]
@[simp]
theorem restrict_apply_self (s : Set α) : (μ.restrict s) s = μ s :=
restrict_eq_self μ Subset.rfl
variable {μ}
theorem restrict_apply_univ (s : Set α) : μ.restrict s univ = μ s := by
rw [restrict_apply MeasurableSet.univ, Set.univ_inter]
theorem le_restrict_apply (s t : Set α) : μ (t ∩ s) ≤ μ.restrict s t :=
calc
μ (t ∩ s) = μ.restrict s (t ∩ s) := (restrict_eq_self μ inter_subset_right).symm
_ ≤ μ.restrict s t := measure_mono inter_subset_left
theorem restrict_apply_le (s t : Set α) : μ.restrict s t ≤ μ t :=
Measure.le_iff'.1 restrict_le_self _
theorem restrict_apply_superset (h : s ⊆ t) : μ.restrict s t = μ s :=
((measure_mono (subset_univ _)).trans_eq <| restrict_apply_univ _).antisymm
((restrict_apply_self μ s).symm.trans_le <| measure_mono h)
@[simp]
theorem restrict_add {_m0 : MeasurableSpace α} (μ ν : Measure α) (s : Set α) :
(μ + ν).restrict s = μ.restrict s + ν.restrict s :=
(restrictₗ s).map_add μ ν
@[simp]
theorem restrict_zero {_m0 : MeasurableSpace α} (s : Set α) : (0 : Measure α).restrict s = 0 :=
(restrictₗ s).map_zero
@[simp]
theorem restrict_smul {_m0 : MeasurableSpace α} {R : Type*} [SMul R ℝ≥0∞]
[IsScalarTower R ℝ≥0∞ ℝ≥0∞] (c : R) (μ : Measure α) (s : Set α) :
(c • μ).restrict s = c • μ.restrict s := by
simpa only [smul_one_smul] using (restrictₗ s).map_smul (c • 1) μ
theorem restrict_restrict₀ (hs : NullMeasurableSet s (μ.restrict t)) :
(μ.restrict t).restrict s = μ.restrict (s ∩ t) :=
ext fun u hu => by
simp only [Set.inter_assoc, restrict_apply hu,
restrict_apply₀ (hu.nullMeasurableSet.inter hs)]
@[simp]
theorem restrict_restrict (hs : MeasurableSet s) : (μ.restrict t).restrict s = μ.restrict (s ∩ t) :=
restrict_restrict₀ hs.nullMeasurableSet
theorem restrict_restrict_of_subset (h : s ⊆ t) : (μ.restrict t).restrict s = μ.restrict s := by
ext1 u hu
rw [restrict_apply hu, restrict_apply hu, restrict_eq_self]
exact inter_subset_right.trans h
theorem restrict_restrict₀' (ht : NullMeasurableSet t μ) :
(μ.restrict t).restrict s = μ.restrict (s ∩ t) :=
ext fun u hu => by simp only [restrict_apply hu, restrict_apply₀' ht, inter_assoc]
theorem restrict_restrict' (ht : MeasurableSet t) :
(μ.restrict t).restrict s = μ.restrict (s ∩ t) :=
restrict_restrict₀' ht.nullMeasurableSet
theorem restrict_comm (hs : MeasurableSet s) :
(μ.restrict t).restrict s = (μ.restrict s).restrict t := by
rw [restrict_restrict hs, restrict_restrict' hs, inter_comm]
theorem restrict_apply_eq_zero (ht : MeasurableSet t) : μ.restrict s t = 0 ↔ μ (t ∩ s) = 0 := by
rw [restrict_apply ht]
theorem measure_inter_eq_zero_of_restrict (h : μ.restrict s t = 0) : μ (t ∩ s) = 0 :=
nonpos_iff_eq_zero.1 (h ▸ le_restrict_apply _ _)
theorem restrict_apply_eq_zero' (hs : MeasurableSet s) : μ.restrict s t = 0 ↔ μ (t ∩ s) = 0 := by
rw [restrict_apply' hs]
@[simp]
theorem restrict_eq_zero : μ.restrict s = 0 ↔ μ s = 0 := by
rw [← measure_univ_eq_zero, restrict_apply_univ]
/-- If `μ s ≠ 0`, then `μ.restrict s ≠ 0`, in terms of `NeZero` instances. -/
instance restrict.neZero [NeZero (μ s)] : NeZero (μ.restrict s) :=
⟨mt restrict_eq_zero.mp <| NeZero.ne _⟩
theorem restrict_zero_set {s : Set α} (h : μ s = 0) : μ.restrict s = 0 :=
restrict_eq_zero.2 h
@[simp]
theorem restrict_empty : μ.restrict ∅ = 0 :=
restrict_zero_set measure_empty
@[simp]
theorem restrict_univ : μ.restrict univ = μ :=
ext fun s hs => by simp [hs]
theorem restrict_inter_add_diff₀ (s : Set α) (ht : NullMeasurableSet t μ) :
μ.restrict (s ∩ t) + μ.restrict (s \ t) = μ.restrict s := by
ext1 u hu
simp only [add_apply, restrict_apply hu, ← inter_assoc, diff_eq]
exact measure_inter_add_diff₀ (u ∩ s) ht
theorem restrict_inter_add_diff (s : Set α) (ht : MeasurableSet t) :
μ.restrict (s ∩ t) + μ.restrict (s \ t) = μ.restrict s :=
restrict_inter_add_diff₀ s ht.nullMeasurableSet
theorem restrict_union_add_inter₀ (s : Set α) (ht : NullMeasurableSet t μ) :
μ.restrict (s ∪ t) + μ.restrict (s ∩ t) = μ.restrict s + μ.restrict t := by
rw [← restrict_inter_add_diff₀ (s ∪ t) ht, union_inter_cancel_right, union_diff_right, ←
restrict_inter_add_diff₀ s ht, add_comm, ← add_assoc, add_right_comm]
theorem restrict_union_add_inter (s : Set α) (ht : MeasurableSet t) :
μ.restrict (s ∪ t) + μ.restrict (s ∩ t) = μ.restrict s + μ.restrict t :=
restrict_union_add_inter₀ s ht.nullMeasurableSet
theorem restrict_union_add_inter' (hs : MeasurableSet s) (t : Set α) :
μ.restrict (s ∪ t) + μ.restrict (s ∩ t) = μ.restrict s + μ.restrict t := by
simpa only [union_comm, inter_comm, add_comm] using restrict_union_add_inter t hs
theorem restrict_union₀ (h : AEDisjoint μ s t) (ht : NullMeasurableSet t μ) :
μ.restrict (s ∪ t) = μ.restrict s + μ.restrict t := by
simp [← restrict_union_add_inter₀ s ht, restrict_zero_set h]
theorem restrict_union (h : Disjoint s t) (ht : MeasurableSet t) :
μ.restrict (s ∪ t) = μ.restrict s + μ.restrict t :=
restrict_union₀ h.aedisjoint ht.nullMeasurableSet
theorem restrict_union' (h : Disjoint s t) (hs : MeasurableSet s) :
μ.restrict (s ∪ t) = μ.restrict s + μ.restrict t := by
rw [union_comm, restrict_union h.symm hs, add_comm]
@[simp]
theorem restrict_add_restrict_compl (hs : MeasurableSet s) :
μ.restrict s + μ.restrict sᶜ = μ := by
rw [← restrict_union (@disjoint_compl_right (Set α) _ _) hs.compl, union_compl_self,
restrict_univ]
@[simp]
theorem restrict_compl_add_restrict (hs : MeasurableSet s) : μ.restrict sᶜ + μ.restrict s = μ := by
rw [add_comm, restrict_add_restrict_compl hs]
theorem restrict_union_le (s s' : Set α) : μ.restrict (s ∪ s') ≤ μ.restrict s + μ.restrict s' :=
le_iff.2 fun t ht ↦ by
simpa [ht, inter_union_distrib_left] using measure_union_le (t ∩ s) (t ∩ s')
theorem restrict_iUnion_apply_ae [Countable ι] {s : ι → Set α} (hd : Pairwise (AEDisjoint μ on s))
(hm : ∀ i, NullMeasurableSet (s i) μ) {t : Set α} (ht : MeasurableSet t) :
μ.restrict (⋃ i, s i) t = ∑' i, μ.restrict (s i) t := by
simp only [restrict_apply, ht, inter_iUnion]
exact
measure_iUnion₀ (hd.mono fun i j h => h.mono inter_subset_right inter_subset_right)
fun i => ht.nullMeasurableSet.inter (hm i)
theorem restrict_iUnion_apply [Countable ι] {s : ι → Set α} (hd : Pairwise (Disjoint on s))
(hm : ∀ i, MeasurableSet (s i)) {t : Set α} (ht : MeasurableSet t) :
μ.restrict (⋃ i, s i) t = ∑' i, μ.restrict (s i) t :=
restrict_iUnion_apply_ae hd.aedisjoint (fun i => (hm i).nullMeasurableSet) ht
theorem restrict_iUnion_apply_eq_iSup [Countable ι] {s : ι → Set α} (hd : Directed (· ⊆ ·) s)
{t : Set α} (ht : MeasurableSet t) : μ.restrict (⋃ i, s i) t = ⨆ i, μ.restrict (s i) t := by
simp only [restrict_apply ht, inter_iUnion]
rw [Directed.measure_iUnion]
exacts [hd.mono_comp _ fun s₁ s₂ => inter_subset_inter_right _]
/-- The restriction of the pushforward measure is the pushforward of the restriction. For a version
assuming only `AEMeasurable`, see `restrict_map_of_aemeasurable`. -/
theorem restrict_map {f : α → β} (hf : Measurable f) {s : Set β} (hs : MeasurableSet s) :
(μ.map f).restrict s = (μ.restrict <| f ⁻¹' s).map f :=
ext fun t ht => by simp [*, hf ht]
theorem restrict_toMeasurable (h : μ s ≠ ∞) : μ.restrict (toMeasurable μ s) = μ.restrict s :=
ext fun t ht => by
rw [restrict_apply ht, restrict_apply ht, inter_comm, measure_toMeasurable_inter ht h,
inter_comm]
theorem restrict_eq_self_of_ae_mem {_m0 : MeasurableSpace α} ⦃s : Set α⦄ ⦃μ : Measure α⦄
(hs : ∀ᵐ x ∂μ, x ∈ s) : μ.restrict s = μ :=
calc
μ.restrict s = μ.restrict univ := restrict_congr_set (eventuallyEq_univ.mpr hs)
_ = μ := restrict_univ
theorem restrict_congr_meas (hs : MeasurableSet s) :
μ.restrict s = ν.restrict s ↔ ∀ t ⊆ s, MeasurableSet t → μ t = ν t :=
⟨fun H t hts ht => by
rw [← inter_eq_self_of_subset_left hts, ← restrict_apply ht, H, restrict_apply ht], fun H =>
ext fun t ht => by
rw [restrict_apply ht, restrict_apply ht, H _ inter_subset_right (ht.inter hs)]⟩
theorem restrict_congr_mono (hs : s ⊆ t) (h : μ.restrict t = ν.restrict t) :
μ.restrict s = ν.restrict s := by
rw [← restrict_restrict_of_subset hs, h, restrict_restrict_of_subset hs]
/-- If two measures agree on all measurable subsets of `s` and `t`, then they agree on all
measurable subsets of `s ∪ t`. -/
theorem restrict_union_congr :
μ.restrict (s ∪ t) = ν.restrict (s ∪ t) ↔
μ.restrict s = ν.restrict s ∧ μ.restrict t = ν.restrict t := by
refine ⟨fun h ↦ ⟨restrict_congr_mono subset_union_left h,
restrict_congr_mono subset_union_right h⟩, ?_⟩
rintro ⟨hs, ht⟩
ext1 u hu
simp only [restrict_apply hu, inter_union_distrib_left]
rcases exists_measurable_superset₂ μ ν (u ∩ s) with ⟨US, hsub, hm, hμ, hν⟩
calc
μ (u ∩ s ∪ u ∩ t) = μ (US ∪ u ∩ t) :=
measure_union_congr_of_subset hsub hμ.le Subset.rfl le_rfl
_ = μ US + μ ((u ∩ t) \ US) := (measure_add_diff hm.nullMeasurableSet _).symm
_ = restrict μ s u + restrict μ t (u \ US) := by
simp only [restrict_apply, hu, hu.diff hm, hμ, ← inter_comm t, inter_diff_assoc]
_ = restrict ν s u + restrict ν t (u \ US) := by rw [hs, ht]
_ = ν US + ν ((u ∩ t) \ US) := by
simp only [restrict_apply, hu, hu.diff hm, hν, ← inter_comm t, inter_diff_assoc]
_ = ν (US ∪ u ∩ t) := measure_add_diff hm.nullMeasurableSet _
_ = ν (u ∩ s ∪ u ∩ t) := .symm <| measure_union_congr_of_subset hsub hν.le Subset.rfl le_rfl
theorem restrict_biUnion_finset_congr {s : Finset ι} {t : ι → Set α} :
μ.restrict (⋃ i ∈ s, t i) = ν.restrict (⋃ i ∈ s, t i) ↔
∀ i ∈ s, μ.restrict (t i) = ν.restrict (t i) := by
classical
induction s using Finset.induction_on with
| empty => simp
| insert i s _ hs =>
simp only [forall_eq_or_imp, iUnion_iUnion_eq_or_left, Finset.mem_insert]
rw [restrict_union_congr, ← hs]
@[deprecated (since := "2025-08-28")]
alias restrict_finset_biUnion_congr := restrict_biUnion_finset_congr
theorem restrict_iUnion_congr [Countable ι] {s : ι → Set α} :
μ.restrict (⋃ i, s i) = ν.restrict (⋃ i, s i) ↔ ∀ i, μ.restrict (s i) = ν.restrict (s i) := by
refine ⟨fun h i => restrict_congr_mono (subset_iUnion _ _) h, fun h => ?_⟩
ext1 t ht
have D : Directed (· ⊆ ·) fun t : Finset ι => ⋃ i ∈ t, s i :=
Monotone.directed_le fun t₁ t₂ ht => biUnion_subset_biUnion_left ht
rw [iUnion_eq_iUnion_finset]
simp only [restrict_iUnion_apply_eq_iSup D ht, restrict_biUnion_finset_congr.2 fun i _ => h i]
theorem restrict_biUnion_congr {s : Set ι} {t : ι → Set α} (hc : s.Countable) :
μ.restrict (⋃ i ∈ s, t i) = ν.restrict (⋃ i ∈ s, t i) ↔
∀ i ∈ s, μ.restrict (t i) = ν.restrict (t i) := by
haveI := hc.toEncodable
simp only [biUnion_eq_iUnion, SetCoe.forall', restrict_iUnion_congr]
theorem restrict_sUnion_congr {S : Set (Set α)} (hc : S.Countable) :
μ.restrict (⋃₀ S) = ν.restrict (⋃₀ S) ↔ ∀ s ∈ S, μ.restrict s = ν.restrict s := by
rw [sUnion_eq_biUnion, restrict_biUnion_congr hc]
/-- This lemma shows that `Inf` and `restrict` commute for measures. -/
theorem restrict_sInf_eq_sInf_restrict {m0 : MeasurableSpace α} {m : Set (Measure α)}
(hm : m.Nonempty) (ht : MeasurableSet t) :
(sInf m).restrict t = sInf ((fun μ : Measure α => μ.restrict t) '' m) := by
ext1 s hs
simp_rw [sInf_apply hs, restrict_apply hs, sInf_apply (MeasurableSet.inter hs ht),
Set.image_image, restrict_toOuterMeasure_eq_toOuterMeasure_restrict ht, ←
Set.image_image _ toOuterMeasure, ← OuterMeasure.restrict_sInf_eq_sInf_restrict _ (hm.image _),
OuterMeasure.restrict_apply]
theorem exists_mem_of_measure_ne_zero_of_ae (hs : μ s ≠ 0) {p : α → Prop}
(hp : ∀ᵐ x ∂μ.restrict s, p x) : ∃ x, x ∈ s ∧ p x := by
rw [← μ.restrict_apply_self, ← frequently_ae_mem_iff] at hs
exact (hs.and_eventually hp).exists
/-- If a quasi-measure-preserving map `f` maps a set `s` to a set `t`,
then it is quasi-measure-preserving with respect to the restrictions of the measures. -/
theorem QuasiMeasurePreserving.restrict {ν : Measure β} {f : α → β}
(hf : QuasiMeasurePreserving f μ ν) {t : Set β} (hmaps : MapsTo f s t) :
QuasiMeasurePreserving f (μ.restrict s) (ν.restrict t) where
measurable := hf.measurable
absolutelyContinuous := by
refine AbsolutelyContinuous.mk fun u hum ↦ ?_
suffices ν (u ∩ t) = 0 → μ (f ⁻¹' u ∩ s) = 0 by simpa [hum, hf.measurable, hf.measurable hum]
refine fun hu ↦ measure_mono_null ?_ (hf.preimage_null hu)
rw [preimage_inter]
gcongr
assumption
/-! ### Extensionality results -/
/-- Two measures are equal if they have equal restrictions on a spanning collection of sets
(formulated using `Union`). -/
theorem ext_iff_of_iUnion_eq_univ [Countable ι] {s : ι → Set α} (hs : ⋃ i, s i = univ) :
μ = ν ↔ ∀ i, μ.restrict (s i) = ν.restrict (s i) := by
rw [← restrict_iUnion_congr, hs, restrict_univ, restrict_univ]
alias ⟨_, ext_of_iUnion_eq_univ⟩ := ext_iff_of_iUnion_eq_univ
/-- Two measures are equal if they have equal restrictions on a spanning collection of sets
(formulated using `biUnion`). -/
theorem ext_iff_of_biUnion_eq_univ {S : Set ι} {s : ι → Set α} (hc : S.Countable)
(hs : ⋃ i ∈ S, s i = univ) : μ = ν ↔ ∀ i ∈ S, μ.restrict (s i) = ν.restrict (s i) := by
rw [← restrict_biUnion_congr hc, hs, restrict_univ, restrict_univ]
alias ⟨_, ext_of_biUnion_eq_univ⟩ := ext_iff_of_biUnion_eq_univ
/-- Two measures are equal if they have equal restrictions on a spanning collection of sets
(formulated using `sUnion`). -/
theorem ext_iff_of_sUnion_eq_univ {S : Set (Set α)} (hc : S.Countable) (hs : ⋃₀ S = univ) :
μ = ν ↔ ∀ s ∈ S, μ.restrict s = ν.restrict s :=
ext_iff_of_biUnion_eq_univ hc <| by rwa [← sUnion_eq_biUnion]
alias ⟨_, ext_of_sUnion_eq_univ⟩ := ext_iff_of_sUnion_eq_univ
theorem ext_of_generateFrom_of_cover {S T : Set (Set α)} (h_gen : ‹_› = generateFrom S)
(hc : T.Countable) (h_inter : IsPiSystem S) (hU : ⋃₀ T = univ) (htop : ∀ t ∈ T, μ t ≠ ∞)
(ST_eq : ∀ t ∈ T, ∀ s ∈ S, μ (s ∩ t) = ν (s ∩ t)) (T_eq : ∀ t ∈ T, μ t = ν t) : μ = ν := by
refine ext_of_sUnion_eq_univ hc hU fun t ht => ?_
ext1 u hu
simp only [restrict_apply hu]
induction u, hu using induction_on_inter h_gen h_inter with
| empty => simp only [Set.empty_inter, measure_empty]
| basic u hu => exact ST_eq _ ht _ hu
| compl u hu ihu =>
have := T_eq t ht
rw [Set.inter_comm] at ihu ⊢
rwa [← measure_inter_add_diff t hu, ← measure_inter_add_diff t hu, ← ihu,
ENNReal.add_right_inj] at this
exact ne_top_of_le_ne_top (htop t ht) (measure_mono Set.inter_subset_left)
| iUnion f hfd hfm ihf =>
simp only [← restrict_apply (hfm _), ← restrict_apply (MeasurableSet.iUnion hfm)] at ihf ⊢
simp only [measure_iUnion hfd hfm, ihf]
/-- Two measures are equal if they are equal on the π-system generating the σ-algebra,
and they are both finite on an increasing spanning sequence of sets in the π-system.
This lemma is formulated using `sUnion`. -/
theorem ext_of_generateFrom_of_cover_subset {S T : Set (Set α)} (h_gen : ‹_› = generateFrom S)
(h_inter : IsPiSystem S) (h_sub : T ⊆ S) (hc : T.Countable) (hU : ⋃₀ T = univ)
(htop : ∀ s ∈ T, μ s ≠ ∞) (h_eq : ∀ s ∈ S, μ s = ν s) : μ = ν := by
refine ext_of_generateFrom_of_cover h_gen hc h_inter hU htop ?_ fun t ht => h_eq t (h_sub ht)
intro t ht s hs; rcases (s ∩ t).eq_empty_or_nonempty with H | H
· simp only [H, measure_empty]
· exact h_eq _ (h_inter _ hs _ (h_sub ht) H)
/-- Two measures are equal if they are equal on the π-system generating the σ-algebra,
and they are both finite on an increasing spanning sequence of sets in the π-system.
This lemma is formulated using `iUnion`.
`FiniteSpanningSetsIn.ext` is a reformulation of this lemma. -/
theorem ext_of_generateFrom_of_iUnion (C : Set (Set α)) (B : ℕ → Set α) (hA : ‹_› = generateFrom C)
(hC : IsPiSystem C) (h1B : ⋃ i, B i = univ) (h2B : ∀ i, B i ∈ C) (hμB : ∀ i, μ (B i) ≠ ∞)
(h_eq : ∀ s ∈ C, μ s = ν s) : μ = ν := by
refine ext_of_generateFrom_of_cover_subset hA hC ?_ (countable_range B) h1B ?_ h_eq
· rintro _ ⟨i, rfl⟩
apply h2B
· rintro _ ⟨i, rfl⟩
apply hμB
@[simp]
theorem restrict_sum (μ : ι → Measure α) {s : Set α} (hs : MeasurableSet s) :
(sum μ).restrict s = sum fun i => (μ i).restrict s :=
ext fun t ht => by simp only [sum_apply, restrict_apply, ht, ht.inter hs]
@[simp]
theorem restrict_sum_of_countable [Countable ι] (μ : ι → Measure α) (s : Set α) :
(sum μ).restrict s = sum fun i => (μ i).restrict s := by
ext t ht
simp_rw [sum_apply _ ht, restrict_apply ht, sum_apply_of_countable]
lemma AbsolutelyContinuous.restrict (h : μ ≪ ν) (s : Set α) : μ.restrict s ≪ ν.restrict s := by
refine Measure.AbsolutelyContinuous.mk (fun t ht htν ↦ ?_)
rw [restrict_apply ht] at htν ⊢
exact h htν
theorem restrict_iUnion_ae [Countable ι] {s : ι → Set α} (hd : Pairwise (AEDisjoint μ on s))
(hm : ∀ i, NullMeasurableSet (s i) μ) : μ.restrict (⋃ i, s i) = sum fun i => μ.restrict (s i) :=
ext fun t ht => by simp only [sum_apply _ ht, restrict_iUnion_apply_ae hd hm ht]
theorem restrict_iUnion [Countable ι] {s : ι → Set α} (hd : Pairwise (Disjoint on s))
(hm : ∀ i, MeasurableSet (s i)) : μ.restrict (⋃ i, s i) = sum fun i => μ.restrict (s i) :=
restrict_iUnion_ae hd.aedisjoint fun i => (hm i).nullMeasurableSet
theorem restrict_biUnion {s : ι → Set α} {T : Set ι} (hT : Countable T)
(hd : T.Pairwise (Disjoint on s)) (hm : ∀ i, MeasurableSet (s i)) :
μ.restrict (⋃ i ∈ T, s i) = sum fun (i : T) => μ.restrict (s i) := by
rw [Set.biUnion_eq_iUnion]
exact restrict_iUnion (fun i j hij ↦ hd i.coe_prop j.coe_prop (Subtype.coe_ne_coe.mpr hij)) (hm ·)
theorem restrict_biUnion_finset {s : ι → Set α} {T : Finset ι}
(hd : (T : Set ι).Pairwise (Disjoint on s)) (hm : ∀ i, MeasurableSet (s i)) :
μ.restrict (⋃ i ∈ T, s i) = sum fun (i : T) => μ.restrict (s i) :=
restrict_biUnion (T := (T : Set ι)) Finite.to_countable hd hm
theorem restrict_iUnion_le [Countable ι] {s : ι → Set α} :
μ.restrict (⋃ i, s i) ≤ sum fun i => μ.restrict (s i) :=
le_iff.2 fun t ht ↦ by simpa [ht, inter_iUnion] using measure_iUnion_le (t ∩ s ·)
theorem restrict_biUnion_le {s : ι → Set α} {T : Set ι} (hT : Countable T) :
μ.restrict (⋃ i ∈ T, s i) ≤ sum fun (i : T) => μ.restrict (s i) :=
le_iff.2 fun t ht ↦ by simpa [ht, inter_iUnion] using measure_biUnion_le μ hT (t ∩ s ·)
end Measure
@[simp]
theorem ae_restrict_iUnion_eq [Countable ι] (s : ι → Set α) :
ae (μ.restrict (⋃ i, s i)) = ⨆ i, ae (μ.restrict (s i)) :=
le_antisymm ((ae_sum_eq fun i => μ.restrict (s i)) ▸ ae_mono restrict_iUnion_le) <|
iSup_le fun i => ae_mono <| restrict_mono (subset_iUnion s i) le_rfl
@[simp]
theorem ae_restrict_union_eq (s t : Set α) :
ae (μ.restrict (s ∪ t)) = ae (μ.restrict s) ⊔ ae (μ.restrict t) := by
simp [union_eq_iUnion, iSup_bool_eq]
theorem ae_restrict_biUnion_eq (s : ι → Set α) {t : Set ι} (ht : t.Countable) :
ae (μ.restrict (⋃ i ∈ t, s i)) = ⨆ i ∈ t, ae (μ.restrict (s i)) := by
haveI := ht.to_subtype
rw [biUnion_eq_iUnion, ae_restrict_iUnion_eq, ← iSup_subtype'']
theorem ae_restrict_biUnion_finset_eq (s : ι → Set α) (t : Finset ι) :
ae (μ.restrict (⋃ i ∈ t, s i)) = ⨆ i ∈ t, ae (μ.restrict (s i)) :=
ae_restrict_biUnion_eq s t.countable_toSet
theorem ae_restrict_iUnion_iff [Countable ι] (s : ι → Set α) (p : α → Prop) :
(∀ᵐ x ∂μ.restrict (⋃ i, s i), p x) ↔ ∀ i, ∀ᵐ x ∂μ.restrict (s i), p x := by simp
theorem ae_restrict_union_iff (s t : Set α) (p : α → Prop) :
(∀ᵐ x ∂μ.restrict (s ∪ t), p x) ↔ (∀ᵐ x ∂μ.restrict s, p x) ∧ ∀ᵐ x ∂μ.restrict t, p x := by simp
theorem ae_restrict_biUnion_iff (s : ι → Set α) {t : Set ι} (ht : t.Countable) (p : α → Prop) :
(∀ᵐ x ∂μ.restrict (⋃ i ∈ t, s i), p x) ↔ ∀ i ∈ t, ∀ᵐ x ∂μ.restrict (s i), p x := by
simp_rw [Filter.Eventually, ae_restrict_biUnion_eq s ht, mem_iSup]
@[simp]
theorem ae_restrict_biUnion_finset_iff (s : ι → Set α) (t : Finset ι) (p : α → Prop) :
(∀ᵐ x ∂μ.restrict (⋃ i ∈ t, s i), p x) ↔ ∀ i ∈ t, ∀ᵐ x ∂μ.restrict (s i), p x := by
simp_rw [Filter.Eventually, ae_restrict_biUnion_finset_eq s, mem_iSup]
theorem ae_eq_restrict_iUnion_iff [Countable ι] (s : ι → Set α) (f g : α → δ) :
f =ᵐ[μ.restrict (⋃ i, s i)] g ↔ ∀ i, f =ᵐ[μ.restrict (s i)] g := by
simp_rw [EventuallyEq, ae_restrict_iUnion_eq, eventually_iSup]
theorem ae_eq_restrict_biUnion_iff (s : ι → Set α) {t : Set ι} (ht : t.Countable) (f g : α → δ) :
f =ᵐ[μ.restrict (⋃ i ∈ t, s i)] g ↔ ∀ i ∈ t, f =ᵐ[μ.restrict (s i)] g := by
simp_rw [ae_restrict_biUnion_eq s ht, EventuallyEq, eventually_iSup]
theorem ae_eq_restrict_biUnion_finset_iff (s : ι → Set α) (t : Finset ι) (f g : α → δ) :
f =ᵐ[μ.restrict (⋃ i ∈ t, s i)] g ↔ ∀ i ∈ t, f =ᵐ[μ.restrict (s i)] g :=
ae_eq_restrict_biUnion_iff s t.countable_toSet f g
open scoped Interval in
theorem ae_restrict_uIoc_eq [LinearOrder α] (a b : α) :
ae (μ.restrict (Ι a b)) = ae (μ.restrict (Ioc a b)) ⊔ ae (μ.restrict (Ioc b a)) := by
simp only [uIoc_eq_union, ae_restrict_union_eq]
open scoped Interval in
/-- See also `MeasureTheory.ae_uIoc_iff`. -/
theorem ae_restrict_uIoc_iff [LinearOrder α] {a b : α} {P : α → Prop} :
(∀ᵐ x ∂μ.restrict (Ι a b), P x) ↔
(∀ᵐ x ∂μ.restrict (Ioc a b), P x) ∧ ∀ᵐ x ∂μ.restrict (Ioc b a), P x := by
rw [ae_restrict_uIoc_eq, eventually_sup]
theorem ae_restrict_iff₀ {p : α → Prop} (hp : NullMeasurableSet { x | p x } (μ.restrict s)) :
(∀ᵐ x ∂μ.restrict s, p x) ↔ ∀ᵐ x ∂μ, x ∈ s → p x := by
simp only [ae_iff, ← compl_setOf, Measure.restrict_apply₀ hp.compl]
rw [iff_iff_eq]; congr with x; simp [and_comm]
theorem ae_restrict_iff {p : α → Prop} (hp : MeasurableSet { x | p x }) :
(∀ᵐ x ∂μ.restrict s, p x) ↔ ∀ᵐ x ∂μ, x ∈ s → p x :=
ae_restrict_iff₀ hp.nullMeasurableSet
theorem ae_imp_of_ae_restrict {s : Set α} {p : α → Prop} (h : ∀ᵐ x ∂μ.restrict s, p x) :
∀ᵐ x ∂μ, x ∈ s → p x := by
simp only [ae_iff] at h ⊢
simpa [setOf_and, inter_comm] using measure_inter_eq_zero_of_restrict h
theorem ae_restrict_iff'₀ {p : α → Prop} (hs : NullMeasurableSet s μ) :
(∀ᵐ x ∂μ.restrict s, p x) ↔ ∀ᵐ x ∂μ, x ∈ s → p x := by
simp only [ae_iff, ← compl_setOf, restrict_apply₀' hs]
rw [iff_iff_eq]; congr with x; simp [and_comm]
theorem ae_restrict_iff' {p : α → Prop} (hs : MeasurableSet s) :
(∀ᵐ x ∂μ.restrict s, p x) ↔ ∀ᵐ x ∂μ, x ∈ s → p x :=
ae_restrict_iff'₀ hs.nullMeasurableSet
theorem _root_.Filter.EventuallyEq.restrict {f g : α → δ} {s : Set α} (hfg : f =ᵐ[μ] g) :
f =ᵐ[μ.restrict s] g := by
-- note that we cannot use `ae_restrict_iff` since we do not require measurability
refine hfg.filter_mono ?_
rw [Measure.ae_le_iff_absolutelyContinuous]
exact absolutelyContinuous_restrict
theorem ae_restrict_mem₀ (hs : NullMeasurableSet s μ) : ∀ᵐ x ∂μ.restrict s, x ∈ s :=
(ae_restrict_iff'₀ hs).2 (Filter.Eventually.of_forall fun _ => id)
theorem ae_restrict_mem (hs : MeasurableSet s) : ∀ᵐ x ∂μ.restrict s, x ∈ s :=
ae_restrict_mem₀ hs.nullMeasurableSet
theorem ae_restrict_of_forall_mem {μ : Measure α} {s : Set α}
(hs : MeasurableSet s) {p : α → Prop} (h : ∀ x ∈ s, p x) : ∀ᵐ (x : α) ∂μ.restrict s, p x :=
(ae_restrict_mem hs).mono h
theorem ae_restrict_of_ae {s : Set α} {p : α → Prop} (h : ∀ᵐ x ∂μ, p x) : ∀ᵐ x ∂μ.restrict s, p x :=
h.filter_mono (ae_mono Measure.restrict_le_self)
theorem ae_restrict_of_ae_restrict_of_subset {s t : Set α} {p : α → Prop} (hst : s ⊆ t)
(h : ∀ᵐ x ∂μ.restrict t, p x) : ∀ᵐ x ∂μ.restrict s, p x :=
h.filter_mono (ae_mono <| Measure.restrict_mono hst (le_refl μ))
theorem ae_of_ae_restrict_of_ae_restrict_compl (t : Set α) {p : α → Prop}
(ht : ∀ᵐ x ∂μ.restrict t, p x) (htc : ∀ᵐ x ∂μ.restrict tᶜ, p x) : ∀ᵐ x ∂μ, p x :=
nonpos_iff_eq_zero.1 <|
calc
μ { x | ¬p x } ≤ μ ({ x | ¬p x } ∩ t) + μ ({ x | ¬p x } ∩ tᶜ) :=
measure_le_inter_add_diff _ _ _
_ ≤ μ.restrict t { x | ¬p x } + μ.restrict tᶜ { x | ¬p x } :=
add_le_add (le_restrict_apply _ _) (le_restrict_apply _ _)
_ = 0 := by rw [ae_iff.1 ht, ae_iff.1 htc, zero_add]
theorem mem_map_restrict_ae_iff {β} {s : Set α} {t : Set β} {f : α → β} (hs : MeasurableSet s) :
t ∈ Filter.map f (ae (μ.restrict s)) ↔ μ ((f ⁻¹' t)ᶜ ∩ s) = 0 := by
rw [mem_map, mem_ae_iff, Measure.restrict_apply' hs]
theorem ae_add_measure_iff {p : α → Prop} {ν} :
(∀ᵐ x ∂μ + ν, p x) ↔ (∀ᵐ x ∂μ, p x) ∧ ∀ᵐ x ∂ν, p x :=
add_eq_zero
theorem ae_eq_comp' {ν : Measure β} {f : α → β} {g g' : β → δ} (hf : AEMeasurable f μ)
(h : g =ᵐ[ν] g') (h2 : μ.map f ≪ ν) : g ∘ f =ᵐ[μ] g' ∘ f :=
(tendsto_ae_map hf).mono_right h2.ae_le h
theorem Measure.QuasiMeasurePreserving.ae_eq_comp {ν : Measure β} {f : α → β} {g g' : β → δ}
(hf : QuasiMeasurePreserving f μ ν) (h : g =ᵐ[ν] g') : g ∘ f =ᵐ[μ] g' ∘ f :=
ae_eq_comp' hf.aemeasurable h hf.absolutelyContinuous
theorem ae_eq_comp {f : α → β} {g g' : β → δ} (hf : AEMeasurable f μ) (h : g =ᵐ[μ.map f] g') :
g ∘ f =ᵐ[μ] g' ∘ f :=
ae_eq_comp' hf h AbsolutelyContinuous.rfl
@[to_additive]
theorem div_ae_eq_one {β} [Group β] (f g : α → β) : f / g =ᵐ[μ] 1 ↔ f =ᵐ[μ] g := by
refine ⟨fun h ↦ h.mono fun x hx ↦ ?_, fun h ↦ h.mono fun x hx ↦ ?_⟩
· rwa [Pi.div_apply, Pi.one_apply, div_eq_one] at hx
· rwa [Pi.div_apply, Pi.one_apply, div_eq_one]
@[to_additive sub_nonneg_ae]
lemma one_le_div_ae {β : Type*} [Group β] [LE β] [MulRightMono β] (f g : α → β) :
1 ≤ᵐ[μ] g / f ↔ f ≤ᵐ[μ] g := by
refine ⟨fun h ↦ h.mono fun a ha ↦ ?_, fun h ↦ h.mono fun a ha ↦ ?_⟩
· rwa [Pi.one_apply, Pi.div_apply, one_le_div'] at ha
· rwa [Pi.one_apply, Pi.div_apply, one_le_div']
theorem le_ae_restrict : ae μ ⊓ 𝓟 s ≤ ae (μ.restrict s) := fun _s hs =>
eventually_inf_principal.2 (ae_imp_of_ae_restrict hs)
@[simp]
theorem ae_restrict_eq (hs : MeasurableSet s) : ae (μ.restrict s) = ae μ ⊓ 𝓟 s := by
ext t
simp only [mem_inf_principal, mem_ae_iff, restrict_apply_eq_zero' hs, compl_setOf,
Classical.not_imp, fun a => and_comm (a := a ∈ s) (b := a ∉ t)]
rfl
lemma ae_restrict_le : ae (μ.restrict s) ≤ ae μ :=
ae_mono restrict_le_self
theorem ae_restrict_eq_bot {s} : ae (μ.restrict s) = ⊥ ↔ μ s = 0 :=
ae_eq_bot.trans restrict_eq_zero
theorem ae_restrict_neBot {s} : (ae <| μ.restrict s).NeBot ↔ μ s ≠ 0 :=
neBot_iff.trans ae_restrict_eq_bot.not
theorem self_mem_ae_restrict {s} (hs : MeasurableSet s) : s ∈ ae (μ.restrict s) := by
simp only [ae_restrict_eq hs, mem_principal, mem_inf_iff]
exact ⟨_, univ_mem, s, Subset.rfl, (univ_inter s).symm⟩
/-- If two measurable sets are ae_eq then any proposition that is almost everywhere true on one
is almost everywhere true on the other -/
theorem ae_restrict_of_ae_eq_of_ae_restrict {s t} (hst : s =ᵐ[μ] t) {p : α → Prop} :
(∀ᵐ x ∂μ.restrict s, p x) → ∀ᵐ x ∂μ.restrict t, p x := by simp [Measure.restrict_congr_set hst]
/-- If two measurable sets are ae_eq then any proposition that is almost everywhere true on one
is almost everywhere true on the other -/
theorem ae_restrict_congr_set {s t} (hst : s =ᵐ[μ] t) {p : α → Prop} :
(∀ᵐ x ∂μ.restrict s, p x) ↔ ∀ᵐ x ∂μ.restrict t, p x :=
⟨ae_restrict_of_ae_eq_of_ae_restrict hst, ae_restrict_of_ae_eq_of_ae_restrict hst.symm⟩
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
{β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
(f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
{t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
rw [Measure.restrict_apply₀ (f_mble t_mble)]
rw [EventuallyEq, ae_iff, Measure.restrict_apply₀] at hs
· apply le_antisymm _ (measure_mono inter_subset_left)
apply (measure_mono (Eq.symm (inter_union_compl (f ⁻¹' t) s)).le).trans
apply (measure_union_le _ _).trans
have obs : μ ((f ⁻¹' t) ∩ sᶜ) = 0 := by
apply le_antisymm _ (zero_le _)
rw [← hs]
apply measure_mono (inter_subset_inter_left _ _)
intro x hx hfx
simp only [mem_preimage] at hx hfx
exact ht (hfx ▸ hx)
simp only [obs, add_zero, le_refl]
· exact NullMeasurableSet.of_null hs
lemma nullMeasurableSet_restrict (hs : NullMeasurableSet s μ) {t : Set α} :
NullMeasurableSet t (μ.restrict s) ↔ NullMeasurableSet (t ∩ s) μ := by
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· obtain ⟨t', -, ht', t't⟩ : ∃ t' ⊇ t, MeasurableSet t' ∧ t' =ᵐ[μ.restrict s] t :=
h.exists_measurable_superset_ae_eq
have A : (t' ∩ s : Set α) =ᵐ[μ] (t ∩ s : Set α) := by
have : ∀ᵐ x ∂μ, x ∈ s → (x ∈ t') = (x ∈ t) :=
(ae_restrict_iff'₀ hs).1 t't
filter_upwards [this] with y hy
change (y ∈ t' ∩ s) = (y ∈ t ∩ s)
simpa only [eq_iff_iff, mem_inter_iff, and_congr_left_iff] using hy
obtain ⟨s', -, hs', s's⟩ : ∃ s' ⊇ s, MeasurableSet s' ∧ s' =ᵐ[μ] s :=
hs.exists_measurable_superset_ae_eq
have B : (t' ∩ s' : Set α) =ᵐ[μ] (t' ∩ s : Set α) :=
ae_eq_set_inter (EventuallyEq.refl _ _) s's
exact (ht'.inter hs').nullMeasurableSet.congr (B.trans A)
· have A : NullMeasurableSet (t \ s) (μ.restrict s) := by
apply NullMeasurableSet.of_null
rw [Measure.restrict_apply₀' hs]
simp
have B : NullMeasurableSet (t ∩ s) (μ.restrict s) :=
h.mono_ac absolutelyContinuous_restrict
simpa using A.union B
lemma nullMeasurableSet_restrict_of_subset {t : Set α} (ht : t ⊆ s) :
NullMeasurableSet t (μ.restrict s) ↔ NullMeasurableSet t μ := by
refine ⟨fun h ↦ ?_, fun h ↦ h.mono_ac absolutelyContinuous_restrict⟩
obtain ⟨t', t'_subs, ht', t't⟩ : ∃ t' ⊆ t, MeasurableSet t' ∧ t' =ᵐ[μ.restrict s] t :=
h.exists_measurable_subset_ae_eq
have : ∀ᵐ x ∂μ, x ∈ s → (x ∈ t' ↔ x ∈ t) := by
apply ae_imp_of_ae_restrict
filter_upwards [t't] with x hx using by simpa using hx
have : t' =ᵐ[μ] t := by
filter_upwards [this] with x hx
change (x ∈ t') = (x ∈ t)
simp only [eq_iff_iff]
tauto
exact ht'.nullMeasurableSet.congr this
namespace Measure
section Subtype
/-! ### Subtype of a measure space -/
section ComapAnyMeasure
theorem MeasurableSet.nullMeasurableSet_subtype_coe {t : Set s} (hs : NullMeasurableSet s μ)
(ht : MeasurableSet t) : NullMeasurableSet ((↑) '' t) μ := by
rw [Subtype.instMeasurableSpace, comap_eq_generateFrom] at ht
induction t, ht using generateFrom_induction with
| hC t' ht' =>
obtain ⟨s', hs', rfl⟩ := ht'
rw [Subtype.image_preimage_coe]
exact hs.inter (hs'.nullMeasurableSet)
| empty => simp only [image_empty, nullMeasurableSet_empty]
| compl t' _ ht' =>
simp only [← range_diff_image Subtype.coe_injective, Subtype.range_coe_subtype, setOf_mem_eq]
exact hs.diff ht'
| iUnion f _ hf =>
dsimp only []
rw [image_iUnion]
exact .iUnion hf
theorem NullMeasurableSet.subtype_coe {t : Set s} (hs : NullMeasurableSet s μ)
(ht : NullMeasurableSet t (μ.comap Subtype.val)) : NullMeasurableSet (((↑) : s → α) '' t) μ :=
NullMeasurableSet.image _ μ Subtype.coe_injective
(fun _ => MeasurableSet.nullMeasurableSet_subtype_coe hs) ht
theorem measure_subtype_coe_le_comap (hs : NullMeasurableSet s μ) (t : Set s) :
μ (((↑) : s → α) '' t) ≤ μ.comap Subtype.val t :=
le_comap_apply _ _ Subtype.coe_injective (fun _ =>
MeasurableSet.nullMeasurableSet_subtype_coe hs) _
theorem measure_subtype_coe_eq_zero_of_comap_eq_zero (hs : NullMeasurableSet s μ) {t : Set s}
(ht : μ.comap Subtype.val t = 0) : μ (((↑) : s → α) '' t) = 0 :=
eq_bot_iff.mpr <| (measure_subtype_coe_le_comap hs t).trans ht.le
end ComapAnyMeasure
section MeasureSpace
variable {u : Set δ} [MeasureSpace δ] {p : δ → Prop}
/-- In a measure space, one can restrict the measure to a subtype to get a new measure space.
Not registered as an instance, as there are other natural choices such as the normalized restriction
for a probability measure, or the subspace measure when restricting to a vector subspace. Enable
locally if needed with `attribute [local instance] Measure.Subtype.measureSpace`. -/
noncomputable def Subtype.measureSpace : MeasureSpace (Subtype p) where
volume := Measure.comap Subtype.val volume
attribute [local instance] Subtype.measureSpace
theorem Subtype.volume_def : (volume : Measure u) = volume.comap Subtype.val :=
rfl
theorem Subtype.volume_univ (hu : NullMeasurableSet u) : volume (univ : Set u) = volume u := by
rw [Subtype.volume_def, comap_apply₀ _ _ _ _ MeasurableSet.univ.nullMeasurableSet]
· simp only [image_univ, Subtype.range_coe_subtype, setOf_mem_eq]
· exact Subtype.coe_injective
· exact fun t => MeasurableSet.nullMeasurableSet_subtype_coe hu
theorem volume_subtype_coe_le_volume (hu : NullMeasurableSet u) (t : Set u) :
volume (((↑) : u → δ) '' t) ≤ volume t :=
measure_subtype_coe_le_comap hu t
theorem volume_subtype_coe_eq_zero_of_volume_eq_zero (hu : NullMeasurableSet u) {t : Set u}
(ht : volume t = 0) : volume (((↑) : u → δ) '' t) = 0 :=
measure_subtype_coe_eq_zero_of_comap_eq_zero hu ht
end MeasureSpace
end Subtype
end Measure
end MeasureTheory
open MeasureTheory Measure
namespace MeasurableEmbedding
variable {m0 : MeasurableSpace α} {m1 : MeasurableSpace β} {f : α → β}
section
variable (hf : MeasurableEmbedding f)
include hf
theorem map_comap (μ : Measure β) : (comap f μ).map f = μ.restrict (range f) := by
ext1 t ht
rw [hf.map_apply, comap_apply f hf.injective hf.measurableSet_image' _ (hf.measurable ht),
image_preimage_eq_inter_range, Measure.restrict_apply ht]
theorem comap_apply (μ : Measure β) (s : Set α) : comap f μ s = μ (f '' s) :=
calc
comap f μ s = comap f μ (f ⁻¹' (f '' s)) := by rw [hf.injective.preimage_image]
_ = (comap f μ).map f (f '' s) := (hf.map_apply _ _).symm
_ = μ (f '' s) := by
rw [hf.map_comap, restrict_apply' hf.measurableSet_range,
inter_eq_self_of_subset_left (image_subset_range _ _)]
theorem comap_map (μ : Measure α) : (map f μ).comap f = μ := by
ext t _
rw [hf.comap_apply, hf.map_apply, preimage_image_eq _ hf.injective]
theorem ae_map_iff {p : β → Prop} {μ : Measure α} : (∀ᵐ x ∂μ.map f, p x) ↔ ∀ᵐ x ∂μ, p (f x) := by
simp only [ae_iff, hf.map_apply, preimage_setOf_eq]
theorem restrict_map (μ : Measure α) (s : Set β) :
(μ.map f).restrict s = (μ.restrict <| f ⁻¹' s).map f :=
Measure.ext fun t ht => by simp [hf.map_apply, ht, hf.measurable ht]
protected theorem comap_preimage (μ : Measure β) (s : Set β) :
μ.comap f (f ⁻¹' s) = μ (s ∩ range f) := by
rw [← hf.map_apply, hf.map_comap, restrict_apply' hf.measurableSet_range]
lemma comap_restrict (μ : Measure β) (s : Set β) :
(μ.restrict s).comap f = (μ.comap f).restrict (f ⁻¹' s) := by
ext t ht
rw [Measure.restrict_apply ht, comap_apply hf, comap_apply hf,
Measure.restrict_apply (hf.measurableSet_image.2 ht), image_inter_preimage]
lemma restrict_comap (μ : Measure β) (s : Set α) :
(μ.comap f).restrict s = (μ.restrict (f '' s)).comap f := by
rw [comap_restrict hf, preimage_image_eq _ hf.injective]
end
theorem _root_.MeasurableEquiv.restrict_map (e : α ≃ᵐ β) (μ : Measure α) (s : Set β) :
(μ.map e).restrict s = (μ.restrict <| e ⁻¹' s).map e :=
e.measurableEmbedding.restrict_map _ _
lemma _root_.MeasurableEquiv.comap_apply (e : α ≃ᵐ β) (μ : Measure β) (s : Set α) :
comap e μ s = μ (e.symm ⁻¹' s) := by
rw [e.measurableEmbedding.comap_apply, e.image_eq_preimage_symm]
end MeasurableEmbedding
lemma MeasureTheory.Measure.map_eq_comap {_ : MeasurableSpace α} {_ : MeasurableSpace β} {f : α → β}
{g : β → α} {μ : Measure α} (hf : Measurable f) (hg : MeasurableEmbedding g)
(hμg : ∀ᵐ a ∂μ, a ∈ Set.range g) (hfg : ∀ a, f (g a) = a) : μ.map f = μ.comap g := by
ext s hs
rw [map_apply hf hs, hg.comap_apply, ← measure_diff_null hμg]
congr
simp
grind
section Subtype
theorem comap_subtype_coe_apply {_m0 : MeasurableSpace α} {s : Set α} (hs : MeasurableSet s)
(μ : Measure α) (t : Set s) : comap (↑) μ t = μ ((↑) '' t) :=
(MeasurableEmbedding.subtype_coe hs).comap_apply _ _
theorem map_comap_subtype_coe {m0 : MeasurableSpace α} {s : Set α} (hs : MeasurableSet s)
(μ : Measure α) : (comap (↑) μ).map ((↑) : s → α) = μ.restrict s := by
rw [(MeasurableEmbedding.subtype_coe hs).map_comap, Subtype.range_coe]
theorem ae_restrict_iff_subtype {m0 : MeasurableSpace α} {μ : Measure α} {s : Set α}
(hs : MeasurableSet s) {p : α → Prop} :
(∀ᵐ x ∂μ.restrict s, p x) ↔ ∀ᵐ (x : s) ∂comap ((↑) : s → α) μ, p x := by
rw [← map_comap_subtype_coe hs, (MeasurableEmbedding.subtype_coe hs).ae_map_iff]
variable [MeasureSpace α] {s t : Set α}
/-!
### Volume on `s : Set α`
Note the instance is provided earlier as `Subtype.measureSpace`.
-/
attribute [local instance] Subtype.measureSpace
theorem volume_set_coe_def (s : Set α) : (volume : Measure s) = comap ((↑) : s → α) volume :=
rfl
theorem MeasurableSet.map_coe_volume {s : Set α} (hs : MeasurableSet s) :
volume.map ((↑) : s → α) = restrict volume s := by
rw [volume_set_coe_def, (MeasurableEmbedding.subtype_coe hs).map_comap volume, Subtype.range_coe]
theorem volume_image_subtype_coe {s : Set α} (hs : MeasurableSet s) (t : Set s) :
volume ((↑) '' t : Set α) = volume t :=
(comap_subtype_coe_apply hs volume t).symm
@[simp]
theorem volume_preimage_coe (hs : NullMeasurableSet s) (ht : MeasurableSet t) :
volume (((↑) : s → α) ⁻¹' t) = volume (t ∩ s) := by
rw [volume_set_coe_def,
comap_apply₀ _ _ Subtype.coe_injective
(fun h => MeasurableSet.nullMeasurableSet_subtype_coe hs)
(measurable_subtype_coe ht).nullMeasurableSet,
image_preimage_eq_inter_range, Subtype.range_coe]
end Subtype
section Piecewise
variable [MeasurableSpace α] {μ : Measure α} {s t : Set α} {f g : α → β}
theorem piecewise_ae_eq_restrict [DecidablePred (· ∈ s)] (hs : MeasurableSet s) :
piecewise s f g =ᵐ[μ.restrict s] f := by
rw [ae_restrict_eq hs]
exact (piecewise_eqOn s f g).eventuallyEq.filter_mono inf_le_right
theorem piecewise_ae_eq_restrict_compl [DecidablePred (· ∈ s)] (hs : MeasurableSet s) :
piecewise s f g =ᵐ[μ.restrict sᶜ] g := by
rw [ae_restrict_eq hs.compl]
exact (piecewise_eqOn_compl s f g).eventuallyEq.filter_mono inf_le_right
theorem piecewise_ae_eq_of_ae_eq_set [DecidablePred (· ∈ s)] [DecidablePred (· ∈ t)]
(hst : s =ᵐ[μ] t) : s.piecewise f g =ᵐ[μ] t.piecewise f g :=
hst.mem_iff.mono fun x hx => by simp [piecewise, hx]
end Piecewise
section IndicatorFunction
variable [MeasurableSpace α] {μ : Measure α} {s t : Set α} {f : α → β}
theorem mem_map_indicator_ae_iff_mem_map_restrict_ae_of_zero_mem [Zero β] {t : Set β}
(ht : (0 : β) ∈ t) (hs : MeasurableSet s) :
t ∈ Filter.map (s.indicator f) (ae μ) ↔ t ∈ Filter.map f (ae <| μ.restrict s) := by
classical
simp_rw [mem_map, mem_ae_iff]
rw [Measure.restrict_apply' hs, Set.indicator_preimage, Set.ite]
simp_rw [Set.compl_union, Set.compl_inter]
change μ (((f ⁻¹' t)ᶜ ∪ sᶜ) ∩ ((fun _ => (0 : β)) ⁻¹' t \ s)ᶜ) = 0 ↔ μ ((f ⁻¹' t)ᶜ ∩ s) = 0
simp only [ht, ← Set.compl_eq_univ_diff, compl_compl, if_true,
Set.preimage_const]
simp_rw [Set.union_inter_distrib_right, Set.compl_inter_self s, Set.union_empty]
theorem mem_map_indicator_ae_iff_of_zero_notMem [Zero β] {t : Set β} (ht : (0 : β) ∉ t) :
t ∈ Filter.map (s.indicator f) (ae μ) ↔ μ ((f ⁻¹' t)ᶜ ∪ sᶜ) = 0 := by
classical
rw [mem_map, mem_ae_iff, Set.indicator_preimage, Set.ite, Set.compl_union, Set.compl_inter]
change μ (((f ⁻¹' t)ᶜ ∪ sᶜ) ∩ ((fun _ => (0 : β)) ⁻¹' t \ s)ᶜ) = 0 ↔ μ ((f ⁻¹' t)ᶜ ∪ sᶜ) = 0
simp only [ht, if_false, Set.compl_empty, Set.empty_diff, Set.inter_univ, Set.preimage_const]
@[deprecated (since := "2025-05-24")]
alias mem_map_indicator_ae_iff_of_zero_nmem := mem_map_indicator_ae_iff_of_zero_notMem
theorem map_restrict_ae_le_map_indicator_ae [Zero β] (hs : MeasurableSet s) :
Filter.map f (ae <| μ.restrict s) ≤ Filter.map (s.indicator f) (ae μ) := by
intro t
by_cases ht : (0 : β) ∈ t
· rw [mem_map_indicator_ae_iff_mem_map_restrict_ae_of_zero_mem ht hs]
exact id
rw [mem_map_indicator_ae_iff_of_zero_notMem ht, mem_map_restrict_ae_iff hs]
exact fun h => measure_mono_null (Set.inter_subset_left.trans Set.subset_union_left) h
variable [Zero β]
theorem indicator_ae_eq_restrict (hs : MeasurableSet s) : indicator s f =ᵐ[μ.restrict s] f := by
classical exact piecewise_ae_eq_restrict hs
theorem indicator_ae_eq_restrict_compl (hs : MeasurableSet s) :
indicator s f =ᵐ[μ.restrict sᶜ] 0 := by
classical exact piecewise_ae_eq_restrict_compl hs
theorem indicator_ae_eq_of_restrict_compl_ae_eq_zero (hs : MeasurableSet s)
(hf : f =ᵐ[μ.restrict sᶜ] 0) : s.indicator f =ᵐ[μ] f := by
rw [Filter.EventuallyEq, ae_restrict_iff' hs.compl] at hf
filter_upwards [hf] with x hx
by_cases hxs : x ∈ s
· simp only [hxs, Set.indicator_of_mem]
· simp only [hx hxs, Pi.zero_apply, Set.indicator_apply_eq_zero, imp_true_iff]
theorem indicator_ae_eq_zero_of_restrict_ae_eq_zero (hs : MeasurableSet s)
(hf : f =ᵐ[μ.restrict s] 0) : s.indicator f =ᵐ[μ] 0 := by
rw [Filter.EventuallyEq, ae_restrict_iff' hs] at hf
filter_upwards [hf] with x hx
by_cases hxs : x ∈ s
· simp only [hxs, hx hxs, Set.indicator_of_mem]
· simp [hxs]
theorem indicator_ae_eq_of_ae_eq_set (hst : s =ᵐ[μ] t) : s.indicator f =ᵐ[μ] t.indicator f := by
classical exact piecewise_ae_eq_of_ae_eq_set hst
theorem indicator_meas_zero (hs : μ s = 0) : indicator s f =ᵐ[μ] 0 :=
indicator_empty' f ▸ indicator_ae_eq_of_ae_eq_set (ae_eq_empty.2 hs)
theorem ae_eq_restrict_iff_indicator_ae_eq {g : α → β} (hs : MeasurableSet s) :
f =ᵐ[μ.restrict s] g ↔ s.indicator f =ᵐ[μ] s.indicator g := by
rw [Filter.EventuallyEq, ae_restrict_iff' hs]
refine ⟨fun h => ?_, fun h => ?_⟩ <;> filter_upwards [h] with x hx
· by_cases hxs : x ∈ s
· simp [hxs, hx hxs]
· simp [hxs]
· intro hxs
simpa [hxs] using hx
end IndicatorFunction
section Sum
open Finset in
/-- An upper bound on a sum of restrictions of a measure `μ`. This can be used to compare
`∫ x ∈ X, f x ∂μ` with `∑ i, ∫ x ∈ (s i), f x ∂μ`, where `s` is a cover of `X`. -/
lemma MeasureTheory.Measure.sum_restrict_le {_ : MeasurableSpace α}
{μ : Measure α} {s : ι → Set α} {M : ℕ} (hs_meas : ∀ i, MeasurableSet (s i))
(hs : ∀ y, {i | y ∈ s i}.encard ≤ M) :
Measure.sum (fun i ↦ μ.restrict (s i)) ≤ M • μ.restrict (⋃ i, s i) := by
classical
refine le_iff.mpr (fun t ht ↦ le_of_eq_of_le (sum_apply _ ht) ?_)
refine ENNReal.summable.tsum_le_of_sum_le (fun F ↦ ?_)
-- `P` is a partition of `⋃ i ∈ F, s i` indexed by `C ∈ Cs` (nonempty subsets of `F`).
-- `P` is a partition of `s i` when restricted to `C ∈ G i` (subsets of `F` containing `i`).
let P (C : Finset ι) := (⋂ i ∈ C, s i) ∩ (⋂ i ∈ (F \ C), (s i)ᶜ)
let Cs := F.powerset \ {∅}
let G (i : ι) := { C | C ∈ F.powerset ∧ i ∈ C }
have P_meas C : MeasurableSet (P C) :=
measurableSet_biInter C (fun i _ ↦ hs_meas i) |>.inter <|
measurableSet_biInter _ (fun i _ ↦ (hs_meas i).compl)
have P_cover {i : ι} (hi : i ∈ F) : s i ⊆ ⋃ C ∈ G i, P C := by
refine fun x hx ↦ Set.mem_biUnion (x := F.filter (x ∈ s ·)) ?_ ?_
· exact ⟨Finset.mem_powerset.mpr (filter_subset _ F), mem_filter.mpr ⟨hi, hx⟩⟩
· simp_rw [P, mem_inter_iff, mem_iInter, mem_sdiff, mem_filter]; tauto
have iUnion_P : ⋃ C ∈ Cs, P C ⊆ ⋃ i, s i := by
intro x hx
simp_rw [Cs, toFinset_diff, mem_sdiff, mem_iUnion] at hx
have ⟨C, ⟨_, C_nonempty⟩, hxC⟩ := hx
have ⟨i, hi⟩ := Finset.nonempty_iff_ne_empty.mpr <| Finset.notMem_singleton.mp C_nonempty
exact ⟨s i, ⟨i, rfl⟩, hxC.1 (s i) ⟨i, by simp [hi]⟩⟩
have P_subset_s {i : ι} {C : Finset ι} (hiC : i ∈ C) : P C ⊆ s i := by
intro x hx
simp only [P, mem_inter_iff, mem_iInter] at hx
exact hx.1 i hiC
have mem_C {i} (hi : i ∈ F) {C : Finset ι} {x : α} (hx : x ∈ P C) (hxs : x ∈ s i) : i ∈ C := by
rw [mem_inter_iff, mem_iInter₂, mem_iInter₂] at hx
exact of_not_not fun h ↦ hx.2 i (mem_sdiff.mpr ⟨hi, h⟩) hxs
have C_subset_C {C₁ C₂} (hC₁ : C₁ ∈ Cs) {x : α} (hx : x ∈ P C₁ ∩ P C₂) : C₁ ⊆ C₂ :=
fun i hi ↦ mem_C (mem_powerset.mp (sdiff_subset hC₁) hi) hx.2 <| P_subset_s hi hx.1
calc ∑ i ∈ F, (μ.restrict (s i)) t
_ ≤ ∑ i ∈ F, Measure.sum (fun (C : G i) ↦ μ.restrict (P C)) t :=
F.sum_le_sum fun i hi ↦ (restrict_mono_set μ (P_cover hi) t).trans <|
restrict_biUnion_le ((finite_toSet F.powerset).subset (sep_subset _ _)).countable t
_ = ∑ i ∈ F, ∑' (C : G i), μ.restrict (P C) t := by simp_rw [Measure.sum_apply _ ht]
_ = ∑' C, ∑ i ∈ F, (G i).indicator (fun C ↦ μ.restrict (P C) t) C := by
rw [Summable.tsum_finsetSum (fun _ _ ↦ ENNReal.summable)]
congr with i
rw [tsum_subtype (G i) (fun C ↦ (μ.restrict (P C)) t)]
_ = ∑ C ∈ Cs, ∑ i ∈ F, (C : Set ι).indicator (fun _ ↦ (μ.restrict (P C)) t) i := by
rw [sum_eq_tsum_indicator]
congr with C
by_cases hC : C ∈ F.powerset <;> by_cases hC' : C = ∅ <;>
simp [hC, hC', Cs, G, indicator, -Finset.mem_powerset, -coe_powerset]
_ = ∑ C ∈ Cs, {a ∈ F | a ∈ C}.card • μ.restrict (P C) t := by simp [indicator]; rfl
_ ≤ ∑ C ∈ Cs, M • μ.restrict (P C) t := by
refine sum_le_sum fun C hC ↦ ?_
by_cases hPC : P C = ∅
· simp [hPC]
have hCM : (C : Set ι).encard ≤ M :=
have ⟨x, hx⟩ := Set.nonempty_iff_ne_empty.mpr hPC
(encard_mono (mem_iInter₂.mp hx.1)).trans (hs x)
exact nsmul_le_nsmul_left (zero_le _) <| calc {a ∈ F | a ∈ C}.card
_ ≤ C.card := card_mono <| fun i hi ↦ (F.mem_filter.mp hi).2
_ = (C : Set ι).ncard := (ncard_coe_finset C).symm
_ ≤ M := ENat.toNat_le_of_le_coe hCM
_ = M • (μ.restrict (⋃ C ∈ Cs, (P C)) t) := by
rw [← smul_sum, ← Cs.tsum_subtype, μ.restrict_biUnion_finset _ P_meas, Measure.sum_apply _ ht]
refine fun C₁ hC₁ C₂ hC₂ hC ↦ Set.disjoint_iff.mpr fun x hx ↦ hC <| ?_
exact subset_antisymm (C_subset_C hC₁ hx) (C_subset_C hC₂ (Set.inter_comm _ _ ▸ hx))
_ ≤ (M • μ.restrict (⋃ i, s i)) t := by
rw [Measure.smul_apply]
exact nsmul_le_nsmul_right (μ.restrict_mono_set iUnion_P t) M
end Sum |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/CharacteristicFunction.lean | import Mathlib.Analysis.Fourier.BoundedContinuousFunctionChar
import Mathlib.Analysis.Fourier.FourierTransform
import Mathlib.Analysis.InnerProductSpace.Dual
import Mathlib.Analysis.InnerProductSpace.ProdL2
import Mathlib.Analysis.Normed.Lp.MeasurableSpace
import Mathlib.MeasureTheory.Group.IntegralConvolution
import Mathlib.MeasureTheory.Integral.Pi
import Mathlib.MeasureTheory.Measure.FiniteMeasureExt
/-!
# Characteristic Function of a Finite Measure
This file defines the characteristic function of a finite measure on a topological vector space `V`.
The characteristic function of a finite measure `P` on `V` is the mapping
`W → ℂ, w => ∫ v, e (L v w) ∂P`,
where `e` is a continuous additive character and `L : V →ₗ[ℝ] W →ₗ[ℝ] ℝ` is a bilinear map.
A typical example is `V = W = ℝ` and `L v w = v * w`.
The integral is expressed as `∫ v, char he hL w v ∂P`, where `char he hL w` is the
bounded continuous function `fun v ↦ e (L v w)` and `he`, `hL` are continuity hypotheses on `e`
and `L`.
## Main definitions
* `innerProbChar`: the bounded continuous map `x ↦ exp(⟪x, t⟫ * I)` in an inner product space.
This is `char` for the inner product bilinear map and the additive character `e = probChar`.
* `charFun μ t`: the characteristic function of a measure `μ` at `t` in an inner product space `E`.
This is defined as `∫ x, exp (⟪x, t⟫ * I) ∂μ`, where `⟪x, t⟫` is the inner product on `E`.
It is equal to `∫ v, innerProbChar w v ∂P` (see `charFun_eq_integral_innerProbChar`).
* `probCharDual`: the bounded continuous map `x ↦ exp (L x * I)`, for a continuous linear form `L`.
* `charFunDual μ L`: the characteristic function of a measure `μ` at `L : Dual ℝ E` in
a normed space `E`. This is the integral `∫ v, exp (L v * I) ∂μ`.
## Main statements
* `ext_of_integral_char_eq`: Assume `e` and `L` are non-trivial. If the integrals of `char`
with respect to two finite measures `P` and `P'` coincide, then `P = P'`.
* `Measure.ext_of_charFun`: If the characteristic functions `charFun` of two finite measures
`μ` and `ν` on a complete second-countable inner product space coincide, then `μ = ν`.
* `Measure.ext_of_charFunDual`: If the characteristic functions `charFunDual` of two finite measures
`μ` and `ν` on a Banach space coincide, then `μ = ν`.
-/
open BoundedContinuousFunction RealInnerProductSpace Real Complex ComplexConjugate NormedSpace
WithLp
open scoped ENNReal
namespace BoundedContinuousFunction
variable {E F : Type*} [SeminormedAddCommGroup E] [InnerProductSpace ℝ E]
[SeminormedAddCommGroup F] [NormedSpace ℝ F]
/-- The bounded continuous map `x ↦ exp(⟪x, t⟫ * I)`. -/
noncomputable
def innerProbChar (t : E) : E →ᵇ ℂ :=
char continuous_probChar (L := bilinFormOfRealInner) continuous_inner t
lemma innerProbChar_apply (t x : E) : innerProbChar t x = exp (⟪x, t⟫ * I) := rfl
@[simp]
lemma innerProbChar_zero : innerProbChar (0 : E) = 1 := by simp [innerProbChar]
/-- The bounded continuous map `x ↦ exp (L x * I)`, for a continuous linear form `L`. -/
noncomputable
def probCharDual (L : StrongDual ℝ F) : F →ᵇ ℂ :=
char continuous_probChar
(L := isBoundedBilinearMap_apply.symm.toContinuousLinearMap.toLinearMap₁₂)
isBoundedBilinearMap_apply.symm.continuous L
lemma probCharDual_apply (L : StrongDual ℝ F) (x : F) : probCharDual L x = exp (L x * I) := rfl
@[simp]
lemma probCharDual_zero : probCharDual (0 : StrongDual ℝ F) = 1 := by simp [probCharDual]
end BoundedContinuousFunction
namespace MeasureTheory
variable {W : Type*} [AddCommGroup W] [Module ℝ W] [TopologicalSpace W]
{e : AddChar ℝ Circle}
section ext
variable {V : Type*} [AddCommGroup V] [Module ℝ V] [PseudoEMetricSpace V] [MeasurableSpace V]
[BorelSpace V] [CompleteSpace V] [SecondCountableTopology V] {L : V →ₗ[ℝ] W →ₗ[ℝ] ℝ}
/-- If the integrals of `char` with respect to two finite measures `P` and `P'` coincide, then
`P = P'`. -/
theorem ext_of_integral_char_eq (he : Continuous e) (he' : e ≠ 1)
(hL' : ∀ v ≠ 0, L v ≠ 0) (hL : Continuous fun p : V × W ↦ L p.1 p.2)
{P P' : Measure V} [IsFiniteMeasure P] [IsFiniteMeasure P']
(h : ∀ w, ∫ v, char he hL w v ∂P = ∫ v, char he hL w v ∂P') :
P = P' := by
apply ext_of_forall_mem_subalgebra_integral_eq_of_pseudoEMetric_complete_countable
(separatesPoints_charPoly he he' hL hL')
intro _ hg
simp only [mem_charPoly] at hg
obtain ⟨w, hw⟩ := hg
rw [hw]
have hsum (P : Measure V) [IsFiniteMeasure P] :
∫ v, ∑ a ∈ w.support, w a * e (L v a) ∂P = ∑ a ∈ w.support, ∫ v, w a * e (L v a) ∂P :=
integral_finset_sum w.support
fun a ha => Integrable.const_mul (integrable P (char he hL a)) _
rw [hsum P, hsum P']
apply Finset.sum_congr rfl fun i _ => ?_
simp only [MeasureTheory.integral_const_mul, mul_eq_mul_left_iff]
exact Or.inl (h i)
end ext
section InnerProductSpace
variable {E : Type*} {mE : MeasurableSpace E} {μ : Measure E} {t : E}
/-- The characteristic function of a measure in an inner product space. -/
noncomputable def charFun [Inner ℝ E] (μ : Measure E) (t : E) : ℂ := ∫ x, exp (⟪x, t⟫ * I) ∂μ
lemma charFun_apply [Inner ℝ E] (t : E) : charFun μ t = ∫ x, exp (⟪x, t⟫ * I) ∂μ := rfl
lemma charFun_apply_real {μ : Measure ℝ} (t : ℝ) :
charFun μ t = ∫ x, exp (t * x * I) ∂μ := by simp [charFun_apply]
variable [SeminormedAddCommGroup E] [InnerProductSpace ℝ E]
@[simp]
lemma charFun_zero (μ : Measure E) : charFun μ 0 = μ.real Set.univ := by
simp [charFun_apply]
@[simp]
lemma charFun_zero_measure : charFun (0 : Measure E) t = 0 := by simp [charFun_apply]
@[simp]
lemma charFun_neg (t : E) : charFun μ (-t) = conj (charFun μ t) := by
simp [charFun_apply, ← integral_conj, ← exp_conj]
/-- `charFun` as the integral of a bounded continuous function. -/
lemma charFun_eq_integral_innerProbChar : charFun μ t = ∫ v, innerProbChar t v ∂μ := by
simp [charFun_apply, innerProbChar_apply]
lemma charFun_eq_integral_probChar (t : E) : charFun μ t = ∫ x, (probChar ⟪x, t⟫ : ℂ) ∂μ := by
simp [charFun_apply, probChar_apply]
/-- `charFun` is a Fourier integral for the inner product and the character `probChar`. -/
lemma charFun_eq_fourierIntegral (t : E) :
charFun μ t = VectorFourier.fourierIntegral probChar μ bilinFormOfRealInner 1 (-t) := by
simp [charFun_apply, VectorFourier.fourierIntegral_probChar]
/-- `charFun` is a Fourier integral for the inner product and the character `fourierChar`. -/
lemma charFun_eq_fourierIntegral' (t : E) :
charFun μ t
= VectorFourier.fourierIntegral fourierChar μ bilinFormOfRealInner 1 (-(2 * π)⁻¹ • t) := by
simp only [charFun_apply, VectorFourier.fourierIntegral, neg_smul,
bilinFormOfRealInner_apply_apply, inner_neg_right, inner_smul_right, neg_neg,
fourierChar_apply', Pi.ofNat_apply, Circle.smul_def, Circle.coe_exp, ofReal_mul, ofReal_ofNat,
ofReal_inv, smul_eq_mul, mul_one]
congr with x
rw [← mul_assoc, mul_inv_cancel₀ (by simp [pi_ne_zero]), one_mul]
lemma norm_charFun_le (t : E) : ‖charFun μ t‖ ≤ μ.real Set.univ := by
rw [charFun_eq_fourierIntegral]
exact (VectorFourier.norm_fourierIntegral_le_integral_norm _ _ _ _ _).trans_eq (by simp)
lemma norm_charFun_le_one [IsProbabilityMeasure μ] (t : E) : ‖charFun μ t‖ ≤ 1 :=
(norm_charFun_le _).trans_eq (by simp)
lemma norm_one_sub_charFun_le_two [IsProbabilityMeasure μ] : ‖1 - charFun μ t‖ ≤ 2 :=
calc ‖1 - charFun μ t‖
_ ≤ ‖(1 : ℂ)‖ + ‖charFun μ t‖ := norm_sub_le _ _
_ ≤ 1 + 1 := by simp [norm_charFun_le_one]
_ = 2 := by norm_num
@[fun_prop, measurability]
lemma stronglyMeasurable_charFun [OpensMeasurableSpace E] [SecondCountableTopology E] [SFinite μ] :
StronglyMeasurable (charFun μ) :=
(Measurable.stronglyMeasurable (by fun_prop)).integral_prod_left
@[fun_prop, measurability]
lemma measurable_charFun [OpensMeasurableSpace E] [SecondCountableTopology E] [SFinite μ] :
Measurable (charFun μ) :=
stronglyMeasurable_charFun.measurable
lemma intervalIntegrable_charFun {μ : Measure ℝ} [IsFiniteMeasure μ] {a b : ℝ} :
IntervalIntegrable (charFun μ) volume a b :=
IntervalIntegrable.mono_fun' (g := fun _ ↦ μ.real Set.univ) (by simp)
stronglyMeasurable_charFun.aestronglyMeasurable (ae_of_all _ norm_charFun_le)
lemma charFun_map_smul [BorelSpace E] (r : ℝ) (t : E) :
charFun (μ.map (r • ·)) t = charFun μ (r • t) := by
rw [charFun_apply, charFun_apply,
integral_map (by fun_prop) (by fun_prop)]
simp_rw [inner_smul_right, ← real_inner_smul_left]
lemma charFun_map_mul {μ : Measure ℝ} (r t : ℝ) :
charFun (μ.map (r * ·)) t = charFun μ (r * t) := charFun_map_smul r t
variable {E : Type*} [MeasurableSpace E] {μ ν : Measure E} {t : E}
[NormedAddCommGroup E] [InnerProductSpace ℝ E]
@[simp]
lemma charFun_dirac [OpensMeasurableSpace E] {x : E} (t : E) :
charFun (Measure.dirac x) t = cexp (⟪x, t⟫ * I) := by
rw [charFun_apply, integral_dirac]
lemma charFun_map_add_const [BorelSpace E] (r t : E) :
charFun (μ.map (· + r)) t = charFun μ t * cexp (⟪r, t⟫ * I) := by
rw [charFun_apply, charFun_apply, integral_map (by fun_prop) (by fun_prop),
← integral_mul_const]
congr with a
rw [← Complex.exp_add]
congr
rw [inner_add_left]
simp only [ofReal_add]
ring
lemma charFun_map_const_add [BorelSpace E] (r t : E) :
charFun (μ.map (r + ·)) t = charFun μ t * cexp (⟪r, t⟫ * I) := by
simp_rw [add_comm r]
exact charFun_map_add_const _ _
variable [BorelSpace E] [SecondCountableTopology E]
/-- If the characteristic functions `charFun` of two finite measures `μ` and `ν` on
a complete second-countable inner product space coincide, then `μ = ν`. -/
theorem Measure.ext_of_charFun [CompleteSpace E]
[IsFiniteMeasure μ] [IsFiniteMeasure ν] (h : charFun μ = charFun ν) :
μ = ν := by
simp_rw [funext_iff, charFun_eq_integral_innerProbChar] at h
refine ext_of_integral_char_eq continuous_probChar probChar_ne_one (L := bilinFormOfRealInner)
?_ ?_ h
· exact fun v hv ↦ DFunLike.ne_iff.mpr ⟨v, inner_self_ne_zero.mpr hv⟩
· exact continuous_inner
/-- The characteristic function of a convolution of measures
is the product of the respective characteristic functions. -/
lemma charFun_conv [IsFiniteMeasure μ] [IsFiniteMeasure ν] (t : E) :
charFun (μ ∗ ν) t = charFun μ t * charFun ν t := by
simp_rw [charFun_apply]
rw [integral_conv]
· simp [inner_add_left, add_mul, Complex.exp_add, integral_const_mul, integral_mul_const]
· exact (integrable_const (1 : ℝ)).mono (by fun_prop) (by simp)
variable {E F : Type*} [NormedAddCommGroup E] [NormedAddCommGroup F]
[InnerProductSpace ℝ E] [InnerProductSpace ℝ F] {mE : MeasurableSpace E}
{mF : MeasurableSpace F}
/-- The characteristic function of a product of measures is a product of
characteristic functions. This is the version for Hilbert spaces, see `charFunDual_prod`
for the Banach space version. -/
lemma charFun_prod {μ : Measure E} {ν : Measure F} [SFinite μ] [SFinite ν]
(t : WithLp 2 (E × F)) :
charFun ((μ.prod ν).map (toLp 2)) t =
charFun μ (ofLp t).1 * charFun ν (ofLp t).2 := by
simp_rw [charFun, prod_inner_apply, ← MeasurableEquiv.coe_toLp, ← integral_prod_mul,
integral_map_equiv]
simp [ofReal_add, add_mul, Complex.exp_add]
variable [CompleteSpace E] [CompleteSpace F] [SecondCountableTopology E] [SecondCountableTopology F]
[BorelSpace E] [BorelSpace F]
/-- The characteristic function of a measure is a product of
characteristic functions if and only if it is a product measure.
This is the version for Hilbert spaces, see `charFunDual_eq_prod_iff`
for the Banach space version. -/
lemma charFun_eq_prod_iff {μ : Measure E} {ν : Measure F} {ξ : Measure (E × F)}
[IsFiniteMeasure μ] [IsFiniteMeasure ν] [IsFiniteMeasure ξ] :
(∀ t, charFun (ξ.map (toLp 2)) t = charFun μ (ofLp t).1 * charFun ν (ofLp t).2) ↔
ξ = μ.prod ν where
mp h := by
refine (MeasurableEquiv.toLp 2 (E × F)).map_measurableEquiv_injective
<| Measure.ext_of_charFun <| funext fun t ↦ ?_
rw [MeasurableEquiv.coe_toLp, h, charFun_prod]
mpr h := by rw [h]; exact charFun_prod
variable {ι : Type*} [Fintype ι] {E : ι → Type*} [∀ i, NormedAddCommGroup (E i)]
[∀ i, InnerProductSpace ℝ (E i)] {mE : ∀ i, MeasurableSpace (E i)}
/-- The characteristic function of a product of measures is a product of
characteristic functions. This is the version for Hilbert spaces, see `charFunDual_pi`
for the Banach space version. -/
lemma charFun_pi {μ : (i : ι) → Measure (E i)} [∀ i, SigmaFinite (μ i)] (t : PiLp 2 E) :
charFun ((Measure.pi μ).map (toLp 2)) t = ∏ i, charFun (μ i) (t i) := by
simp_rw [charFun, PiLp.inner_apply, ← MeasurableEquiv.coe_toLp, ← integral_fintype_prod_eq_prod,
integral_map_equiv]
simp [ofReal_sum, Finset.sum_mul, Complex.exp_sum]
variable [∀ i, CompleteSpace (E i)] [∀ i, SecondCountableTopology (E i)] [∀ i, BorelSpace (E i)]
/-- The characteristic function of a measure is a product of
characteristic functions if and only if it is a product measure.
This is the version for Hilbert spaces, see `charFunDual_eq_pi_iff`
for the Banach space version. -/
lemma charFun_eq_pi_iff {μ : (i : ι) → Measure (E i)} {ν : Measure (Π i, E i)}
[∀ i, IsFiniteMeasure (μ i)] [IsFiniteMeasure ν] :
(∀ t, charFun (ν.map (toLp 2)) t = ∏ i, charFun (μ i) (t i)) ↔ ν = Measure.pi μ where
mp h := by
refine (MeasurableEquiv.toLp 2 (Π i, E i)).map_measurableEquiv_injective
<| Measure.ext_of_charFun <| funext fun t ↦ ?_
rw [MeasurableEquiv.coe_toLp, h, charFun_pi]
mpr h := by rw [h]; exact charFun_pi
end InnerProductSpace
section NormedSpace
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {mE : MeasurableSpace E}
[NormedAddCommGroup F] [NormedSpace ℝ F] {mF : MeasurableSpace F}
{μ : Measure E} {ν : Measure F}
/-- The characteristic function of a measure in a normed space, function from `StrongDual ℝ E` to
`ℂ` with `charFunDual μ L = ∫ v, exp (L v * I) ∂μ`. -/
noncomputable
def charFunDual (μ : Measure E) (L : StrongDual ℝ E) : ℂ := ∫ v, probCharDual L v ∂μ
lemma charFunDual_apply (L : StrongDual ℝ E) : charFunDual μ L = ∫ v, exp (L v * I) ∂μ := rfl
lemma charFunDual_eq_charFun_map_one [OpensMeasurableSpace E] (L : StrongDual ℝ E) :
charFunDual μ L = charFun (μ.map L) 1 := by
rw [charFunDual_apply]
have : ∫ x, cexp (L x * I) ∂μ = ∫ x, cexp (x * I) ∂(μ.map L) := by
rw [integral_map]
· fun_prop
· exact Measurable.aestronglyMeasurable <| by fun_prop
rw [this, charFun_apply]
simp
lemma charFun_map_eq_charFunDual_smul [OpensMeasurableSpace E] (L : StrongDual ℝ E) (u : ℝ) :
charFun (μ.map L) u = charFunDual μ (u • L) := by
rw [charFunDual_apply]
have : ∫ x, cexp ((u • L) x * I) ∂μ = ∫ x, cexp (u * x * I) ∂(μ.map L) := by
rw [integral_map]
· simp
· fun_prop
· exact Measurable.aestronglyMeasurable <| by fun_prop
rw [this, charFun_apply]
simp
lemma charFun_eq_charFunDual_toDualMap {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
{mE : MeasurableSpace E} {μ : Measure E} (t : E) :
charFun μ t = charFunDual μ (InnerProductSpace.toDualMap ℝ E t) := by
simp [charFunDual_apply, charFun_apply, real_inner_comm]
lemma charFunDual_map [OpensMeasurableSpace E] [BorelSpace F] (L : E →L[ℝ] F)
(L' : StrongDual ℝ F) : charFunDual (μ.map L) L' = charFunDual μ (L'.comp L) := by
rw [charFunDual_eq_charFun_map_one, charFunDual_eq_charFun_map_one,
Measure.map_map (by fun_prop) (by fun_prop)]
simp
@[simp]
lemma charFunDual_dirac [OpensMeasurableSpace E] {x : E} (L : StrongDual ℝ E) :
charFunDual (Measure.dirac x) L = cexp (L x * I) := by
rw [charFunDual_apply, integral_dirac]
lemma charFunDual_map_add_const [BorelSpace E] (r : E) (L : StrongDual ℝ E) :
charFunDual (μ.map (· + r)) L = charFunDual μ L * cexp (L r * I) := by
rw [charFunDual_apply, charFunDual_apply, integral_map (by fun_prop) (by fun_prop),
← integral_mul_const]
congr with a
rw [← Complex.exp_add]
congr
simp only [map_add, ofReal_add]
ring
lemma charFunDual_map_const_add [BorelSpace E] (r : E) (L : StrongDual ℝ E) :
charFunDual (μ.map (r + ·)) L = charFunDual μ L * cexp (L r * I) := by
simp_rw [add_comm r]
exact charFunDual_map_add_const _ _
/-- The characteristic function of a product of measures is a product of
characteristic functions. This is the version for Banach spaces, see `charFun_prod`
for the Hilbert space version. -/
lemma charFunDual_prod [SFinite μ] [SFinite ν] (L : StrongDual ℝ (E × F)) :
charFunDual (μ.prod ν) L
= charFunDual μ (L.comp (.inl ℝ E F)) * charFunDual ν (L.comp (.inr ℝ E F)) := by
simp_rw [charFunDual_apply, ← L.comp_inl_add_comp_inr, ofReal_add, add_mul,
Complex.exp_add, ← integral_prod_mul]
/-- The characteristic function of a product of measures is a product of
characteristic functions. This is `charFunDual_prod` for `WithLp`.
See `charFun_prod` for the Hilbert space version. -/
lemma charFunDual_prod' (p : ℝ≥0∞) [Fact (1 ≤ p)] [SFinite μ] [SFinite ν]
(L : StrongDual ℝ (WithLp p (E × F))) :
charFunDual ((μ.prod ν).map (toLp p)) L =
charFunDual μ (L.comp
((prodContinuousLinearEquiv p ℝ E F).symm.toContinuousLinearMap.comp
(.inl ℝ E F))) *
charFunDual ν (L.comp
((prodContinuousLinearEquiv p ℝ E F).symm.toContinuousLinearMap.comp
(.inr ℝ E F))) := by
simp_rw [charFunDual_apply, ← integral_prod_mul, ← Complex.exp_add, ← add_mul, ← ofReal_add,
L.comp_apply, ← map_add, ContinuousLinearMap.comp_inl_add_comp_inr]
rw [← MeasurableEquiv.coe_toLp, integral_map_equiv]
simp
/-- The characteristic function of a product of measures is a product of
characteristic functions. This is the version for Banach spaces, see `charFunDual_pi`
for the Hilbert space version. -/
lemma charFunDual_pi {ι : Type*} [Fintype ι] [DecidableEq ι] {E : ι → Type*}
[∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace ℝ (E i)] {mE : ∀ i, MeasurableSpace (E i)}
{μ : (i : ι) → Measure (E i)} [∀ i, SigmaFinite (μ i)] (L : StrongDual ℝ (Π i, E i)) :
charFunDual (Measure.pi μ) L =
∏ i, charFunDual (μ i) (L.comp (.single ℝ E i)) := by
simp_rw [charFunDual_apply, ← L.sum_comp_single, ofReal_sum, Finset.sum_mul, Complex.exp_sum,
← integral_fintype_prod_eq_prod]
/-- The characteristic function of a product of measures is a product of
characteristic functions. This is `charFunDual_pi` for `PiLp`.
See `charFunDual_pi` for the Banach space version. -/
lemma charFunDual_pi' (p : ℝ≥0∞) [Fact (1 ≤ p)] {ι : Type*} [Fintype ι] [DecidableEq ι]
{E : ι → Type*} [∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace ℝ (E i)]
{mE : ∀ i, MeasurableSpace (E i)} {μ : (i : ι) → Measure (E i)} [∀ i, SigmaFinite (μ i)]
(L : StrongDual ℝ (PiLp p E)) :
charFunDual ((Measure.pi μ).map (toLp p)) L =
∏ i, charFunDual (μ i) (L.comp
((PiLp.continuousLinearEquiv p ℝ E).symm.toContinuousLinearMap.comp (.single ℝ E i))) := by
simp_rw [charFunDual_apply, ← integral_fintype_prod_eq_prod, ← Complex.exp_sum, ← Finset.sum_mul,
← ofReal_sum, L.comp_apply, ← map_sum, ContinuousLinearMap.sum_comp_single]
rw [← MeasurableEquiv.coe_toLp, integral_map_equiv]
simp
variable [BorelSpace E] [SecondCountableTopology E]
/-- If two finite measures have the same characteristic function, then they are equal. -/
theorem Measure.ext_of_charFunDual [CompleteSpace E]
{μ ν : Measure E} [IsFiniteMeasure μ] [IsFiniteMeasure ν]
(h : charFunDual μ = charFunDual ν) :
μ = ν := by
refine ext_of_integral_char_eq continuous_probChar probChar_ne_one
?_ ?_ (fun L ↦ funext_iff.mp h L)
· intro v hv
rw [ne_eq, LinearMap.ext_iff]
simp only [ContinuousLinearMap.toLinearMap₁₂_apply, LinearMap.zero_apply, not_forall]
change ∃ L : StrongDual ℝ E, L v ≠ 0
by_contra! h
exact hv (NormedSpace.eq_zero_of_forall_dual_eq_zero _ h)
· exact isBoundedBilinearMap_apply.symm.continuous
/-- The characteristic function of a measure is a product of
characteristic functions if and only if it is a product measure.
This is the version for Banach spaces, see `charFun_eq_prod_iff`
for the Hilbert space version. -/
lemma charFunDual_eq_prod_iff [BorelSpace F] [SecondCountableTopology F] [CompleteSpace E]
[CompleteSpace F] {ξ : Measure (E × F)} [IsFiniteMeasure μ] [IsFiniteMeasure ν]
[IsFiniteMeasure ξ] :
(∀ L, charFunDual ξ L =
charFunDual μ (L.comp (.inl ℝ E F)) * charFunDual ν (L.comp (.inr ℝ E F))) ↔
ξ = μ.prod ν where
mp h := by
refine Measure.ext_of_charFunDual <| funext fun t ↦ ?_
rw [h, charFunDual_prod]
mpr h := by rw [h]; exact charFunDual_prod
/-- The characteristic function of a measure is a product of
characteristic functions if and only if it is a product measure.
This is `charFunDual_eq_prod_iff` for `WithLp`.
See `charFun_eq_prod_iff` for the Hilbert space version. -/
lemma charFunDual_eq_prod_iff' (p : ℝ≥0∞) [Fact (1 ≤ p)] [BorelSpace F]
[SecondCountableTopology F] [CompleteSpace E] [CompleteSpace F] {ξ : Measure (E × F)}
[IsFiniteMeasure μ] [IsFiniteMeasure ν] [IsFiniteMeasure ξ] :
(∀ L, charFunDual (ξ.map (toLp p)) L =
charFunDual μ (L.comp
((WithLp.prodContinuousLinearEquiv p ℝ E F).symm.toContinuousLinearMap.comp
(.inl ℝ E F))) *
charFunDual ν (L.comp
((WithLp.prodContinuousLinearEquiv p ℝ E F).symm.toContinuousLinearMap.comp
(.inr ℝ E F)))) ↔
ξ = μ.prod ν where
mp h := by
refine (MeasurableEquiv.toLp p (E × F)).map_measurableEquiv_injective
<| Measure.ext_of_charFunDual <| funext fun L ↦ ?_
rw [MeasurableEquiv.coe_toLp, h, charFunDual_prod']
mpr h := by rw [h]; exact charFunDual_prod' p
/-- The characteristic function of a measure is a product of
characteristic functions if and only if it is a product measure.
This is the version for Banach spaces, see `charFun_eq_pi_iff`
for the Hilbert space version. -/
lemma charFunDual_eq_pi_iff {ι : Type*} [Fintype ι] [DecidableEq ι] {E : ι → Type*}
[∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace ℝ (E i)] {mE : ∀ i, MeasurableSpace (E i)}
[∀ i, BorelSpace (E i)] [∀ i, SecondCountableTopology (E i)] [∀ i, CompleteSpace (E i)]
{μ : (i : ι) → Measure (E i)} {ν : Measure (Π i, E i)} [∀ i, IsFiniteMeasure (μ i)]
[IsFiniteMeasure ν] :
(∀ L, charFunDual ν L = ∏ i, charFunDual (μ i) (L.comp (.single ℝ E i))) ↔
ν = Measure.pi μ where
mp h := by
refine Measure.ext_of_charFunDual <| funext fun t ↦ ?_
rw [h, charFunDual_pi]
mpr h := by rw [h]; exact charFunDual_pi
/-- The characteristic function of a measure is a product of
characteristic functions if and only if it is a product measure.
This is `charFunDual_eq_pi_iff` for `PiLp`.
See `charFun_eq_pi_iff` for the Hilbert space version. -/
lemma charFunDual_eq_pi_iff' (p : ℝ≥0∞) [Fact (1 ≤ p)] {ι : Type*} [Fintype ι] [DecidableEq ι]
{E : ι → Type*} [∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace ℝ (E i)]
{mE : ∀ i, MeasurableSpace (E i)} [∀ i, BorelSpace (E i)] [∀ i, SecondCountableTopology (E i)]
[∀ i, CompleteSpace (E i)] {μ : (i : ι) → Measure (E i)} {ν : Measure (Π i, E i)}
[∀ i, IsFiniteMeasure (μ i)] [IsFiniteMeasure ν] :
(∀ L, charFunDual (ν.map (toLp p)) L =
∏ i, charFunDual (μ i) (L.comp
((PiLp.continuousLinearEquiv p ℝ E).symm.toContinuousLinearMap.comp (.single ℝ E i)))) ↔
ν = Measure.pi μ where
mp h := by
refine (MeasurableEquiv.toLp p (Π i, E i)).map_measurableEquiv_injective
<| Measure.ext_of_charFunDual <| funext fun L ↦ ?_
rw [MeasurableEquiv.coe_toLp, h, charFunDual_pi']
mpr h := by rw [h]; exact charFunDual_pi' p
/-- The characteristic function of a convolution of measures
is the product of the respective characteristic functions. -/
lemma charFunDual_conv {μ ν : Measure E} [IsFiniteMeasure μ] [IsFiniteMeasure ν]
(L : StrongDual ℝ E) : charFunDual (μ ∗ ν) L = charFunDual μ L * charFunDual ν L := by
simp_rw [charFunDual_apply]
rw [integral_conv]
· simp [add_mul, Complex.exp_add, integral_const_mul, integral_mul_const]
· exact (integrable_const (1 : ℝ)).mono (by fun_prop) (by simp)
end NormedSpace
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/AbsolutelyContinuous.lean | import Mathlib.MeasureTheory.Measure.Map
/-!
# Absolute Continuity of Measures
We say that `μ` is absolutely continuous with respect to `ν`, or that `μ` is dominated by `ν`,
if `ν(A) = 0` implies that `μ(A) = 0`. We denote that by `μ ≪ ν`.
It is equivalent to an inequality of the almost everywhere filters of the measures:
`μ ≪ ν ↔ ae μ ≤ ae ν`.
## Main definitions
* `MeasureTheory.Measure.AbsolutelyContinuous μ ν`: `μ` is absolutely continuous with respect to `ν`
## Main statements
* `ae_le_iff_absolutelyContinuous`: `ae μ ≤ ae ν ↔ μ ≪ ν`
## Notation
* `μ ≪ ν`: `MeasureTheory.Measure.AbsolutelyContinuous μ ν`. That is: `μ` is absolutely continuous
with respect to `ν`
-/
variable {α β δ ι R : Type*}
namespace MeasureTheory
open Set ENNReal NNReal
variable {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
{μ μ₁ μ₂ μ₃ ν ν' : Measure α} {s t : Set α}
namespace Measure
/-- We say that `μ` is absolutely continuous with respect to `ν`, or that `μ` is dominated by `ν`,
if `ν(A) = 0` implies that `μ(A) = 0`. -/
def AbsolutelyContinuous {_m0 : MeasurableSpace α} (μ ν : Measure α) : Prop :=
∀ ⦃s : Set α⦄, ν s = 0 → μ s = 0
@[inherit_doc MeasureTheory.Measure.AbsolutelyContinuous]
scoped[MeasureTheory] infixl:50 " ≪ " => MeasureTheory.Measure.AbsolutelyContinuous
theorem absolutelyContinuous_of_le (h : μ ≤ ν) : μ ≪ ν := fun s hs =>
nonpos_iff_eq_zero.1 <| hs ▸ le_iff'.1 h s
alias _root_.LE.le.absolutelyContinuous := absolutelyContinuous_of_le
theorem absolutelyContinuous_of_eq (h : μ = ν) : μ ≪ ν :=
h.le.absolutelyContinuous
alias _root_.Eq.absolutelyContinuous := absolutelyContinuous_of_eq
namespace AbsolutelyContinuous
theorem mk (h : ∀ ⦃s : Set α⦄, MeasurableSet s → ν s = 0 → μ s = 0) : μ ≪ ν := by
intro s hs
rcases exists_measurable_superset_of_null hs with ⟨t, h1t, h2t, h3t⟩
exact measure_mono_null h1t (h h2t h3t)
@[refl]
protected theorem refl {_m0 : MeasurableSpace α} (μ : Measure α) : μ ≪ μ :=
rfl.absolutelyContinuous
protected theorem rfl : μ ≪ μ := fun _s hs => hs
instance instIsRefl {_ : MeasurableSpace α} : IsRefl (Measure α) (· ≪ ·) :=
⟨fun _ => AbsolutelyContinuous.rfl⟩
@[simp]
protected lemma zero (μ : Measure α) : 0 ≪ μ := fun _ _ ↦ by simp
@[trans]
protected theorem trans (h1 : μ₁ ≪ μ₂) (h2 : μ₂ ≪ μ₃) : μ₁ ≪ μ₃ := fun _s hs => h1 <| h2 hs
@[mono]
protected theorem map (h : μ ≪ ν) {f : α → β} (hf : Measurable f) : μ.map f ≪ ν.map f :=
AbsolutelyContinuous.mk fun s hs => by simpa [hf, hs] using @h _
protected theorem smul_left [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞] (h : μ ≪ ν) (c : R) :
c • μ ≪ ν := fun s hνs => by
simp only [h hνs, smul_apply, smul_zero, ← smul_one_smul ℝ≥0∞ c (0 : ℝ≥0∞)]
/-- If `μ ≪ ν`, then `c • μ ≪ c • ν`.
Earlier, this name was used for what's now called `AbsolutelyContinuous.smul_left`. -/
protected theorem smul [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞] (h : μ ≪ ν) (c : R) :
c • μ ≪ c • ν := by
intro s hνs
rw [smul_apply, ← smul_one_smul ℝ≥0∞, smul_eq_mul, mul_eq_zero] at hνs ⊢
exact hνs.imp_right fun hs ↦ h hs
protected lemma add (h1 : μ₁ ≪ ν) (h2 : μ₂ ≪ ν') : μ₁ + μ₂ ≪ ν + ν' := by
intro s hs
simp only [coe_add, Pi.add_apply, add_eq_zero] at hs ⊢
exact ⟨h1 hs.1, h2 hs.2⟩
lemma add_left_iff {μ₁ μ₂ ν : Measure α} :
μ₁ + μ₂ ≪ ν ↔ μ₁ ≪ ν ∧ μ₂ ≪ ν := by
refine ⟨fun h ↦ ?_, fun h ↦ (h.1.add h.2).trans ?_⟩
· have : ∀ s, ν s = 0 → μ₁ s = 0 ∧ μ₂ s = 0 := by intro s hs0; simpa using h hs0
exact ⟨fun s hs0 ↦ (this s hs0).1, fun s hs0 ↦ (this s hs0).2⟩
· rw [← two_smul ℝ≥0]
exact AbsolutelyContinuous.rfl.smul_left 2
lemma add_left {μ₁ μ₂ ν : Measure α} (h₁ : μ₁ ≪ ν) (h₂ : μ₂ ≪ ν) : μ₁ + μ₂ ≪ ν :=
Measure.AbsolutelyContinuous.add_left_iff.mpr ⟨h₁, h₂⟩
lemma add_right (h1 : μ ≪ ν) (ν' : Measure α) : μ ≪ ν + ν' := by
intro s hs
simp only [coe_add, Pi.add_apply, add_eq_zero] at hs ⊢
exact h1 hs.1
lemma null_mono {μ ν : Measure α} (hμν : μ ≪ ν) ⦃t : Set α⦄
(ht : ν t = 0) : μ t = 0 :=
hμν ht
lemma pos_mono {μ ν : Measure α} (hμν : μ ≪ ν) ⦃t : Set α⦄
(ht : 0 < μ t) : 0 < ν t := by
contrapose! ht
simp_all [hμν.null_mono]
end AbsolutelyContinuous
@[simp]
lemma absolutelyContinuous_zero_iff : μ ≪ 0 ↔ μ = 0 :=
⟨fun h ↦ measure_univ_eq_zero.mp (h rfl), fun h ↦ h.symm ▸ AbsolutelyContinuous.zero _⟩
alias absolutelyContinuous_refl := AbsolutelyContinuous.refl
alias absolutelyContinuous_rfl := AbsolutelyContinuous.rfl
lemma absolutelyContinuous_sum_left {μs : ι → Measure α} (hμs : ∀ i, μs i ≪ ν) :
Measure.sum μs ≪ ν :=
AbsolutelyContinuous.mk fun s hs hs0 ↦ by simp [sum_apply _ hs, fun i ↦ hμs i hs0]
lemma absolutelyContinuous_sum_right {μs : ι → Measure α} (i : ι) (hνμ : ν ≪ μs i) :
ν ≪ Measure.sum μs := by
refine AbsolutelyContinuous.mk fun s hs hs0 ↦ ?_
simp only [sum_apply _ hs, ENNReal.tsum_eq_zero] at hs0
exact hνμ (hs0 i)
lemma smul_absolutelyContinuous {c : ℝ≥0∞} : c • μ ≪ μ := .smul_left .rfl _
theorem absolutelyContinuous_of_le_smul {μ' : Measure α} {c : ℝ≥0∞} (hμ'_le : μ' ≤ c • μ) :
μ' ≪ μ :=
(Measure.absolutelyContinuous_of_le hμ'_le).trans smul_absolutelyContinuous
lemma absolutelyContinuous_smul {c : ℝ≥0∞} (hc : c ≠ 0) : μ ≪ c • μ := by
simp [AbsolutelyContinuous, hc]
theorem ae_le_iff_absolutelyContinuous : ae μ ≤ ae ν ↔ μ ≪ ν :=
⟨fun h s => by
rw [measure_eq_zero_iff_ae_notMem, measure_eq_zero_iff_ae_notMem]
exact fun hs => h hs, fun h _ hs => h hs⟩
alias ⟨_root_.LE.le.absolutelyContinuous_of_ae, AbsolutelyContinuous.ae_le⟩ :=
ae_le_iff_absolutelyContinuous
alias ae_mono' := AbsolutelyContinuous.ae_le
theorem AbsolutelyContinuous.ae_eq (h : μ ≪ ν) {f g : α → δ} (h' : f =ᵐ[ν] g) : f =ᵐ[μ] g :=
h.ae_le h'
end Measure
protected theorem AEDisjoint.of_absolutelyContinuous
(h : AEDisjoint μ s t) {ν : Measure α} (h' : ν ≪ μ) :
AEDisjoint ν s t := h' h
protected theorem AEDisjoint.of_le
(h : AEDisjoint μ s t) {ν : Measure α} (h' : ν ≤ μ) :
AEDisjoint ν s t :=
h.of_absolutelyContinuous (Measure.absolutelyContinuous_of_le h')
@[mono]
theorem ae_mono (h : μ ≤ ν) : ae μ ≤ ae ν :=
h.absolutelyContinuous.ae_le
end MeasureTheory
namespace MeasurableEmbedding
open MeasureTheory Measure
variable {m0 : MeasurableSpace α} {m1 : MeasurableSpace β} {f : α → β} {μ ν : Measure α}
lemma absolutelyContinuous_map (hf : MeasurableEmbedding f) (hμν : μ ≪ ν) :
μ.map f ≪ ν.map f := by
intro t ht
rw [hf.map_apply] at ht ⊢
exact hμν ht
end MeasurableEmbedding |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/HasOuterApproxClosedProd.lean | import Mathlib.MeasureTheory.Integral.Prod
import Mathlib.MeasureTheory.Measure.HasOuterApproxClosed
/-!
# Characterization of a finite measure by the integrals of products of bounded functions
Given two finite families of Borel spaces `(i : ι) → X i` and `(j : κ) → Y j` satisfying
`HasOuterApproxClosed`, a finite measure `μ` over `(Π i, X i) × (Π j, Y j)` is determined by
the values `∫ p, (Π i, f i (p.1 i)) * (Π j, g j (p.2 j)) ∂μ`, for
`f : (i : ι) → X i → ℝ` and `g : (j : κ) → Y j → ℝ`
any families of bounded continuous functions.
In particular, If `μ` and `ν` and two finite measures over `Π i, X i` and `Π j, Y j` respectively,
then their product is the only finite measure `ξ` over `(Π i, X i) × (Π j, Y j)`
such that for any two families bounded continuous functions
`f : (i : ι) → X i → ℝ` and `g : (j : κ) → Y j → ℝ` we have
`∫ p, (Π i, f i (p.1 i)) * (Π j, g j (p.2 j)) ∂ξ =
(∫ x, Π i, f i (x i) ∂μ) * (∫ y, Π j, g j (y j) ∂ν)`.
We specialize these results to the cases where one of the families contains only one type.
## Main statements
* `ext_of_integral_prod_mul_prod_boundedContinuousFunction`: A finite measure `μ`
over `(Π i, X i) × (Π j, Y j)` is determined by the values
`∫ p, (Π i, f i (p.1 i)) * (Π j, g j (p.2 j)) ∂μ`, for `f : (i : ι) → X i → ℝ`
and `g : (j : κ) → Y j → ℝ` any families of bounded continuous functions.
This is stronger than `ext_of_integral_mul_boundedContinuousFunction` because we do not require
`Π i, X i` and `Π j, Y j` to be Borel spaces and only consider products of continuous bounded
functions rather than general continuous bounded functions `(Π i, X i) → ℝ` and `(Π j, Y j) → ℝ`.
* `eq_prod_of_integral_prod_mul_prod_boundedContinuousFunction`: The product of two finite measures
`μ` and `ν` is the only finite measure `ξ` over `(Π i, X i) × (Π j, Y j)` such that for all
families of real bounded continuous functions `f` and `g` we have
`∫ p, (Π i, f i (p.1 i)) * (Π j, g j (p.2 j)) ∂ξ =
(∫ x, Π i, f i (x i) ∂μ) * (∫ y, Π j, g j (y j) ∂ν)`.
* `ext_of_integral_mul_boundedContinuousFunction`: A finite measure `μ` over `X × Y` is determined
by the values `∫ p, f p.1 * g p.2 ∂μ`, for `f : X → ℝ` and `g : Y → ℝ`
any bounded continuous functions.
* `eq_prod_of_integral_mul_boundedContinuousFunction`: The product of two finite measures `μ` and
`ν` is the only finite measure `ξ` such that for all real bounded continuous functions
`f` and `g` we have `∫ z, f z.1 * g z.2 ∂ξ = ∫ x, f x ∂μ * ∫ y, g y ∂ν`.
## Tags
bounded continuous function, product measure
-/
open BoundedContinuousFunction MeasureTheory Topology Filter Set ENNReal NNReal MeasurableSpace
open scoped Topology ENNReal NNReal
namespace Measure
variable {ι κ Z T : Type*} [Fintype ι] [Fintype κ] {X : ι → Type*} {Y : κ → Type*}
{mX : ∀ i, MeasurableSpace (X i)} [∀ i, TopologicalSpace (X i)] [∀ i, BorelSpace (X i)]
[∀ i, HasOuterApproxClosed (X i)]
{mY : ∀ j, MeasurableSpace (Y j)} [∀ j, TopologicalSpace (Y j)] [∀ j, BorelSpace (Y j)]
[∀ j, HasOuterApproxClosed (Y j)]
{mZ : MeasurableSpace Z} [TopologicalSpace Z] [BorelSpace Z] [HasOuterApproxClosed Z]
{mT : MeasurableSpace T} [TopologicalSpace T] [BorelSpace T] [HasOuterApproxClosed T]
/-- A finite measure `μ` over `(Π i, X i) × (Π j, Y j)` is determined by the values
`∫⁻ p, (Π i, f i (p.1 i)) * (Π j, g j (p.2 j)) ∂μ`, for `f : (i : ι) → X i → ℝ≥0`
and `g : (j : κ) → Y j → ℝ≥0` any families of bounded continuous functions. -/
lemma ext_of_lintegral_prod_mul_prod_boundedContinuousFunction
{μ ν : Measure ((Π i, X i) × (Π j, Y j))} [IsFiniteMeasure μ]
(h : ∀ (f : (i : ι) → X i →ᵇ ℝ≥0) (g : (j : κ) → Y j →ᵇ ℝ≥0),
∫⁻ p, (∏ i, f i (p.1 i)) * ∏ j, g j (p.2 j) ∂μ =
∫⁻ p, (∏ i, f i (p.1 i)) * ∏ j, g j (p.2 j) ∂ν) :
μ = ν := by
have hμν : μ univ = ν univ := by convert h 1 1 <;> simp
have : IsFiniteMeasure ν := ⟨by simp [← hμν]⟩
let π : Set (Set ((Π i, X i) × (Π j, Y j))) :=
Set.image2 (fun s t ↦ s ×ˢ t) (Set.univ.pi '' (Set.univ.pi fun _ ↦ {s | IsClosed s}))
(Set.univ.pi '' (Set.univ.pi fun _ ↦ {t | IsClosed t}))
have hπ1 : IsPiSystem π := by
rintro - ⟨-, ⟨s₁, hs₁, rfl⟩, -, ⟨t₁, ht₁, rfl⟩, rfl⟩ -
⟨-, ⟨s₂, hs₂, rfl⟩, -, ⟨t₂, ht₂, rfl⟩, rfl⟩ -
refine ⟨_, ⟨fun i ↦ s₁ i ∩ s₂ i, ?_, rfl⟩, _, ⟨fun j ↦ t₁ j ∩ t₂ j, ?_, rfl⟩, ?_⟩
· simp only [Set.mem_pi, mem_univ, mem_setOf_eq, forall_const] at hs₁ hs₂ ⊢
exact fun i ↦ (hs₁ i).inter (hs₂ i)
· simp only [Set.mem_pi, mem_univ, mem_setOf_eq, forall_const] at ht₁ ht₂ ⊢
exact fun j ↦ (ht₁ j).inter (ht₂ j)
simp [Set.pi_inter_distrib, Set.prod_inter_prod]
have hπ2 : Prod.instMeasurableSpace = generateFrom π := by
rw [← generateFrom_eq_prod (C := Set.univ.pi '' (Set.univ.pi fun _ ↦ {s | IsClosed s}))
(D := Set.univ.pi '' (Set.univ.pi fun _ ↦ {t | IsClosed t}))]
· rw [← generateFrom_eq_pi (C := fun _ ↦ {s | IsClosed s})]
· simp [BorelSpace.measurable_eq, borel_eq_generateFrom_isClosed]
· exact fun _ ↦ ⟨fun _ ↦ Set.univ, fun _ ↦ isClosed_univ, iUnion_const _⟩
· rw [← generateFrom_eq_pi (C := fun _ ↦ {t | IsClosed t})]
· simp [BorelSpace.measurable_eq, borel_eq_generateFrom_isClosed]
· exact fun _ ↦ ⟨fun _ ↦ Set.univ, fun _ ↦ isClosed_univ, iUnion_const _⟩
· exact ⟨fun _ ↦ Set.univ, fun _ ↦ ⟨fun _ ↦ Set.univ, by simp, by simp⟩, iUnion_const _⟩
· exact ⟨fun _ ↦ Set.univ, fun _ ↦ ⟨fun _ ↦ Set.univ, by simp, by simp⟩, iUnion_const _⟩
refine ext_of_generate_finite π hπ2 hπ1 ?_ hμν
rintro - ⟨-, ⟨s, hs, rfl⟩, -, ⟨t, ht, rfl⟩, rfl⟩
simp only [Set.mem_pi, mem_univ, mem_setOf_eq, forall_const] at hs ht
have (p : (Π i, X i) × (Π j, Y j)) := ENNReal.continuous_coe.tendsto _ |>.comp <|
(tendsto_finset_prod Finset.univ (fun i _ ↦ tendsto_pi_nhds.1
(HasOuterApproxClosed.tendsto_apprSeq (hs i)) (p.1 i))).mul
(tendsto_finset_prod Finset.univ (fun j _ ↦ tendsto_pi_nhds.1
(HasOuterApproxClosed.tendsto_apprSeq (ht j)) (p.2 j)))
have hp1 (x : Π i, X i) : ∏ i, (s i).indicator (fun _ ↦ (1 : ℝ≥0)) (x i) =
(Set.univ.pi s).indicator 1 x := by
simp only [Set.indicator, Set.mem_pi, mem_univ, forall_const, Pi.ofNat_apply]
split_ifs with hy
· simp only [Set.mem_pi, mem_univ, forall_const] at hy
exact Finset.prod_eq_one (by simpa)
· simpa [Finset.prod_eq_zero_iff] using hy
have hp2 (y : Π j, Y j) : ∏ j, (t j).indicator (fun _ ↦ (1 : ℝ≥0)) (y j) =
(Set.univ.pi t).indicator 1 y := by
simp only [Set.indicator, Set.mem_pi, mem_univ, forall_const, Pi.ofNat_apply]
split_ifs with hy
· simp only [Set.mem_pi, mem_univ, forall_const] at hy
exact Finset.prod_eq_one (by simpa)
· simpa [Finset.prod_eq_zero_iff] using hy
simp_rw [hp1, hp2, ← Set.indicator_prod_one, Prod.eta] at this
have h1 : Tendsto (fun n ↦ ∫⁻ p, ((∏ i, (hs i).apprSeq n (p.1 i)) *
∏ j, (ht j).apprSeq n (p.2 j) : ℝ≥0) ∂μ)
atTop (𝓝 (∫⁻ p, (((Set.univ.pi s) ×ˢ (Set.univ.pi t)).indicator 1 p : ℝ≥0) ∂μ)) := by
refine tendsto_lintegral_filter_of_dominated_convergence 1
(Eventually.of_forall <| by fun_prop) (Eventually.of_forall fun n ↦ ae_of_all _ fun ω ↦ ?_)
(by simp) (ae_of_all _ this)
grw [Finset.prod_le_one (by simp), Finset.prod_le_one (by simp)]
· simp
· exact fun j _ ↦ HasOuterApproxClosed.apprSeq_apply_le_one (ht j) _ _
· exact fun i _ ↦ HasOuterApproxClosed.apprSeq_apply_le_one (hs i) _ _
have h2 : Tendsto (fun n ↦ ∫⁻ p, ((∏ i, (hs i).apprSeq n (p.1 i)) *
∏ j, (ht j).apprSeq n (p.2 j) : ℝ≥0) ∂μ)
atTop (𝓝 (∫⁻ p, (((Set.univ.pi s) ×ˢ (Set.univ.pi t)).indicator 1 p : ℝ≥0) ∂ν)) := by
simp_rw [coe_mul, h]
refine tendsto_lintegral_filter_of_dominated_convergence 1
(Eventually.of_forall <| by fun_prop) (Eventually.of_forall fun _ ↦ ae_of_all _ fun _ ↦ ?_)
(by simp) (ae_of_all _ this)
grw [Finset.prod_le_one (by simp), Finset.prod_le_one (by simp)]
· simp
· exact fun j _ ↦ HasOuterApproxClosed.apprSeq_apply_le_one (ht j) _ _
· exact fun i _ ↦ HasOuterApproxClosed.apprSeq_apply_le_one (hs i) _ _
convert tendsto_nhds_unique h1 h2 <;>
simp [(MeasurableSet.univ_pi (fun i ↦ (hs i).measurableSet)).prod
(.univ_pi (fun j ↦ (ht j).measurableSet))]
/-- A finite measure `μ` over `(Π i, X i) × (Π j, Y j)` is determined by the values
`∫ p, (Π i, f i (p.1 i)) * (Π j, g j (p.2 j)) ∂μ`, for `f : (i : ι) → X i → ℝ`
and `g : (j : κ) → Y j → ℝ` any families of bounded continuous functions. -/
lemma ext_of_integral_prod_mul_prod_boundedContinuousFunction
{μ ν : Measure ((Π i, X i) × (Π j, Y j))} [IsFiniteMeasure μ] [IsFiniteMeasure ν]
(h : ∀ (f : (i : ι) → X i →ᵇ ℝ) (g : (j : κ) → Y j →ᵇ ℝ),
∫ p, (∏ i, f i (p.1 i)) * ∏ j, g j (p.2 j) ∂μ =
∫ p, (∏ i, f i (p.1 i)) * ∏ j, g j (p.2 j) ∂ν) :
μ = ν := by
refine ext_of_lintegral_prod_mul_prod_boundedContinuousFunction fun f g ↦ ?_
rw [← toReal_eq_toReal_iff']
· simp only [coe_finset_prod]
have {μ : Measure ((Π i, X i) × Π j, Y j)} :
(∫⁻ p, (∏ i, (f i (p.1 i) : ℝ≥0∞)) * ∏ j, (g j (p.2 j) : ℝ≥0∞) ∂μ).toReal =
∫ p, (∏ i, (f i (p.1 i)).toReal) * ∏ j, (g j (p.2 j)).toReal ∂μ := by
rw [integral_eq_lintegral_of_nonneg_ae]
· simp [Finset.prod_nonneg, ofReal_prod_of_nonneg]
· exact Eventually.of_forall fun _ ↦ by positivity
exact AEStronglyMeasurable.mul
(Finset.aestronglyMeasurable_fun_prod _ fun _ _ ↦
continuous_coe.aestronglyMeasurable.comp_measurable (by fun_prop))
(Finset.aestronglyMeasurable_fun_prod _ fun _ _ ↦
continuous_coe.aestronglyMeasurable.comp_measurable (by fun_prop))
simp_rw [this]
exact h (fun i ↦ ⟨⟨fun x ↦ (f i x), by fun_prop⟩, (f i).map_bounded'⟩)
(fun j ↦ ⟨⟨fun y ↦ (g j y), by fun_prop⟩, (g j).map_bounded'⟩)
· convert (lintegral_lt_top_of_nnreal μ
((∏ i, (f i).compContinuous ⟨Function.eval i ∘ Prod.fst, by fun_prop⟩) *
(∏ j, (g j).compContinuous ⟨Function.eval j ∘ Prod.snd, by fun_prop⟩))).ne
simp
· convert (lintegral_lt_top_of_nnreal ν
((∏ i, (f i).compContinuous ⟨Function.eval i ∘ Prod.fst, by fun_prop⟩) *
(∏ j, (g j).compContinuous ⟨Function.eval j ∘ Prod.snd, by fun_prop⟩))).ne
simp
lemma ext_of_integral_prod_mul_prod_boundedContinuousFunction'
{μ ν : Measure ((Π i, X i) × (Π j, Y j))} [IsFiniteMeasure μ] [IsFiniteMeasure ν]
(h : ∀ (f : (Π i, X i) →ᵇ ℝ) (g : (Π j, Y j) →ᵇ ℝ),
∫ p, f p.1 * g p.2 ∂μ = ∫ p, f p.1 * g p.2 ∂ν) :
μ = ν := by
refine ext_of_integral_prod_mul_prod_boundedContinuousFunction fun f g ↦ ?_
convert h (∏ i, (f i).compContinuous ⟨Function.eval i, by fun_prop⟩)
(∏ j, (g j).compContinuous ⟨Function.eval j, by fun_prop⟩) <;> simp
/-- The product of two finite measures `μ` and `ν` is the only finite measure `ξ` such that
for all families of real bounded continuous functions `f` and `g` we have
`∫ p, (Π i, f i (p.1 i)) * (Π j, g j (p.2 j)) ∂ξ =
(∫ x, Π i, f i (x i) ∂μ) * (∫ y, Π j, g j (y j) ∂ν)`. -/
lemma eq_prod_of_integral_prod_mul_prod_boundedContinuousFunction {μ : Measure (Π i, X i)}
{ν : Measure (Π j, Y j)} {ξ : Measure ((Π i, X i) × (Π j, Y j))}
[IsFiniteMeasure μ] [IsFiniteMeasure ν] [IsFiniteMeasure ξ]
(h : ∀ (f : (i : ι) → X i →ᵇ ℝ) (g : (j : κ) → Y j →ᵇ ℝ),
∫ p, (∏ i, f i (p.1 i)) * (∏ j, g j (p.2 j)) ∂ξ =
(∫ x, ∏ i, f i (x i) ∂μ) * (∫ y, ∏ j, g j (y j) ∂ν)) :
ξ = μ.prod ν :=
ext_of_integral_prod_mul_prod_boundedContinuousFunction fun f g ↦ by rw [h, ← integral_prod_mul]
lemma eq_prod_of_integral_prod_mul_prod_boundedContinuousFunction' {μ : Measure (Π i, X i)}
{ν : Measure (Π j, Y j)} {ξ : Measure ((Π i, X i) × (Π j, Y j))}
[IsFiniteMeasure μ] [IsFiniteMeasure ν] [IsFiniteMeasure ξ]
(h : ∀ (f : (Π i, X i) →ᵇ ℝ) (g : (Π j, Y j) →ᵇ ℝ),
∫ p, f p.1 * g p.2 ∂ξ = (∫ x, f x ∂μ) * (∫ y, g y ∂ν)) :
ξ = μ.prod ν :=
ext_of_integral_prod_mul_prod_boundedContinuousFunction' fun f g ↦ by rw [h, ← integral_prod_mul]
lemma ext_of_integral_prod_mul_boundedContinuousFunction {μ ν : Measure ((Π i, X i) × T)}
[IsFiniteMeasure μ] [IsFiniteMeasure ν]
(h : ∀ (f : (i : ι) → X i →ᵇ ℝ) (g : T →ᵇ ℝ),
∫ p, (∏ i, f i (p.1 i)) * g p.2 ∂μ = ∫ p, (∏ i, f i (p.1 i)) * g p.2 ∂ν) :
μ = ν := by
let e : ((Π i, X i) × T) ≃ᵐ ((Π i, X i) × (Unit → T)) :=
{ toFun p := ⟨fun i ↦ p.1 i, fun _ ↦ p.2⟩
invFun p := ⟨fun i ↦ p.1 i, p.2 ()⟩
left_inv p := by simp
right_inv p := by simp
measurable_toFun := by simp; fun_prop
measurable_invFun := by simp; fun_prop }
rw [← e.map_measurableEquiv_injective.eq_iff]
refine ext_of_integral_prod_mul_prod_boundedContinuousFunction fun f g ↦ ?_
rw [integral_map_equiv, integral_map_equiv]
simpa [e] using h f (g ())
lemma ext_of_integral_prod_mul_boundedContinuousFunction' {μ ν : Measure ((Π i, X i) × T)}
[IsFiniteMeasure μ] [IsFiniteMeasure ν]
(h : ∀ (f : (Π i, X i) →ᵇ ℝ) (g : T →ᵇ ℝ),
∫ p, f p.1 * g p.2 ∂μ = ∫ p, f p.1 * g p.2 ∂ν) :
μ = ν := by
refine ext_of_integral_prod_mul_boundedContinuousFunction fun f g ↦ ?_
convert h (∏ i, (f i).compContinuous ⟨Function.eval i, by fun_prop⟩) g <;> simp
lemma eq_prod_of_integral_prod_mul_boundedContinuousFunction {μ : Measure (Π i, X i)}
{ν : Measure T} {ξ : Measure ((Π i, X i) × T)}
[IsFiniteMeasure μ] [IsFiniteMeasure ν] [IsFiniteMeasure ξ]
(h : ∀ (f : (i : ι) → X i →ᵇ ℝ) (g : T →ᵇ ℝ),
∫ p, (∏ i, f i (p.1 i)) * g p.2 ∂ξ = (∫ x, ∏ i, f i (x i) ∂μ) * (∫ t, g t ∂ν)) :
ξ = μ.prod ν :=
ext_of_integral_prod_mul_boundedContinuousFunction fun f g ↦ by rw [h, ← integral_prod_mul]
lemma eq_prod_of_integral_prod_mul_boundedContinuousFunction' {μ : Measure (Π i, X i)}
{ν : Measure T} {ξ : Measure ((Π i, X i) × T)}
[IsFiniteMeasure μ] [IsFiniteMeasure ν] [IsFiniteMeasure ξ]
(h : ∀ (f : (Π i, X i) →ᵇ ℝ) (g : T →ᵇ ℝ),
∫ p, f p.1 * g p.2 ∂ξ = (∫ x, f x ∂μ) * (∫ t, g t ∂ν)) :
ξ = μ.prod ν :=
ext_of_integral_prod_mul_boundedContinuousFunction' fun f g ↦ by rw [h, ← integral_prod_mul]
lemma ext_of_integral_mul_prod_boundedContinuousFunction {μ ν : Measure (Z × (Π j, Y j))}
[IsFiniteMeasure μ] [IsFiniteMeasure ν]
(h : ∀ (f : Z →ᵇ ℝ) (g : (j : κ) → Y j →ᵇ ℝ),
∫ p, f p.1 * ∏ j, g j (p.2 j) ∂μ = ∫ p, f p.1 * ∏ j, g j (p.2 j) ∂ν) :
μ = ν := by
let e : (Z × (Π i, Y i)) ≃ᵐ ((Π i, Y i) × Z) :=
{ toEquiv := Equiv.prodComm _ _
measurable_toFun := measurable_swap
measurable_invFun := measurable_swap }
rw [← e.map_measurableEquiv_injective.eq_iff]
refine ext_of_integral_prod_mul_boundedContinuousFunction fun f g ↦ ?_
rw [integral_map_equiv, integral_map_equiv]
simpa [e, mul_comm] using h g f
lemma ext_of_integral_mul_prod_boundedContinuousFunction' {μ ν : Measure (Z × (Π i, Y i))}
[IsFiniteMeasure μ] [IsFiniteMeasure ν]
(h : ∀ (f : Z →ᵇ ℝ) (g : (Π j, Y j) →ᵇ ℝ), ∫ p, f p.1 * g p.2 ∂μ = ∫ p, f p.1 * g p.2 ∂ν) :
μ = ν := by
refine ext_of_integral_mul_prod_boundedContinuousFunction fun f g ↦ ?_
convert h f (∏ j, (g j).compContinuous ⟨Function.eval j, by fun_prop⟩) <;> simp
lemma eq_prod_of_integral_mul_prod_boundedContinuousFunction {μ : Measure Z}
{ν : Measure (Π j, Y j)} {ξ : Measure (Z × (Π j, Y j))}
[IsFiniteMeasure μ] [IsFiniteMeasure ν] [IsFiniteMeasure ξ]
(h : ∀ (f : Z →ᵇ ℝ) (g : (j : κ) → Y j →ᵇ ℝ),
∫ p, f p.1 * (∏ j, g j (p.2 j)) ∂ξ = (∫ z, f z ∂μ) * (∫ y, ∏ j, g j (y j) ∂ν)) :
ξ = μ.prod ν :=
ext_of_integral_mul_prod_boundedContinuousFunction fun f g ↦ by rw [h, ← integral_prod_mul]
lemma eq_prod_of_integral_mul_prod_boundedContinuousFunction' {μ : Measure Z}
{ν : Measure (Π j, Y j)} {ξ : Measure (Z × (Π j, Y j))}
[IsFiniteMeasure μ] [IsFiniteMeasure ν] [IsFiniteMeasure ξ]
(h : ∀ (f : Z →ᵇ ℝ) (g : (Π j, Y j) →ᵇ ℝ),
∫ p, f p.1 * g p.2 ∂ξ = (∫ z, f z ∂μ) * (∫ y, g y ∂ν)) :
ξ = μ.prod ν :=
ext_of_integral_mul_prod_boundedContinuousFunction' fun f g ↦ by rw [h, ← integral_prod_mul]
/-- A finite measure `μ` over `X × Y` is determined by the values `∫ p, f p.1 * g p.2 ∂μ`,
for `f : X → ℝ` and `g : Y → ℝ` any bounded continuous functions. -/
lemma ext_of_integral_mul_boundedContinuousFunction {μ ν : Measure (Z × T)}
[IsFiniteMeasure μ] [IsFiniteMeasure ν]
(h : ∀ (f : Z →ᵇ ℝ) (g : T →ᵇ ℝ), ∫ p, f p.1 * g p.2 ∂μ = ∫ p, f p.1 * g p.2 ∂ν) :
μ = ν := by
let e : (Z × T) ≃ᵐ ((Unit → Z) × (Unit → T)) :=
{ toFun p := ⟨fun _ ↦ p.1, fun _ ↦ p.2⟩
invFun p := ⟨p.1 (), p.2 ()⟩
left_inv p := by simp
right_inv p := by simp
measurable_toFun := by simp; fun_prop
measurable_invFun := by simp; fun_prop }
rw [← e.map_measurableEquiv_injective.eq_iff]
refine ext_of_integral_prod_mul_prod_boundedContinuousFunction fun f g ↦ ?_
rw [integral_map_equiv, integral_map_equiv]
simpa [e] using h (f ()) (g ())
/-- The product of two finite measures `μ` and `ν` is the only finite measure `ξ` such that
for all real bounded continuous functions `f` and `g` we have
`∫ z, f z.1 * g z.2 ∂ξ = ∫ x, f x ∂μ * ∫ y, g y ∂ν`. -/
lemma eq_prod_of_integral_mul_boundedContinuousFunction {μ : Measure Z}
{ν : Measure T} {ξ : Measure (Z × T)}
[IsFiniteMeasure μ] [IsFiniteMeasure ν] [IsFiniteMeasure ξ]
(h : ∀ (f : Z →ᵇ ℝ) (g : T →ᵇ ℝ), ∫ p, f p.1 * g p.2 ∂ξ = (∫ z, f z ∂μ) * (∫ t, g t ∂ν)) :
ξ = μ.prod ν :=
ext_of_integral_mul_boundedContinuousFunction fun f g ↦ by rw [h, ← integral_prod_mul]
end Measure |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/NullMeasurable.lean | import Mathlib.MeasureTheory.MeasurableSpace.EventuallyMeasurable
import Mathlib.MeasureTheory.MeasurableSpace.Basic
import Mathlib.MeasureTheory.Measure.AEDisjoint
/-!
# Null measurable sets and complete measures
## Main definitions
### Null measurable sets and functions
A set `s : Set α` is called *null measurable* (`MeasureTheory.NullMeasurableSet`) if it satisfies
any of the following equivalent conditions:
* there exists a measurable set `t` such that `s =ᵐ[μ] t` (this is used as a definition);
* `MeasureTheory.toMeasurable μ s =ᵐ[μ] s`;
* there exists a measurable subset `t ⊆ s` such that `t =ᵐ[μ] s` (in this case the latter equality
means that `μ (s \ t) = 0`);
* `s` can be represented as a union of a measurable set and a set of measure zero;
* `s` can be represented as a difference of a measurable set and a set of measure zero.
Null measurable sets form a σ-algebra that is registered as a `MeasurableSpace` instance on
`MeasureTheory.NullMeasurableSpace α μ`. We also say that `f : α → β` is
`MeasureTheory.NullMeasurable` if the preimage of a measurable set is a null measurable set.
In other words, `f : α → β` is null measurable if it is measurable as a function
`MeasureTheory.NullMeasurableSpace α μ → β`.
### Complete measures
We say that a measure `μ` is complete w.r.t. the `MeasurableSpace α` σ-algebra (or the σ-algebra is
complete w.r.t. measure `μ`) if every set of measure zero is measurable. In this case all null
measurable sets and functions are measurable.
For each measure `μ`, we define `MeasureTheory.Measure.completion μ` to be the same measure
interpreted as a measure on `MeasureTheory.NullMeasurableSpace α μ` and prove that this is a
complete measure.
## Implementation notes
We define `MeasureTheory.NullMeasurableSet` as `@MeasurableSet (NullMeasurableSpace α μ) _` so
that theorems about `MeasurableSet`s like `MeasurableSet.union` can be applied to
`NullMeasurableSet`s. However, these lemmas output terms of the same form
`@MeasurableSet (NullMeasurableSpace α μ) _ _`. While this is definitionally equal to the
expected output `NullMeasurableSet s μ`, it looks different and may be misleading. So we copy all
standard lemmas about measurable sets to the `MeasureTheory.NullMeasurableSet` namespace and fix
the output type.
## Tags
measurable, measure, null measurable, completion
-/
open Filter Set Encodable
open scoped ENNReal
variable {ι α β γ : Type*}
namespace MeasureTheory
/-- A type tag for `α` with `MeasurableSet` given by `NullMeasurableSet`. -/
@[nolint unusedArguments]
def NullMeasurableSpace (α : Type*) [MeasurableSpace α]
(_μ : Measure α := by volume_tac) : Type _ :=
α
section
variable {m0 : MeasurableSpace α} {μ : Measure α} {s t : Set α}
instance NullMeasurableSpace.instInhabited [h : Inhabited α] :
Inhabited (NullMeasurableSpace α μ) :=
h
instance NullMeasurableSpace.instSubsingleton [h : Subsingleton α] :
Subsingleton (NullMeasurableSpace α μ) :=
h
instance NullMeasurableSpace.instMeasurableSpace : MeasurableSpace (NullMeasurableSpace α μ) :=
@eventuallyMeasurableSpace α inferInstance (ae μ) _
/-- A set is called `NullMeasurableSet` if it can be approximated by a measurable set up to
a set of null measure. -/
def NullMeasurableSet [MeasurableSpace α] (s : Set α)
(μ : Measure α := by volume_tac) : Prop :=
@MeasurableSet (NullMeasurableSpace α μ) _ s
@[simp, aesop unsafe (rule_sets := [Measurable])]
theorem _root_.MeasurableSet.nullMeasurableSet (h : MeasurableSet s) : NullMeasurableSet s μ :=
h.eventuallyMeasurableSet
theorem nullMeasurableSet_empty : NullMeasurableSet ∅ μ :=
MeasurableSet.empty
theorem nullMeasurableSet_univ : NullMeasurableSet univ μ :=
MeasurableSet.univ
namespace NullMeasurableSet
theorem of_null (h : μ s = 0) : NullMeasurableSet s μ :=
⟨∅, MeasurableSet.empty, ae_eq_empty.2 h⟩
theorem compl (h : NullMeasurableSet s μ) : NullMeasurableSet sᶜ μ :=
MeasurableSet.compl h
theorem of_compl (h : NullMeasurableSet sᶜ μ) : NullMeasurableSet s μ :=
MeasurableSet.of_compl h
@[simp]
theorem compl_iff : NullMeasurableSet sᶜ μ ↔ NullMeasurableSet s μ :=
MeasurableSet.compl_iff
@[nontriviality]
theorem of_subsingleton [Subsingleton α] : NullMeasurableSet s μ :=
Subsingleton.measurableSet
protected theorem congr (hs : NullMeasurableSet s μ) (h : s =ᵐ[μ] t) : NullMeasurableSet t μ :=
EventuallyMeasurableSet.congr hs h.symm
@[measurability]
protected theorem iUnion {ι : Sort*} [Countable ι] {s : ι → Set α}
(h : ∀ i, NullMeasurableSet (s i) μ) : NullMeasurableSet (⋃ i, s i) μ :=
MeasurableSet.iUnion h
protected theorem biUnion {f : ι → Set α} {s : Set ι} (hs : s.Countable)
(h : ∀ b ∈ s, NullMeasurableSet (f b) μ) : NullMeasurableSet (⋃ b ∈ s, f b) μ :=
MeasurableSet.biUnion hs h
protected theorem sUnion {s : Set (Set α)} (hs : s.Countable) (h : ∀ t ∈ s, NullMeasurableSet t μ) :
NullMeasurableSet (⋃₀ s) μ := by
rw [sUnion_eq_biUnion]
exact MeasurableSet.biUnion hs h
@[measurability]
protected theorem iInter {ι : Sort*} [Countable ι] {f : ι → Set α}
(h : ∀ i, NullMeasurableSet (f i) μ) : NullMeasurableSet (⋂ i, f i) μ :=
MeasurableSet.iInter h
protected theorem biInter {f : β → Set α} {s : Set β} (hs : s.Countable)
(h : ∀ b ∈ s, NullMeasurableSet (f b) μ) : NullMeasurableSet (⋂ b ∈ s, f b) μ :=
MeasurableSet.biInter hs h
protected theorem sInter {s : Set (Set α)} (hs : s.Countable) (h : ∀ t ∈ s, NullMeasurableSet t μ) :
NullMeasurableSet (⋂₀ s) μ :=
MeasurableSet.sInter hs h
@[simp]
protected theorem union (hs : NullMeasurableSet s μ) (ht : NullMeasurableSet t μ) :
NullMeasurableSet (s ∪ t) μ :=
MeasurableSet.union hs ht
protected theorem union_null (hs : NullMeasurableSet s μ) (ht : μ t = 0) :
NullMeasurableSet (s ∪ t) μ :=
hs.union (of_null ht)
@[simp]
protected theorem inter (hs : NullMeasurableSet s μ) (ht : NullMeasurableSet t μ) :
NullMeasurableSet (s ∩ t) μ :=
MeasurableSet.inter hs ht
@[simp]
protected theorem diff (hs : NullMeasurableSet s μ) (ht : NullMeasurableSet t μ) :
NullMeasurableSet (s \ t) μ :=
MeasurableSet.diff hs ht
@[simp]
protected theorem symmDiff {s₁ s₂ : Set α} (h₁ : NullMeasurableSet s₁ μ)
(h₂ : NullMeasurableSet s₂ μ) : NullMeasurableSet (symmDiff s₁ s₂) μ :=
(h₁.diff h₂).union (h₂.diff h₁)
@[simp]
protected theorem disjointed {f : ℕ → Set α} (h : ∀ i, NullMeasurableSet (f i) μ) (n) :
NullMeasurableSet (disjointed f n) μ :=
MeasurableSet.disjointed h n
protected theorem const (p : Prop) : NullMeasurableSet { _a : α | p } μ :=
MeasurableSet.const p
instance instMeasurableSingletonClass [MeasurableSingletonClass α] :
MeasurableSingletonClass (NullMeasurableSpace α μ) :=
eventuallyMeasurableSingleton (m := m0)
protected theorem insert [MeasurableSingletonClass (NullMeasurableSpace α μ)]
(hs : NullMeasurableSet s μ) (a : α) : NullMeasurableSet (insert a s) μ :=
MeasurableSet.insert hs a
theorem exists_measurable_superset_ae_eq (h : NullMeasurableSet s μ) :
∃ t ⊇ s, MeasurableSet t ∧ t =ᵐ[μ] s := by
rcases h with ⟨t, htm, hst⟩
refine ⟨t ∪ toMeasurable μ (s \ t), ?_, htm.union (measurableSet_toMeasurable _ _), ?_⟩
· exact diff_subset_iff.1 (subset_toMeasurable _ _)
· have : toMeasurable μ (s \ t) =ᵐ[μ] (∅ : Set α) := by simp [ae_le_set.1 hst.le]
simpa only [union_empty] using hst.symm.union this
theorem toMeasurable_ae_eq (h : NullMeasurableSet s μ) : toMeasurable μ s =ᵐ[μ] s := by
rw [toMeasurable_def, dif_pos]
exact (exists_measurable_superset_ae_eq h).choose_spec.2.2
theorem compl_toMeasurable_compl_ae_eq (h : NullMeasurableSet s μ) : (toMeasurable μ sᶜ)ᶜ =ᵐ[μ] s :=
Iff.mpr ae_eq_set_compl <| toMeasurable_ae_eq h.compl
theorem exists_measurable_subset_ae_eq (h : NullMeasurableSet s μ) :
∃ t ⊆ s, MeasurableSet t ∧ t =ᵐ[μ] s :=
⟨(toMeasurable μ sᶜ)ᶜ, compl_subset_comm.2 <| subset_toMeasurable _ _,
(measurableSet_toMeasurable _ _).compl, compl_toMeasurable_compl_ae_eq h⟩
end NullMeasurableSet
open NullMeasurableSet
open scoped Function -- required for scoped `on` notation
/-- If `sᵢ` is a countable family of (null) measurable pairwise `μ`-a.e. disjoint sets, then there
exists a subordinate family `tᵢ ⊆ sᵢ` of measurable pairwise disjoint sets such that
`tᵢ =ᵐ[μ] sᵢ`. -/
theorem exists_subordinate_pairwise_disjoint [Countable ι] {s : ι → Set α}
(h : ∀ i, NullMeasurableSet (s i) μ) (hd : Pairwise (AEDisjoint μ on s)) :
∃ t : ι → Set α,
(∀ i, t i ⊆ s i) ∧
(∀ i, s i =ᵐ[μ] t i) ∧ (∀ i, MeasurableSet (t i)) ∧ Pairwise (Disjoint on t) := by
choose t ht_sub htm ht_eq using fun i => exists_measurable_subset_ae_eq (h i)
rcases exists_null_pairwise_disjoint_diff hd with ⟨u, hum, hu₀, hud⟩
exact
⟨fun i => t i \ u i, fun i => diff_subset.trans (ht_sub _), fun i =>
(ht_eq _).symm.trans (diff_null_ae_eq_self (hu₀ i)).symm, fun i => (htm i).diff (hum i),
hud.mono fun i j h =>
h.mono (diff_subset_diff_left (ht_sub i)) (diff_subset_diff_left (ht_sub j))⟩
theorem measure_iUnion {m0 : MeasurableSpace α} {μ : Measure α} [Countable ι] {f : ι → Set α}
(hn : Pairwise (Disjoint on f)) (h : ∀ i, MeasurableSet (f i)) :
μ (⋃ i, f i) = ∑' i, μ (f i) := by
rw [measure_eq_extend (MeasurableSet.iUnion h),
extend_iUnion MeasurableSet.empty _ MeasurableSet.iUnion _ hn h]
· simp [measure_eq_extend, h]
· exact μ.empty
· exact μ.m_iUnion
theorem measure_iUnion₀ [Countable ι] {f : ι → Set α} (hd : Pairwise (AEDisjoint μ on f))
(h : ∀ i, NullMeasurableSet (f i) μ) : μ (⋃ i, f i) = ∑' i, μ (f i) := by
rcases exists_subordinate_pairwise_disjoint h hd with ⟨t, _ht_sub, ht_eq, htm, htd⟩
calc
μ (⋃ i, f i) = μ (⋃ i, t i) := measure_congr (EventuallyEq.countable_iUnion ht_eq)
_ = ∑' i, μ (t i) := measure_iUnion htd htm
_ = ∑' i, μ (f i) := tsum_congr fun i => measure_congr (ht_eq _).symm
theorem measure_union₀_aux (hs : NullMeasurableSet s μ) (ht : NullMeasurableSet t μ)
(hd : AEDisjoint μ s t) : μ (s ∪ t) = μ s + μ t := by
rw [union_eq_iUnion, measure_iUnion₀, tsum_fintype, Fintype.sum_bool, cond, cond]
exacts [(pairwise_on_bool AEDisjoint.symmetric).2 hd, fun b => Bool.casesOn b ht hs]
/-- A null measurable set `t` is Carathéodory measurable: for any `s`, we have
`μ (s ∩ t) + μ (s \ t) = μ s`. -/
theorem measure_inter_add_diff₀ (s : Set α) (ht : NullMeasurableSet t μ) :
μ (s ∩ t) + μ (s \ t) = μ s := by
refine le_antisymm ?_ (measure_le_inter_add_diff _ _ _)
rcases exists_measurable_superset μ s with ⟨s', hsub, hs'm, hs'⟩
replace hs'm : NullMeasurableSet s' μ := hs'm.nullMeasurableSet
calc
μ (s ∩ t) + μ (s \ t) ≤ μ (s' ∩ t) + μ (s' \ t) := by gcongr
_ = μ (s' ∩ t ∪ s' \ t) :=
(measure_union₀_aux (hs'm.inter ht) (hs'm.diff ht) <|
(@disjoint_inf_sdiff _ s' t _).aedisjoint).symm
_ = μ s' := congr_arg μ (inter_union_diff _ _)
_ = μ s := hs'
/-- If `s` and `t` are null measurable sets of equal measure
and their intersection has finite measure,
then `s \ t` and `t \ s` have equal measures too. -/
theorem measure_diff_symm (hs : NullMeasurableSet s μ) (ht : NullMeasurableSet t μ)
(h : μ s = μ t) (hfin : μ (s ∩ t) ≠ ∞) : μ (s \ t) = μ (t \ s) := by
rw [← ENNReal.add_right_inj hfin, measure_inter_add_diff₀ _ ht, inter_comm,
measure_inter_add_diff₀ _ hs, h]
theorem measure_union_add_inter₀ (s : Set α) (ht : NullMeasurableSet t μ) :
μ (s ∪ t) + μ (s ∩ t) = μ s + μ t := by
rw [← measure_inter_add_diff₀ (s ∪ t) ht, union_inter_cancel_right, union_diff_right, ←
measure_inter_add_diff₀ s ht, add_comm, ← add_assoc, add_right_comm]
theorem measure_union_add_inter₀' (hs : NullMeasurableSet s μ) (t : Set α) :
μ (s ∪ t) + μ (s ∩ t) = μ s + μ t := by
rw [union_comm, inter_comm, measure_union_add_inter₀ t hs, add_comm]
theorem measure_union₀ (ht : NullMeasurableSet t μ) (hd : AEDisjoint μ s t) :
μ (s ∪ t) = μ s + μ t := by rw [← measure_union_add_inter₀ s ht, hd, add_zero]
theorem measure_union₀' (hs : NullMeasurableSet s μ) (hd : AEDisjoint μ s t) :
μ (s ∪ t) = μ s + μ t := by rw [union_comm, measure_union₀ hs (AEDisjoint.symm hd), add_comm]
theorem measure_add_measure_compl₀ {s : Set α} (hs : NullMeasurableSet s μ) :
μ s + μ sᶜ = μ univ := by rw [← measure_union₀' hs aedisjoint_compl_right, union_compl_self]
lemma measure_of_measure_compl_eq_zero (hs : μ sᶜ = 0) : μ s = μ Set.univ := by
simpa [hs] using measure_add_measure_compl₀ <| .of_compl <| .of_null hs
section MeasurableSingletonClass
variable [MeasurableSingletonClass (NullMeasurableSpace α μ)]
theorem nullMeasurableSet_singleton (x : α) : NullMeasurableSet {x} μ :=
@measurableSet_singleton _ _ _ _
@[simp]
theorem nullMeasurableSet_insert {a : α} {s : Set α} :
NullMeasurableSet (insert a s) μ ↔ NullMeasurableSet s μ :=
measurableSet_insert
theorem nullMeasurableSet_eq {a : α} : NullMeasurableSet { x | x = a } μ :=
nullMeasurableSet_singleton a
protected theorem _root_.Set.Finite.nullMeasurableSet (hs : s.Finite) : NullMeasurableSet s μ :=
Finite.measurableSet hs
protected theorem _root_.Finset.nullMeasurableSet (s : Finset α) : NullMeasurableSet (↑s) μ := by
apply Finset.measurableSet
end MeasurableSingletonClass
theorem _root_.Set.Finite.nullMeasurableSet_biUnion {f : ι → Set α} {s : Set ι} (hs : s.Finite)
(h : ∀ b ∈ s, NullMeasurableSet (f b) μ) : NullMeasurableSet (⋃ b ∈ s, f b) μ :=
Finite.measurableSet_biUnion hs h
theorem _root_.Finset.nullMeasurableSet_biUnion {f : ι → Set α} (s : Finset ι)
(h : ∀ b ∈ s, NullMeasurableSet (f b) μ) : NullMeasurableSet (⋃ b ∈ s, f b) μ :=
Finset.measurableSet_biUnion s h
theorem _root_.Set.Finite.nullMeasurableSet_sUnion {s : Set (Set α)} (hs : s.Finite)
(h : ∀ t ∈ s, NullMeasurableSet t μ) : NullMeasurableSet (⋃₀ s) μ :=
Finite.measurableSet_sUnion hs h
theorem _root_.Set.Finite.nullMeasurableSet_biInter {f : ι → Set α} {s : Set ι} (hs : s.Finite)
(h : ∀ b ∈ s, NullMeasurableSet (f b) μ) : NullMeasurableSet (⋂ b ∈ s, f b) μ :=
Finite.measurableSet_biInter hs h
theorem _root_.Finset.nullMeasurableSet_biInter {f : ι → Set α} (s : Finset ι)
(h : ∀ b ∈ s, NullMeasurableSet (f b) μ) : NullMeasurableSet (⋂ b ∈ s, f b) μ :=
s.finite_toSet.nullMeasurableSet_biInter h
theorem _root_.Set.Finite.nullMeasurableSet_sInter {s : Set (Set α)} (hs : s.Finite)
(h : ∀ t ∈ s, NullMeasurableSet t μ) : NullMeasurableSet (⋂₀ s) μ :=
NullMeasurableSet.sInter (Finite.countable hs) h
theorem nullMeasurableSet_toMeasurable : NullMeasurableSet (toMeasurable μ s) μ :=
(measurableSet_toMeasurable _ _).nullMeasurableSet
variable [MeasurableSingletonClass α] {mβ : MeasurableSpace β} [MeasurableSingletonClass β]
lemma measure_preimage_fst_singleton_eq_tsum [Countable β] (μ : Measure (α × β)) (x : α) :
μ (Prod.fst ⁻¹' {x}) = ∑' y, μ {(x, y)} := by
rw [← measure_iUnion (by simp [Pairwise]) fun _ ↦ .singleton _, iUnion_singleton_eq_range,
preimage_fst_singleton_eq_range]
lemma measure_preimage_snd_singleton_eq_tsum [Countable α] (μ : Measure (α × β)) (y : β) :
μ (Prod.snd ⁻¹' {y}) = ∑' x, μ {(x, y)} := by
have : Prod.snd ⁻¹' {y} = ⋃ x : α, {(x, y)} := by ext y; simp [Prod.ext_iff, eq_comm]
rw [this, measure_iUnion] <;> simp [Pairwise]
lemma measure_preimage_fst_singleton_eq_sum [Fintype β] (μ : Measure (α × β)) (x : α) :
μ (Prod.fst ⁻¹' {x}) = ∑ y, μ {(x, y)} := by
rw [measure_preimage_fst_singleton_eq_tsum μ x, tsum_fintype]
lemma measure_preimage_snd_singleton_eq_sum [Fintype α] (μ : Measure (α × β)) (y : β) :
μ (Prod.snd ⁻¹' {y}) = ∑ x, μ {(x, y)} := by
rw [measure_preimage_snd_singleton_eq_tsum μ y, tsum_fintype]
end
section NullMeasurable
variable [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ] {f : α → β} {μ : Measure α}
/-- A function `f : α → β` is null measurable if the preimage of a measurable set is a null
measurable set. -/
def NullMeasurable (f : α → β) (μ : Measure α := by volume_tac) : Prop :=
∀ ⦃s : Set β⦄, MeasurableSet s → NullMeasurableSet (f ⁻¹' s) μ
protected theorem _root_.Measurable.nullMeasurable (h : Measurable f) : NullMeasurable f μ :=
h.eventuallyMeasurable
protected theorem NullMeasurable.measurable' (h : NullMeasurable f μ) :
@Measurable (NullMeasurableSpace α μ) β _ _ f :=
h
theorem Measurable.comp_nullMeasurable {g : β → γ} (hg : Measurable g) (hf : NullMeasurable f μ) :
NullMeasurable (g ∘ f) μ :=
hg.comp_eventuallyMeasurable hf
theorem NullMeasurable.congr {g : α → β} (hf : NullMeasurable f μ) (hg : f =ᵐ[μ] g) :
NullMeasurable g μ :=
EventuallyMeasurable.congr hf hg.symm
end NullMeasurable
section IsComplete
/-- A measure is complete if every null set is also measurable.
A null set is a subset of a measurable set with measure `0`.
Since every measure is defined as a special case of an outer measure, we can more simply state
that a set `s` is null if `μ s = 0`. -/
class Measure.IsComplete {_ : MeasurableSpace α} (μ : Measure α) : Prop where
out' : ∀ s, μ s = 0 → MeasurableSet s
variable {m0 : MeasurableSpace α} {μ : Measure α} {s t : Set α}
theorem Measure.isComplete_iff : μ.IsComplete ↔ ∀ s, μ s = 0 → MeasurableSet s :=
⟨fun h => h.1, fun h => ⟨h⟩⟩
theorem Measure.IsComplete.out (h : μ.IsComplete) : ∀ s, μ s = 0 → MeasurableSet s :=
h.1
theorem measurableSet_of_null [μ.IsComplete] (hs : μ s = 0) : MeasurableSet s :=
MeasureTheory.Measure.IsComplete.out' s hs
theorem NullMeasurableSet.measurable_of_complete (hs : NullMeasurableSet s μ) [μ.IsComplete] :
MeasurableSet s :=
diff_diff_cancel_left (subset_toMeasurable μ s) ▸
(measurableSet_toMeasurable _ _).diff
(measurableSet_of_null (ae_le_set.1 <|
EventuallyEq.le (NullMeasurableSet.toMeasurable_ae_eq hs)))
theorem NullMeasurable.measurable_of_complete [μ.IsComplete] {_m1 : MeasurableSpace β} {f : α → β}
(hf : NullMeasurable f μ) : Measurable f := fun _s hs => (hf hs).measurable_of_complete
theorem _root_.Measurable.congr_ae {α β} [MeasurableSpace α] [MeasurableSpace β] {μ : Measure α}
[_hμ : μ.IsComplete] {f g : α → β} (hf : Measurable f) (hfg : f =ᵐ[μ] g) : Measurable g :=
NullMeasurable.measurable_of_complete (NullMeasurable.congr hf.nullMeasurable hfg)
namespace Measure
/-- Given a measure we can complete it to a (complete) measure on all null measurable sets. -/
def completion {_ : MeasurableSpace α} (μ : Measure α) :
MeasureTheory.Measure (NullMeasurableSpace α μ) where
toOuterMeasure := μ.toOuterMeasure
m_iUnion _ hs hd := measure_iUnion₀ (hd.mono fun _ _ h => h.aedisjoint) hs
trim_le := by
nth_rewrite 2 [← μ.trimmed]
exact OuterMeasure.trim_anti_measurableSpace _ fun _ ↦ MeasurableSet.nullMeasurableSet
instance completion.isComplete {_m : MeasurableSpace α} (μ : Measure α) : μ.completion.IsComplete :=
⟨fun _z hz => NullMeasurableSet.of_null hz⟩
@[simp]
theorem coe_completion {_ : MeasurableSpace α} (μ : Measure α) : ⇑μ.completion = μ :=
rfl
theorem completion_apply {_ : MeasurableSpace α} (μ : Measure α) (s : Set α) :
μ.completion s = μ s :=
rfl
@[simp]
theorem ae_completion {_ : MeasurableSpace α} (μ : Measure α) : ae μ.completion = ae μ := rfl
end Measure
end IsComplete
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/AddContent.lean | import Mathlib.MeasureTheory.SetSemiring
import Mathlib.MeasureTheory.OuterMeasure.Induced
/-!
# Additive Contents
An additive content `m` on a set of sets `C` is a set function with value 0 at the empty set which
is finitely additive on `C`. That means that for any finset `I` of pairwise disjoint sets in `C`
such that `⋃₀ I ∈ C`, `m (⋃₀ I) = ∑ s ∈ I, m s`.
Mathlib also has a definition of contents over compact sets: see `MeasureTheory.Content`.
A `Content` is in particular an `AddContent` on the set of compact sets.
## Main definitions
* `MeasureTheory.AddContent C`: additive contents over the set of sets `C`.
* `MeasureTheory.AddContent.IsSigmaSubadditive`: an `AddContent` is σ-subadditive if
`m (⋃ i, f i) ≤ ∑' i, m (f i)` for any sequence of sets `f` in `C` such that `⋃ i, f i ∈ C`.
## Main statements
Let `m` be an `AddContent C`. If `C` is a set semi-ring (`IsSetSemiring C`) we have the properties
* `MeasureTheory.sum_addContent_le_of_subset`: if `I` is a finset of pairwise disjoint sets in `C`
and `⋃₀ I ⊆ t` for `t ∈ C`, then `∑ s ∈ I, m s ≤ m t`.
* `MeasureTheory.addContent_mono`: if `s ⊆ t` for two sets in `C`, then `m s ≤ m t`.
* `MeasureTheory.addContent_sUnion_le_sum`: an `AddContent C` on a `SetSemiring C` is
sub-additive.
* `MeasureTheory.addContent_iUnion_eq_tsum_of_disjoint_of_addContent_iUnion_le`: if an
`AddContent` is σ-subadditive on a semi-ring of sets, then it is σ-additive.
* `MeasureTheory.addContent_union'`: if `s, t ∈ C` are disjoint and `s ∪ t ∈ C`,
then `m (s ∪ t) = m s + m t`.
If `C` is a set ring (`IsSetRing`), then `addContent_union` gives the same conclusion without the
hypothesis `s ∪ t ∈ C` (since it is a consequence of `IsSetRing C`).
If `C` is a set ring (`MeasureTheory.IsSetRing C`), we have
* `MeasureTheory.addContent_union_le`: for `s, t ∈ C`, `m (s ∪ t) ≤ m s + m t`
* `MeasureTheory.addContent_le_diff`: for `s, t ∈ C`, `m s - m t ≤ m (s \ t)`
* `IsSetRing.addContent_of_union`: a function on a ring of sets which is additive on pairs of
disjoint sets defines an additive content
* `addContent_iUnion_eq_sum_of_tendsto_zero`: if an additive content is continuous at `∅`, then
its value on a countable disjoint union is the sum of the values
* `MeasureTheory.isSigmaSubadditive_of_addContent_iUnion_eq_tsum`: if an `AddContent` is
σ-additive on a set ring, then it is σ-subadditive.
-/
open Set Finset Function Filter
open scoped ENNReal Topology Function
namespace MeasureTheory
variable {α : Type*} {C : Set (Set α)} {s t : Set α} {I : Finset (Set α)}
/-- An additive content is a set function with value 0 at the empty set which is finitely additive
on a given set of sets. -/
structure AddContent (C : Set (Set α)) where
/-- The value of the content on a set. -/
toFun : Set α → ℝ≥0∞
empty' : toFun ∅ = 0
sUnion' (I : Finset (Set α)) (_h_ss : ↑I ⊆ C)
(_h_dis : PairwiseDisjoint (I : Set (Set α)) id) (_h_mem : ⋃₀ ↑I ∈ C) :
toFun (⋃₀ I) = ∑ u ∈ I, toFun u
instance : Inhabited (AddContent C) :=
⟨{toFun := fun _ => 0
empty' := by simp
sUnion' := by simp }⟩
instance : FunLike (AddContent C) (Set α) ℝ≥0∞ where
coe m s := m.toFun s
coe_injective' m m' _ := by
cases m
cases m'
congr
variable {m m' : AddContent C}
@[ext] protected lemma AddContent.ext (h : ∀ s, m s = m' s) : m = m' :=
DFunLike.ext _ _ h
@[simp] lemma addContent_empty : m ∅ = 0 := m.empty'
lemma addContent_sUnion (h_ss : ↑I ⊆ C)
(h_dis : PairwiseDisjoint (I : Set (Set α)) id) (h_mem : ⋃₀ ↑I ∈ C) :
m (⋃₀ I) = ∑ u ∈ I, m u :=
m.sUnion' I h_ss h_dis h_mem
lemma addContent_union' (hs : s ∈ C) (ht : t ∈ C) (hst : s ∪ t ∈ C) (h_dis : Disjoint s t) :
m (s ∪ t) = m s + m t := by
by_cases hs_empty : s = ∅
· simp only [hs_empty, Set.empty_union, addContent_empty, zero_add]
classical
have h := addContent_sUnion (m := m) (I := {s, t}) ?_ ?_ ?_
rotate_left
· simp only [coe_pair, Set.insert_subset_iff, hs, ht, Set.singleton_subset_iff, and_self_iff]
· simp only [coe_pair, Set.pairwiseDisjoint_insert, pairwiseDisjoint_singleton,
mem_singleton_iff, Ne, id, forall_eq, true_and]
exact fun _ => h_dis
· simp only [coe_pair, sUnion_insert, sUnion_singleton]
exact hst
convert h
· simp only [coe_pair, sUnion_insert, sUnion_singleton]
· rw [sum_insert, sum_singleton]
simp only [Finset.mem_singleton]
refine fun hs_eq_t => hs_empty ?_
rw [← hs_eq_t] at h_dis
exact Disjoint.eq_bot_of_self h_dis
/-- An additive content is said to be sigma-sub-additive if for any sequence of sets `f` in `C` such
that `⋃ i, f i ∈ C`, we have `m (⋃ i, f i) ≤ ∑' i, m (f i)`. -/
def AddContent.IsSigmaSubadditive (m : AddContent C) : Prop :=
∀ ⦃f : ℕ → Set α⦄ (_hf : ∀ i, f i ∈ C) (_hf_Union : (⋃ i, f i) ∈ C), m (⋃ i, f i) ≤ ∑' i, m (f i)
section IsSetSemiring
lemma addContent_eq_add_disjointOfDiffUnion_of_subset (hC : IsSetSemiring C)
(hs : s ∈ C) (hI : ↑I ⊆ C) (hI_ss : ∀ t ∈ I, t ⊆ s)
(h_dis : PairwiseDisjoint (I : Set (Set α)) id) :
m s = ∑ i ∈ I, m i + ∑ i ∈ hC.disjointOfDiffUnion hs hI, m i := by
classical
conv_lhs => rw [← hC.sUnion_union_disjointOfDiffUnion_of_subset hs hI hI_ss]
rw [addContent_sUnion]
· rw [sum_union]
exact hC.disjoint_disjointOfDiffUnion hs hI
· rw [coe_union]
exact Set.union_subset hI (hC.disjointOfDiffUnion_subset hs hI)
· rw [coe_union]
exact hC.pairwiseDisjoint_union_disjointOfDiffUnion hs hI h_dis
· rwa [hC.sUnion_union_disjointOfDiffUnion_of_subset hs hI hI_ss]
/-- For an `m : addContent C` on a `SetSemiring C`, if `I` is a `Finset` of pairwise disjoint
sets in `C` and `⋃₀ I ⊆ t` for `t ∈ C`, then `∑ s ∈ I, m s ≤ m t`. -/
lemma sum_addContent_le_of_subset (hC : IsSetSemiring C)
(h_ss : ↑I ⊆ C) (h_dis : PairwiseDisjoint (I : Set (Set α)) id)
(ht : t ∈ C) (hJt : ∀ s ∈ I, s ⊆ t) :
∑ u ∈ I, m u ≤ m t := by
classical
rw [addContent_eq_add_disjointOfDiffUnion_of_subset hC ht h_ss hJt h_dis]
exact le_add_right le_rfl
/-- An `addContent C` on a `SetSemiring C` is monotone. -/
lemma addContent_mono (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C)
(hst : s ⊆ t) :
m s ≤ m t := by
have h := sum_addContent_le_of_subset (m := m) hC (I := {s}) ?_ ?_ ht ?_
· simpa only [sum_singleton] using h
· rwa [singleton_subset_set_iff]
· simp only [coe_singleton, pairwiseDisjoint_singleton]
· simp [hst]
/-- For an `m : addContent C` on a `SetSemiring C` and `s t : Set α` with `s ⊆ t`, we can write
`m t = m s + ∑ i in hC.disjointOfDiff ht hs, m i`. -/
theorem eq_add_disjointOfDiff_of_subset (hC : IsSetSemiring C)
(hs : s ∈ C) (ht : t ∈ C) (hst : s ⊆ t) :
m t = m s + ∑ i ∈ hC.disjointOfDiff ht hs, m i := by
classical
conv_lhs => rw [← hC.sUnion_insert_disjointOfDiff ht hs hst]
rw [← coe_insert, addContent_sUnion]
· rw [sum_insert]
exact hC.notMem_disjointOfDiff ht hs
· rw [coe_insert]
exact Set.insert_subset hs (hC.subset_disjointOfDiff ht hs)
· rw [coe_insert]
exact hC.pairwiseDisjoint_insert_disjointOfDiff ht hs
· rw [coe_insert]
rwa [hC.sUnion_insert_disjointOfDiff ht hs hst]
/-- An `addContent C` on a `SetSemiring C` is sub-additive. -/
lemma addContent_sUnion_le_sum {m : AddContent C} (hC : IsSetSemiring C)
(J : Finset (Set α)) (h_ss : ↑J ⊆ C) (h_mem : ⋃₀ ↑J ∈ C) :
m (⋃₀ ↑J) ≤ ∑ u ∈ J, m u := by
classical
have h1 : (disjiUnion J (hC.disjointOfUnion h_ss)
(hC.pairwiseDisjoint_disjointOfUnion h_ss) : Set (Set α)) ⊆ C := by
simp only [disjiUnion_eq_biUnion, coe_biUnion, mem_coe, iUnion_subset_iff]
exact fun _ x ↦ hC.disjointOfUnion_subset h_ss x
have h2 : PairwiseDisjoint (disjiUnion J (hC.disjointOfUnion h_ss)
((hC.pairwiseDisjoint_disjointOfUnion h_ss)) : Set (Set α)) id := by
simp only [disjiUnion_eq_biUnion, coe_biUnion, mem_coe]
exact hC.pairwiseDisjoint_biUnion_disjointOfUnion h_ss
have h3 : ⋃₀ J = ⋃₀ ((disjiUnion J (hC.disjointOfUnion h_ss)
(hC.pairwiseDisjoint_disjointOfUnion h_ss)) : Set (Set α)) := by
simp only [disjiUnion_eq_biUnion, coe_biUnion, mem_coe]
exact (Exists.choose_spec (hC.disjointOfUnion_props h_ss)).2.2.2.2.2
rw [h3, addContent_sUnion h1 h2, sum_disjiUnion]
· gcongr with x hx
refine sum_addContent_le_of_subset hC (hC.disjointOfUnion_subset h_ss hx)
(hC.pairwiseDisjoint_disjointOfUnion_of_mem h_ss hx) (h_ss hx)
(fun _ s ↦ hC.subset_of_mem_disjointOfUnion h_ss hx s)
· simp only [disjiUnion_eq_biUnion, coe_biUnion, mem_coe] at *
exact h3.symm ▸ h_mem
lemma addContent_le_sum_of_subset_sUnion {m : AddContent C} (hC : IsSetSemiring C)
{J : Finset (Set α)} (h_ss : ↑J ⊆ C) (ht : t ∈ C) (htJ : t ⊆ ⋃₀ ↑J) :
m t ≤ ∑ u ∈ J, m u := by
-- we can't apply `addContent_mono` and `addContent_sUnion_le_sum` because `⋃₀ ↑J` might not
-- be in `C`
classical
let Jt := J.image (fun u ↦ t ∩ u)
have ht_eq : t = ⋃₀ Jt := by
rw [coe_image, sUnion_image, ← inter_iUnion₂, inter_eq_self_of_subset_left]
rwa [← sUnion_eq_biUnion]
rw [ht_eq]
refine (addContent_sUnion_le_sum hC Jt ?_ ?_).trans ?_
· intro s
simp only [Jt, coe_image, Set.mem_image, mem_coe, forall_exists_index, and_imp]
rintro u hu rfl
exact hC.inter_mem _ ht _ (h_ss hu)
· rwa [← ht_eq]
· refine (Finset.sum_image_le_of_nonneg fun _ _ ↦ zero_le _).trans (sum_le_sum fun u hu ↦ ?_)
exact addContent_mono hC (hC.inter_mem _ ht _ (h_ss hu)) (h_ss hu) inter_subset_right
/-- If an `AddContent` is σ-subadditive on a semi-ring of sets, then it is σ-additive. -/
theorem addContent_iUnion_eq_tsum_of_disjoint_of_addContent_iUnion_le {m : AddContent C}
(hC : IsSetSemiring C)
-- TODO: `m_subadd` is in fact equivalent to `m.IsSigmaSubadditive`.
(m_subadd : ∀ (f : ℕ → Set α) (_ : ∀ i, f i ∈ C) (_ : ⋃ i, f i ∈ C)
(_hf_disj : Pairwise (Disjoint on f)), m (⋃ i, f i) ≤ ∑' i, m (f i))
(f : ℕ → Set α) (hf : ∀ i, f i ∈ C) (hf_Union : (⋃ i, f i) ∈ C)
(hf_disj : Pairwise (Disjoint on f)) :
m (⋃ i, f i) = ∑' i, m (f i) := by
refine le_antisymm (m_subadd f hf hf_Union hf_disj) ?_
refine ENNReal.summable.tsum_le_of_sum_le fun I ↦ ?_
classical
rw [← Finset.sum_image_of_disjoint addContent_empty (hf_disj.pairwiseDisjoint _)]
refine sum_addContent_le_of_subset hC (I := I.image f) ?_ ?_ hf_Union ?_
· simp only [coe_image, Set.image_subset_iff]
refine (subset_preimage_image f I).trans (preimage_mono ?_)
rintro i ⟨j, _, rfl⟩
exact hf j
· simp only [coe_image]
intro s hs t ht hst
rw [Set.mem_image] at hs ht
obtain ⟨i, _, rfl⟩ := hs
obtain ⟨j, _, rfl⟩ := ht
have hij : i ≠ j := by intro h_eq; rw [h_eq] at hst; exact hst rfl
exact hf_disj hij
· simp only [Finset.mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
exact fun i _ ↦ subset_iUnion _ i
/-- If an `AddContent` is σ-subadditive on a semi-ring of sets, then it is σ-additive. -/
theorem addContent_iUnion_eq_tsum_of_disjoint_of_IsSigmaSubadditive {m : AddContent C}
(hC : IsSetSemiring C) (m_subadd : m.IsSigmaSubadditive)
(f : ℕ → Set α) (hf : ∀ i, f i ∈ C) (hf_Union : (⋃ i, f i) ∈ C)
(hf_disj : Pairwise (Disjoint on f)) :
m (⋃ i, f i) = ∑' i, m (f i) :=
addContent_iUnion_eq_tsum_of_disjoint_of_addContent_iUnion_le hC
(fun _ hf hf_Union _ ↦ m_subadd hf hf_Union) f hf hf_Union hf_disj
end IsSetSemiring
section AddContentExtend
/-- An additive content obtained from another one on the same semiring of sets by setting the value
of each set not in the semiring at `∞`. -/
protected noncomputable
def AddContent.extend (hC : IsSetSemiring C) (m : AddContent C) : AddContent C where
toFun := extend (fun x (_ : x ∈ C) ↦ m x)
empty' := by rw [extend_eq, addContent_empty]; exact hC.empty_mem
sUnion' I h_ss h_dis h_mem := by
rw [extend_eq]
swap; · exact h_mem
rw [addContent_sUnion h_ss h_dis h_mem]
refine Finset.sum_congr rfl (fun s hs ↦ ?_)
rw [extend_eq]
exact h_ss hs
protected theorem AddContent.extend_eq_extend (hC : IsSetSemiring C) (m : AddContent C) :
m.extend hC = extend (fun x (_ : x ∈ C) ↦ m x) := rfl
protected theorem AddContent.extend_eq (hC : IsSetSemiring C) (m : AddContent C) (hs : s ∈ C) :
m.extend hC s = m s := by
rwa [m.extend_eq_extend, extend_eq]
protected theorem AddContent.extend_eq_top (hC : IsSetSemiring C) (m : AddContent C) (hs : s ∉ C) :
m.extend hC s = ∞ := by
rwa [m.extend_eq_extend, extend_eq_top]
end AddContentExtend
section IsSetRing
lemma addContent_union (hC : IsSetRing C) (hs : s ∈ C) (ht : t ∈ C)
(h_dis : Disjoint s t) :
m (s ∪ t) = m s + m t :=
addContent_union' hs ht (hC.union_mem hs ht) h_dis
lemma addContent_union_le (hC : IsSetRing C) (hs : s ∈ C) (ht : t ∈ C) :
m (s ∪ t) ≤ m s + m t := by
rw [← union_diff_self, addContent_union hC hs (hC.diff_mem ht hs)]
· exact add_le_add le_rfl
(addContent_mono hC.isSetSemiring (hC.diff_mem ht hs) ht diff_subset)
· rw [Set.disjoint_iff_inter_eq_empty, inter_diff_self]
lemma addContent_biUnion_le {ι : Type*} (hC : IsSetRing C) {s : ι → Set α}
{S : Finset ι} (hs : ∀ n ∈ S, s n ∈ C) :
m (⋃ i ∈ S, s i) ≤ ∑ i ∈ S, m (s i) := by
classical
induction S using Finset.induction with
| empty => simp
| insert i S hiS h =>
rw [Finset.sum_insert hiS]
simp_rw [← Finset.mem_coe, Finset.coe_insert, Set.biUnion_insert]
simp only [Finset.mem_insert, forall_eq_or_imp] at hs
refine (addContent_union_le hC hs.1 (hC.biUnion_mem S hs.2)).trans ?_
exact add_le_add le_rfl (h hs.2)
lemma addContent_biUnion_eq {ι : Type*} (hC : IsSetRing C) {s : ι → Set α}
{S : Finset ι} (hs : ∀ n ∈ S, s n ∈ C) (hS : (S : Set ι).PairwiseDisjoint s) :
m (⋃ i ∈ S, s i) = ∑ i ∈ S, m (s i) := by
classical
induction S using Finset.induction with
| empty => simp
| insert i S hiS h =>
rw [Finset.sum_insert hiS]
simp_rw [← Finset.mem_coe, Finset.coe_insert, Set.biUnion_insert]
simp only [Finset.mem_insert, forall_eq_or_imp] at hs
simp only [Finset.coe_insert, Set.pairwiseDisjoint_insert] at hS
rw [← h hs.2 hS.1]
refine addContent_union hC hs.1 (hC.biUnion_mem S hs.2) ?_
rw [disjoint_iUnion₂_right]
exact fun j hjS ↦ hS.2 j hjS (ne_of_mem_of_not_mem hjS hiS).symm
lemma le_addContent_diff (m : AddContent C) (hC : IsSetRing C) (hs : s ∈ C) (ht : t ∈ C) :
m s - m t ≤ m (s \ t) := by
conv_lhs => rw [← inter_union_diff s t]
rw [addContent_union hC (hC.inter_mem hs ht) (hC.diff_mem hs ht) disjoint_inf_sdiff, add_comm]
refine add_tsub_le_assoc.trans_eq ?_
rw [tsub_eq_zero_of_le
(addContent_mono hC.isSetSemiring (hC.inter_mem hs ht) ht inter_subset_right), add_zero]
lemma addContent_diff_of_ne_top (m : AddContent C) (hC : IsSetRing C)
(hm_ne_top : ∀ s ∈ C, m s ≠ ∞)
{s t : Set α} (hs : s ∈ C) (ht : t ∈ C) (hts : t ⊆ s) :
m (s \ t) = m s - m t := by
have h_union : m (t ∪ s \ t) = m t + m (s \ t) :=
addContent_union hC ht (hC.diff_mem hs ht) disjoint_sdiff_self_right
simp_rw [Set.union_diff_self, Set.union_eq_right.mpr hts] at h_union
rw [h_union, ENNReal.add_sub_cancel_left (hm_ne_top _ ht)]
lemma addContent_accumulate (m : AddContent C) (hC : IsSetRing C)
{s : ℕ → Set α} (hs_disj : Pairwise (Disjoint on s)) (hsC : ∀ i, s i ∈ C) (n : ℕ) :
m (Set.Accumulate s n) = ∑ i ∈ Finset.range (n + 1), m (s i) := by
induction n with
| zero => simp
| succ n hn =>
rw [Finset.sum_range_succ, ← hn, Set.accumulate_succ, addContent_union hC _ (hsC _)]
· exact Set.disjoint_accumulate hs_disj (Nat.lt_succ_self n)
· exact hC.accumulate_mem hsC n
/-- A function which is additive on disjoint elements in a ring of sets `C` defines an
additive content on `C`. -/
def IsSetRing.addContent_of_union (m : Set α → ℝ≥0∞) (hC : IsSetRing C) (m_empty : m ∅ = 0)
(m_add : ∀ {s t : Set α} (_hs : s ∈ C) (_ht : t ∈ C), Disjoint s t → m (s ∪ t) = m s + m t) :
AddContent C where
toFun := m
empty' := m_empty
sUnion' I h_ss h_dis h_mem := by
classical
induction I using Finset.induction with
| empty => simp only [Finset.coe_empty, Set.sUnion_empty, Finset.sum_empty, m_empty]
| insert s I hsI h =>
rw [Finset.coe_insert] at *
rw [Set.insert_subset_iff] at h_ss
rw [Set.pairwiseDisjoint_insert_of_notMem] at h_dis
swap; · exact hsI
have h_sUnion_mem : ⋃₀ ↑I ∈ C := by
rw [Set.sUnion_eq_biUnion]
apply hC.biUnion_mem
intro n hn
exact h_ss.2 hn
rw [Set.sUnion_insert, m_add h_ss.1 h_sUnion_mem (Set.disjoint_sUnion_right.mpr h_dis.2),
Finset.sum_insert hsI, h h_ss.2 h_dis.1]
rwa [Set.sUnion_insert] at h_mem
/-- In a ring of sets, continuity of an additive content at `∅` implies σ-additivity.
This is not true in general in semirings, or without the hypothesis that `m` is finite. See the
examples 7 and 8 in Halmos' book Measure Theory (1974), page 40. -/
theorem addContent_iUnion_eq_sum_of_tendsto_zero (hC : IsSetRing C) (m : AddContent C)
(hm_ne_top : ∀ s ∈ C, m s ≠ ∞)
(hm_tendsto : ∀ ⦃s : ℕ → Set α⦄ (_ : ∀ n, s n ∈ C),
Antitone s → (⋂ n, s n) = ∅ → Tendsto (fun n ↦ m (s n)) atTop (𝓝 0))
⦃f : ℕ → Set α⦄ (hf : ∀ i, f i ∈ C) (hUf : (⋃ i, f i) ∈ C)
(h_disj : Pairwise (Disjoint on f)) :
m (⋃ i, f i) = ∑' i, m (f i) := by
-- We use the continuity of `m` at `∅` on the sequence `n ↦ (⋃ i, f i) \ (set.accumulate f n)`
let s : ℕ → Set α := fun n ↦ (⋃ i, f i) \ Set.Accumulate f n
have hCs n : s n ∈ C := hC.diff_mem hUf (hC.accumulate_mem hf n)
have h_tendsto : Tendsto (fun n ↦ m (s n)) atTop (𝓝 0) := by
refine hm_tendsto hCs ?_ ?_
· intro i j hij x hxj
rw [Set.mem_diff] at hxj ⊢
exact ⟨hxj.1, fun hxi ↦ hxj.2 (Set.monotone_accumulate hij hxi)⟩
· simp_rw [s, Set.diff_eq]
rw [Set.iInter_inter_distrib, Set.iInter_const, ← Set.compl_iUnion, Set.iUnion_accumulate]
exact Set.inter_compl_self _
have hmsn n : m (s n) = m (⋃ i, f i) - ∑ i ∈ Finset.range (n + 1), m (f i) := by
rw [addContent_diff_of_ne_top m hC hm_ne_top hUf (hC.accumulate_mem hf n)
(Set.accumulate_subset_iUnion _), addContent_accumulate m hC h_disj hf n]
simp_rw [hmsn] at h_tendsto
refine tendsto_nhds_unique ?_ (ENNReal.tendsto_nat_tsum fun i ↦ m (f i))
refine (Filter.tendsto_add_atTop_iff_nat 1).mp ?_
rwa [ENNReal.tendsto_const_sub_nhds_zero_iff (hm_ne_top _ hUf) (fun n ↦ ?_)] at h_tendsto
rw [← addContent_accumulate m hC h_disj hf]
exact addContent_mono hC.isSetSemiring (hC.accumulate_mem hf n) hUf
(Set.accumulate_subset_iUnion _)
/-- If an additive content is σ-additive on a set ring, then the content of a monotone sequence of
sets tends to the content of the union. -/
theorem tendsto_atTop_addContent_iUnion_of_addContent_iUnion_eq_tsum (hC : IsSetRing C)
(m_iUnion : ∀ (f : ℕ → Set α) (_ : ∀ i, f i ∈ C) (_ : (⋃ i, f i) ∈ C)
(_hf_disj : Pairwise (Disjoint on f)), m (⋃ i, f i) = ∑' i, m (f i))
⦃f : ℕ → Set α⦄ (hf_mono : Monotone f) (hf : ∀ i, f i ∈ C) (hf_Union : ⋃ i, f i ∈ C) :
Tendsto (fun n ↦ m (f n)) atTop (𝓝 (m (⋃ i, f i))) := by
rw [← iUnion_disjointed, m_iUnion _ (hC.disjointed_mem hf) (by rwa [iUnion_disjointed])
(disjoint_disjointed f)]
have h n : m (f n) = ∑ i ∈ range (n + 1), m (disjointed f i) := by
nth_rw 1 [← addContent_accumulate _ hC (disjoint_disjointed f) (hC.disjointed_mem hf),
← hf_mono.partialSups_eq, ← partialSups_disjointed, partialSups_eq_biSup, Accumulate]
rfl
simp_rw [h]
refine (tendsto_add_atTop_iff_nat (f := (fun k ↦ ∑ i ∈ range k, m (disjointed f i))) 1).2 ?_
exact ENNReal.tendsto_nat_tsum _
/-- If an additive content is σ-additive on a set ring, then it is σ-subadditive. -/
theorem isSigmaSubadditive_of_addContent_iUnion_eq_tsum (hC : IsSetRing C)
(m_iUnion : ∀ (f : ℕ → Set α) (_ : ∀ i, f i ∈ C) (_ : (⋃ i, f i) ∈ C)
(_hf_disj : Pairwise (Disjoint on f)), m (⋃ i, f i) = ∑' i, m (f i)) :
m.IsSigmaSubadditive := by
intro f hf hf_Union
have h_tendsto : Tendsto (fun n ↦ m (partialSups f n)) atTop (𝓝 (m (⋃ i, f i))) := by
rw [← iSup_eq_iUnion, ← iSup_partialSups_eq]
refine tendsto_atTop_addContent_iUnion_of_addContent_iUnion_eq_tsum hC m_iUnion
(partialSups_monotone f) (hC.partialSups_mem hf) ?_
rwa [← iSup_eq_iUnion, iSup_partialSups_eq]
have h_tendsto' : Tendsto (fun n ↦ ∑ i ∈ range (n + 1), m (f i)) atTop (𝓝 (∑' i, m (f i))) := by
rw [tendsto_add_atTop_iff_nat (f := (fun k ↦ ∑ i ∈ range k, m (f i))) 1]
exact ENNReal.tendsto_nat_tsum _
refine le_of_tendsto_of_tendsto' h_tendsto h_tendsto' fun _ ↦ ?_
rw [partialSups_eq_biUnion_range]
exact addContent_biUnion_le hC (fun _ _ ↦ hf _)
end IsSetRing
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Content.lean | import Mathlib.MeasureTheory.Measure.MeasureSpace
import Mathlib.MeasureTheory.Measure.Regular
import Mathlib.Topology.Sets.Compacts
/-!
# Contents
In this file we work with *contents*. A content `λ` is a function from a certain class of subsets
(such as the compact subsets) to `ℝ≥0` that is
* additive: If `K₁` and `K₂` are disjoint sets in the domain of `λ`,
then `λ(K₁ ∪ K₂) = λ(K₁) + λ(K₂)`;
* subadditive: If `K₁` and `K₂` are in the domain of `λ`, then `λ(K₁ ∪ K₂) ≤ λ(K₁) + λ(K₂)`;
* monotone: If `K₁ ⊆ K₂` are in the domain of `λ`, then `λ(K₁) ≤ λ(K₂)`.
We show that:
* Given a content `λ` on compact sets, let us define a function `λ*` on open sets, by letting
`λ* U` be the supremum of `λ K` for `K` included in `U`. This is a countably subadditive map that
vanishes at `∅`. In Halmos (1950) this is called the *inner content* `λ*` of `λ`, and formalized
as `innerContent`.
* Given an inner content, we define an outer measure `μ*`, by letting `μ* E` be the infimum of
`λ* U` over the open sets `U` containing `E`. This is indeed an outer measure. It is formalized
as `outerMeasure`.
* Restricting this outer measure to Borel sets gives a regular measure `μ`.
We define bundled contents as `Content`.
In this file we only work on contents on compact sets, and inner contents on open sets, and both
contents and inner contents map into the extended nonnegative reals. However, in other applications
other choices can be made, and it is not a priori clear what the best interface should be.
## Main definitions
For `μ : Content G`, we define
* `μ.innerContent` : the inner content associated to `μ`.
* `μ.outerMeasure` : the outer measure associated to `μ`.
* `μ.measure` : the Borel measure associated to `μ`.
These definitions are given for spaces which are R₁.
The resulting measure `μ.measure` is always outer regular by design.
When the space is locally compact, `μ.measure` is also regular.
## References
* Paul Halmos (1950), Measure Theory, §53
* <https://en.wikipedia.org/wiki/Content_(measure_theory)>
-/
universe u v w
noncomputable section
open Set TopologicalSpace
open NNReal ENNReal MeasureTheory
namespace MeasureTheory
variable {G : Type w} [TopologicalSpace G]
/-- A content is an additive function on compact sets taking values in `ℝ≥0`. It is a device
from which one can define a measure. -/
structure Content (G : Type w) [TopologicalSpace G] where
/-- The underlying additive function -/
toFun : Compacts G → ℝ≥0
mono' : ∀ K₁ K₂ : Compacts G, (K₁ : Set G) ⊆ K₂ → toFun K₁ ≤ toFun K₂
sup_disjoint' :
∀ K₁ K₂ : Compacts G, Disjoint (K₁ : Set G) K₂ → IsClosed (K₁ : Set G) → IsClosed (K₂ : Set G)
→ toFun (K₁ ⊔ K₂) = toFun K₁ + toFun K₂
sup_le' : ∀ K₁ K₂ : Compacts G, toFun (K₁ ⊔ K₂) ≤ toFun K₁ + toFun K₂
instance : Inhabited (Content G) :=
⟨{ toFun := fun _ => 0
mono' := by simp
sup_disjoint' := by simp
sup_le' := by simp }⟩
namespace Content
instance : FunLike (Content G) (Compacts G) ℝ≥0∞ where
coe μ s := μ.toFun s
coe_injective' := by
rintro ⟨μ, _, _⟩ ⟨v, _, _⟩ h; congr!; ext s : 1; exact ENNReal.coe_injective <| congr_fun h s
variable (μ : Content G)
@[simp] lemma toFun_eq_toNNReal_apply (K : Compacts G) : μ.toFun K = (μ K).toNNReal := rfl
@[simp]
lemma mk_apply (toFun : Compacts G → ℝ≥0) (mono' sup_disjoint' sup_le') (K : Compacts G) :
mk toFun mono' sup_disjoint' sup_le' K = toFun K := rfl
@[simp] lemma apply_ne_top {K : Compacts G} : μ K ≠ ∞ := coe_ne_top
theorem mono (K₁ K₂ : Compacts G) (h : (K₁ : Set G) ⊆ K₂) : μ K₁ ≤ μ K₂ := by
simpa using μ.mono' _ _ h
theorem sup_disjoint (K₁ K₂ : Compacts G) (h : Disjoint (K₁ : Set G) K₂)
(h₁ : IsClosed (K₁ : Set G)) (h₂ : IsClosed (K₂ : Set G)) :
μ (K₁ ⊔ K₂) = μ K₁ + μ K₂ := by
simpa [toNNReal_eq_toNNReal_iff, ← toNNReal_add] using μ.sup_disjoint' _ _ h h₁ h₂
theorem sup_le (K₁ K₂ : Compacts G) : μ (K₁ ⊔ K₂) ≤ μ K₁ + μ K₂ := by
simpa [← toNNReal_add] using μ.sup_le' _ _
theorem lt_top (K : Compacts G) : μ K < ∞ :=
ENNReal.coe_lt_top
theorem empty : μ ⊥ = 0 := by simpa [toNNReal_eq_zero_iff] using μ.sup_disjoint' ⊥ ⊥
/-- Constructing the inner content of a content. From a content defined on the compact sets, we
obtain a function defined on all open sets, by taking the supremum of the content of all compact
subsets. -/
def innerContent (U : Opens G) : ℝ≥0∞ :=
⨆ (K : Compacts G) (_ : (K : Set G) ⊆ U), μ K
theorem le_innerContent (K : Compacts G) (U : Opens G) (h2 : (K : Set G) ⊆ U) :
μ K ≤ μ.innerContent U :=
le_iSup_of_le K <| le_iSup (fun _ ↦ (μ.toFun K : ℝ≥0∞)) h2
theorem innerContent_le (U : Opens G) (K : Compacts G) (h2 : (U : Set G) ⊆ K) :
μ.innerContent U ≤ μ K :=
iSup₂_le fun _ hK' => μ.mono _ _ (Subset.trans hK' h2)
theorem innerContent_of_isCompact {K : Set G} (h1K : IsCompact K) (h2K : IsOpen K) :
μ.innerContent ⟨K, h2K⟩ = μ ⟨K, h1K⟩ :=
le_antisymm (iSup₂_le fun _ hK' => μ.mono _ ⟨K, h1K⟩ hK') (μ.le_innerContent _ _ Subset.rfl)
theorem innerContent_bot : μ.innerContent ⊥ = 0 := by
refine le_antisymm ?_ (zero_le _)
rw [← μ.empty]
refine iSup₂_le fun K hK => ?_
have : K = ⊥ := by
ext1
rw [subset_empty_iff.mp hK, Compacts.coe_bot]
rw [this]
/-- This is "unbundled", because that is required for the API of `inducedOuterMeasure`. -/
theorem innerContent_mono ⦃U V : Set G⦄ (hU : IsOpen U) (hV : IsOpen V) (h2 : U ⊆ V) :
μ.innerContent ⟨U, hU⟩ ≤ μ.innerContent ⟨V, hV⟩ :=
biSup_mono fun _ hK => hK.trans h2
theorem innerContent_exists_compact {U : Opens G} (hU : μ.innerContent U ≠ ∞) {ε : ℝ≥0}
(hε : ε ≠ 0) : ∃ K : Compacts G, (K : Set G) ⊆ U ∧ μ.innerContent U ≤ μ K + ε := by
have h'ε := ENNReal.coe_ne_zero.2 hε
rcases le_or_gt (μ.innerContent U) ε with h | h
· exact ⟨⊥, empty_subset _, le_add_left h⟩
have h₂ := ENNReal.sub_lt_self hU h.ne_bot h'ε
conv at h₂ => rhs; rw [innerContent]
simp only [lt_iSup_iff] at h₂
rcases h₂ with ⟨U, h1U, h2U⟩; refine ⟨U, h1U, ?_⟩
rw [← tsub_le_iff_right]; exact le_of_lt h2U
/-- The inner content of a supremum of opens is at most the sum of the individual inner contents. -/
theorem innerContent_iSup_nat [R1Space G] (U : ℕ → Opens G) :
μ.innerContent (⨆ i : ℕ, U i) ≤ ∑' i : ℕ, μ.innerContent (U i) := by
have h3 : ∀ (t : Finset ℕ) (K : ℕ → Compacts G), μ (t.sup K) ≤ t.sum fun i => μ (K i) := by
intro t K
refine Finset.induction_on t ?_ ?_
· simp only [μ.empty, nonpos_iff_eq_zero, Finset.sum_empty, Finset.sup_empty]
· intro n s hn ih
grw [Finset.sup_insert, Finset.sum_insert hn, μ.sup_le, ih]
refine iSup₂_le fun K hK => ?_
obtain ⟨t, ht⟩ :=
K.isCompact.elim_finite_subcover _ (fun i => (U i).isOpen) (by rwa [← Opens.coe_iSup])
rcases K.isCompact.finite_compact_cover t (SetLike.coe ∘ U) (fun i _ => (U i).isOpen) ht with
⟨K', h1K', h2K', h3K'⟩
let L : ℕ → Compacts G := fun n => ⟨K' n, h1K' n⟩
convert le_trans (h3 t L) _
· ext1
rw [Compacts.coe_finset_sup, Finset.sup_eq_iSup]
exact h3K'
refine le_trans (Finset.sum_le_sum ?_) (ENNReal.sum_le_tsum t)
intro i _
refine le_trans ?_ (le_iSup _ (L i))
refine le_trans ?_ (le_iSup _ (h2K' i))
rfl
/-- The inner content of a union of sets is at most the sum of the individual inner contents.
This is the "unbundled" version of `innerContent_iSup_nat`.
It is required for the API of `inducedOuterMeasure`. -/
theorem innerContent_iUnion_nat [R1Space G] ⦃U : ℕ → Set G⦄
(hU : ∀ i : ℕ, IsOpen (U i)) :
μ.innerContent ⟨⋃ i : ℕ, U i, isOpen_iUnion hU⟩ ≤ ∑' i : ℕ, μ.innerContent ⟨U i, hU i⟩ := by
have := μ.innerContent_iSup_nat fun i => ⟨U i, hU i⟩
rwa [Opens.iSup_def] at this
theorem innerContent_comap (f : G ≃ₜ G) (h : ∀ ⦃K : Compacts G⦄, μ (K.map f f.continuous) = μ K)
(U : Opens G) : μ.innerContent (Opens.comap f U) = μ.innerContent U := by
refine (Compacts.equiv f).surjective.iSup_congr _ fun K => iSup_congr_Prop image_subset_iff ?_
intro hK
simp only [Equiv.coe_fn_mk, Compacts.equiv]
apply h
@[to_additive]
theorem is_mul_left_invariant_innerContent [Group G] [ContinuousMul G]
(h : ∀ (g : G) {K : Compacts G}, μ (K.map _ <| continuous_mul_left g) = μ K) (g : G)
(U : Opens G) :
μ.innerContent (Opens.comap (Homeomorph.mulLeft g) U) = μ.innerContent U := by
convert μ.innerContent_comap (Homeomorph.mulLeft g) (fun K => h g) U
@[to_additive]
theorem innerContent_pos_of_is_mul_left_invariant [Group G] [IsTopologicalGroup G]
(h3 : ∀ (g : G) {K : Compacts G}, μ (K.map _ <| continuous_mul_left g) = μ K) (K : Compacts G)
(hK : μ K ≠ 0) (U : Opens G) (hU : (U : Set G).Nonempty) : 0 < μ.innerContent U := by
have : (interior (U : Set G)).Nonempty := by rwa [U.isOpen.interior_eq]
rcases compact_covered_by_mul_left_translates K.2 this with ⟨s, hs⟩
suffices μ K ≤ s.card * μ.innerContent U by
exact (ENNReal.mul_pos_iff.mp <| hK.bot_lt.trans_le this).2
have : (K : Set G) ⊆ ↑(⨆ g ∈ s, Opens.comap (Homeomorph.mulLeft g : C(G, G)) U) := by
simpa only [Opens.iSup_def, Opens.coe_comap, Subtype.coe_mk]
refine (μ.le_innerContent _ _ this).trans ?_
refine
(rel_iSup_sum μ.innerContent μ.innerContent_bot (· ≤ ·) μ.innerContent_iSup_nat _ _).trans ?_
simp only [μ.is_mul_left_invariant_innerContent h3, Finset.sum_const, nsmul_eq_mul, le_refl]
theorem innerContent_mono' ⦃U V : Set G⦄ (hU : IsOpen U) (hV : IsOpen V) (h2 : U ⊆ V) :
μ.innerContent ⟨U, hU⟩ ≤ μ.innerContent ⟨V, hV⟩ :=
biSup_mono fun _ hK => hK.trans h2
section OuterMeasure
/-- Extending a content on compact sets to an outer measure on all sets. -/
protected def outerMeasure : OuterMeasure G :=
inducedOuterMeasure (fun U hU => μ.innerContent ⟨U, hU⟩) isOpen_empty μ.innerContent_bot
variable [R1Space G]
theorem outerMeasure_opens (U : Opens G) : μ.outerMeasure U = μ.innerContent U :=
inducedOuterMeasure_eq' (fun _ => isOpen_iUnion) μ.innerContent_iUnion_nat μ.innerContent_mono U.2
theorem outerMeasure_of_isOpen (U : Set G) (hU : IsOpen U) :
μ.outerMeasure U = μ.innerContent ⟨U, hU⟩ :=
μ.outerMeasure_opens ⟨U, hU⟩
theorem outerMeasure_le (U : Opens G) (K : Compacts G) (hUK : (U : Set G) ⊆ K) :
μ.outerMeasure U ≤ μ K :=
(μ.outerMeasure_opens U).le.trans <| μ.innerContent_le U K hUK
theorem le_outerMeasure_compacts (K : Compacts G) : μ K ≤ μ.outerMeasure K := by
rw [Content.outerMeasure, inducedOuterMeasure_eq_iInf]
· exact le_iInf fun U => le_iInf fun hU => le_iInf <| μ.le_innerContent K ⟨U, hU⟩
· exact fun U hU => isOpen_iUnion hU
· exact μ.innerContent_iUnion_nat
· exact μ.innerContent_mono
theorem outerMeasure_eq_iInf (A : Set G) :
μ.outerMeasure A = ⨅ (U : Set G) (hU : IsOpen U) (_ : A ⊆ U), μ.innerContent ⟨U, hU⟩ :=
inducedOuterMeasure_eq_iInf _ μ.innerContent_iUnion_nat μ.innerContent_mono A
theorem outerMeasure_interior_compacts (K : Compacts G) : μ.outerMeasure (interior K) ≤ μ K :=
(μ.outerMeasure_opens <| Opens.interior K).le.trans <| μ.innerContent_le _ _ interior_subset
theorem outerMeasure_exists_compact {U : Opens G} (hU : μ.outerMeasure U ≠ ∞) {ε : ℝ≥0}
(hε : ε ≠ 0) : ∃ K : Compacts G, (K : Set G) ⊆ U ∧ μ.outerMeasure U ≤ μ.outerMeasure K + ε := by
rw [μ.outerMeasure_opens] at hU ⊢
rcases μ.innerContent_exists_compact hU hε with ⟨K, h1K, h2K⟩
exact ⟨K, h1K, by grw [h2K, μ.le_outerMeasure_compacts K]⟩
theorem outerMeasure_exists_open {A : Set G} (hA : μ.outerMeasure A ≠ ∞) {ε : ℝ≥0} (hε : ε ≠ 0) :
∃ U : Opens G, A ⊆ U ∧ μ.outerMeasure U ≤ μ.outerMeasure A + ε := by
rcases inducedOuterMeasure_exists_set _ μ.innerContent_iUnion_nat μ.innerContent_mono hA
(ENNReal.coe_ne_zero.2 hε) with
⟨U, hU, h2U, h3U⟩
exact ⟨⟨U, hU⟩, h2U, h3U⟩
theorem outerMeasure_preimage (f : G ≃ₜ G) (h : ∀ ⦃K : Compacts G⦄, μ (K.map f f.continuous) = μ K)
(A : Set G) : μ.outerMeasure (f ⁻¹' A) = μ.outerMeasure A := by
refine inducedOuterMeasure_preimage _ μ.innerContent_iUnion_nat μ.innerContent_mono _
(fun _ => f.isOpen_preimage) ?_
intro s hs
convert μ.innerContent_comap f h ⟨s, hs⟩
theorem outerMeasure_lt_top_of_isCompact [WeaklyLocallyCompactSpace G]
{K : Set G} (hK : IsCompact K) :
μ.outerMeasure K < ∞ := by
rcases exists_compact_superset hK with ⟨F, h1F, h2F⟩
calc
μ.outerMeasure K ≤ μ.outerMeasure (interior F) := measure_mono h2F
_ ≤ μ ⟨F, h1F⟩ := by
apply μ.outerMeasure_le ⟨interior F, isOpen_interior⟩ ⟨F, h1F⟩ interior_subset
_ < ⊤ := μ.lt_top _
@[to_additive]
theorem is_mul_left_invariant_outerMeasure [Group G] [ContinuousMul G]
(h : ∀ (g : G) {K : Compacts G}, μ (K.map _ <| continuous_mul_left g) = μ K) (g : G)
(A : Set G) : μ.outerMeasure ((g * ·) ⁻¹' A) = μ.outerMeasure A := by
convert μ.outerMeasure_preimage (Homeomorph.mulLeft g) (fun K => h g) A
theorem outerMeasure_caratheodory (A : Set G) :
MeasurableSet[μ.outerMeasure.caratheodory] A ↔
∀ U : Opens G, μ.outerMeasure (U ∩ A) + μ.outerMeasure (U \ A) ≤ μ.outerMeasure U := by
rw [Opens.forall]
apply inducedOuterMeasure_caratheodory
· apply innerContent_iUnion_nat
· apply innerContent_mono'
@[to_additive]
theorem outerMeasure_pos_of_is_mul_left_invariant [Group G] [IsTopologicalGroup G]
(h3 : ∀ (g : G) {K : Compacts G}, μ (K.map _ <| continuous_mul_left g) = μ K) (K : Compacts G)
(hK : μ K ≠ 0) {U : Set G} (h1U : IsOpen U) (h2U : U.Nonempty) : 0 < μ.outerMeasure U := by
convert μ.innerContent_pos_of_is_mul_left_invariant h3 K hK ⟨U, h1U⟩ h2U
exact μ.outerMeasure_opens ⟨U, h1U⟩
variable [S : MeasurableSpace G] [BorelSpace G]
/-- For the outer measure coming from a content, all Borel sets are measurable. -/
theorem borel_le_caratheodory : S ≤ μ.outerMeasure.caratheodory := by
rw [BorelSpace.measurable_eq (α := G)]
refine MeasurableSpace.generateFrom_le ?_
intro U hU
rw [μ.outerMeasure_caratheodory]
intro U'
rw [μ.outerMeasure_of_isOpen ((U' : Set G) ∩ U) (U'.isOpen.inter hU)]
simp only [innerContent, iSup_subtype']
rw [Opens.coe_mk]
haveI : Nonempty { L : Compacts G // (L : Set G) ⊆ U' ∩ U } := ⟨⟨⊥, empty_subset _⟩⟩
rw [ENNReal.iSup_add]
refine iSup_le ?_
rintro ⟨L, hL⟩
let L' : Compacts G := ⟨closure L, L.isCompact.closure⟩
dsimp
grw [show μ L ≤ μ L' from μ.mono _ _ subset_closure]
simp only [subset_inter_iff] at hL
have hL'U : (L' : Set G) ⊆ U := IsCompact.closure_subset_of_isOpen L.2 hU hL.2
have hL'U' : (L' : Set G) ⊆ (U' : Set G) := IsCompact.closure_subset_of_isOpen L.2 U'.2 hL.1
have : ↑U' \ U ⊆ U' \ L' := diff_subset_diff_right hL'U
grw [this]
rw [μ.outerMeasure_of_isOpen (↑U' \ L') (IsOpen.sdiff U'.2 isClosed_closure)]
simp only [innerContent, iSup_subtype']
rw [Opens.coe_mk]
haveI : Nonempty { M : Compacts G // (M : Set G) ⊆ ↑U' \ closure L } := ⟨⟨⊥, empty_subset _⟩⟩
rw [ENNReal.add_iSup]
refine iSup_le ?_
rintro ⟨M, hM⟩
let M' : Compacts G := ⟨closure M, M.isCompact.closure⟩
dsimp
grw [show μ M ≤ μ M' from μ.mono _ _ subset_closure]
have hM' : (M' : Set G) ⊆ U' \ L' :=
IsCompact.closure_subset_of_isOpen M.2 (IsOpen.sdiff U'.2 isClosed_closure) hM
have : (↑(L' ⊔ M') : Set G) ⊆ U' := by
simp only [Compacts.coe_sup, union_subset_iff, hL'U', true_and]
exact hM'.trans diff_subset
rw [μ.outerMeasure_of_isOpen (↑U') U'.2]
refine le_trans (ge_of_eq ?_) (μ.le_innerContent _ _ this)
exact μ.sup_disjoint L' M' (subset_diff.1 hM').2.symm isClosed_closure isClosed_closure
/-- The measure induced by the outer measure coming from a content, on the Borel sigma-algebra. -/
protected def measure : Measure G :=
μ.outerMeasure.toMeasure μ.borel_le_caratheodory
theorem measure_apply {s : Set G} (hs : MeasurableSet s) : μ.measure s = μ.outerMeasure s :=
toMeasure_apply _ _ hs
instance outerRegular : μ.measure.OuterRegular := by
refine ⟨fun A hA r (hr : _ < _) ↦ ?_⟩
rw [μ.measure_apply hA, outerMeasure_eq_iInf] at hr
simp only [iInf_lt_iff] at hr
rcases hr with ⟨U, hUo, hAU, hr⟩
rw [← μ.outerMeasure_of_isOpen U hUo, ← μ.measure_apply hUo.measurableSet] at hr
exact ⟨U, hAU, hUo, hr⟩
/-- In a locally compact space, any measure constructed from a content is regular. -/
instance regular [WeaklyLocallyCompactSpace G] : μ.measure.Regular := by
have : IsFiniteMeasureOnCompacts μ.measure := by
refine ⟨fun K hK => ?_⟩
apply (measure_mono subset_closure).trans_lt _
rw [measure_apply _ isClosed_closure.measurableSet]
exact μ.outerMeasure_lt_top_of_isCompact hK.closure
refine ⟨fun U hU r hr => ?_⟩
rw [measure_apply _ hU.measurableSet, μ.outerMeasure_of_isOpen U hU] at hr
simp only [innerContent, lt_iSup_iff] at hr
rcases hr with ⟨K, hKU, hr⟩
refine ⟨K, hKU, K.2, hr.trans_le ?_⟩
exact (μ.le_outerMeasure_compacts K).trans (le_toMeasure_apply _ _ _)
end OuterMeasure
section RegularContents
/-- A content `μ` is called regular if for every compact set `K`,
`μ(K) = inf {μ(K') : K ⊂ int K' ⊂ K'}`. See Paul Halmos (1950), Measure Theory, §54. -/
def ContentRegular :=
∀ ⦃K : TopologicalSpace.Compacts G⦄,
μ K = ⨅ (K' : TopologicalSpace.Compacts G) (_ : (K : Set G) ⊆ interior (K' : Set G)), μ K'
theorem contentRegular_exists_compact (H : ContentRegular μ) (K : TopologicalSpace.Compacts G)
{ε : NNReal} (hε : ε ≠ 0) :
∃ K' : TopologicalSpace.Compacts G, K.carrier ⊆ interior K'.carrier ∧ μ K' ≤ μ K + ε := by
by_contra hc
simp only [not_exists, not_and, not_le] at hc
have lower_bound_iInf : μ K + ε ≤
⨅ (K' : TopologicalSpace.Compacts G) (_ : (K : Set G) ⊆ interior (K' : Set G)), μ K' :=
le_iInf fun K' => le_iInf fun K'_hyp => le_of_lt (hc K' K'_hyp)
rw [← H] at lower_bound_iInf
exact (lt_self_iff_false (μ K)).mp (lt_of_le_of_lt' lower_bound_iInf
(ENNReal.lt_add_right (ne_top_of_lt (μ.lt_top K)) (ENNReal.coe_ne_zero.mpr hε)))
variable [MeasurableSpace G] [R1Space G] [BorelSpace G]
/-- If `μ` is a regular content, then the measure induced by `μ` will agree with `μ`
on compact sets. -/
theorem measure_eq_content_of_regular (H : MeasureTheory.Content.ContentRegular μ)
(K : TopologicalSpace.Compacts G) : μ.measure ↑K = μ K := by
refine le_antisymm ?_ ?_
· apply ENNReal.le_of_forall_pos_le_add
intro ε εpos _
obtain ⟨K', K'_hyp⟩ := contentRegular_exists_compact μ H K (ne_bot_of_gt εpos)
calc
μ.measure ↑K ≤ μ.measure (interior ↑K') := measure_mono K'_hyp.1
_ ≤ μ K' := by
rw [μ.measure_apply (IsOpen.measurableSet isOpen_interior)]
exact μ.outerMeasure_interior_compacts K'
_ ≤ μ K + ε := K'_hyp.right
· calc
μ K ≤ μ ⟨closure K, K.2.closure⟩ := μ.mono _ _ subset_closure
_ ≤ μ.measure (closure K) := by
rw [μ.measure_apply (isClosed_closure.measurableSet)]
exact μ.le_outerMeasure_compacts _
_ = μ.measure K := K.2.measure_closure _
end RegularContents
end Content
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Hausdorff.lean | import Mathlib.Analysis.Convex.Between
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
import Mathlib.Topology.MetricSpace.Holder
import Mathlib.Topology.MetricSpace.MetricSeparated
/-!
# Hausdorff measure and metric (outer) measures
In this file we define the `d`-dimensional Hausdorff measure on an (extended) metric space `X` and
the Hausdorff dimension of a set in an (extended) metric space. Let `μ d δ` be the maximal outer
measure such that `μ d δ s ≤ (EMetric.diam s) ^ d` for every set of diameter less than `δ`. Then
the Hausdorff measure `μH[d] s` of `s` is defined as `⨆ δ > 0, μ d δ s`. By Caratheodory theorem
`MeasureTheory.OuterMeasure.IsMetric.borel_le_caratheodory`, this is a Borel measure on `X`.
The value of `μH[d]`, `d > 0`, on a set `s` (measurable or not) is given by
```
μH[d] s = ⨆ (r : ℝ≥0∞) (hr : 0 < r), ⨅ (t : ℕ → Set X) (hts : s ⊆ ⋃ n, t n)
(ht : ∀ n, EMetric.diam (t n) ≤ r), ∑' n, EMetric.diam (t n) ^ d
```
For every set `s` for any `d < d'` we have either `μH[d] s = ∞` or `μH[d'] s = 0`, see
`MeasureTheory.Measure.hausdorffMeasure_zero_or_top`. In
`Mathlib/Topology/MetricSpace/HausdorffDimension.lean` we use this fact to define the Hausdorff
dimension `dimH` of a set in an (extended) metric space.
We also define two generalizations of the Hausdorff measure. In one generalization (see
`MeasureTheory.Measure.mkMetric`) we take any function `m (diam s)` instead of `(diam s) ^ d`. In
an even more general definition (see `MeasureTheory.Measure.mkMetric'`) we use any function
of `m : Set X → ℝ≥0∞`. Some authors start with a partial function `m` defined only on some sets
`s : Set X` (e.g., only on balls or only on measurable sets). This is equivalent to our definition
applied to `MeasureTheory.extend m`.
We also define a predicate `MeasureTheory.OuterMeasure.IsMetric` which says that an outer measure
is additive on metric separated pairs of sets: `μ (s ∪ t) = μ s + μ t` provided that
`⨅ (x ∈ s) (y ∈ t), edist x y ≠ 0`. This is the property required for the Caratheodory theorem
`MeasureTheory.OuterMeasure.IsMetric.borel_le_caratheodory`, so we prove this theorem for any
metric outer measure, then prove that outer measures constructed using `mkMetric'` are metric outer
measures.
## Main definitions
* `MeasureTheory.OuterMeasure.IsMetric`: an outer measure `μ` is called *metric* if
`μ (s ∪ t) = μ s + μ t` for any two metric separated sets `s` and `t`. A metric outer measure in a
Borel extended metric space is guaranteed to satisfy the Caratheodory condition, see
`MeasureTheory.OuterMeasure.IsMetric.borel_le_caratheodory`.
* `MeasureTheory.OuterMeasure.mkMetric'` and its particular case
`MeasureTheory.OuterMeasure.mkMetric`: a construction of an outer measure that is guaranteed to
be metric. Both constructions are generalizations of the Hausdorff measure. The same measures
interpreted as Borel measures are called `MeasureTheory.Measure.mkMetric'` and
`MeasureTheory.Measure.mkMetric`.
* `MeasureTheory.Measure.hausdorffMeasure` a.k.a. `μH[d]`: the `d`-dimensional Hausdorff measure.
There are many definitions of the Hausdorff measure that differ from each other by a
multiplicative constant. We put
`μH[d] s = ⨆ r > 0, ⨅ (t : ℕ → Set X) (hts : s ⊆ ⋃ n, t n) (ht : ∀ n, EMetric.diam (t n) ≤ r),
∑' n, ⨆ (ht : ¬Set.Subsingleton (t n)), (EMetric.diam (t n)) ^ d`,
see `MeasureTheory.Measure.hausdorffMeasure_apply`. In the most interesting case `0 < d` one
can omit the `⨆ (ht : ¬Set.Subsingleton (t n))` part.
## Main statements
### Basic properties
* `MeasureTheory.OuterMeasure.IsMetric.borel_le_caratheodory`: if `μ` is a metric outer measure
on an extended metric space `X` (that is, it is additive on pairs of metric separated sets), then
every Borel set is Caratheodory measurable (hence, `μ` defines an actual
`MeasureTheory.Measure`). See also `MeasureTheory.Measure.mkMetric`.
* `MeasureTheory.Measure.hausdorffMeasure_mono`: `μH[d] s` is an antitone function
of `d`.
* `MeasureTheory.Measure.hausdorffMeasure_zero_or_top`: if `d₁ < d₂`, then for any `s`, either
`μH[d₂] s = 0` or `μH[d₁] s = ∞`. Together with the previous lemma, this means that `μH[d] s` is
equal to infinity on some ray `(-∞, D)` and is equal to zero on `(D, +∞)`, where `D` is a possibly
infinite number called the *Hausdorff dimension* of `s`; `μH[D] s` can be zero, infinity, or
anything in between.
* `MeasureTheory.Measure.noAtoms_hausdorff`: Hausdorff measure has no atoms.
### Hausdorff measure in `ℝⁿ`
* `MeasureTheory.hausdorffMeasure_pi_real`: for a nonempty `ι`, `μH[card ι]` on `ι → ℝ` equals
Lebesgue measure.
## Notation
We use the following notation localized in `MeasureTheory`.
- `μH[d]` : `MeasureTheory.Measure.hausdorffMeasure d`
## Implementation notes
There are a few similar constructions called the `d`-dimensional Hausdorff measure. E.g., some
sources only allow coverings by balls and use `r ^ d` instead of `(diam s) ^ d`. While these
construction lead to different Hausdorff measures, they lead to the same notion of the Hausdorff
dimension.
## References
* [Herbert Federer, Geometric Measure Theory, Chapter 2.10][Federer1996]
## Tags
Hausdorff measure, measure, metric measure
-/
open scoped NNReal ENNReal Topology
open EMetric Set Function Filter Encodable Module TopologicalSpace
noncomputable section
variable {ι X Y : Type*} [EMetricSpace X] [EMetricSpace Y]
namespace MeasureTheory
namespace OuterMeasure
/-!
### Metric outer measures
In this section we define metric outer measures and prove Caratheodory theorem: a metric outer
measure has the Caratheodory property.
-/
/-- We say that an outer measure `μ` in an (e)metric space is *metric* if `μ (s ∪ t) = μ s + μ t`
for any two metric separated sets `s`, `t`. -/
def IsMetric (μ : OuterMeasure X) : Prop :=
∀ s t : Set X, Metric.AreSeparated s t → μ (s ∪ t) = μ s + μ t
namespace IsMetric
variable {μ : OuterMeasure X}
/-- A metric outer measure is additive on a finite set of pairwise metric separated sets. -/
theorem finset_iUnion_of_pairwise_separated (hm : IsMetric μ) {I : Finset ι} {s : ι → Set X}
(hI : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → Metric.AreSeparated (s i) (s j)) :
μ (⋃ i ∈ I, s i) = ∑ i ∈ I, μ (s i) := by
classical
induction I using Finset.induction_on with
| empty => simp
| insert i I hiI ihI =>
simp only [Finset.mem_insert] at hI
rw [Finset.set_biUnion_insert, hm, ihI, Finset.sum_insert hiI]
exacts [fun i hi j hj hij => hI i (Or.inr hi) j (Or.inr hj) hij,
Metric.AreSeparated.finset_iUnion_right fun j hj =>
hI i (Or.inl rfl) j (Or.inr hj) (ne_of_mem_of_not_mem hj hiI).symm]
/-- Caratheodory theorem. If `m` is a metric outer measure, then every Borel measurable set `t` is
Caratheodory measurable: for any (not necessarily measurable) set `s` we have
`μ (s ∩ t) + μ (s \ t) = μ s`. -/
theorem borel_le_caratheodory (hm : IsMetric μ) : borel X ≤ μ.caratheodory := by
rw [borel_eq_generateFrom_isClosed]
refine MeasurableSpace.generateFrom_le fun t ht => μ.isCaratheodory_iff_le.2 fun s => ?_
set S : ℕ → Set X := fun n => {x ∈ s | (↑n)⁻¹ ≤ infEdist x t}
have Ssep (n) : Metric.AreSeparated (S n) t :=
⟨n⁻¹, ENNReal.inv_ne_zero.2 (ENNReal.natCast_ne_top _),
fun x hx y hy ↦ hx.2.trans <| infEdist_le_edist_of_mem hy⟩
have Ssep' : ∀ n, Metric.AreSeparated (S n) (s ∩ t) := fun n =>
(Ssep n).mono Subset.rfl inter_subset_right
have S_sub : ∀ n, S n ⊆ s \ t := fun n =>
subset_inter inter_subset_left (Ssep n).subset_compl_right
have hSs : ∀ n, μ (s ∩ t) + μ (S n) ≤ μ s := fun n =>
calc
μ (s ∩ t) + μ (S n) = μ (s ∩ t ∪ S n) := Eq.symm <| hm _ _ <| (Ssep' n).symm
_ ≤ μ (s ∩ t ∪ s \ t) := μ.mono <| union_subset_union_right _ <| S_sub n
_ = μ s := by rw [inter_union_diff]
have iUnion_S : ⋃ n, S n = s \ t := by
refine Subset.antisymm (iUnion_subset S_sub) ?_
rintro x ⟨hxs, hxt⟩
rw [mem_iff_infEdist_zero_of_closed ht] at hxt
rcases ENNReal.exists_inv_nat_lt hxt with ⟨n, hn⟩
exact mem_iUnion.2 ⟨n, hxs, hn.le⟩
/- Now we have `∀ n, μ (s ∩ t) + μ (S n) ≤ μ s` and we need to prove
`μ (s ∩ t) + μ (⋃ n, S n) ≤ μ s`. We can't pass to the limit because
`μ` is only an outer measure. -/
by_cases htop : μ (s \ t) = ∞
· rw [htop, add_top, ← htop]
exact μ.mono diff_subset
suffices μ (⋃ n, S n) ≤ ⨆ n, μ (S n) by calc
μ (s ∩ t) + μ (s \ t) = μ (s ∩ t) + μ (⋃ n, S n) := by rw [iUnion_S]
_ ≤ μ (s ∩ t) + ⨆ n, μ (S n) := by gcongr
_ = ⨆ n, μ (s ∩ t) + μ (S n) := ENNReal.add_iSup ..
_ ≤ μ s := iSup_le hSs
/- It suffices to show that `∑' k, μ (S (k + 1) \ S k) ≠ ∞`. Indeed, if we have this,
then for all `N` we have `μ (⋃ n, S n) ≤ μ (S N) + ∑' k, m (S (N + k + 1) \ S (N + k))`
and the second term tends to zero, see `OuterMeasure.iUnion_nat_of_monotone_of_tsum_ne_top`
for details. -/
have : ∀ n, S n ⊆ S (n + 1) := fun n x hx =>
⟨hx.1, le_trans (ENNReal.inv_le_inv.2 <| Nat.cast_le.2 n.le_succ) hx.2⟩
refine (μ.iUnion_nat_of_monotone_of_tsum_ne_top this ?_).le; clear this
/- While the sets `S (k + 1) \ S k` are not pairwise metric separated, the sets in each
subsequence `S (2 * k + 1) \ S (2 * k)` and `S (2 * k + 2) \ S (2 * k)` are metric separated,
so `m` is additive on each of those sequences. -/
rw [← tsum_even_add_odd ENNReal.summable ENNReal.summable, ENNReal.add_ne_top]
suffices ∀ a, (∑' k : ℕ, μ (S (2 * k + 1 + a) \ S (2 * k + a))) ≠ ∞ from
⟨by simpa using this 0, by simpa using this 1⟩
refine fun r => ne_top_of_le_ne_top htop ?_
rw [← iUnion_S, ENNReal.tsum_eq_iSup_nat, iSup_le_iff]
intro n
rw [← hm.finset_iUnion_of_pairwise_separated]
· exact μ.mono (iUnion_subset fun i => iUnion_subset fun _ x hx => mem_iUnion.2 ⟨_, hx.1⟩)
suffices ∀ i j, i < j → Metric.AreSeparated (S (2 * i + 1 + r)) (s \ S (2 * j + r)) from
fun i _ j _ hij => hij.lt_or_gt.elim
(fun h => (this i j h).mono inter_subset_left fun x hx => by exact ⟨hx.1.1, hx.2⟩)
fun h => (this j i h).symm.mono (fun x hx => by exact ⟨hx.1.1, hx.2⟩) inter_subset_left
intro i j hj
have A : ((↑(2 * j + r))⁻¹ : ℝ≥0∞) < (↑(2 * i + 1 + r))⁻¹ := by
rw [ENNReal.inv_lt_inv, Nat.cast_lt]; omega
refine ⟨(↑(2 * i + 1 + r))⁻¹ - (↑(2 * j + r))⁻¹, by simpa [tsub_eq_zero_iff_le] using A,
fun x hx y hy => ?_⟩
have : infEdist y t < (↑(2 * j + r))⁻¹ := not_le.1 fun hle => hy.2 ⟨hy.1, hle⟩
rcases infEdist_lt_iff.mp this with ⟨z, hzt, hyz⟩
have hxz : (↑(2 * i + 1 + r))⁻¹ ≤ edist x z := le_infEdist.1 hx.2 _ hzt
apply ENNReal.le_of_add_le_add_right hyz.ne_top
refine le_trans ?_ (edist_triangle _ _ _)
refine (add_le_add le_rfl hyz.le).trans (Eq.trans_le ?_ hxz)
rw [tsub_add_cancel_of_le A.le]
theorem le_caratheodory [MeasurableSpace X] [BorelSpace X] (hm : IsMetric μ) :
‹MeasurableSpace X› ≤ μ.caratheodory := by
rw [BorelSpace.measurable_eq (α := X)]
exact hm.borel_le_caratheodory
end IsMetric
/-!
### Constructors of metric outer measures
In this section we provide constructors `MeasureTheory.OuterMeasure.mkMetric'` and
`MeasureTheory.OuterMeasure.mkMetric` and prove that these outer measures are metric outer
measures. We also prove basic lemmas about `map`/`comap` of these measures.
-/
/-- Auxiliary definition for `OuterMeasure.mkMetric'`: given a function on sets
`m : Set X → ℝ≥0∞`, returns the maximal outer measure `μ` such that `μ s ≤ m s`
for any set `s` of diameter at most `r`. -/
def mkMetric'.pre (m : Set X → ℝ≥0∞) (r : ℝ≥0∞) : OuterMeasure X :=
boundedBy <| extend fun s (_ : diam s ≤ r) => m s
/-- Given a function `m : Set X → ℝ≥0∞`, `mkMetric' m` is the supremum of `mkMetric'.pre m r`
over `r > 0`. Equivalently, it is the limit of `mkMetric'.pre m r` as `r` tends to zero from
the right. -/
def mkMetric' (m : Set X → ℝ≥0∞) : OuterMeasure X :=
⨆ r > 0, mkMetric'.pre m r
/-- Given a function `m : ℝ≥0∞ → ℝ≥0∞` and `r > 0`, let `μ r` be the maximal outer measure such that
`μ s ≤ m (EMetric.diam s)` whenever `EMetric.diam s < r`. Then `mkMetric m = ⨆ r > 0, μ r`. -/
def mkMetric (m : ℝ≥0∞ → ℝ≥0∞) : OuterMeasure X :=
mkMetric' fun s => m (diam s)
namespace mkMetric'
variable {m : Set X → ℝ≥0∞} {r : ℝ≥0∞} {μ : OuterMeasure X} {s : Set X}
theorem le_pre : μ ≤ pre m r ↔ ∀ s : Set X, diam s ≤ r → μ s ≤ m s := by
simp only [pre, le_boundedBy, extend, le_iInf_iff]
theorem pre_le (hs : diam s ≤ r) : pre m r s ≤ m s :=
(boundedBy_le _).trans <| iInf_le _ hs
theorem mono_pre (m : Set X → ℝ≥0∞) {r r' : ℝ≥0∞} (h : r ≤ r') : pre m r' ≤ pre m r :=
le_pre.2 fun _ hs => pre_le (hs.trans h)
theorem mono_pre_nat (m : Set X → ℝ≥0∞) : Monotone fun k : ℕ => pre m k⁻¹ :=
fun k l h => le_pre.2 fun _ hs => pre_le (hs.trans <| by simpa)
theorem tendsto_pre (m : Set X → ℝ≥0∞) (s : Set X) :
Tendsto (fun r => pre m r s) (𝓝[>] 0) (𝓝 <| mkMetric' m s) := by
rw [← map_coe_Ioi_atBot, tendsto_map'_iff]
simp only [mkMetric', OuterMeasure.iSup_apply, iSup_subtype']
exact tendsto_atBot_iSup fun r r' hr => mono_pre _ hr _
theorem tendsto_pre_nat (m : Set X → ℝ≥0∞) (s : Set X) :
Tendsto (fun n : ℕ => pre m n⁻¹ s) atTop (𝓝 <| mkMetric' m s) := by
refine (tendsto_pre m s).comp (tendsto_inf.2 ⟨ENNReal.tendsto_inv_nat_nhds_zero, ?_⟩)
refine tendsto_principal.2 (Eventually.of_forall fun n => ?_)
simp
theorem eq_iSup_nat (m : Set X → ℝ≥0∞) : mkMetric' m = ⨆ n : ℕ, mkMetric'.pre m n⁻¹ := by
ext1 s
rw [iSup_apply]
refine tendsto_nhds_unique (mkMetric'.tendsto_pre_nat m s)
(tendsto_atTop_iSup fun k l hkl => mkMetric'.mono_pre_nat m hkl s)
/-- `MeasureTheory.OuterMeasure.mkMetric'.pre m r` is a trimmed measure provided that
`m (closure s) = m s` for any set `s`. -/
theorem trim_pre [MeasurableSpace X] [OpensMeasurableSpace X] (m : Set X → ℝ≥0∞)
(hcl : ∀ s, m (closure s) = m s) (r : ℝ≥0∞) : (pre m r).trim = pre m r := by
refine le_antisymm (le_pre.2 fun s hs => ?_) (le_trim _)
rw [trim_eq_iInf]
refine iInf_le_of_le (closure s) <| iInf_le_of_le subset_closure <|
iInf_le_of_le measurableSet_closure ((pre_le ?_).trans_eq (hcl _))
rwa [diam_closure]
end mkMetric'
/-- An outer measure constructed using `OuterMeasure.mkMetric'` is a metric outer measure. -/
theorem mkMetric'_isMetric (m : Set X → ℝ≥0∞) : (mkMetric' m).IsMetric := by
rintro s t ⟨r, r0, hr⟩
refine tendsto_nhds_unique_of_eventuallyEq
(mkMetric'.tendsto_pre _ _) ((mkMetric'.tendsto_pre _ _).add (mkMetric'.tendsto_pre _ _)) ?_
rw [← pos_iff_ne_zero] at r0
filter_upwards [Ioo_mem_nhdsGT r0]
rintro ε ⟨_, εr⟩
refine boundedBy_union_of_top_of_nonempty_inter ?_
rintro u ⟨x, hxs, hxu⟩ ⟨y, hyt, hyu⟩
have : ε < diam u := εr.trans_le ((hr x hxs y hyt).trans <| edist_le_diam_of_mem hxu hyu)
exact iInf_eq_top.2 fun h => (this.not_ge h).elim
/-- If `c ∉ {0, ∞}` and `m₁ d ≤ c * m₂ d` for `d < ε` for some `ε > 0`
(we use `≤ᶠ[𝓝[≥] 0]` to state this), then `mkMetric m₁ hm₁ ≤ c • mkMetric m₂ hm₂`. -/
theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0∞} (hc : c ≠ ∞) (h0 : c ≠ 0)
(hle : m₁ ≤ᶠ[𝓝[≥] 0] c • m₂) : (mkMetric m₁ : OuterMeasure X) ≤ c • mkMetric m₂ := by
classical
rcases (mem_nhdsGE_iff_exists_Ico_subset' zero_lt_one).1 hle with ⟨r, hr0, hr⟩
refine fun s =>
le_of_tendsto_of_tendsto (mkMetric'.tendsto_pre _ s)
(ENNReal.Tendsto.const_mul (mkMetric'.tendsto_pre _ s) (Or.inr hc))
(mem_of_superset (Ioo_mem_nhdsGT hr0) fun r' hr' => ?_)
simp only [mem_setOf_eq, mkMetric'.pre]
rw [← smul_eq_mul, ← smul_apply, smul_boundedBy hc]
refine le_boundedBy.2 (fun t => (boundedBy_le _).trans ?_) _
simp only [smul_eq_mul, Pi.smul_apply, extend, iInf_eq_if]
split_ifs with ht
· apply hr
exact ⟨zero_le _, ht.trans_lt hr'.2⟩
· simp [h0]
@[simp]
theorem mkMetric_top : (mkMetric (fun _ => ∞ : ℝ≥0∞ → ℝ≥0∞) : OuterMeasure X) = ⊤ := by
simp_rw [mkMetric, mkMetric', mkMetric'.pre, extend_top, boundedBy_top, eq_top_iff]
rw [le_iSup_iff]
intro b hb
simpa using hb ⊤
/-- If `m₁ d ≤ m₂ d` for `d < ε` for some `ε > 0` (we use `≤ᶠ[𝓝[≥] 0]` to state this), then
`mkMetric m₁ hm₁ ≤ mkMetric m₂ hm₂`. -/
theorem mkMetric_mono {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} (hle : m₁ ≤ᶠ[𝓝[≥] 0] m₂) :
(mkMetric m₁ : OuterMeasure X) ≤ mkMetric m₂ := by
convert @mkMetric_mono_smul X _ _ m₂ _ ENNReal.one_ne_top one_ne_zero _ <;> simp [*]
theorem isometry_comap_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (hf : Isometry f)
(H : Monotone m ∨ Surjective f) : comap f (mkMetric m) = mkMetric m := by
simp only [mkMetric, mkMetric', mkMetric'.pre, comap_iSup]
refine surjective_id.iSup_congr id fun ε => surjective_id.iSup_congr id fun hε => ?_
rw [comap_boundedBy _ (H.imp _ id)]
· congr with s : 1
apply extend_congr <;> simp [hf.ediam_image]
· intro h_mono s t hst
simp only [extend, le_iInf_iff]
intro ht
apply le_trans _ (h_mono (diam_mono hst))
simp only [(diam_mono hst).trans ht, le_refl, ciInf_pos]
theorem mkMetric_smul (m : ℝ≥0∞ → ℝ≥0∞) {c : ℝ≥0∞} (hc : c ≠ ∞) (hc' : c ≠ 0) :
(mkMetric (c • m) : OuterMeasure X) = c • mkMetric m := by
simp only [mkMetric, mkMetric', mkMetric'.pre]
simp_rw [smul_iSup, smul_boundedBy hc, smul_extend _ hc', Pi.smul_apply]
theorem mkMetric_nnreal_smul (m : ℝ≥0∞ → ℝ≥0∞) {c : ℝ≥0} (hc : c ≠ 0) :
(mkMetric (c • m) : OuterMeasure X) = c • mkMetric m := by
rw [ENNReal.smul_def, ENNReal.smul_def,
mkMetric_smul m ENNReal.coe_ne_top (ENNReal.coe_ne_zero.mpr hc)]
theorem isometry_map_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) {f : X → Y} (hf : Isometry f)
(H : Monotone m ∨ Surjective f) : map f (mkMetric m) = restrict (range f) (mkMetric m) := by
rw [← isometry_comap_mkMetric _ hf H, map_comap]
theorem isometryEquiv_comap_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (f : X ≃ᵢ Y) :
comap f (mkMetric m) = mkMetric m :=
isometry_comap_mkMetric _ f.isometry (Or.inr f.surjective)
theorem isometryEquiv_map_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (f : X ≃ᵢ Y) :
map f (mkMetric m) = mkMetric m := by
rw [← isometryEquiv_comap_mkMetric _ f, map_comap_of_surjective f.surjective]
theorem trim_mkMetric [MeasurableSpace X] [BorelSpace X] (m : ℝ≥0∞ → ℝ≥0∞) :
(mkMetric m : OuterMeasure X).trim = mkMetric m := by
simp only [mkMetric, mkMetric'.eq_iSup_nat, trim_iSup]
congr 1 with n : 1
refine mkMetric'.trim_pre _ (fun s => ?_) _
simp
theorem le_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (μ : OuterMeasure X) (r : ℝ≥0∞) (h0 : 0 < r)
(hr : ∀ s, diam s ≤ r → μ s ≤ m (diam s)) : μ ≤ mkMetric m :=
le_iSup₂_of_le r h0 <| mkMetric'.le_pre.2 fun _ hs => hr _ hs
end OuterMeasure
/-!
### Metric measures
In this section we use `MeasureTheory.OuterMeasure.toMeasure` and theorems about
`MeasureTheory.OuterMeasure.mkMetric'`/`MeasureTheory.OuterMeasure.mkMetric` to define
`MeasureTheory.Measure.mkMetric'`/`MeasureTheory.Measure.mkMetric`. We also restate some lemmas
about metric outer measures for metric measures.
-/
namespace Measure
variable [MeasurableSpace X] [BorelSpace X]
/-- Given a function `m : Set X → ℝ≥0∞`, `mkMetric' m` is the supremum of `μ r`
over `r > 0`, where `μ r` is the maximal outer measure `μ` such that `μ s ≤ m s`
for all `s`. While each `μ r` is an *outer* measure, the supremum is a measure. -/
def mkMetric' (m : Set X → ℝ≥0∞) : Measure X :=
(OuterMeasure.mkMetric' m).toMeasure (OuterMeasure.mkMetric'_isMetric _).le_caratheodory
/-- Given a function `m : ℝ≥0∞ → ℝ≥0∞`, `mkMetric m` is the supremum of `μ r` over `r > 0`, where
`μ r` is the maximal outer measure `μ` such that `μ s ≤ m s` for all sets `s` that contain at least
two points. While each `mkMetric'.pre` is an *outer* measure, the supremum is a measure. -/
def mkMetric (m : ℝ≥0∞ → ℝ≥0∞) : Measure X :=
(OuterMeasure.mkMetric m).toMeasure (OuterMeasure.mkMetric'_isMetric _).le_caratheodory
@[simp]
theorem mkMetric'_toOuterMeasure (m : Set X → ℝ≥0∞) :
(mkMetric' m).toOuterMeasure = (OuterMeasure.mkMetric' m).trim :=
rfl
@[simp]
theorem mkMetric_toOuterMeasure (m : ℝ≥0∞ → ℝ≥0∞) :
(mkMetric m : Measure X).toOuterMeasure = OuterMeasure.mkMetric m :=
OuterMeasure.trim_mkMetric m
end Measure
theorem OuterMeasure.coe_mkMetric [MeasurableSpace X] [BorelSpace X] (m : ℝ≥0∞ → ℝ≥0∞) :
⇑(OuterMeasure.mkMetric m : OuterMeasure X) = Measure.mkMetric m := by
rw [← Measure.mkMetric_toOuterMeasure, Measure.coe_toOuterMeasure]
namespace Measure
variable [MeasurableSpace X] [BorelSpace X]
/-- If `c ∉ {0, ∞}` and `m₁ d ≤ c * m₂ d` for `d < ε` for some `ε > 0`
(we use `≤ᶠ[𝓝[≥] 0]` to state this), then `mkMetric m₁ hm₁ ≤ c • mkMetric m₂ hm₂`. -/
theorem mkMetric_mono_smul {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} {c : ℝ≥0∞} (hc : c ≠ ∞) (h0 : c ≠ 0)
(hle : m₁ ≤ᶠ[𝓝[≥] 0] c • m₂) : (mkMetric m₁ : Measure X) ≤ c • mkMetric m₂ := fun s ↦ by
rw [← OuterMeasure.coe_mkMetric, coe_smul, ← OuterMeasure.coe_mkMetric]
exact OuterMeasure.mkMetric_mono_smul hc h0 hle s
@[simp]
theorem mkMetric_top : (mkMetric (fun _ => ∞ : ℝ≥0∞ → ℝ≥0∞) : Measure X) = ⊤ := by
apply toOuterMeasure_injective
rw [mkMetric_toOuterMeasure, OuterMeasure.mkMetric_top, toOuterMeasure_top]
/-- If `m₁ d ≤ m₂ d` for `d < ε` for some `ε > 0` (we use `≤ᶠ[𝓝[≥] 0]` to state this), then
`mkMetric m₁ hm₁ ≤ mkMetric m₂ hm₂`. -/
theorem mkMetric_mono {m₁ m₂ : ℝ≥0∞ → ℝ≥0∞} (hle : m₁ ≤ᶠ[𝓝[≥] 0] m₂) :
(mkMetric m₁ : Measure X) ≤ mkMetric m₂ := by
convert @mkMetric_mono_smul X _ _ _ _ m₂ _ ENNReal.one_ne_top one_ne_zero _ <;> simp [*]
/-- A formula for `MeasureTheory.Measure.mkMetric`. -/
theorem mkMetric_apply (m : ℝ≥0∞ → ℝ≥0∞) (s : Set X) :
mkMetric m s =
⨆ (r : ℝ≥0∞) (_ : 0 < r),
⨅ (t : ℕ → Set X) (_ : s ⊆ iUnion t) (_ : ∀ n, diam (t n) ≤ r),
∑' n, ⨆ _ : (t n).Nonempty, m (diam (t n)) := by
classical
-- We mostly unfold the definitions but we need to switch the order of `∑'` and `⨅`
simp only [← OuterMeasure.coe_mkMetric, OuterMeasure.mkMetric, OuterMeasure.mkMetric',
OuterMeasure.iSup_apply, OuterMeasure.mkMetric'.pre, OuterMeasure.boundedBy_apply, extend]
refine
surjective_id.iSup_congr id fun r =>
iSup_congr_Prop Iff.rfl fun _ =>
surjective_id.iInf_congr _ fun t => iInf_congr_Prop Iff.rfl fun ht => ?_
dsimp
by_cases htr : ∀ n, diam (t n) ≤ r
· rw [iInf_eq_if, if_pos htr]
congr 1 with n : 1
simp only [iInf_eq_if, htr n, if_true]
· rw [iInf_eq_if, if_neg htr]
push_neg at htr; rcases htr with ⟨n, hn⟩
refine ENNReal.tsum_eq_top_of_eq_top ⟨n, ?_⟩
rw [iSup_eq_if, if_pos, iInf_eq_if, if_neg]
· exact hn.not_ge
rcases diam_pos_iff.1 ((zero_le r).trans_lt hn) with ⟨x, hx, -⟩
exact ⟨x, hx⟩
theorem le_mkMetric (m : ℝ≥0∞ → ℝ≥0∞) (μ : Measure X) (ε : ℝ≥0∞) (h₀ : 0 < ε)
(h : ∀ s : Set X, diam s ≤ ε → μ s ≤ m (diam s)) : μ ≤ mkMetric m := by
rw [← toOuterMeasure_le, mkMetric_toOuterMeasure]
exact OuterMeasure.le_mkMetric m μ.toOuterMeasure ε h₀ h
/-- To bound the Hausdorff measure (or, more generally, for a measure defined using
`MeasureTheory.Measure.mkMetric`) of a set, one may use coverings with maximum diameter tending to
`0`, indexed by any sequence of countable types. -/
theorem mkMetric_le_liminf_tsum {β : Type*} {ι : β → Type*} [∀ n, Countable (ι n)] (s : Set X)
{l : Filter β} (r : β → ℝ≥0∞) (hr : Tendsto r l (𝓝 0)) (t : ∀ n : β, ι n → Set X)
(ht : ∀ᶠ n in l, ∀ i, diam (t n i) ≤ r n) (hst : ∀ᶠ n in l, s ⊆ ⋃ i, t n i) (m : ℝ≥0∞ → ℝ≥0∞) :
mkMetric m s ≤ liminf (fun n => ∑' i, m (diam (t n i))) l := by
haveI : ∀ n, Encodable (ι n) := fun n => Encodable.ofCountable _
simp only [mkMetric_apply]
refine iSup₂_le fun ε hε => ?_
refine le_of_forall_gt_imp_ge_of_dense fun c hc => ?_
rcases ((frequently_lt_of_liminf_lt (by isBoundedDefault) hc).and_eventually
((hr.eventually (gt_mem_nhds hε)).and (ht.and hst))).exists with
⟨n, hn, hrn, htn, hstn⟩
set u : ℕ → Set X := fun j => ⋃ b ∈ decode₂ (ι n) j, t n b
refine iInf₂_le_of_le u (by rwa [iUnion_decode₂]) ?_
refine iInf_le_of_le (fun j => ?_) ?_
· rw [EMetric.diam_iUnion_mem_option]
exact iSup₂_le fun _ _ => (htn _).trans hrn.le
· calc
(∑' j : ℕ, ⨆ _ : (u j).Nonempty, m (diam (u j))) = _ :=
tsum_iUnion_decode₂ (fun t : Set X => ⨆ _ : t.Nonempty, m (diam t)) (by simp) _
_ ≤ ∑' i : ι n, m (diam (t n i)) := ENNReal.tsum_le_tsum fun b => iSup_le fun _ => le_rfl
_ ≤ c := hn.le
/-- To bound the Hausdorff measure (or, more generally, for a measure defined using
`MeasureTheory.Measure.mkMetric`) of a set, one may use coverings with maximum diameter tending to
`0`, indexed by any sequence of finite types. -/
theorem mkMetric_le_liminf_sum {β : Type*} {ι : β → Type*} [hι : ∀ n, Fintype (ι n)] (s : Set X)
{l : Filter β} (r : β → ℝ≥0∞) (hr : Tendsto r l (𝓝 0)) (t : ∀ n : β, ι n → Set X)
(ht : ∀ᶠ n in l, ∀ i, diam (t n i) ≤ r n) (hst : ∀ᶠ n in l, s ⊆ ⋃ i, t n i) (m : ℝ≥0∞ → ℝ≥0∞) :
mkMetric m s ≤ liminf (fun n => ∑ i, m (diam (t n i))) l := by
simpa only [tsum_fintype] using mkMetric_le_liminf_tsum s r hr t ht hst m
/-!
### Hausdorff measure and Hausdorff dimension
-/
/-- Hausdorff measure on an (e)metric space. -/
def hausdorffMeasure (d : ℝ) : Measure X :=
mkMetric fun r => r ^ d
@[inherit_doc]
scoped[MeasureTheory] notation "μH[" d "]" => MeasureTheory.Measure.hausdorffMeasure d
theorem le_hausdorffMeasure (d : ℝ) (μ : Measure X) (ε : ℝ≥0∞) (h₀ : 0 < ε)
(h : ∀ s : Set X, diam s ≤ ε → μ s ≤ diam s ^ d) : μ ≤ μH[d] :=
le_mkMetric _ μ ε h₀ h
/-- A formula for `μH[d] s`. -/
theorem hausdorffMeasure_apply (d : ℝ) (s : Set X) :
μH[d] s =
⨆ (r : ℝ≥0∞) (_ : 0 < r),
⨅ (t : ℕ → Set X) (_ : s ⊆ ⋃ n, t n) (_ : ∀ n, diam (t n) ≤ r),
∑' n, ⨆ _ : (t n).Nonempty, diam (t n) ^ d :=
mkMetric_apply _ _
/-- To bound the Hausdorff measure of a set, one may use coverings with maximum diameter tending
to `0`, indexed by any sequence of countable types. -/
theorem hausdorffMeasure_le_liminf_tsum {β : Type*} {ι : β → Type*} [∀ n, Countable (ι n)]
(d : ℝ) (s : Set X) {l : Filter β} (r : β → ℝ≥0∞) (hr : Tendsto r l (𝓝 0))
(t : ∀ n : β, ι n → Set X) (ht : ∀ᶠ n in l, ∀ i, diam (t n i) ≤ r n)
(hst : ∀ᶠ n in l, s ⊆ ⋃ i, t n i) : μH[d] s ≤ liminf (fun n => ∑' i, diam (t n i) ^ d) l :=
mkMetric_le_liminf_tsum s r hr t ht hst _
/-- To bound the Hausdorff measure of a set, one may use coverings with maximum diameter tending
to `0`, indexed by any sequence of finite types. -/
theorem hausdorffMeasure_le_liminf_sum {β : Type*} {ι : β → Type*} [∀ n, Fintype (ι n)]
(d : ℝ) (s : Set X) {l : Filter β} (r : β → ℝ≥0∞) (hr : Tendsto r l (𝓝 0))
(t : ∀ n : β, ι n → Set X) (ht : ∀ᶠ n in l, ∀ i, diam (t n i) ≤ r n)
(hst : ∀ᶠ n in l, s ⊆ ⋃ i, t n i) : μH[d] s ≤ liminf (fun n => ∑ i, diam (t n i) ^ d) l :=
mkMetric_le_liminf_sum s r hr t ht hst _
/-- If `d₁ < d₂`, then for any set `s` we have either `μH[d₂] s = 0`, or `μH[d₁] s = ∞`. -/
theorem hausdorffMeasure_zero_or_top {d₁ d₂ : ℝ} (h : d₁ < d₂) (s : Set X) :
μH[d₂] s = 0 ∨ μH[d₁] s = ∞ := by
by_contra! H
suffices ∀ c : ℝ≥0, c ≠ 0 → μH[d₂] s ≤ c * μH[d₁] s by
rcases ENNReal.exists_nnreal_pos_mul_lt H.2 H.1 with ⟨c, hc0, hc⟩
exact hc.not_ge (this c (pos_iff_ne_zero.1 hc0))
intro c hc
refine le_iff'.1 (mkMetric_mono_smul ENNReal.coe_ne_top (mod_cast hc) ?_) s
have : 0 < ((c : ℝ≥0∞) ^ (d₂ - d₁)⁻¹) := by
rw [← ENNReal.coe_rpow_of_ne_zero hc, pos_iff_ne_zero, Ne, ENNReal.coe_eq_zero,
NNReal.rpow_eq_zero_iff]
exact mt And.left hc
filter_upwards [Ico_mem_nhdsGE this]
rintro r ⟨hr₀, hrc⟩
lift r to ℝ≥0 using ne_top_of_lt hrc
rw [Pi.smul_apply, smul_eq_mul,
← ENNReal.div_le_iff_le_mul (Or.inr ENNReal.coe_ne_top) (Or.inr <| mt ENNReal.coe_eq_zero.1 hc)]
rcases eq_or_ne r 0 with (rfl | hr₀)
· rcases lt_or_ge 0 d₂ with (h₂ | h₂)
· simp only [h₂, ENNReal.zero_rpow_of_pos, zero_le, ENNReal.zero_div, ENNReal.coe_zero]
· simp only [h.trans_le h₂, ENNReal.div_top, zero_le, ENNReal.zero_rpow_of_neg,
ENNReal.coe_zero]
· have : (r : ℝ≥0∞) ≠ 0 := by simpa only [ENNReal.coe_eq_zero, Ne] using hr₀
rw [← ENNReal.rpow_sub _ _ this ENNReal.coe_ne_top]
refine (ENNReal.rpow_lt_rpow hrc (sub_pos.2 h)).le.trans ?_
rw [← ENNReal.rpow_mul, inv_mul_cancel₀ (sub_pos.2 h).ne', ENNReal.rpow_one]
/-- Hausdorff measure `μH[d] s` is monotone in `d`. -/
theorem hausdorffMeasure_mono {d₁ d₂ : ℝ} (h : d₁ ≤ d₂) (s : Set X) : μH[d₂] s ≤ μH[d₁] s := by
rcases h.eq_or_lt with (rfl | h); · exact le_rfl
rcases hausdorffMeasure_zero_or_top h s with hs | hs
· rw [hs]; exact zero_le _
· rw [hs]; exact le_top
variable (X) in
theorem noAtoms_hausdorff {d : ℝ} (hd : 0 < d) : NoAtoms (hausdorffMeasure d : Measure X) := by
refine ⟨fun x => ?_⟩
rw [← nonpos_iff_eq_zero, hausdorffMeasure_apply]
refine iSup₂_le fun ε _ => iInf₂_le_of_le (fun _ => {x}) ?_ <| iInf_le_of_le (fun _ => ?_) ?_
· exact subset_iUnion (fun _ => {x} : ℕ → Set X) 0
· simp only [EMetric.diam_singleton, zero_le]
· simp [hd]
@[simp]
theorem hausdorffMeasure_zero_singleton (x : X) : μH[0] ({x} : Set X) = 1 := by
apply le_antisymm
· let r : ℕ → ℝ≥0∞ := fun _ => 0
let t : ℕ → Unit → Set X := fun _ _ => {x}
have ht : ∀ᶠ n in atTop, ∀ i, diam (t n i) ≤ r n := by
simp only [t, r, imp_true_iff, diam_singleton, eventually_atTop,
nonpos_iff_eq_zero, exists_const]
simpa [t, liminf_const] using hausdorffMeasure_le_liminf_sum 0 {x} r tendsto_const_nhds t ht
· rw [hausdorffMeasure_apply]
suffices
(1 : ℝ≥0∞) ≤
⨅ (t : ℕ → Set X) (_ : {x} ⊆ ⋃ n, t n) (_ : ∀ n, diam (t n) ≤ 1),
∑' n, ⨆ _ : (t n).Nonempty, diam (t n) ^ (0 : ℝ) by
apply le_trans this _
convert le_iSup₂ (α := ℝ≥0∞) (1 : ℝ≥0∞) zero_lt_one
rfl
simp only [ENNReal.rpow_zero, le_iInf_iff]
intro t hst _
rcases mem_iUnion.1 (hst (mem_singleton x)) with ⟨m, hm⟩
have A : (t m).Nonempty := ⟨x, hm⟩
calc
(1 : ℝ≥0∞) = ⨆ h : (t m).Nonempty, 1 := by simp only [A, ciSup_pos]
_ ≤ ∑' n, ⨆ h : (t n).Nonempty, 1 := ENNReal.le_tsum _
theorem one_le_hausdorffMeasure_zero_of_nonempty {s : Set X} (h : s.Nonempty) : 1 ≤ μH[0] s := by
rcases h with ⟨x, hx⟩
calc
(1 : ℝ≥0∞) = μH[0] ({x} : Set X) := (hausdorffMeasure_zero_singleton x).symm
_ ≤ μH[0] s := measure_mono (singleton_subset_iff.2 hx)
theorem hausdorffMeasure_le_one_of_subsingleton {s : Set X} (hs : s.Subsingleton) {d : ℝ}
(hd : 0 ≤ d) : μH[d] s ≤ 1 := by
rcases eq_empty_or_nonempty s with (rfl | ⟨x, hx⟩)
· simp only [measure_empty, zero_le]
· rw [(subsingleton_iff_singleton hx).1 hs]
rcases eq_or_lt_of_le hd with (rfl | dpos)
· simp only [le_refl, hausdorffMeasure_zero_singleton]
· haveI := noAtoms_hausdorff X dpos
simp only [zero_le, measure_singleton]
end Measure
end MeasureTheory
/-!
### Hausdorff measure, Hausdorff dimension, and Hölder or Lipschitz continuous maps
-/
open scoped MeasureTheory
open MeasureTheory MeasureTheory.Measure
variable [MeasurableSpace X] [BorelSpace X] [MeasurableSpace Y] [BorelSpace Y]
namespace HolderOnWith
variable {C r : ℝ≥0} {f : X → Y} {s : Set X}
/-- If `f : X → Y` is Hölder continuous on `s` with a positive exponent `r`, then
`μH[d] (f '' s) ≤ C ^ d * μH[r * d] s`. -/
theorem hausdorffMeasure_image_le (h : HolderOnWith C r f s) (hr : 0 < r) {d : ℝ} (hd : 0 ≤ d) :
μH[d] (f '' s) ≤ (C : ℝ≥0∞) ^ d * μH[r * d] s := by
-- We start with the trivial case `C = 0`
rcases (zero_le C).eq_or_lt with (rfl | hC0)
· rcases eq_empty_or_nonempty s with (rfl | ⟨x, hx⟩)
· simp only [measure_empty, nonpos_iff_eq_zero, mul_zero, image_empty]
have : f '' s = {f x} :=
have : (f '' s).Subsingleton := by simpa [diam_eq_zero_iff] using h.ediam_image_le
(subsingleton_iff_singleton (mem_image_of_mem f hx)).1 this
rw [this]
rcases eq_or_lt_of_le hd with (rfl | h'd)
· simp only [ENNReal.rpow_zero, one_mul, mul_zero]
rw [hausdorffMeasure_zero_singleton]
exact one_le_hausdorffMeasure_zero_of_nonempty ⟨x, hx⟩
· haveI := noAtoms_hausdorff Y h'd
simp only [zero_le, measure_singleton]
-- Now assume `C ≠ 0`
· have hCd0 : (C : ℝ≥0∞) ^ d ≠ 0 := by simp [hC0.ne']
have hCd : (C : ℝ≥0∞) ^ d ≠ ∞ := by simp [hd]
simp only [hausdorffMeasure_apply, ENNReal.mul_iSup, ENNReal.mul_iInf_of_ne hCd0 hCd,
← ENNReal.tsum_mul_left]
refine iSup_le fun R => iSup_le fun hR => ?_
have : Tendsto (fun d : ℝ≥0∞ => (C : ℝ≥0∞) * d ^ (r : ℝ)) (𝓝 0) (𝓝 0) :=
ENNReal.tendsto_const_mul_rpow_nhds_zero_of_pos ENNReal.coe_ne_top hr
rcases ENNReal.nhds_zero_basis_Iic.eventually_iff.1 (this.eventually (gt_mem_nhds hR)) with
⟨δ, δ0, H⟩
refine le_iSup₂_of_le δ δ0 <| iInf₂_mono' fun t hst ↦
⟨fun n => f '' (t n ∩ s), ?_, iInf_mono' fun htδ ↦
⟨fun n => (h.ediam_image_inter_le (t n)).trans (H (htδ n)).le, ?_⟩⟩
· grw [← image_iUnion, ← iUnion_inter, ← hst, inter_self]
· refine ENNReal.tsum_le_tsum fun n => ?_
simp only [iSup_le_iff, image_nonempty]
intro hft
simp only [Nonempty.mono ((t n).inter_subset_left) hft, ciSup_pos]
rw [ENNReal.rpow_mul, ← ENNReal.mul_rpow_of_nonneg _ _ hd]
exact ENNReal.rpow_le_rpow (h.ediam_image_inter_le _) hd
end HolderOnWith
namespace LipschitzOnWith
open Submodule
variable {K : ℝ≥0} {f : X → Y} {s : Set X}
/-- If `f : X → Y` is `K`-Lipschitz on `s`, then `μH[d] (f '' s) ≤ K ^ d * μH[d] s`. -/
theorem hausdorffMeasure_image_le (h : LipschitzOnWith K f s) {d : ℝ} (hd : 0 ≤ d) :
μH[d] (f '' s) ≤ (K : ℝ≥0∞) ^ d * μH[d] s := by
simpa only [NNReal.coe_one, one_mul] using h.holderOnWith.hausdorffMeasure_image_le zero_lt_one hd
end LipschitzOnWith
namespace LipschitzWith
variable {K : ℝ≥0} {f : X → Y}
/-- If `f` is a `K`-Lipschitz map, then it increases the Hausdorff `d`-measures of sets at most
by the factor of `K ^ d`. -/
theorem hausdorffMeasure_image_le (h : LipschitzWith K f) {d : ℝ} (hd : 0 ≤ d) (s : Set X) :
μH[d] (f '' s) ≤ (K : ℝ≥0∞) ^ d * μH[d] s :=
h.lipschitzOnWith.hausdorffMeasure_image_le hd
end LipschitzWith
open scoped Pointwise
theorem MeasureTheory.Measure.hausdorffMeasure_smul₀ {𝕜 E : Type*} [NormedAddCommGroup E]
[NormedDivisionRing 𝕜] [Module 𝕜 E] [NormSMulClass 𝕜 E] [MeasurableSpace E] [BorelSpace E]
{d : ℝ} (hd : 0 ≤ d) {r : 𝕜} (hr : r ≠ 0) (s : Set E) :
μH[d] (r • s) = ‖r‖₊ ^ d • μH[d] s := by
have {r : 𝕜} (s : Set E) : μH[d] (r • s) ≤ ‖r‖₊ ^ d • μH[d] s := by
simpa [ENNReal.coe_rpow_of_nonneg, hd]
using (lipschitzWith_smul r).hausdorffMeasure_image_le hd s
refine le_antisymm (this s) ?_
rw [← le_inv_smul_iff_of_pos]
· dsimp
rw [← NNReal.inv_rpow, ← nnnorm_inv]
· refine Eq.trans_le ?_ (this (r • s))
rw [inv_smul_smul₀ hr]
· simp [pos_iff_ne_zero, hr]
/-!
### Antilipschitz maps do not decrease Hausdorff measures and dimension
-/
namespace AntilipschitzWith
variable {f : X → Y} {K : ℝ≥0} {d : ℝ}
theorem hausdorffMeasure_preimage_le (hf : AntilipschitzWith K f) (hd : 0 ≤ d) (s : Set Y) :
μH[d] (f ⁻¹' s) ≤ (K : ℝ≥0∞) ^ d * μH[d] s := by
rcases eq_or_ne K 0 with (rfl | h0)
· rcases eq_empty_or_nonempty (f ⁻¹' s) with (hs | ⟨x, hx⟩)
· simp only [hs, measure_empty, zero_le]
have : f ⁻¹' s = {x} := by
haveI : Subsingleton X := hf.subsingleton
have : (f ⁻¹' s).Subsingleton := subsingleton_univ.anti (subset_univ _)
exact (subsingleton_iff_singleton hx).1 this
rw [this]
rcases eq_or_lt_of_le hd with (rfl | h'd)
· simp only [ENNReal.rpow_zero, one_mul]
rw [hausdorffMeasure_zero_singleton]
exact one_le_hausdorffMeasure_zero_of_nonempty ⟨f x, hx⟩
· haveI := noAtoms_hausdorff X h'd
simp only [zero_le, measure_singleton]
have hKd0 : (K : ℝ≥0∞) ^ d ≠ 0 := by simp [h0]
have hKd : (K : ℝ≥0∞) ^ d ≠ ∞ := by simp [hd]
simp only [hausdorffMeasure_apply, ENNReal.mul_iSup, ENNReal.mul_iInf_of_ne hKd0 hKd,
← ENNReal.tsum_mul_left]
refine iSup₂_le fun ε ε0 => ?_
refine le_iSup₂_of_le (ε / K) (by simp [ε0.ne']) ?_
refine le_iInf₂ fun t hst => le_iInf fun htε => ?_
replace hst : f ⁻¹' s ⊆ _ := preimage_mono hst; rw [preimage_iUnion] at hst
refine iInf₂_le_of_le _ hst (iInf_le_of_le (fun n => ?_) ?_)
· exact (hf.ediam_preimage_le _).trans (ENNReal.mul_le_of_le_div' <| htε n)
· refine ENNReal.tsum_le_tsum fun n => iSup_le_iff.2 fun hft => ?_
simp only [nonempty_of_nonempty_preimage hft, ciSup_pos]
rw [← ENNReal.mul_rpow_of_nonneg _ _ hd]
exact ENNReal.rpow_le_rpow (hf.ediam_preimage_le _) hd
theorem le_hausdorffMeasure_image (hf : AntilipschitzWith K f) (hd : 0 ≤ d) (s : Set X) :
μH[d] s ≤ (K : ℝ≥0∞) ^ d * μH[d] (f '' s) :=
calc
μH[d] s ≤ μH[d] (f ⁻¹' (f '' s)) := measure_mono (subset_preimage_image _ _)
_ ≤ (K : ℝ≥0∞) ^ d * μH[d] (f '' s) := hf.hausdorffMeasure_preimage_le hd (f '' s)
end AntilipschitzWith
/-!
### Isometries preserve the Hausdorff measure and Hausdorff dimension
-/
namespace Isometry
variable {f : X → Y} {d : ℝ}
theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set X) :
μH[d] (f '' s) = μH[d] s := by
simp only [hausdorffMeasure, ← OuterMeasure.coe_mkMetric, ← OuterMeasure.comap_apply]
rw [OuterMeasure.isometry_comap_mkMetric _ hf (hd.imp_left _)]
exact ENNReal.monotone_rpow_of_nonneg
theorem hausdorffMeasure_preimage (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set Y) :
μH[d] (f ⁻¹' s) = μH[d] (s ∩ range f) := by
rw [← hf.hausdorffMeasure_image hd, image_preimage_eq_inter_range]
theorem map_hausdorffMeasure (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) :
Measure.map f μH[d] = μH[d].restrict (range f) := by
ext1 s hs
rw [map_apply hf.continuous.measurable hs, Measure.restrict_apply hs,
hf.hausdorffMeasure_preimage hd]
end Isometry
namespace IsometryEquiv
@[simp]
theorem hausdorffMeasure_image (e : X ≃ᵢ Y) (d : ℝ) (s : Set X) : μH[d] (e '' s) = μH[d] s :=
e.isometry.hausdorffMeasure_image (Or.inr e.surjective) s
@[simp]
theorem hausdorffMeasure_preimage (e : X ≃ᵢ Y) (d : ℝ) (s : Set Y) : μH[d] (e ⁻¹' s) = μH[d] s := by
rw [← e.image_symm, e.symm.hausdorffMeasure_image]
@[simp]
theorem map_hausdorffMeasure (e : X ≃ᵢ Y) (d : ℝ) : Measure.map e μH[d] = μH[d] := by
rw [e.isometry.map_hausdorffMeasure (Or.inr e.surjective), e.surjective.range_eq, restrict_univ]
theorem measurePreserving_hausdorffMeasure (e : X ≃ᵢ Y) (d : ℝ) : MeasurePreserving e μH[d] μH[d] :=
⟨e.continuous.measurable, map_hausdorffMeasure _ _⟩
end IsometryEquiv
namespace MeasureTheory
@[to_additive]
theorem hausdorffMeasure_smul {α : Type*} [SMul α X] [IsIsometricSMul α X] {d : ℝ} (c : α)
(h : 0 ≤ d ∨ Surjective (c • · : X → X)) (s : Set X) : μH[d] (c • s) = μH[d] s :=
(isometry_smul X c).hausdorffMeasure_image h _
@[to_additive]
instance {d : ℝ} [Group X] [IsIsometricSMul X X] : IsMulLeftInvariant (μH[d] : Measure X) where
map_mul_left_eq_self x := (IsometryEquiv.constSMul x).map_hausdorffMeasure _
@[to_additive]
instance {d : ℝ} [Group X] [IsIsometricSMul Xᵐᵒᵖ X] : IsMulRightInvariant (μH[d] : Measure X) where
map_mul_right_eq_self x := (IsometryEquiv.constSMul (MulOpposite.op x)).map_hausdorffMeasure _
/-!
### Hausdorff measure and Lebesgue measure
-/
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
(μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
classical
-- it suffices to check that the two measures coincide on products of rational intervals
refine (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
(fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) ?_).symm
simp only [mem_iUnion, mem_singleton_iff]
-- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
intro s hs
choose a b H using hs
obtain rfl : s = fun i => Ioo (α := ℝ) (a i) (b i) := funext fun i => (H i).2
replace H := fun i => (H i).1
apply le_antisymm _
-- first check that `volume s ≤ μH s`
· have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) := by
refine le_hausdorffMeasure _ _ ∞ ENNReal.coe_lt_top fun s _ => ?_
rw [ENNReal.rpow_natCast]
exact Real.volume_pi_le_diam_pow s
rw [← volume_pi_pi fun i => Ioo (a i : ℝ) (b i)]
exact Measure.le_iff'.1 Hle _
/- For the other inequality `μH s ≤ volume s`, we use a covering of `s` by sets of small diameter
`1/n`, namely cubes with left-most point of the form `a i + f i / n` with `f i` ranging between
`0` and `⌈(b i - a i) * n⌉`. Their number is asymptotic to `n^d * Π (b i - a i)`. -/
have I : ∀ i, 0 ≤ (b i : ℝ) - a i := fun i => by
simpa only [sub_nonneg, Rat.cast_le] using (H i).le
let γ := fun n : ℕ => ∀ i : ι, Fin ⌈((b i : ℝ) - a i) * n⌉₊
let t : ∀ n : ℕ, γ n → Set (ι → ℝ) := fun n f =>
Set.pi univ fun i => Icc (a i + f i / n) (a i + (f i + 1) / n)
have A : Tendsto (fun n : ℕ => 1 / (n : ℝ≥0∞)) atTop (𝓝 0) := by
simp only [one_div, ENNReal.tendsto_inv_nat_nhds_zero]
have B : ∀ᶠ n in atTop, ∀ i : γ n, diam (t n i) ≤ 1 / n := by
refine eventually_atTop.2 ⟨1, fun n hn => ?_⟩
intro f
refine diam_pi_le_of_le fun b => ?_
simp only [Real.ediam_Icc, add_div, ENNReal.ofReal_div_of_pos (Nat.cast_pos.mpr hn), le_refl,
add_sub_add_left_eq_sub, add_sub_cancel_left, ENNReal.ofReal_one, ENNReal.ofReal_natCast]
have C : ∀ᶠ n in atTop, (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ⊆ ⋃ i : γ n, t n i := by
refine eventually_atTop.2 ⟨1, fun n hn => ?_⟩
have npos : (0 : ℝ) < n := Nat.cast_pos.2 hn
intro x hx
simp only [mem_Ioo, mem_univ_pi] at hx
simp only [t, mem_iUnion, mem_univ_pi]
let f : γ n := fun i =>
⟨⌊(x i - a i) * n⌋₊, by
apply Nat.floor_lt_ceil_of_lt_of_pos
· gcongr
exact (hx i).right
· refine mul_pos ?_ npos
simpa only [Rat.cast_lt, sub_pos] using H i⟩
refine ⟨f, fun i => ⟨?_, ?_⟩⟩
· calc
(a i : ℝ) + ⌊(x i - a i) * n⌋₊ / n ≤ (a i : ℝ) + (x i - a i) * n / n := by
gcongr
exact Nat.floor_le (mul_nonneg (sub_nonneg.2 (hx i).1.le) npos.le)
_ = x i := by field
· calc
x i = (a i : ℝ) + (x i - a i) * n / n := by field
_ ≤ (a i : ℝ) + (⌊(x i - a i) * n⌋₊ + 1) / n := by
gcongr
exact (Nat.lt_floor_add_one _).le
calc
μH[Fintype.card ι] (Set.pi univ fun i : ι => Ioo (a i : ℝ) (b i)) ≤
liminf (fun n : ℕ => ∑ i : γ n, diam (t n i) ^ ((Fintype.card ι) : ℝ)) atTop :=
hausdorffMeasure_le_liminf_sum _ (Set.pi univ fun i => Ioo (a i : ℝ) (b i))
(fun n : ℕ => 1 / (n : ℝ≥0∞)) A t B C
_ ≤ liminf (fun n : ℕ => ∑ i : γ n, (1 / (n : ℝ≥0∞)) ^ Fintype.card ι) atTop := by
refine liminf_le_liminf ?_ ?_
· filter_upwards [B] with _ hn
apply Finset.sum_le_sum fun i _ => _
simp only [ENNReal.rpow_natCast]
intro i _
exact pow_le_pow_left' (hn i) _
· isBoundedDefault
_ = liminf (fun n : ℕ => ∏ i : ι, (⌈((b i : ℝ) - a i) * n⌉₊ : ℝ≥0∞) / n) atTop := by
simp only [γ, Finset.card_univ, Nat.cast_prod, one_mul, Fintype.card_fin, Finset.sum_const,
nsmul_eq_mul, Fintype.card_pi, div_eq_mul_inv, Finset.prod_mul_distrib, Finset.prod_const]
_ = ∏ i : ι, volume (Ioo (a i : ℝ) (b i)) := by
simp only [Real.volume_Ioo]
apply Tendsto.liminf_eq
refine ENNReal.tendsto_finset_prod_of_ne_top _ (fun i _ => ?_) fun i _ => ?_
· apply
Tendsto.congr' _
((ENNReal.continuous_ofReal.tendsto _).comp
((tendsto_nat_ceil_mul_div_atTop (I i)).comp tendsto_natCast_atTop_atTop))
apply eventually_atTop.2 ⟨1, fun n hn => _⟩
intro n hn
simp only [ENNReal.ofReal_div_of_pos (Nat.cast_pos.mpr hn), comp_apply,
ENNReal.ofReal_natCast]
· simp only [ENNReal.ofReal_ne_top, Ne, not_false_iff]
instance isAddHaarMeasure_hausdorffMeasure {E : Type*}
[NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]
[MeasurableSpace E] [BorelSpace E] :
IsAddHaarMeasure (G := E) μH[finrank ℝ E] where
lt_top_of_isCompact K hK := by
set e : E ≃L[ℝ] Fin (finrank ℝ E) → ℝ := ContinuousLinearEquiv.ofFinrankEq (by simp)
suffices μH[finrank ℝ E] (e '' K) < ⊤ by
rw [← e.symm_image_image K]
apply lt_of_le_of_lt <| e.symm.lipschitz.hausdorffMeasure_image_le (by simp) (e '' K)
rw [ENNReal.rpow_natCast]
exact ENNReal.mul_lt_top (ENNReal.pow_lt_top ENNReal.coe_lt_top) this
conv_lhs => congr; congr; rw [← Fintype.card_fin (finrank ℝ E)]
rw [hausdorffMeasure_pi_real]
exact (hK.image e.continuous).measure_lt_top
open_pos U hU hU' := by
set e : E ≃L[ℝ] Fin (finrank ℝ E) → ℝ := ContinuousLinearEquiv.ofFinrankEq (by simp)
suffices 0 < μH[finrank ℝ E] (e '' U) from
(ENNReal.mul_pos_iff.mp (lt_of_lt_of_le this <|
e.lipschitz.hausdorffMeasure_image_le (by simp) _)).2.ne'
conv_rhs => congr; congr; rw [← Fintype.card_fin (finrank ℝ E)]
rw [hausdorffMeasure_pi_real]
apply (e.isOpenMap U hU).measure_pos (μ := volume)
simpa
variable (ι X)
theorem hausdorffMeasure_measurePreserving_funUnique [Unique ι]
[SecondCountableTopology X] (d : ℝ) :
MeasurePreserving (MeasurableEquiv.funUnique ι X) μH[d] μH[d] :=
(IsometryEquiv.funUnique ι X).measurePreserving_hausdorffMeasure _
theorem hausdorffMeasure_measurePreserving_piFinTwo (α : Fin 2 → Type*)
[∀ i, MeasurableSpace (α i)] [∀ i, EMetricSpace (α i)] [∀ i, BorelSpace (α i)]
[∀ i, SecondCountableTopology (α i)] (d : ℝ) :
MeasurePreserving (MeasurableEquiv.piFinTwo α) μH[d] μH[d] :=
(IsometryEquiv.piFinTwo α).measurePreserving_hausdorffMeasure _
/-- In the space `ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_real : (μH[1] : Measure ℝ) = volume := by
rw [← (volume_preserving_funUnique Unit ℝ).map_eq,
← (hausdorffMeasure_measurePreserving_funUnique Unit ℝ 1).map_eq,
← hausdorffMeasure_pi_real, Fintype.card_unit, Nat.cast_one]
/-- In the space `ℝ × ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_prod_real : (μH[2] : Measure (ℝ × ℝ)) = volume := by
rw [← (volume_preserving_piFinTwo fun _ => ℝ).map_eq,
← (hausdorffMeasure_measurePreserving_piFinTwo (fun _ => ℝ) _).map_eq,
← hausdorffMeasure_pi_real, Fintype.card_fin, Nat.cast_two]
/-! ### Geometric results in affine spaces -/
section Geometric
variable {𝕜 E P : Type*}
theorem hausdorffMeasure_smul_right_image [NormedAddCommGroup E] [NormedSpace ℝ E]
[MeasurableSpace E] [BorelSpace E] (v : E) (s : Set ℝ) :
μH[1] ((fun r => r • v) '' s) = ‖v‖₊ • μH[1] s := by
obtain rfl | hv := eq_or_ne v 0
· haveI := noAtoms_hausdorff E one_pos
obtain rfl | hs := s.eq_empty_or_nonempty
· simp
simp [hs]
have hn : ‖v‖ ≠ 0 := norm_ne_zero_iff.mpr hv
-- break lineMap into pieces
suffices
μH[1] ((‖v‖ • ·) '' (LinearMap.toSpanSingleton ℝ E (‖v‖⁻¹ • v) '' s)) = ‖v‖₊ • μH[1] s by
simpa only [Set.image_image, smul_comm (norm _), inv_smul_smul₀ hn,
LinearMap.toSpanSingleton_apply] using this
have iso_smul : Isometry (LinearMap.toSpanSingleton ℝ E (‖v‖⁻¹ • v)) := by
refine AddMonoidHomClass.isometry_of_norm _ fun x => (norm_smul _ _).trans ?_
rw [norm_smul, norm_inv, norm_norm, inv_mul_cancel₀ hn, mul_one, LinearMap.id_apply]
rw [Set.image_smul, Measure.hausdorffMeasure_smul₀ zero_le_one hn, nnnorm_norm,
NNReal.rpow_one, iso_smul.hausdorffMeasure_image (Or.inl <| zero_le_one' ℝ)]
section NormedFieldAffine
variable [NormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [MeasurableSpace P]
variable [MetricSpace P] [NormedAddTorsor E P] [BorelSpace P]
/-- Scaling by `c` around `x` scales the measure by `‖c‖₊ ^ d`. -/
theorem hausdorffMeasure_homothety_image {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 𝕜} (hc : c ≠ 0)
(s : Set P) : μH[d] (AffineMap.homothety x c '' s) = ‖c‖₊ ^ d • μH[d] s := by
suffices
μH[d] (IsometryEquiv.vaddConst x '' ((c • ·) '' ((IsometryEquiv.vaddConst x).symm '' s))) =
‖c‖₊ ^ d • μH[d] s by
simpa only [Set.image_image]
borelize E
rw [IsometryEquiv.hausdorffMeasure_image, Set.image_smul, Measure.hausdorffMeasure_smul₀ hd hc,
IsometryEquiv.hausdorffMeasure_image]
theorem hausdorffMeasure_homothety_preimage {d : ℝ} (hd : 0 ≤ d) (x : P) {c : 𝕜} (hc : c ≠ 0)
(s : Set P) : μH[d] (AffineMap.homothety x c ⁻¹' s) = ‖c‖₊⁻¹ ^ d • μH[d] s := by
change μH[d] (AffineEquiv.homothetyUnitsMulHom x (Units.mk0 c hc) ⁻¹' s) = _
rw [← AffineEquiv.image_symm, AffineEquiv.coe_homothetyUnitsMulHom_apply_symm,
hausdorffMeasure_homothety_image hd x (_ : 𝕜ˣ).isUnit.ne_zero, Units.val_inv_eq_inv_val,
Units.val_mk0, nnnorm_inv]
/-! TODO: prove `Measure.map (AffineMap.homothety x c) μH[d] = ‖c‖₊⁻¹ ^ d • μH[d]`, which needs a
more general version of `AffineMap.homothety_continuous`. -/
end NormedFieldAffine
section RealAffine
variable [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace P]
variable [MetricSpace P] [NormedAddTorsor E P] [BorelSpace P]
/-- Mapping a set of reals along a line segment scales the measure by the length of a segment.
This is an auxiliary result used to prove `hausdorffMeasure_affineSegment`. -/
theorem hausdorffMeasure_lineMap_image (x y : P) (s : Set ℝ) :
μH[1] (AffineMap.lineMap x y '' s) = nndist x y • μH[1] s := by
suffices μH[1] (IsometryEquiv.vaddConst x '' ((· • (y -ᵥ x)) '' s)) = nndist x y • μH[1] s by
simpa only [Set.image_image]
borelize E
rw [IsometryEquiv.hausdorffMeasure_image, hausdorffMeasure_smul_right_image,
nndist_eq_nnnorm_vsub' E]
/-- The measure of a segment is the distance between its endpoints. -/
@[simp]
theorem hausdorffMeasure_affineSegment (x y : P) : μH[1] (affineSegment ℝ x y) = edist x y := by
rw [affineSegment, hausdorffMeasure_lineMap_image, hausdorffMeasure_real, Real.volume_Icc,
sub_zero, ENNReal.ofReal_one, ← Algebra.algebraMap_eq_smul_one]
exact (edist_nndist _ _).symm
end RealAffine
/-- The measure of a segment is the distance between its endpoints. -/
@[simp]
theorem hausdorffMeasure_segment {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[MeasurableSpace E] [BorelSpace E] (x y : E) : μH[1] (segment ℝ x y) = edist x y := by
rw [← affineSegment_eq_segment, hausdorffMeasure_affineSegment]
/--
Let `s` be a subset of `𝕜`-inner product space, and `K` a subspace. Then the `d`-dimensional
Hausdorff measure of the orthogonal projection of `s` onto `K` is less than or equal to the
`d`-dimensional Hausdorff measure of `s`.
-/
theorem hausdorffMeasure_orthogonalProjection_le [RCLike 𝕜]
[NormedAddCommGroup E] [InnerProductSpace 𝕜 E] [MeasurableSpace E] [BorelSpace E]
(K : Submodule 𝕜 E) [K.HasOrthogonalProjection]
(d : ℝ) (s : Set E) (hs : 0 ≤ d) :
μH[d] (K.orthogonalProjection '' s) ≤ μH[d] s := by
simpa using K.lipschitzWith_orthogonalProjection.hausdorffMeasure_image_le hs s
end Geometric
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/WithDensity.lean | import Mathlib.MeasureTheory.Integral.Lebesgue.Countable
import Mathlib.MeasureTheory.Measure.Decomposition.Exhaustion
import Mathlib.MeasureTheory.Group.Convolution
import Mathlib.Analysis.LConvolution
/-!
# Measure with a given density with respect to another measure
For a measure `μ` on `α` and a function `f : α → ℝ≥0∞`, we define a new measure `μ.withDensity f`.
On a measurable set `s`, that measure has value `∫⁻ a in s, f a ∂μ`.
An important result about `withDensity` is the Radon-Nikodym theorem. It states that, given measures
`μ, ν`, if `HaveLebesgueDecomposition μ ν` then `μ` is absolutely continuous with respect to
`ν` if and only if there exists a measurable function `f : α → ℝ≥0∞` such that
`μ = ν.withDensity f`.
See `MeasureTheory.Measure.absolutelyContinuous_iff_withDensity_rnDeriv_eq`.
-/
open Set hiding restrict restrict_apply
open Filter ENNReal NNReal MeasureTheory.Measure
namespace MeasureTheory
variable {α : Type*} {m0 : MeasurableSpace α} {μ : Measure α}
/-- Given a measure `μ : Measure α` and a function `f : α → ℝ≥0∞`, `μ.withDensity f` is the
measure such that for a measurable set `s` we have `μ.withDensity f s = ∫⁻ a in s, f a ∂μ`. -/
noncomputable
def Measure.withDensity {m : MeasurableSpace α} (μ : Measure α) (f : α → ℝ≥0∞) : Measure α :=
Measure.ofMeasurable (fun s _ => ∫⁻ a in s, f a ∂μ) (by simp) fun _ hs hd =>
lintegral_iUnion hs hd _
@[simp]
theorem withDensity_apply (f : α → ℝ≥0∞) {s : Set α} (hs : MeasurableSet s) :
μ.withDensity f s = ∫⁻ a in s, f a ∂μ :=
Measure.ofMeasurable_apply s hs
theorem withDensity_apply_le (f : α → ℝ≥0∞) (s : Set α) :
∫⁻ a in s, f a ∂μ ≤ μ.withDensity f s := by
let t := toMeasurable (μ.withDensity f) s
calc
∫⁻ a in s, f a ∂μ ≤ ∫⁻ a in t, f a ∂μ :=
lintegral_mono_set (subset_toMeasurable (withDensity μ f) s)
_ = μ.withDensity f t :=
(withDensity_apply f (measurableSet_toMeasurable (withDensity μ f) s)).symm
_ = μ.withDensity f s := measure_toMeasurable s
/-! In the next theorem, the s-finiteness assumption is necessary. Here is a counterexample
without this assumption. Let `α` be an uncountable space, let `x₀` be some fixed point, and consider
the σ-algebra made of those sets which are countable and do not contain `x₀`, and of their
complements. This is the σ-algebra generated by the sets `{x}` for `x ≠ x₀`. Define a measure equal
to `+∞` on nonempty sets. Let `s = {x₀}` and `f` the indicator of `sᶜ`. Then
* `∫⁻ a in s, f a ∂μ = 0`. Indeed, consider a simple function `g ≤ f`. It vanishes on `s`. Then
`∫⁻ a in s, g a ∂μ = 0`. Taking the supremum over `g` gives the claim.
* `μ.withDensity f s = +∞`. Indeed, this is the infimum of `μ.withDensity f t` over measurable sets
`t` containing `s`. As `s` is not measurable, such a set `t` contains a point `x ≠ x₀`. Then
`μ.withDensity f t ≥ μ.withDensity f {x} = ∫⁻ a in {x}, f a ∂μ = μ {x} = +∞`.
One checks that `μ.withDensity f = μ`, while `μ.restrict s` gives zero mass to sets not
containing `x₀`, and infinite mass to those that contain it. -/
theorem withDensity_apply' [SFinite μ] (f : α → ℝ≥0∞) (s : Set α) :
μ.withDensity f s = ∫⁻ a in s, f a ∂μ := by
apply le_antisymm ?_ (withDensity_apply_le f s)
let t := toMeasurable μ s
calc
μ.withDensity f s ≤ μ.withDensity f t := measure_mono (subset_toMeasurable μ s)
_ = ∫⁻ a in t, f a ∂μ := withDensity_apply f (measurableSet_toMeasurable μ s)
_ = ∫⁻ a in s, f a ∂μ := by congr 1; exact restrict_toMeasurable_of_sFinite s
@[simp]
lemma withDensity_zero_left (f : α → ℝ≥0∞) : (0 : Measure α).withDensity f = 0 := by
ext s hs
rw [withDensity_apply _ hs]
simp
theorem withDensity_congr_ae {f g : α → ℝ≥0∞} (h : f =ᵐ[μ] g) :
μ.withDensity f = μ.withDensity g := by
refine Measure.ext fun s hs => ?_
rw [withDensity_apply _ hs, withDensity_apply _ hs]
exact lintegral_congr_ae (ae_restrict_of_ae h)
lemma withDensity_mono {f g : α → ℝ≥0∞} (hfg : f ≤ᵐ[μ] g) :
μ.withDensity f ≤ μ.withDensity g := by
refine le_iff.2 fun s hs ↦ ?_
rw [withDensity_apply _ hs, withDensity_apply _ hs]
refine setLIntegral_mono_ae' hs ?_
filter_upwards [hfg] with x h_le using fun _ ↦ h_le
theorem withDensity_add_left {f : α → ℝ≥0∞} (hf : Measurable f) (g : α → ℝ≥0∞) :
μ.withDensity (f + g) = μ.withDensity f + μ.withDensity g := by
refine Measure.ext fun s hs => ?_
rw [withDensity_apply _ hs, Measure.add_apply, withDensity_apply _ hs, withDensity_apply _ hs,
← lintegral_add_left hf]
simp only [Pi.add_apply]
theorem withDensity_add_right (f : α → ℝ≥0∞) {g : α → ℝ≥0∞} (hg : Measurable g) :
μ.withDensity (f + g) = μ.withDensity f + μ.withDensity g := by
simpa only [add_comm] using withDensity_add_left hg f
theorem withDensity_add_measure {m : MeasurableSpace α} (μ ν : Measure α) (f : α → ℝ≥0∞) :
(μ + ν).withDensity f = μ.withDensity f + ν.withDensity f := by
ext1 s hs
simp only [withDensity_apply f hs, restrict_add, lintegral_add_measure, Measure.add_apply]
theorem withDensity_sum {ι : Type*} {m : MeasurableSpace α} (μ : ι → Measure α) (f : α → ℝ≥0∞) :
(sum μ).withDensity f = sum fun n => (μ n).withDensity f := by
ext1 s hs
simp_rw [sum_apply _ hs, withDensity_apply f hs, restrict_sum μ hs, lintegral_sum_measure]
theorem withDensity_smul (r : ℝ≥0∞) {f : α → ℝ≥0∞} (hf : Measurable f) :
μ.withDensity (r • f) = r • μ.withDensity f := by
refine Measure.ext fun s hs => ?_
rw [withDensity_apply _ hs, Measure.coe_smul, Pi.smul_apply, withDensity_apply _ hs,
smul_eq_mul, ← lintegral_const_mul r hf]
simp only [Pi.smul_apply, smul_eq_mul]
theorem withDensity_smul' (r : ℝ≥0∞) (f : α → ℝ≥0∞) (hr : r ≠ ∞) :
μ.withDensity (r • f) = r • μ.withDensity f := by
refine Measure.ext fun s hs => ?_
rw [withDensity_apply _ hs, Measure.coe_smul, Pi.smul_apply, withDensity_apply _ hs,
smul_eq_mul, ← lintegral_const_mul' r f hr]
simp only [Pi.smul_apply, smul_eq_mul]
theorem withDensity_smul_measure (r : ℝ≥0∞) (f : α → ℝ≥0∞) :
(r • μ).withDensity f = r • μ.withDensity f := by
ext s hs
simp [withDensity_apply, hs]
theorem isFiniteMeasure_withDensity {f : α → ℝ≥0∞} (hf : ∫⁻ a, f a ∂μ ≠ ∞) :
IsFiniteMeasure (μ.withDensity f) :=
{ measure_univ_lt_top := by
rwa [withDensity_apply _ MeasurableSet.univ, Measure.restrict_univ, lt_top_iff_ne_top] }
theorem withDensity_absolutelyContinuous {m : MeasurableSpace α} (μ : Measure α) (f : α → ℝ≥0∞) :
μ.withDensity f ≪ μ := by
refine AbsolutelyContinuous.mk fun s hs₁ hs₂ => ?_
rw [withDensity_apply _ hs₁]
exact setLIntegral_measure_zero _ _ hs₂
theorem withDensity_apply₀ (f : α → ℝ≥0∞) {s : Set α} (hs : NullMeasurableSet s μ) :
μ.withDensity f s = ∫⁻ a in s, f a ∂μ := by
let t := toMeasurable μ s
have A : ∫⁻ a in t, f a ∂μ = ∫⁻ a in s, f a ∂μ :=
setLIntegral_congr hs.toMeasurable_ae_eq
have B : μ.withDensity f t = μ.withDensity f s :=
measure_congr (withDensity_absolutelyContinuous μ f hs.toMeasurable_ae_eq)
rw [← A, ← B]
exact withDensity_apply _ (measurableSet_toMeasurable μ s)
instance noAtoms_withDensity [NoAtoms μ] (f : α → ℝ≥0∞) : NoAtoms (μ.withDensity f) where
measure_singleton _ := withDensity_absolutelyContinuous μ f (measure_singleton _)
@[simp]
theorem withDensity_zero : μ.withDensity 0 = 0 := by
ext1 s hs
simp [withDensity_apply _ hs]
@[simp]
theorem withDensity_one : μ.withDensity 1 = μ := by
ext1 s hs
simp [withDensity_apply _ hs]
@[simp]
theorem withDensity_const (c : ℝ≥0∞) : μ.withDensity (fun _ ↦ c) = c • μ := by
ext1 s hs
simp [withDensity_apply _ hs]
theorem withDensity_tsum {ι : Type*} [Countable ι] {f : ι → α → ℝ≥0∞} (h : ∀ i, Measurable (f i)) :
μ.withDensity (∑' n, f n) = sum fun n => μ.withDensity (f n) := by
ext1 s hs
simp_rw [sum_apply _ hs, withDensity_apply _ hs]
change ∫⁻ x in s, (∑' n, f n) x ∂μ = ∑' i, ∫⁻ x, f i x ∂μ.restrict s
rw [← lintegral_tsum fun i => (h i).aemeasurable]
exact lintegral_congr fun x => tsum_apply (Pi.summable.2 fun _ => ENNReal.summable)
theorem withDensity_indicator {s : Set α} (hs : MeasurableSet s) (f : α → ℝ≥0∞) :
μ.withDensity (s.indicator f) = (μ.restrict s).withDensity f := by
ext1 t ht
rw [withDensity_apply _ ht, lintegral_indicator hs, restrict_comm hs, ←
withDensity_apply _ ht]
theorem withDensity_indicator_one {s : Set α} (hs : MeasurableSet s) :
μ.withDensity (s.indicator 1) = μ.restrict s := by
rw [withDensity_indicator hs, withDensity_one]
theorem withDensity_ofReal_mutuallySingular {f : α → ℝ} (hf : Measurable f) :
(μ.withDensity fun x => ENNReal.ofReal <| f x) ⟂ₘ
μ.withDensity fun x => ENNReal.ofReal <| -f x := by
set S : Set α := { x | f x < 0 }
have hS : MeasurableSet S := measurableSet_lt hf measurable_const
refine ⟨S, hS, ?_, ?_⟩
· rw [withDensity_apply _ hS, lintegral_eq_zero_iff hf.ennreal_ofReal, EventuallyEq]
exact (ae_restrict_mem hS).mono fun x hx => ENNReal.ofReal_eq_zero.2 (le_of_lt hx)
· rw [withDensity_apply _ hS.compl, lintegral_eq_zero_iff hf.neg.ennreal_ofReal, EventuallyEq]
exact
(ae_restrict_mem hS.compl).mono fun x hx =>
ENNReal.ofReal_eq_zero.2 (not_lt.1 <| mt neg_pos.1 hx)
theorem restrict_withDensity {s : Set α} (hs : MeasurableSet s) (f : α → ℝ≥0∞) :
(μ.withDensity f).restrict s = (μ.restrict s).withDensity f := by
ext1 t ht
rw [restrict_apply ht, withDensity_apply _ ht, withDensity_apply _ (ht.inter hs),
restrict_restrict ht]
theorem restrict_withDensity' [SFinite μ] (s : Set α) (f : α → ℝ≥0∞) :
(μ.withDensity f).restrict s = (μ.restrict s).withDensity f := by
ext1 t ht
rw [restrict_apply ht, withDensity_apply _ ht, withDensity_apply' _ (t ∩ s),
restrict_restrict ht]
lemma trim_withDensity {m m0 : MeasurableSpace α} {μ : Measure α}
(hm : m ≤ m0) {f : α → ℝ≥0∞} (hf : Measurable[m] f) :
(μ.withDensity f).trim hm = (μ.trim hm).withDensity f := by
refine @Measure.ext _ m _ _ (fun s hs ↦ ?_)
rw [withDensity_apply _ hs, restrict_trim _ _ hs, lintegral_trim _ hf, trim_measurableSet_eq _ hs,
withDensity_apply _ (hm s hs)]
lemma Measure.MutuallySingular.withDensity {ν : Measure α} {f : α → ℝ≥0∞} (h : μ ⟂ₘ ν) :
μ.withDensity f ⟂ₘ ν :=
MutuallySingular.mono_ac h (withDensity_absolutelyContinuous _ _) AbsolutelyContinuous.rfl
@[simp]
theorem withDensity_eq_zero_iff {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
μ.withDensity f = 0 ↔ f =ᵐ[μ] 0 := by
rw [← measure_univ_eq_zero, withDensity_apply _ .univ, restrict_univ, lintegral_eq_zero_iff' hf]
alias ⟨withDensity_eq_zero, _⟩ := withDensity_eq_zero_iff
theorem withDensity_apply_eq_zero' {f : α → ℝ≥0∞} {s : Set α} (hf : AEMeasurable f μ) :
μ.withDensity f s = 0 ↔ μ ({ x | f x ≠ 0 } ∩ s) = 0 := by
constructor
· intro hs
let t := toMeasurable (μ.withDensity f) s
apply measure_mono_null (inter_subset_inter_right _ (subset_toMeasurable (μ.withDensity f) s))
have A : μ.withDensity f t = 0 := by rw [measure_toMeasurable, hs]
rw [withDensity_apply f (measurableSet_toMeasurable _ s),
lintegral_eq_zero_iff' (AEMeasurable.restrict hf),
EventuallyEq, ae_restrict_iff'₀, ae_iff] at A
swap
· simp only [measurableSet_toMeasurable, MeasurableSet.nullMeasurableSet]
simp only [Pi.zero_apply] at A
convert A using 2
ext x
simp only [and_comm, exists_prop, mem_inter_iff, mem_setOf_eq,
not_forall]
· intro hs
let t := toMeasurable μ ({ x | f x ≠ 0 } ∩ s)
have A : s ⊆ t ∪ { x | f x = 0 } := by
intro x hx
rcases eq_or_ne (f x) 0 with (fx | fx)
· simp only [fx, mem_union, mem_setOf_eq, or_true]
· left
apply subset_toMeasurable _ _
exact ⟨fx, hx⟩
apply measure_mono_null A (measure_union_null _ _)
· apply withDensity_absolutelyContinuous
rwa [measure_toMeasurable]
rcases hf with ⟨g, hg, hfg⟩
have t : {x | f x = 0} =ᵐ[μ.withDensity f] {x | g x = 0} := by
apply withDensity_absolutelyContinuous
filter_upwards [hfg] with a ha
rw [eq_iff_iff]
exact ⟨fun h ↦ by rw [h] at ha; exact ha.symm,
fun h ↦ by rw [h] at ha; exact ha⟩
rw [measure_congr t, withDensity_congr_ae hfg]
have M : MeasurableSet { x : α | g x = 0 } := hg (measurableSet_singleton _)
rw [withDensity_apply _ M, lintegral_eq_zero_iff hg]
filter_upwards [ae_restrict_mem M]
simp only [imp_self, Pi.zero_apply, imp_true_iff]
theorem withDensity_apply_eq_zero {f : α → ℝ≥0∞} {s : Set α} (hf : Measurable f) :
μ.withDensity f s = 0 ↔ μ ({ x | f x ≠ 0 } ∩ s) = 0 :=
withDensity_apply_eq_zero' <| hf.aemeasurable
theorem ae_withDensity_iff' {p : α → Prop} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
(∀ᵐ x ∂μ.withDensity f, p x) ↔ ∀ᵐ x ∂μ, f x ≠ 0 → p x := by
rw [ae_iff, ae_iff, withDensity_apply_eq_zero' hf, iff_iff_eq]
congr
ext x
simp only [exists_prop, mem_inter_iff, mem_setOf_eq, not_forall]
theorem ae_withDensity_iff {p : α → Prop} {f : α → ℝ≥0∞} (hf : Measurable f) :
(∀ᵐ x ∂μ.withDensity f, p x) ↔ ∀ᵐ x ∂μ, f x ≠ 0 → p x :=
ae_withDensity_iff' <| hf.aemeasurable
theorem ae_withDensity_iff_ae_restrict' {p : α → Prop} {f : α → ℝ≥0∞}
(hf : AEMeasurable f μ) :
(∀ᵐ x ∂μ.withDensity f, p x) ↔ ∀ᵐ x ∂μ.restrict { x | f x ≠ 0 }, p x := by
rw [ae_withDensity_iff' hf, ae_restrict_iff'₀]
· simp only [mem_setOf]
· rcases hf with ⟨g, hg, hfg⟩
have nonneg_eq_ae : {x | g x ≠ 0} =ᵐ[μ] {x | f x ≠ 0} := by
filter_upwards [hfg] with a ha
simp only [eq_iff_iff]
exact ⟨fun (h : g a ≠ 0) ↦ by rwa [← ha] at h,
fun (h : f a ≠ 0) ↦ by rwa [ha] at h⟩
exact NullMeasurableSet.congr
(MeasurableSet.nullMeasurableSet
<| hg (measurableSet_singleton _)).compl
nonneg_eq_ae
theorem ae_withDensity_iff_ae_restrict {p : α → Prop} {f : α → ℝ≥0∞} (hf : Measurable f) :
(∀ᵐ x ∂μ.withDensity f, p x) ↔ ∀ᵐ x ∂μ.restrict { x | f x ≠ 0 }, p x :=
ae_withDensity_iff_ae_restrict' <| hf.aemeasurable
theorem aemeasurable_withDensity_ennreal_iff' {f : α → ℝ≥0}
(hf : AEMeasurable f μ) {g : α → ℝ≥0∞} :
AEMeasurable g (μ.withDensity fun x => (f x : ℝ≥0∞)) ↔
AEMeasurable (fun x => (f x : ℝ≥0∞) * g x) μ := by
have t : ∃ f', Measurable f' ∧ f =ᵐ[μ] f' := hf
rcases t with ⟨f', hf'_m, hf'_ae⟩
constructor
· rintro ⟨g', g'meas, hg'⟩
have A : MeasurableSet {x | f' x ≠ 0} := hf'_m (measurableSet_singleton _).compl
refine ⟨fun x => f' x * g' x, hf'_m.coe_nnreal_ennreal.smul g'meas, ?_⟩
apply ae_of_ae_restrict_of_ae_restrict_compl { x | f' x ≠ 0 }
· rw [EventuallyEq, ae_withDensity_iff' hf.coe_nnreal_ennreal] at hg'
rw [ae_restrict_iff' A]
filter_upwards [hg', hf'_ae] with a ha h'a h_a_nonneg
have : (f' a : ℝ≥0∞) ≠ 0 := by simpa only [Ne, ENNReal.coe_eq_zero] using h_a_nonneg
rw [← h'a] at this ⊢
rw [ha this]
· rw [ae_restrict_iff' A.compl]
filter_upwards [hf'_ae] with a ha ha_null
have ha_null : f' a = 0 := Function.notMem_support.mp ha_null
rw [ha_null] at ha ⊢
rw [ha]
simp only [ENNReal.coe_zero, zero_mul]
· rintro ⟨g', g'meas, hg'⟩
refine ⟨fun x => ((f' x)⁻¹ : ℝ≥0∞) * g' x, hf'_m.coe_nnreal_ennreal.inv.smul g'meas, ?_⟩
rw [EventuallyEq, ae_withDensity_iff' hf.coe_nnreal_ennreal]
filter_upwards [hg', hf'_ae] with a hfga hff'a h'a
rw [hff'a] at hfga h'a
rw [← hfga, ← mul_assoc, ENNReal.inv_mul_cancel h'a ENNReal.coe_ne_top, one_mul]
theorem aemeasurable_withDensity_ennreal_iff {f : α → ℝ≥0} (hf : Measurable f) {g : α → ℝ≥0∞} :
AEMeasurable g (μ.withDensity fun x => (f x : ℝ≥0∞)) ↔
AEMeasurable (fun x => (f x : ℝ≥0∞) * g x) μ :=
aemeasurable_withDensity_ennreal_iff' <| hf.aemeasurable
open MeasureTheory.SimpleFunc
/-- This is Exercise 1.2.1 from [tao2010]. It allows you to express integration of a measurable
function with respect to `(μ.withDensity f)` as an integral with respect to `μ`, called the base
measure. `μ` is often the Lebesgue measure, and in this circumstance `f` is the probability density
function, and `(μ.withDensity f)` represents any continuous random variable as a
probability measure, such as the uniform distribution between 0 and 1, the Gaussian distribution,
the exponential distribution, the Beta distribution, or the Cauchy distribution (see Section 2.4
of [wasserman2004]). Thus, this method shows how to one can calculate expectations, variances,
and other moments as a function of the probability density function.
-/
theorem lintegral_withDensity_eq_lintegral_mul (μ : Measure α) {f : α → ℝ≥0∞}
(h_mf : Measurable f) :
∀ {g : α → ℝ≥0∞}, Measurable g → ∫⁻ a, g a ∂μ.withDensity f = ∫⁻ a, (f * g) a ∂μ := by
apply Measurable.ennreal_induction
· intro c s h_ms
simp [*, mul_comm _ c, ← indicator_mul_right]
· intro g h _ h_mea_g _ h_ind_g h_ind_h
simp [mul_add, *, Measurable.mul]
· intro g h_mea_g h_mono_g h_ind
have : Monotone fun n a => f a * g n a := fun m n hmn x => by dsimp; grw [h_mono_g hmn x]
simp [lintegral_iSup, ENNReal.mul_iSup, h_mf.mul (h_mea_g _), *]
theorem setLIntegral_withDensity_eq_setLIntegral_mul (μ : Measure α) {f g : α → ℝ≥0∞}
(hf : Measurable f) (hg : Measurable g) {s : Set α} (hs : MeasurableSet s) :
∫⁻ x in s, g x ∂μ.withDensity f = ∫⁻ x in s, (f * g) x ∂μ := by
rw [restrict_withDensity hs, lintegral_withDensity_eq_lintegral_mul _ hf hg]
/-- The Lebesgue integral of `g` with respect to the measure `μ.withDensity f` coincides with
the integral of `f * g`. This version assumes that `g` is almost everywhere measurable. For a
version without conditions on `g` but requiring that `f` is almost everywhere finite, see
`lintegral_withDensity_eq_lintegral_mul_non_measurable` -/
theorem lintegral_withDensity_eq_lintegral_mul₀' {μ : Measure α} {f : α → ℝ≥0∞}
(hf : AEMeasurable f μ) {g : α → ℝ≥0∞} (hg : AEMeasurable g (μ.withDensity f)) :
∫⁻ a, g a ∂μ.withDensity f = ∫⁻ a, (f * g) a ∂μ := by
let f' := hf.mk f
have : μ.withDensity f = μ.withDensity f' := withDensity_congr_ae hf.ae_eq_mk
rw [this] at hg ⊢
let g' := hg.mk g
calc
∫⁻ a, g a ∂μ.withDensity f' = ∫⁻ a, g' a ∂μ.withDensity f' := lintegral_congr_ae hg.ae_eq_mk
_ = ∫⁻ a, (f' * g') a ∂μ :=
(lintegral_withDensity_eq_lintegral_mul _ hf.measurable_mk hg.measurable_mk)
_ = ∫⁻ a, (f' * g) a ∂μ := by
apply lintegral_congr_ae
apply ae_of_ae_restrict_of_ae_restrict_compl { x | f' x ≠ 0 }
· have Z := hg.ae_eq_mk
rw [EventuallyEq, ae_withDensity_iff_ae_restrict hf.measurable_mk] at Z
filter_upwards [Z]
intro x hx
simp only [g', hx, Pi.mul_apply]
· have M : MeasurableSet { x : α | f' x ≠ 0 }ᶜ :=
(hf.measurable_mk (measurableSet_singleton 0).compl).compl
filter_upwards [ae_restrict_mem M]
intro x hx
simp only [Classical.not_not, mem_setOf_eq, mem_compl_iff] at hx
simp only [hx, zero_mul, Pi.mul_apply]
_ = ∫⁻ a : α, (f * g) a ∂μ := by
apply lintegral_congr_ae
filter_upwards [hf.ae_eq_mk]
intro x hx
simp only [f', hx, Pi.mul_apply]
lemma setLIntegral_withDensity_eq_lintegral_mul₀' {μ : Measure α} {f : α → ℝ≥0∞}
(hf : AEMeasurable f μ) {g : α → ℝ≥0∞} (hg : AEMeasurable g (μ.withDensity f))
{s : Set α} (hs : MeasurableSet s) :
∫⁻ a in s, g a ∂μ.withDensity f = ∫⁻ a in s, (f * g) a ∂μ := by
rw [restrict_withDensity hs, lintegral_withDensity_eq_lintegral_mul₀' hf.restrict]
rw [← restrict_withDensity hs]
exact hg.restrict
theorem lintegral_withDensity_eq_lintegral_mul₀ {μ : Measure α} {f : α → ℝ≥0∞}
(hf : AEMeasurable f μ) {g : α → ℝ≥0∞} (hg : AEMeasurable g μ) :
∫⁻ a, g a ∂μ.withDensity f = ∫⁻ a, (f * g) a ∂μ :=
lintegral_withDensity_eq_lintegral_mul₀' hf (hg.mono' (withDensity_absolutelyContinuous μ f))
lemma setLIntegral_withDensity_eq_lintegral_mul₀ {μ : Measure α} {f : α → ℝ≥0∞}
(hf : AEMeasurable f μ) {g : α → ℝ≥0∞} (hg : AEMeasurable g μ)
{s : Set α} (hs : MeasurableSet s) :
∫⁻ a in s, g a ∂μ.withDensity f = ∫⁻ a in s, (f * g) a ∂μ :=
setLIntegral_withDensity_eq_lintegral_mul₀' hf
(hg.mono' (MeasureTheory.withDensity_absolutelyContinuous μ f)) hs
theorem lintegral_withDensity_le_lintegral_mul (μ : Measure α) {f : α → ℝ≥0∞}
(f_meas : Measurable f) (g : α → ℝ≥0∞) : (∫⁻ a, g a ∂μ.withDensity f) ≤ ∫⁻ a, (f * g) a ∂μ := by
rw [← iSup_lintegral_measurable_le_eq_lintegral, ← iSup_lintegral_measurable_le_eq_lintegral]
refine iSup₂_le fun i i_meas => iSup_le fun hi => ?_
rw [lintegral_withDensity_eq_lintegral_mul _ f_meas i_meas]
exact le_iSup₂_of_le (f * i) (f_meas.mul i_meas) <| le_iSup_of_le (by grw [hi]) le_rfl
theorem lintegral_withDensity_eq_lintegral_mul_non_measurable (μ : Measure α) {f : α → ℝ≥0∞}
(f_meas : Measurable f) (hf : ∀ᵐ x ∂μ, f x < ∞) (g : α → ℝ≥0∞) :
∫⁻ a, g a ∂μ.withDensity f = ∫⁻ a, (f * g) a ∂μ := by
refine le_antisymm (lintegral_withDensity_le_lintegral_mul μ f_meas g) ?_
rw [← iSup_lintegral_measurable_le_eq_lintegral, ← iSup_lintegral_measurable_le_eq_lintegral]
refine iSup₂_le fun i i_meas => iSup_le fun hi => ?_
have A : (fun x => (f x)⁻¹ * i x) ≤ g := by
intro x
dsimp
rw [mul_comm, ← div_eq_mul_inv]
exact div_le_of_le_mul' (hi x)
refine le_iSup_of_le (fun x => (f x)⁻¹ * i x) (le_iSup_of_le (f_meas.inv.mul i_meas) ?_)
refine le_iSup_of_le A ?_
rw [lintegral_withDensity_eq_lintegral_mul _ f_meas (f_meas.inv.mul i_meas)]
apply lintegral_mono_ae
filter_upwards [hf]
intro x h'x
rcases eq_or_ne (f x) 0 with (hx | hx)
· have := hi x
simp only [hx, zero_mul, Pi.mul_apply, nonpos_iff_eq_zero] at this
simp [this]
· apply le_of_eq _
dsimp
rw [← mul_assoc, ENNReal.mul_inv_cancel hx h'x.ne, one_mul]
theorem setLIntegral_withDensity_eq_setLIntegral_mul_non_measurable (μ : Measure α) {f : α → ℝ≥0∞}
(f_meas : Measurable f) (g : α → ℝ≥0∞) {s : Set α} (hs : MeasurableSet s)
(hf : ∀ᵐ x ∂μ.restrict s, f x < ∞) :
∫⁻ a in s, g a ∂μ.withDensity f = ∫⁻ a in s, (f * g) a ∂μ := by
rw [restrict_withDensity hs, lintegral_withDensity_eq_lintegral_mul_non_measurable _ f_meas hf]
theorem lintegral_withDensity_eq_lintegral_mul_non_measurable₀ (μ : Measure α) {f : α → ℝ≥0∞}
(hf : AEMeasurable f μ) (h'f : ∀ᵐ x ∂μ, f x < ∞) (g : α → ℝ≥0∞) :
∫⁻ a, g a ∂μ.withDensity f = ∫⁻ a, (f * g) a ∂μ := by
let f' := hf.mk f
calc
∫⁻ a, g a ∂μ.withDensity f = ∫⁻ a, g a ∂μ.withDensity f' := by
rw [withDensity_congr_ae hf.ae_eq_mk]
_ = ∫⁻ a, (f' * g) a ∂μ := by
apply lintegral_withDensity_eq_lintegral_mul_non_measurable _ hf.measurable_mk
filter_upwards [h'f, hf.ae_eq_mk]
intro x hx h'x
rwa [← h'x]
_ = ∫⁻ a, (f * g) a ∂μ := by
apply lintegral_congr_ae
filter_upwards [hf.ae_eq_mk]
intro x hx
simp only [f', hx, Pi.mul_apply]
theorem setLIntegral_withDensity_eq_setLIntegral_mul_non_measurable₀ (μ : Measure α)
{f : α → ℝ≥0∞} {s : Set α} (hf : AEMeasurable f (μ.restrict s)) (g : α → ℝ≥0∞)
(hs : MeasurableSet s) (h'f : ∀ᵐ x ∂μ.restrict s, f x < ∞) :
∫⁻ a in s, g a ∂μ.withDensity f = ∫⁻ a in s, (f * g) a ∂μ := by
rw [restrict_withDensity hs, lintegral_withDensity_eq_lintegral_mul_non_measurable₀ _ hf h'f]
theorem setLIntegral_withDensity_eq_setLIntegral_mul_non_measurable₀' (μ : Measure α) [SFinite μ]
{f : α → ℝ≥0∞} (s : Set α) (hf : AEMeasurable f (μ.restrict s)) (g : α → ℝ≥0∞)
(h'f : ∀ᵐ x ∂μ.restrict s, f x < ∞) :
∫⁻ a in s, g a ∂μ.withDensity f = ∫⁻ a in s, (f * g) a ∂μ := by
rw [restrict_withDensity' s, lintegral_withDensity_eq_lintegral_mul_non_measurable₀ _ hf h'f]
theorem withDensity_mul₀ {μ : Measure α} {f g : α → ℝ≥0∞}
(hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
μ.withDensity (f * g) = (μ.withDensity f).withDensity g := by
ext1 s hs
rw [withDensity_apply _ hs, withDensity_apply _ hs, restrict_withDensity hs,
lintegral_withDensity_eq_lintegral_mul₀ hf.restrict hg.restrict]
theorem withDensity_mul (μ : Measure α) {f g : α → ℝ≥0∞} (hf : Measurable f) (hg : Measurable g) :
μ.withDensity (f * g) = (μ.withDensity f).withDensity g :=
withDensity_mul₀ hf.aemeasurable hg.aemeasurable
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
(μ.withDensity f).withDensity f⁻¹ ≤ μ := by
change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
rw [← withDensity_mul₀ hf hf.inv]
suffices (f * fun x ↦ (f x)⁻¹) ≤ᵐ[μ] 1 by
refine (withDensity_mono this).trans ?_
rw [withDensity_one]
filter_upwards with x
simp
lemma withDensity_inv_same₀ {μ : Measure α} {f : α → ℝ≥0∞}
(hf : AEMeasurable f μ) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
(μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) = μ := by
rw [← withDensity_mul₀ hf hf.inv]
suffices (f * fun x ↦ (f x)⁻¹) =ᵐ[μ] 1 by
rw [withDensity_congr_ae this, withDensity_one]
filter_upwards [hf_ne_zero, hf_ne_top] with x hf_ne_zero hf_ne_top
simp only [Pi.mul_apply]
rw [ENNReal.mul_inv_cancel hf_ne_zero hf_ne_top, Pi.one_apply]
lemma withDensity_inv_same {μ : Measure α} {f : α → ℝ≥0∞}
(hf : Measurable f) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
(μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) = μ :=
withDensity_inv_same₀ hf.aemeasurable hf_ne_zero hf_ne_top
/-- If `f` is almost everywhere positive, then `μ ≪ μ.withDensity f`. See also
`withDensity_absolutelyContinuous` for the reverse direction, which always holds. -/
lemma withDensity_absolutelyContinuous' {μ : Measure α} {f : α → ℝ≥0∞}
(hf : AEMeasurable f μ) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) :
μ ≪ μ.withDensity f := by
refine Measure.AbsolutelyContinuous.mk (fun s hs hμs ↦ ?_)
rw [withDensity_apply _ hs, lintegral_eq_zero_iff' hf.restrict,
ae_eq_restrict_iff_indicator_ae_eq hs, Set.indicator_zero', Filter.EventuallyEq, ae_iff] at hμs
simp only [ae_iff, ne_eq, not_not] at hf_ne_zero
simp only [Pi.zero_apply, Set.indicator_apply_eq_zero, not_forall, exists_prop] at hμs
have hle : s ⊆ {a | a ∈ s ∧ ¬f a = 0} ∪ {a | f a = 0} :=
fun x hx ↦ or_iff_not_imp_right.mpr <| fun hnx ↦ ⟨hx, hnx⟩
exact measure_mono_null hle <| nonpos_iff_eq_zero.1 <| le_trans (measure_union_le _ _)
<| hμs.symm ▸ zero_add _ |>.symm ▸ hf_ne_zero.le
theorem withDensity_ae_eq {β : Type} {f g : α → β} {d : α → ℝ≥0∞}
(hd : AEMeasurable d μ) (h_ae_nonneg : ∀ᵐ x ∂μ, d x ≠ 0) :
f =ᵐ[μ.withDensity d] g ↔ f =ᵐ[μ] g :=
Iff.intro
(fun h ↦ Measure.AbsolutelyContinuous.ae_eq
(withDensity_absolutelyContinuous' hd h_ae_nonneg) h)
(fun h ↦ Measure.AbsolutelyContinuous.ae_eq
(withDensity_absolutelyContinuous μ d) h)
/-- If `μ` is a σ-finite measure, then so is `μ.withDensity fun x ↦ f x`
for any `ℝ≥0`-valued function `f`. -/
protected instance SigmaFinite.withDensity [SigmaFinite μ] (f : α → ℝ≥0) :
SigmaFinite (μ.withDensity (fun x ↦ f x)) := by
refine ⟨⟨⟨fun n ↦ spanningSets μ n ∩ f ⁻¹' (Iic n), fun _ ↦ trivial, fun n ↦ ?_, ?_⟩⟩⟩
· rw [withDensity_apply']
apply setLIntegral_lt_top_of_bddAbove
· exact ((measure_mono inter_subset_left).trans_lt (measure_spanningSets_lt_top μ n)).ne
· exact ⟨n, forall_mem_image.2 fun x hx ↦ hx.2⟩
· rw [iUnion_eq_univ_iff]
refine fun x ↦ ⟨max (spanningSetsIndex μ x) ⌈f x⌉₊, ?_, ?_⟩
· exact mem_spanningSets_of_index_le _ _ (le_max_left ..)
· simp [Nat.le_ceil]
lemma SigmaFinite.withDensity_of_ne_top [SigmaFinite μ] {f : α → ℝ≥0∞}
(hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) : SigmaFinite (μ.withDensity f) := by
have : f =ᵐ[μ] fun x ↦ (f x).toNNReal := hf_ne_top.mono fun x hx ↦ (ENNReal.coe_toNNReal hx).symm
rw [withDensity_congr_ae this]
infer_instance
lemma SigmaFinite.withDensity_of_ne_top' [SigmaFinite μ] {f : α → ℝ≥0∞} (hf_ne_top : ∀ x, f x ≠ ∞) :
SigmaFinite (μ.withDensity f) :=
SigmaFinite.withDensity_of_ne_top <| ae_of_all _ hf_ne_top
instance SigmaFinite.withDensity_ofReal [SigmaFinite μ] (f : α → ℝ) :
SigmaFinite (μ.withDensity (fun x ↦ ENNReal.ofReal (f x))) :=
.withDensity _
section SFinite
variable (μ) in
theorem exists_measurable_le_withDensity_eq [SFinite μ] (f : α → ℝ≥0∞) :
∃ g, Measurable g ∧ g ≤ f ∧ μ.withDensity g = μ.withDensity f := by
obtain ⟨g, hgm, hgf, hint⟩ := exists_measurable_le_forall_setLIntegral_eq μ f
use g, hgm, hgf
ext s hs
simp only [hint, withDensity_apply _ hs]
/-- If `μ` is an `s`-finite measure, then so is `μ.withDensity f`. -/
instance Measure.withDensity.instSFinite [SFinite μ] {f : α → ℝ≥0∞} :
SFinite (μ.withDensity f) := by
wlog hfm : Measurable f generalizing f
· rcases exists_measurable_le_withDensity_eq μ f with ⟨g, hgm, -, h⟩
exact h ▸ this hgm
wlog hμ : IsFiniteMeasure μ generalizing μ
· rw [← sum_sfiniteSeq μ, withDensity_sum]
have (n : ℕ) : SFinite ((sfiniteSeq μ n).withDensity f) := this inferInstance
infer_instance
set s := {x | f x = ∞}
have hs : MeasurableSet s := hfm (measurableSet_singleton _)
have key := calc
μ.withDensity f = μ.withDensity (sᶜ.indicator f) + μ.withDensity (s.indicator f) := by
simp (disch := measurability) [withDensity_indicator, ← restrict_withDensity]
_ = μ.withDensity (sᶜ.indicator f) + .sum fun _ : ℕ ↦ μ.withDensity (s.indicator 1) := by
rw [← withDensity_tsum (by measurability)]
congr 2 with x
rw [ENNReal.tsum_apply]
if hx : x ∈ s then simpa [hx, ENNReal.tsum_const_eq_top_of_ne_zero]
else simp [hx]
have : SigmaFinite (μ.withDensity (sᶜ.indicator f)) := by
refine SigmaFinite.withDensity_of_ne_top <| ae_of_all _ fun x hx ↦ ?_
simp [indicator_apply, ite_eq_iff, s] at hx
have : SigmaFinite (μ.withDensity (s.indicator 1)) := by
rw [withDensity_indicator hs]
exact SigmaFinite.withDensity 1
rw [key]
infer_instance
instance [SFinite μ] (c : ℝ≥0∞) : SFinite (c • μ) := by
rw [← withDensity_const]
infer_instance
/-- If `μ ≪ ν` and `ν` is s-finite, then `μ` is s-finite. -/
theorem sFinite_of_absolutelyContinuous {ν : Measure α} [SFinite ν] (hμν : μ ≪ ν) :
SFinite μ := by
rw [← Measure.restrict_add_restrict_compl (μ := μ) measurableSet_sigmaFiniteSetWRT,
restrict_compl_sigmaFiniteSetWRT hμν]
infer_instance
/-- In a countable space, every measure is s-finite. -/
instance [Countable α] : SFinite μ := by
obtain ⟨s, h⟩ := exists_sum_smul_dirac μ
rw [h]
infer_instance
end SFinite
section Prod
variable {β : Type*} {mβ : MeasurableSpace β} {ν : Measure β} [SFinite ν]
theorem prod_withDensity_left₀ {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
(μ.withDensity f).prod ν = (μ.prod ν).withDensity (fun z ↦ f z.1) := by
refine ext_of_lintegral _ fun φ hφ ↦ ?_
rw [lintegral_prod _ hφ.aemeasurable, lintegral_withDensity_eq_lintegral_mul₀ hf,
lintegral_withDensity_eq_lintegral_mul₀ _ hφ.aemeasurable, lintegral_prod]
· refine lintegral_congr (fun x ↦ ?_)
rw [Pi.mul_apply, ← lintegral_const_mul'' _ (by fun_prop)]
simp
all_goals fun_prop (disch := intro _ hs; simp [hs])
theorem prod_withDensity_left {f : α → ℝ≥0∞} (hf : Measurable f) :
(μ.withDensity f).prod ν = (μ.prod ν).withDensity (fun z ↦ f z.1) :=
prod_withDensity_left₀ hf.aemeasurable
theorem prod_withDensity_right₀ {g : β → ℝ≥0∞} (hg : AEMeasurable g ν) :
μ.prod (ν.withDensity g) = (μ.prod ν).withDensity (fun z ↦ g z.2) := by
refine ext_of_lintegral _ fun φ hφ ↦ ?_
rw [lintegral_prod _ hφ.aemeasurable, lintegral_withDensity_eq_lintegral_mul₀ _ hφ.aemeasurable,
lintegral_prod]
· refine lintegral_congr (fun x ↦ ?_)
rw [lintegral_withDensity_eq_lintegral_mul₀ hg (by fun_prop)]
simp
all_goals fun_prop (disch := intro _ hs; simp [hs])
theorem prod_withDensity_right {g : β → ℝ≥0∞} (hg : Measurable g) :
μ.prod (ν.withDensity g) = (μ.prod ν).withDensity (fun z ↦ g z.2) :=
prod_withDensity_right₀ hg.aemeasurable
theorem prod_withDensity₀ {f : α → ℝ≥0∞} {g : β → ℝ≥0∞}
(hf : AEMeasurable f μ) (hg : AEMeasurable g ν) :
(μ.withDensity f).prod (ν.withDensity g) = (μ.prod ν).withDensity (fun z ↦ f z.1 * g z.2) := by
rw [prod_withDensity_left₀ hf, prod_withDensity_right₀ hg, ← withDensity_mul₀, mul_comm]
· rfl
all_goals fun_prop (disch := intro _ hs; simp [hs])
theorem prod_withDensity {f : α → ℝ≥0∞} {g : β → ℝ≥0∞} (hf : Measurable f) (hg : Measurable g) :
(μ.withDensity f).prod (ν.withDensity g) = (μ.prod ν).withDensity (fun z ↦ f z.1 * g z.2) :=
prod_withDensity₀ hf.aemeasurable hg.aemeasurable
-- `prod_smul_left` is in the `Prod` file. This lemma is here because this is the file in which
-- we prove the instance that gives `SFinite (c • ν)`.
lemma Measure.prod_smul_right (c : ℝ≥0∞) : μ.prod (c • ν) = c • (μ.prod ν) := by
ext s hs
simp_rw [Measure.prod_apply hs, Measure.smul_apply, Measure.prod_apply hs, smul_eq_mul]
rw [lintegral_const_mul]
exact measurable_measure_prodMk_left hs
end Prod
variable [TopologicalSpace α] [OpensMeasurableSpace α] [IsLocallyFiniteMeasure μ]
lemma IsLocallyFiniteMeasure.withDensity_coe {f : α → ℝ≥0} (hf : Continuous f) :
IsLocallyFiniteMeasure (μ.withDensity fun x ↦ f x) := by
refine ⟨fun x ↦ ?_⟩
rcases (μ.finiteAt_nhds x).exists_mem_basis ((nhds_basis_opens' x).restrict_subset
((hf.tendsto x).eventually_le_const (lt_add_one _))) with ⟨U, ⟨⟨hUx, hUo⟩, hUf⟩, hμU⟩
refine ⟨U, hUx, ?_⟩
rw [withDensity_apply _ hUo.measurableSet]
exact setLIntegral_lt_top_of_bddAbove hμU.ne ⟨f x + 1, forall_mem_image.2 hUf⟩
lemma IsLocallyFiniteMeasure.withDensity_ofReal {f : α → ℝ} (hf : Continuous f) :
IsLocallyFiniteMeasure (μ.withDensity fun x ↦ .ofReal (f x)) :=
.withDensity_coe <| continuous_real_toNNReal.comp hf
section Conv
variable {M : Type*} [Monoid M] [MeasurableSpace M]
-- `mconv_smul_left` is in the `Convolution` file. This lemma is here because this is the file in
-- which we prove the instance that gives `SFinite (c • ν)`.
@[to_additive conv_smul_right]
theorem Measure.mconv_smul_right (μ : Measure M) (ν : Measure M) [SFinite ν] (s : ℝ≥0∞) :
μ ∗ₘ (s • ν) = s • (μ ∗ₘ ν) := by
unfold mconv
rw [Measure.prod_smul_right, Measure.map_smul]
variable {G : Type*} [Group G] {mG : MeasurableSpace G} [MeasurableMul₂ G] [MeasurableInv G]
{μ : Measure G} [SFinite μ] [IsMulLeftInvariant μ]
@[to_additive]
theorem mconv_withDensity_eq_mlconvolution₀ {f g : G → ℝ≥0∞}
(hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
μ.withDensity f ∗ₘ μ.withDensity g = μ.withDensity (f ⋆ₘₗ[μ] g) := by
refine ext_of_lintegral _ fun φ hφ ↦ ?_
rw [lintegral_mconv_eq_lintegral_prod hφ, prod_withDensity₀ hf hg,
lintegral_withDensity_eq_lintegral_mul₀,
lintegral_withDensity_eq_lintegral_mul₀, lintegral_prod,
lintegral_congr (fun x ↦ by apply (lintegral_mul_left_eq_self _ x⁻¹).symm),
lintegral_lintegral_swap]
· simp only [Pi.mul_apply, mul_inv_cancel_left, mlconvolution_def]
conv in (∫⁻ _ , _ ∂μ) * φ _ => rw [(lintegral_mul_const'' _ (by fun_prop)).symm]
all_goals first | fun_prop | dsimp; fun_prop
@[to_additive]
theorem mconv_withDensity_eq_mlconvolution {f g : G → ℝ≥0∞}
(hf : Measurable f) (hg : Measurable g) :
μ.withDensity f ∗ₘ μ.withDensity g = μ.withDensity (f ⋆ₘₗ[μ] g) :=
mconv_withDensity_eq_mlconvolution₀ hf.aemeasurable hg.aemeasurable
end Conv
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/MeasureSpaceDef.lean | import Mathlib.MeasureTheory.OuterMeasure.Induced
import Mathlib.MeasureTheory.OuterMeasure.AE
import Mathlib.Order.Filter.CountableInter
/-!
# Measure spaces
This file defines measure spaces, the almost-everywhere filter and ae_measurable functions.
See `MeasureTheory.MeasureSpace` for their properties and for extended documentation.
Given a measurable space `α`, a measure on `α` is a function that sends measurable sets to the
extended nonnegative reals that satisfies the following conditions:
1. `μ ∅ = 0`;
2. `μ` is countably additive. This means that the measure of a countable union of pairwise disjoint
sets is equal to the sum of the measures of the individual sets.
Every measure can be canonically extended to an outer measure, so that it assigns values to
all subsets, not just the measurable subsets. On the other hand, an outer measure that is countably
additive on measurable sets can be restricted to measurable sets to obtain a measure.
In this file a measure is defined to be an outer measure that is countably additive on
measurable sets, with the additional assumption that the outer measure is the canonical
extension of the restricted measure.
Measures on `α` form a complete lattice, and are closed under scalar multiplication with `ℝ≥0∞`.
## Implementation notes
Given `μ : Measure α`, `μ s` is the value of the *outer measure* applied to `s`.
This conveniently allows us to apply the measure to sets without proving that they are measurable.
We get countable subadditivity for all sets, but only countable additivity for measurable sets.
See the documentation of `MeasureTheory.MeasureSpace` for ways to construct measures and proving
that two measure are equal.
A `MeasureSpace` is a class that is a measurable space with a canonical measure.
The measure is denoted `volume`.
This file does not import `MeasureTheory.MeasurableSpace.Basic`, but only `MeasurableSpace.Defs`.
## References
* <https://en.wikipedia.org/wiki/Measure_(mathematics)>
* <https://en.wikipedia.org/wiki/Almost_everywhere>
## Tags
measure, almost everywhere, measure space
-/
assert_not_exists Module.Basis
noncomputable section
open Set Function MeasurableSpace Topology Filter ENNReal NNReal
open Filter hiding map
variable {α β γ δ : Type*} {ι : Sort*}
namespace MeasureTheory
/-- A measure is defined to be an outer measure that is countably additive on
measurable sets, with the additional assumption that the outer measure is the canonical
extension of the restricted measure.
The measure of a set `s`, denoted `μ s`, is an extended nonnegative real. The real-valued version
is written `μ.real s`.
-/
structure Measure (α : Type*) [MeasurableSpace α] extends OuterMeasure α where
m_iUnion ⦃f : ℕ → Set α⦄ : (∀ i, MeasurableSet (f i)) → Pairwise (Disjoint on f) →
toOuterMeasure (⋃ i, f i) = ∑' i, toOuterMeasure (f i)
trim_le : toOuterMeasure.trim ≤ toOuterMeasure
/-- Notation for `Measure` with respect to a non-standard σ-algebra in the domain. -/
scoped notation "Measure[" mα "] " α:arg => @Measure α mα
theorem Measure.toOuterMeasure_injective [MeasurableSpace α] :
Injective (toOuterMeasure : Measure α → OuterMeasure α)
| ⟨_, _, _⟩, ⟨_, _, _⟩, rfl => rfl
instance Measure.instFunLike [MeasurableSpace α] : FunLike (Measure α) (Set α) ℝ≥0∞ where
coe μ := μ.toOuterMeasure
coe_injective' | ⟨_, _, _⟩, ⟨_, _, _⟩, h => toOuterMeasure_injective <| DFunLike.coe_injective h
instance Measure.instOuterMeasureClass [MeasurableSpace α] : OuterMeasureClass (Measure α) α where
measure_empty m := measure_empty (μ := m.toOuterMeasure)
measure_iUnion_nat_le m := m.iUnion_nat
measure_mono m := m.mono
/-- The real-valued version of a measure. Maps infinite measure sets to zero. Use as `μ.real s`.
The API is developed in `Mathlib/MeasureTheory/Measure/Real.lean`. -/
protected def Measure.real {α : Type*} {m : MeasurableSpace α} (μ : Measure α) (s : Set α) : ℝ :=
(μ s).toReal
theorem measureReal_def {α : Type*} {m : MeasurableSpace α} (μ : Measure α) (s : Set α) :
μ.real s = (μ s).toReal := rfl
alias Measure.real_def := measureReal_def
section
variable [MeasurableSpace α] {μ μ₁ μ₂ : Measure α} {s s₁ s₂ t : Set α}
namespace Measure
theorem trimmed (μ : Measure α) : μ.toOuterMeasure.trim = μ.toOuterMeasure :=
le_antisymm μ.trim_le μ.1.le_trim
/-! ### General facts about measures -/
/-- Obtain a measure by giving a countably additive function that sends `∅` to `0`. -/
def ofMeasurable (m : ∀ s : Set α, MeasurableSet s → ℝ≥0∞) (m0 : m ∅ MeasurableSet.empty = 0)
(mU :
∀ ⦃f : ℕ → Set α⦄ (h : ∀ i, MeasurableSet (f i)),
Pairwise (Disjoint on f) → m (⋃ i, f i) (MeasurableSet.iUnion h) = ∑' i, m (f i) (h i)) :
Measure α :=
{ toOuterMeasure := inducedOuterMeasure m _ m0
m_iUnion := fun f hf hd =>
show inducedOuterMeasure m _ m0 (iUnion f) = ∑' i, inducedOuterMeasure m _ m0 (f i) by
rw [inducedOuterMeasure_eq m0 mU (MeasurableSet.iUnion hf), mU hf hd]
congr; funext n; rw [inducedOuterMeasure_eq m0 mU]
trim_le := le_inducedOuterMeasure.2 fun s hs ↦ by
rw [OuterMeasure.trim_eq _ hs, inducedOuterMeasure_eq m0 mU hs] }
theorem ofMeasurable_apply {m : ∀ s : Set α, MeasurableSet s → ℝ≥0∞}
{m0 : m ∅ MeasurableSet.empty = 0}
{mU :
∀ ⦃f : ℕ → Set α⦄ (h : ∀ i, MeasurableSet (f i)),
Pairwise (Disjoint on f) → m (⋃ i, f i) (MeasurableSet.iUnion h) = ∑' i, m (f i) (h i)}
(s : Set α) (hs : MeasurableSet s) : ofMeasurable m m0 mU s = m s hs :=
inducedOuterMeasure_eq m0 mU hs
@[ext]
theorem ext (h : ∀ s, MeasurableSet s → μ₁ s = μ₂ s) : μ₁ = μ₂ :=
toOuterMeasure_injective <| by
rw [← trimmed, OuterMeasure.trim_congr (h _), trimmed]
theorem ext_iff' : μ₁ = μ₂ ↔ ∀ s, μ₁ s = μ₂ s :=
⟨by rintro rfl s; rfl, fun h ↦ Measure.ext (fun s _ ↦ h s)⟩
theorem outerMeasure_le_iff {m : OuterMeasure α} : m ≤ μ.1 ↔ ∀ s, MeasurableSet s → m s ≤ μ s := by
simpa only [μ.trimmed] using OuterMeasure.le_trim_iff (m₂ := μ.1)
lemma mono_null ⦃s t : Set α⦄ (h : s ⊆ t) (ht : μ t = 0) : μ s = 0 := measure_mono_null h ht
end Measure
@[simp] theorem Measure.coe_toOuterMeasure (μ : Measure α) : ⇑μ.toOuterMeasure = μ := rfl
theorem Measure.toOuterMeasure_apply (μ : Measure α) (s : Set α) :
μ.toOuterMeasure s = μ s :=
rfl
theorem measure_eq_trim (s : Set α) : μ s = μ.toOuterMeasure.trim s := by
rw [μ.trimmed, μ.coe_toOuterMeasure]
theorem measure_eq_iInf (s : Set α) : μ s = ⨅ (t) (_ : s ⊆ t) (_ : MeasurableSet t), μ t := by
rw [measure_eq_trim, OuterMeasure.trim_eq_iInf, μ.coe_toOuterMeasure]
/-- A variant of `measure_eq_iInf` which has a single `iInf`. This is useful when applying a
lemma next that only works for non-empty infima, in which case you can use
`nonempty_measurable_superset`. -/
theorem measure_eq_iInf' (μ : Measure α) (s : Set α) :
μ s = ⨅ t : { t // s ⊆ t ∧ MeasurableSet t }, μ t := by
simp_rw [iInf_subtype, iInf_and, ← measure_eq_iInf]
theorem measure_eq_inducedOuterMeasure :
μ s = inducedOuterMeasure (fun s _ => μ s) MeasurableSet.empty μ.empty s :=
measure_eq_trim _
theorem toOuterMeasure_eq_inducedOuterMeasure :
μ.toOuterMeasure = inducedOuterMeasure (fun s _ => μ s) MeasurableSet.empty μ.empty :=
μ.trimmed.symm
theorem measure_eq_extend (hs : MeasurableSet s) :
μ s = extend (fun t (_ht : MeasurableSet t) => μ t) s := by
rw [extend_eq]
exact hs
theorem nonempty_of_measure_ne_zero (h : μ s ≠ 0) : s.Nonempty :=
nonempty_iff_ne_empty.2 fun h' => h <| h'.symm ▸ measure_empty
theorem measure_mono_top (h : s₁ ⊆ s₂) (h₁ : μ s₁ = ∞) : μ s₂ = ∞ :=
top_unique <| h₁ ▸ measure_mono h
@[simp, mono]
theorem measure_le_measure_union_left : μ s ≤ μ (s ∪ t) := μ.mono subset_union_left
@[simp, mono]
theorem measure_le_measure_union_right : μ t ≤ μ (s ∪ t) := μ.mono subset_union_right
/-- For every set there exists a measurable superset of the same measure. -/
theorem exists_measurable_superset (μ : Measure α) (s : Set α) :
∃ t, s ⊆ t ∧ MeasurableSet t ∧ μ t = μ s := by
simpa only [← measure_eq_trim] using μ.toOuterMeasure.exists_measurable_superset_eq_trim s
/-- For every set `s` and a countable collection of measures `μ i` there exists a measurable
superset `t ⊇ s` such that each measure `μ i` takes the same value on `s` and `t`. -/
theorem exists_measurable_superset_forall_eq [Countable ι] (μ : ι → Measure α) (s : Set α) :
∃ t, s ⊆ t ∧ MeasurableSet t ∧ ∀ i, μ i t = μ i s := by
simpa only [← measure_eq_trim] using
OuterMeasure.exists_measurable_superset_forall_eq_trim (fun i => (μ i).toOuterMeasure) s
theorem exists_measurable_superset₂ (μ ν : Measure α) (s : Set α) :
∃ t, s ⊆ t ∧ MeasurableSet t ∧ μ t = μ s ∧ ν t = ν s := by
simpa only [Bool.forall_bool.trans and_comm] using
exists_measurable_superset_forall_eq (fun b => cond b μ ν) s
theorem exists_measurable_superset_of_null (h : μ s = 0) : ∃ t, s ⊆ t ∧ MeasurableSet t ∧ μ t = 0 :=
h ▸ exists_measurable_superset μ s
theorem exists_measurable_superset_iff_measure_eq_zero :
(∃ t, s ⊆ t ∧ MeasurableSet t ∧ μ t = 0) ↔ μ s = 0 :=
⟨fun ⟨_t, hst, _, ht⟩ => measure_mono_null hst ht, exists_measurable_superset_of_null⟩
theorem measure_biUnion_lt_top {s : Set β} {f : β → Set α} (hs : s.Finite)
(hfin : ∀ i ∈ s, μ (f i) < ∞) : μ (⋃ i ∈ s, f i) < ∞ := by
convert (measure_biUnion_finset_le (μ := μ) hs.toFinset f).trans_lt _ using 3
· ext
rw [Finite.mem_toFinset]
· simpa only [ENNReal.sum_lt_top, Finite.mem_toFinset]
@[aesop (rule_sets := [finiteness]) safe apply]
theorem measure_biUnion_ne_top {s : Set β} {f : β → Set α} (hs : s.Finite)
(hfin : ∀ i ∈ s, μ (f i) ≠ ∞) : μ (⋃ i ∈ s, f i) ≠ ∞ :=
(measure_biUnion_lt_top hs (fun i hi ↦ Ne.lt_top (hfin i hi ·))).ne
theorem measure_union_lt_top (hs : μ s < ∞) (ht : μ t < ∞) : μ (s ∪ t) < ∞ :=
(measure_union_le s t).trans_lt (ENNReal.add_lt_top.mpr ⟨hs, ht⟩)
@[simp]
theorem measure_union_lt_top_iff : μ (s ∪ t) < ∞ ↔ μ s < ∞ ∧ μ t < ∞ := by
refine ⟨fun h => ⟨?_, ?_⟩, fun h => measure_union_lt_top h.1 h.2⟩
· exact (measure_mono Set.subset_union_left).trans_lt h
· exact (measure_mono Set.subset_union_right).trans_lt h
@[aesop (rule_sets := [finiteness]) safe apply]
theorem measure_union_ne_top (hs : μ s ≠ ∞) (ht : μ t ≠ ∞) : μ (s ∪ t) ≠ ∞ :=
(measure_union_lt_top hs.lt_top ht.lt_top).ne
open scoped symmDiff in
@[aesop (rule_sets := [finiteness]) unsafe 95% apply]
theorem measure_symmDiff_ne_top (hs : μ s ≠ ∞) (ht : μ t ≠ ∞) : μ (s ∆ t) ≠ ∞ :=
ne_top_of_le_ne_top (by finiteness) <| measure_mono symmDiff_subset_union
@[simp]
theorem measure_union_eq_top_iff : μ (s ∪ t) = ∞ ↔ μ s = ∞ ∨ μ t = ∞ :=
not_iff_not.1 <| by simp only [← lt_top_iff_ne_top, ← Ne.eq_def, not_or, measure_union_lt_top_iff]
theorem exists_measure_pos_of_not_measure_iUnion_null [Countable ι] {s : ι → Set α}
(hs : μ (⋃ n, s n) ≠ 0) : ∃ n, 0 < μ (s n) := by
contrapose! hs
exact measure_iUnion_null fun n => nonpos_iff_eq_zero.1 (hs n)
theorem measure_lt_top_of_subset (hst : t ⊆ s) (hs : μ s ≠ ∞) : μ t < ∞ :=
lt_of_le_of_lt (μ.mono hst) hs.lt_top
theorem measure_ne_top_of_subset (h : t ⊆ s) (ht : μ s ≠ ∞) : μ t ≠ ∞ :=
(measure_lt_top_of_subset h ht).ne
@[aesop (rule_sets := [finiteness]) unsafe apply]
theorem measure_inter_ne_top_of_left_ne_top (hs_finite : μ s ≠ ∞) : μ (s ∩ t) ≠ ∞ :=
measure_ne_top_of_subset inter_subset_left hs_finite
theorem measure_inter_lt_top_of_left_ne_top (hs_finite : μ s ≠ ∞) : μ (s ∩ t) < ∞ := by
finiteness
@[aesop (rule_sets := [finiteness]) unsafe apply]
theorem measure_inter_ne_top_of_right_ne_top (ht_finite : μ t ≠ ∞) : μ (s ∩ t) ≠ ∞ :=
measure_ne_top_of_subset inter_subset_right ht_finite
theorem measure_inter_lt_top_of_right_ne_top (ht_finite : μ t ≠ ∞) : μ (s ∩ t) < ∞ := by
finiteness
theorem measure_inter_null_of_null_right (S : Set α) {T : Set α} (h : μ T = 0) : μ (S ∩ T) = 0 :=
measure_mono_null inter_subset_right h
theorem measure_inter_null_of_null_left {S : Set α} (T : Set α) (h : μ S = 0) : μ (S ∩ T) = 0 :=
measure_mono_null inter_subset_left h
/-! ### The almost everywhere filter -/
section ae
/-- Given a predicate on `β` and `Set α` where both `α` and `β` are measurable spaces, if the
predicate holds for almost every `x : β` and
- `∅ : Set α`
- a family of sets generating the σ-algebra of `α`
Moreover, if for almost every `x : β`, the predicate is closed under complements and countable
disjoint unions, then the predicate holds for almost every `x : β` and all measurable sets of `α`.
This is an AE version of `MeasurableSpace.induction_on_inter` where the condition is dependent
on a measurable space `β`. -/
theorem _root_.MeasurableSpace.ae_induction_on_inter
{α β : Type*} [MeasurableSpace β] {μ : Measure β}
{C : β → Set α → Prop} {s : Set (Set α)} [m : MeasurableSpace α]
(h_eq : m = MeasurableSpace.generateFrom s)
(h_inter : IsPiSystem s) (h_empty : ∀ᵐ x ∂μ, C x ∅) (h_basic : ∀ᵐ x ∂μ, ∀ t ∈ s, C x t)
(h_compl : ∀ᵐ x ∂μ, ∀ t, MeasurableSet t → C x t → C x tᶜ)
(h_union : ∀ᵐ x ∂μ, ∀ f : ℕ → Set α,
Pairwise (Disjoint on f) → (∀ i, MeasurableSet (f i)) → (∀ i, C x (f i)) → C x (⋃ i, f i)) :
∀ᵐ x ∂μ, ∀ ⦃t⦄, MeasurableSet t → C x t := by
filter_upwards [h_empty, h_basic, h_compl, h_union] with x hx_empty hx_basic hx_compl hx_union
using MeasurableSpace.induction_on_inter (C := fun t _ ↦ C x t)
h_eq h_inter hx_empty hx_basic hx_compl hx_union
end ae
open Classical in
/-- A measurable set `t ⊇ s` such that `μ t = μ s`. It even satisfies `μ (t ∩ u) = μ (s ∩ u)` for
any measurable set `u` if `μ s ≠ ∞`, see `measure_toMeasurable_inter`.
(This property holds without the assumption `μ s ≠ ∞` when the space is s-finite -- for example
σ-finite), see `measure_toMeasurable_inter_of_sFinite`).
If `s` is a null measurable set, then
we also have `t =ᵐ[μ] s`, see `NullMeasurableSet.toMeasurable_ae_eq`.
This notion is sometimes called a "measurable hull" in the literature. -/
irreducible_def toMeasurable (μ : Measure α) (s : Set α) : Set α :=
if h : ∃ t, t ⊇ s ∧ MeasurableSet t ∧ t =ᵐ[μ] s then h.choose else
if h' : ∃ t, t ⊇ s ∧ MeasurableSet t ∧
∀ u, MeasurableSet u → μ (t ∩ u) = μ (s ∩ u) then h'.choose
else (exists_measurable_superset μ s).choose
theorem subset_toMeasurable (μ : Measure α) (s : Set α) : s ⊆ toMeasurable μ s := by
rw [toMeasurable_def]; split_ifs with hs h's
exacts [hs.choose_spec.1, h's.choose_spec.1, (exists_measurable_superset μ s).choose_spec.1]
theorem ae_le_toMeasurable : s ≤ᵐ[μ] toMeasurable μ s :=
HasSubset.Subset.eventuallyLE (subset_toMeasurable _ _)
@[simp]
theorem measurableSet_toMeasurable (μ : Measure α) (s : Set α) :
MeasurableSet (toMeasurable μ s) := by
rw [toMeasurable_def]; split_ifs with hs h's
exacts [hs.choose_spec.2.1, h's.choose_spec.2.1,
(exists_measurable_superset μ s).choose_spec.2.1]
@[simp]
theorem measure_toMeasurable (s : Set α) : μ (toMeasurable μ s) = μ s := by
rw [toMeasurable_def]; split_ifs with hs h's
· exact measure_congr hs.choose_spec.2.2
· simpa only [inter_univ] using h's.choose_spec.2.2 univ MeasurableSet.univ
· exact (exists_measurable_superset μ s).choose_spec.2.2
/-- A measure space is a measurable space equipped with a
measure, referred to as `volume`. -/
class MeasureSpace (α : Type*) extends MeasurableSpace α where
volume : Measure α
export MeasureSpace (volume)
/-- `volume` is the canonical measure on `α`. -/
add_decl_doc volume
section MeasureSpace
/-- `∀ᵐ a, p a` means that `p a` for a.e. `a`, i.e. `p` holds true away from a null set.
This is notation for `Filter.Eventually P (MeasureTheory.ae MeasureSpace.volume)`. -/
notation3 "∀ᵐ "(...)", "r:(scoped P =>
Filter.Eventually P <| MeasureTheory.ae MeasureTheory.MeasureSpace.volume) => r
/-- `∃ᵐ a, p a` means that `p` holds frequently, i.e. on a set of positive measure,
w.r.t. the volume measure.
This is notation for `Filter.Frequently P (MeasureTheory.ae MeasureSpace.volume)`. -/
notation3 "∃ᵐ "(...)", "r:(scoped P =>
Filter.Frequently P <| MeasureTheory.ae MeasureTheory.MeasureSpace.volume) => r
/-- The tactic `exact volume`, to be used in optional (`autoParam`) arguments. -/
macro "volume_tac" : tactic =>
`(tactic| (first | exact MeasureTheory.MeasureSpace.volume))
end MeasureSpace
end
end MeasureTheory
section
open MeasureTheory
/-!
### Almost everywhere measurable functions
A function is almost everywhere measurable if it coincides almost everywhere with a measurable
function. We define this property, called `AEMeasurable f μ`. It's properties are discussed in
`MeasureTheory.MeasureSpace`.
-/
variable {m : MeasurableSpace α} [MeasurableSpace β] {f g : α → β} {μ ν : Measure α}
/-- A function is almost everywhere measurable if it coincides almost everywhere with a measurable
function. -/
@[fun_prop]
def AEMeasurable {_m : MeasurableSpace α} (f : α → β) (μ : Measure α := by volume_tac) : Prop :=
∃ g : α → β, Measurable g ∧ f =ᵐ[μ] g
add_aesop_rules safe tactic
(rule_sets := [Measurable])
(index := [target @AEMeasurable ..])
(by fun_prop (disch := measurability))
@[fun_prop]
theorem Measurable.aemeasurable (h : Measurable f) : AEMeasurable f μ :=
⟨f, h, ae_eq_refl f⟩
namespace AEMeasurable
lemma of_discrete [DiscreteMeasurableSpace α] : AEMeasurable f μ :=
Measurable.of_discrete.aemeasurable
/-- Given an almost everywhere measurable function `f`, associate to it a measurable function
that coincides with it almost everywhere. `f` is explicit in the definition to make sure that
it shows in pretty-printing. -/
def mk (f : α → β) (h : AEMeasurable f μ) : α → β :=
Classical.choose h
@[measurability]
theorem measurable_mk (h : AEMeasurable f μ) : Measurable (h.mk f) :=
(Classical.choose_spec h).1
theorem ae_eq_mk (h : AEMeasurable f μ) : f =ᵐ[μ] h.mk f :=
(Classical.choose_spec h).2
theorem congr (hf : AEMeasurable f μ) (h : f =ᵐ[μ] g) : AEMeasurable g μ :=
⟨hf.mk f, hf.measurable_mk, h.symm.trans hf.ae_eq_mk⟩
end AEMeasurable
theorem aemeasurable_congr (h : f =ᵐ[μ] g) : AEMeasurable f μ ↔ AEMeasurable g μ :=
⟨fun hf => AEMeasurable.congr hf h, fun hg => AEMeasurable.congr hg h.symm⟩
@[simp, fun_prop, measurability]
theorem aemeasurable_const {b : β} : AEMeasurable (fun _a : α => b) μ :=
measurable_const.aemeasurable
@[fun_prop, measurability]
theorem aemeasurable_id : AEMeasurable id μ :=
measurable_id.aemeasurable
@[fun_prop, measurability]
theorem aemeasurable_id' : AEMeasurable (fun x => x) μ :=
measurable_id.aemeasurable
theorem Measurable.comp_aemeasurable [MeasurableSpace δ] {f : α → δ} {g : δ → β} (hg : Measurable g)
(hf : AEMeasurable f μ) : AEMeasurable (g ∘ f) μ :=
⟨g ∘ hf.mk f, hg.comp hf.measurable_mk, EventuallyEq.fun_comp hf.ae_eq_mk _⟩
@[fun_prop, measurability]
theorem Measurable.comp_aemeasurable' [MeasurableSpace δ] {f : α → δ} {g : δ → β}
(hg : Measurable g) (hf : AEMeasurable f μ) : AEMeasurable (fun x ↦ g (f x)) μ :=
Measurable.comp_aemeasurable hg hf
variable {δ : Type*} {X : δ → Type*} {mX : ∀ a, MeasurableSpace (X a)}
protected theorem AEMeasurable.eval {g : α → Π a, X a} (hg : AEMeasurable g μ) (a : δ) :
AEMeasurable (fun x ↦ g x a) μ := by
use fun x ↦ hg.mk g x a, hg.measurable_mk.eval
exact hg.ae_eq_mk.mono fun _ h ↦ congrFun h _
variable [Countable δ]
theorem aemeasurable_pi_iff {g : α → Π a, X a} :
AEMeasurable g μ ↔ ∀ a, AEMeasurable (fun x ↦ g x a) μ := by
constructor
· exact AEMeasurable.eval
· intro h
use fun x a ↦ (h a).mk _ x, measurable_pi_lambda _ fun a ↦ (h a).measurable_mk
exact (eventually_countable_forall.mpr fun a ↦ (h a).ae_eq_mk).mono fun _ h ↦ funext h
@[fun_prop]
theorem aemeasurable_pi_lambda (f : α → Π a, X a) (hf : ∀ a, AEMeasurable (fun c ↦ f c a) μ) :
AEMeasurable f μ :=
aemeasurable_pi_iff.mpr hf
end |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Complex.lean | import Mathlib.MeasureTheory.VectorMeasure.Basic
import Mathlib.Analysis.Complex.Basic
/-!
# Complex measure
This file defines a complex measure to be a vector measure with codomain `ℂ`.
Then we prove some elementary results about complex measures. In particular, we prove that
a complex measure is always in the form `s + it` where `s` and `t` are signed measures.
## Main definitions
* `MeasureTheory.ComplexMeasure.re`: obtains a signed measure `s` from a complex measure `c`
such that `s i = (c i).re` for all measurable sets `i`.
* `MeasureTheory.ComplexMeasure.im`: obtains a signed measure `s` from a complex measure `c`
such that `s i = (c i).im` for all measurable sets `i`.
* `MeasureTheory.SignedMeasure.toComplexMeasure`: given two signed measures `s` and `t`,
`s.to_complex_measure t` provides a complex measure of the form `s + it`.
* `MeasureTheory.ComplexMeasure.equivSignedMeasure`: is the equivalence between the complex
measures and the type of the product of the signed measures with itself.
## Tags
Complex measure
-/
noncomputable section
open scoped MeasureTheory ENNReal NNReal
variable {α : Type*} {m : MeasurableSpace α}
namespace MeasureTheory
open VectorMeasure
/-- A `ComplexMeasure` is a `ℂ`-vector measure. -/
abbrev ComplexMeasure (α : Type*) [MeasurableSpace α] :=
VectorMeasure α ℂ
namespace ComplexMeasure
/-- The real part of a complex measure is a signed measure. -/
@[simps! apply]
def re : ComplexMeasure α →ₗ[ℝ] SignedMeasure α :=
mapRangeₗ Complex.reCLM Complex.continuous_re
/-- The imaginary part of a complex measure is a signed measure. -/
@[simps! apply]
def im : ComplexMeasure α →ₗ[ℝ] SignedMeasure α :=
mapRangeₗ Complex.imCLM Complex.continuous_im
/-- Given `s` and `t` signed measures, `s + it` is a complex measure -/
@[simps!]
def _root_.MeasureTheory.SignedMeasure.toComplexMeasure (s t : SignedMeasure α) :
ComplexMeasure α where
measureOf' i := ⟨s i, t i⟩
empty' := by rw [s.empty, t.empty]; rfl
not_measurable' i hi := by rw [s.not_measurable hi, t.not_measurable hi]; rfl
m_iUnion' _ hf hfdisj := (Complex.hasSum_iff _ _).2 ⟨s.m_iUnion hf hfdisj, t.m_iUnion hf hfdisj⟩
theorem _root_.MeasureTheory.SignedMeasure.toComplexMeasure_apply
{s t : SignedMeasure α} {i : Set α} : s.toComplexMeasure t i = ⟨s i, t i⟩ := rfl
theorem toComplexMeasure_to_signedMeasure (c : ComplexMeasure α) :
SignedMeasure.toComplexMeasure (ComplexMeasure.re c) (ComplexMeasure.im c) = c := rfl
theorem _root_.MeasureTheory.SignedMeasure.re_toComplexMeasure (s t : SignedMeasure α) :
ComplexMeasure.re (SignedMeasure.toComplexMeasure s t) = s := rfl
theorem _root_.MeasureTheory.SignedMeasure.im_toComplexMeasure (s t : SignedMeasure α) :
ComplexMeasure.im (SignedMeasure.toComplexMeasure s t) = t := rfl
/-- The complex measures form an equivalence to the type of pairs of signed measures. -/
@[simps]
def equivSignedMeasure : ComplexMeasure α ≃ SignedMeasure α × SignedMeasure α where
toFun c := ⟨ComplexMeasure.re c, ComplexMeasure.im c⟩
invFun := fun ⟨s, t⟩ => s.toComplexMeasure t
left_inv c := c.toComplexMeasure_to_signedMeasure
right_inv := fun ⟨s, t⟩ => Prod.ext (s.re_toComplexMeasure t) (s.im_toComplexMeasure t)
section
variable {R : Type*} [Semiring R] [Module R ℝ]
variable [ContinuousConstSMul R ℝ] [ContinuousConstSMul R ℂ]
/-- The complex measures form a linear isomorphism to the type of pairs of signed measures. -/
@[simps]
def equivSignedMeasureₗ : ComplexMeasure α ≃ₗ[R] SignedMeasure α × SignedMeasure α :=
{ equivSignedMeasure with
map_add' := fun c d => by rfl
map_smul' := by
intro r c
dsimp
ext
· simp [Complex.smul_re]
· simp [Complex.smul_im] }
end
theorem absolutelyContinuous_ennreal_iff (c : ComplexMeasure α) (μ : VectorMeasure α ℝ≥0∞) :
c ≪ᵥ μ ↔ ComplexMeasure.re c ≪ᵥ μ ∧ ComplexMeasure.im c ≪ᵥ μ := by
constructor <;> intro h
· constructor <;> · intro i hi; simp [h hi]
· intro i hi
rw [← Complex.re_add_im (c i), (_ : (c i).re = 0), (_ : (c i).im = 0)]
exacts [by simp, h.2 hi, h.1 hi]
end ComplexMeasure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/AEMeasurable.lean | import Mathlib.MeasureTheory.Measure.Trim
import Mathlib.MeasureTheory.MeasurableSpace.CountablyGenerated
/-!
# Almost everywhere measurable functions
A function is almost everywhere measurable if it coincides almost everywhere with a measurable
function. This property, called `AEMeasurable f μ`, is defined in the file `MeasureSpaceDef`.
We discuss several of its properties that are analogous to properties of measurable functions.
-/
open MeasureTheory MeasureTheory.Measure Filter Set Function ENNReal
variable {ι α β γ δ R : Type*} {m0 : MeasurableSpace α} [MeasurableSpace β] [MeasurableSpace γ]
[MeasurableSpace δ] {f g : α → β} {μ ν : Measure α}
section
@[nontriviality, measurability]
theorem Subsingleton.aemeasurable [Subsingleton α] : AEMeasurable f μ :=
Subsingleton.measurable.aemeasurable
@[nontriviality, measurability]
theorem aemeasurable_of_subsingleton_codomain [Subsingleton β] : AEMeasurable f μ :=
(measurable_of_subsingleton_codomain f).aemeasurable
@[simp, fun_prop, measurability]
theorem aemeasurable_zero_measure : AEMeasurable f (0 : Measure α) := by
nontriviality α; inhabit α
exact ⟨fun _ => f default, measurable_const, rfl⟩
theorem aemeasurable_id'' (μ : Measure α) {m : MeasurableSpace α} (hm : m ≤ m0) :
@AEMeasurable α α m m0 id μ :=
@Measurable.aemeasurable α α m0 m id μ (measurable_id'' hm)
lemma aemeasurable_of_map_neZero {μ : Measure α}
{f : α → β} (h : NeZero (μ.map f)) :
AEMeasurable f μ := by
by_contra h'
simp [h'] at h
namespace AEMeasurable
lemma mono_ac (hf : AEMeasurable f ν) (hμν : μ ≪ ν) : AEMeasurable f μ :=
⟨hf.mk f, hf.measurable_mk, hμν.ae_le hf.ae_eq_mk⟩
theorem mono_measure (h : AEMeasurable f μ) (h' : ν ≤ μ) : AEMeasurable f ν :=
mono_ac h h'.absolutelyContinuous
theorem mono_set {s t} (h : s ⊆ t) (ht : AEMeasurable f (μ.restrict t)) :
AEMeasurable f (μ.restrict s) :=
ht.mono_measure (restrict_mono h le_rfl)
@[fun_prop]
protected theorem mono' (h : AEMeasurable f μ) (h' : ν ≪ μ) : AEMeasurable f ν :=
⟨h.mk f, h.measurable_mk, h' h.ae_eq_mk⟩
theorem ae_mem_imp_eq_mk {s} (h : AEMeasurable f (μ.restrict s)) :
∀ᵐ x ∂μ, x ∈ s → f x = h.mk f x :=
ae_imp_of_ae_restrict h.ae_eq_mk
theorem ae_inf_principal_eq_mk {s} (h : AEMeasurable f (μ.restrict s)) : f =ᶠ[ae μ ⊓ 𝓟 s] h.mk f :=
le_ae_restrict h.ae_eq_mk
@[measurability]
theorem sum_measure [Countable ι] {μ : ι → Measure α} (h : ∀ i, AEMeasurable f (μ i)) :
AEMeasurable f (sum μ) := by
classical
nontriviality β
inhabit β
set s : ι → Set α := fun i => toMeasurable (μ i) { x | f x ≠ (h i).mk f x }
have hsμ : ∀ i, μ i (s i) = 0 := by
intro i
rw [measure_toMeasurable]
exact (h i).ae_eq_mk
have hsm : MeasurableSet (⋂ i, s i) :=
MeasurableSet.iInter fun i => measurableSet_toMeasurable _ _
have hs : ∀ i x, x ∉ s i → f x = (h i).mk f x := by
intro i x hx
contrapose! hx
exact subset_toMeasurable _ _ hx
set g : α → β := (⋂ i, s i).piecewise (const α default) f
refine ⟨g, measurable_of_restrict_of_restrict_compl hsm ?_ ?_, ae_sum_iff.mpr fun i => ?_⟩
· rw [restrict_piecewise]
simp only [s]
exact measurable_const
· rw [restrict_piecewise_compl, compl_iInter]
intro t ht
refine ⟨⋃ i, (h i).mk f ⁻¹' t ∩ (s i)ᶜ, MeasurableSet.iUnion fun i ↦
(measurable_mk _ ht).inter (measurableSet_toMeasurable _ _).compl, ?_⟩
ext ⟨x, hx⟩
simp only [mem_preimage, mem_iUnion, Set.restrict, mem_inter_iff,
mem_compl_iff] at hx ⊢
constructor
· rintro ⟨i, hxt, hxs⟩
rwa [hs _ _ hxs]
· rcases hx with ⟨i, hi⟩
rw [hs _ _ hi]
exact fun h => ⟨i, h, hi⟩
· refine measure_mono_null (fun x (hx : f x ≠ g x) => ?_) (hsμ i)
contrapose! hx
refine (piecewise_eq_of_notMem _ _ _ ?_).symm
exact fun h => hx (mem_iInter.1 h i)
@[simp]
theorem _root_.aemeasurable_sum_measure_iff [Countable ι] {μ : ι → Measure α} :
AEMeasurable f (sum μ) ↔ ∀ i, AEMeasurable f (μ i) :=
⟨fun h _ => h.mono_measure (le_sum _ _), sum_measure⟩
@[simp]
theorem _root_.aemeasurable_add_measure_iff :
AEMeasurable f (μ + ν) ↔ AEMeasurable f μ ∧ AEMeasurable f ν := by
rw [← sum_cond, aemeasurable_sum_measure_iff, Bool.forall_bool, and_comm]
rfl
@[measurability]
theorem add_measure {f : α → β} (hμ : AEMeasurable f μ) (hν : AEMeasurable f ν) :
AEMeasurable f (μ + ν) :=
aemeasurable_add_measure_iff.2 ⟨hμ, hν⟩
@[measurability]
protected theorem iUnion [Countable ι] {s : ι → Set α}
(h : ∀ i, AEMeasurable f (μ.restrict (s i))) : AEMeasurable f (μ.restrict (⋃ i, s i)) :=
(sum_measure h).mono_measure <| restrict_iUnion_le
@[simp]
theorem _root_.aemeasurable_iUnion_iff [Countable ι] {s : ι → Set α} :
AEMeasurable f (μ.restrict (⋃ i, s i)) ↔ ∀ i, AEMeasurable f (μ.restrict (s i)) :=
⟨fun h _ => h.mono_measure <| restrict_mono (subset_iUnion _ _) le_rfl, AEMeasurable.iUnion⟩
@[simp]
theorem _root_.aemeasurable_union_iff {s t : Set α} :
AEMeasurable f (μ.restrict (s ∪ t)) ↔
AEMeasurable f (μ.restrict s) ∧ AEMeasurable f (μ.restrict t) := by
simp only [union_eq_iUnion, aemeasurable_iUnion_iff, Bool.forall_bool, cond, and_comm]
@[measurability]
theorem smul_measure [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
(h : AEMeasurable f μ) (c : R) : AEMeasurable f (c • μ) :=
⟨h.mk f, h.measurable_mk, ae_smul_measure h.ae_eq_mk c⟩
theorem comp_aemeasurable {f : α → δ} {g : δ → β} (hg : AEMeasurable g (μ.map f))
(hf : AEMeasurable f μ) : AEMeasurable (g ∘ f) μ :=
⟨hg.mk g ∘ hf.mk f, hg.measurable_mk.comp hf.measurable_mk,
(ae_eq_comp hf hg.ae_eq_mk).trans (hf.ae_eq_mk.fun_comp (mk g hg))⟩
@[fun_prop]
theorem comp_aemeasurable' {f : α → δ} {g : δ → β} (hg : AEMeasurable g (μ.map f))
(hf : AEMeasurable f μ) : AEMeasurable (fun x ↦ g (f x)) μ := comp_aemeasurable hg hf
theorem comp_measurable {f : α → δ} {g : δ → β} (hg : AEMeasurable g (μ.map f))
(hf : Measurable f) : AEMeasurable (g ∘ f) μ :=
hg.comp_aemeasurable hf.aemeasurable
@[fun_prop]
theorem comp_quasiMeasurePreserving {ν : Measure δ} {f : α → δ} {g : δ → β} (hg : AEMeasurable g ν)
(hf : QuasiMeasurePreserving f μ ν) : AEMeasurable (g ∘ f) μ :=
(hg.mono' hf.absolutelyContinuous).comp_measurable hf.measurable
theorem map_map_of_aemeasurable {g : β → γ} {f : α → β} (hg : AEMeasurable g (Measure.map f μ))
(hf : AEMeasurable f μ) : (μ.map f).map g = μ.map (g ∘ f) := by
ext1 s hs
rw [map_apply_of_aemeasurable hg hs, map_apply₀ hf (hg.nullMeasurable hs),
map_apply_of_aemeasurable (hg.comp_aemeasurable hf) hs, preimage_comp]
@[fun_prop, measurability]
protected theorem fst {f : α → β × γ} (hf : AEMeasurable f μ) :
AEMeasurable (fun x ↦ (f x).1) μ :=
measurable_fst.comp_aemeasurable hf
@[fun_prop, measurability]
protected theorem snd {f : α → β × γ} (hf : AEMeasurable f μ) :
AEMeasurable (fun x ↦ (f x).2) μ :=
measurable_snd.comp_aemeasurable hf
@[fun_prop, measurability]
theorem prodMk {f : α → β} {g : α → γ} (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
AEMeasurable (fun x => (f x, g x)) μ :=
⟨fun a => (hf.mk f a, hg.mk g a), hf.measurable_mk.prodMk hg.measurable_mk,
hf.ae_eq_mk.prodMk hg.ae_eq_mk⟩
theorem exists_ae_eq_range_subset (H : AEMeasurable f μ) {t : Set β} (ht : ∀ᵐ x ∂μ, f x ∈ t)
(h₀ : t.Nonempty) : ∃ g, Measurable g ∧ range g ⊆ t ∧ f =ᵐ[μ] g := by
classical
let s : Set α := toMeasurable μ { x | f x = H.mk f x ∧ f x ∈ t }ᶜ
let g : α → β := piecewise s (fun _ => h₀.some) (H.mk f)
refine ⟨g, ?_, ?_, ?_⟩
· exact Measurable.piecewise (measurableSet_toMeasurable _ _) measurable_const H.measurable_mk
· rintro _ ⟨x, rfl⟩
by_cases hx : x ∈ s
· simpa [g, hx] using h₀.some_mem
· simp only [g, hx, piecewise_eq_of_notMem, not_false_iff]
contrapose! hx
apply subset_toMeasurable
simp +contextual only [hx, mem_compl_iff, mem_setOf_eq, not_and,
not_false_iff, imp_true_iff]
· have A : μ (toMeasurable μ { x | f x = H.mk f x ∧ f x ∈ t }ᶜ) = 0 := by
rw [measure_toMeasurable, ← compl_mem_ae_iff, compl_compl]
exact H.ae_eq_mk.and ht
filter_upwards [compl_mem_ae_iff.2 A] with x hx
rw [mem_compl_iff] at hx
simp only [s, g, hx, piecewise_eq_of_notMem, not_false_iff]
contrapose! hx
apply subset_toMeasurable
simp only [hx, mem_compl_iff, mem_setOf_eq, false_and, not_false_iff]
theorem exists_measurable_nonneg {β} [Preorder β] [Zero β] {mβ : MeasurableSpace β} {f : α → β}
(hf : AEMeasurable f μ) (f_nn : ∀ᵐ t ∂μ, 0 ≤ f t) : ∃ g, Measurable g ∧ 0 ≤ g ∧ f =ᵐ[μ] g := by
obtain ⟨G, hG_meas, hG_mem, hG_ae_eq⟩ := hf.exists_ae_eq_range_subset f_nn ⟨0, le_rfl⟩
exact ⟨G, hG_meas, fun x => hG_mem (mem_range_self x), hG_ae_eq⟩
theorem subtype_mk (h : AEMeasurable f μ) {s : Set β} {hfs : ∀ x, f x ∈ s} :
AEMeasurable (codRestrict f s hfs) μ := by
nontriviality α; inhabit α
obtain ⟨g, g_meas, hg, fg⟩ : ∃ g : α → β, Measurable g ∧ range g ⊆ s ∧ f =ᵐ[μ] g :=
h.exists_ae_eq_range_subset (Eventually.of_forall hfs) ⟨_, hfs default⟩
refine ⟨codRestrict g s fun x => hg (mem_range_self _), Measurable.subtype_mk g_meas, ?_⟩
filter_upwards [fg] with x hx
simpa [Subtype.ext_iff]
end AEMeasurable
theorem aemeasurable_const' (h : ∀ᵐ (x) (y) ∂μ, f x = f y) : AEMeasurable f μ := by
rcases eq_or_ne μ 0 with (rfl | hμ)
· exact aemeasurable_zero_measure
· haveI := ae_neBot.2 hμ
rcases h.exists with ⟨x, hx⟩
exact ⟨const α (f x), measurable_const, EventuallyEq.symm hx⟩
open scoped Interval in
theorem aemeasurable_uIoc_iff [LinearOrder α] {f : α → β} {a b : α} :
(AEMeasurable f <| μ.restrict <| Ι a b) ↔
(AEMeasurable f <| μ.restrict <| Ioc a b) ∧ (AEMeasurable f <| μ.restrict <| Ioc b a) := by
rw [uIoc_eq_union, aemeasurable_union_iff]
theorem aemeasurable_iff_measurable [μ.IsComplete] : AEMeasurable f μ ↔ Measurable f :=
⟨fun h => h.nullMeasurable.measurable_of_complete, fun h => h.aemeasurable⟩
theorem MeasurableEmbedding.aemeasurable_map_iff {g : β → γ} (hf : MeasurableEmbedding f) :
AEMeasurable g (μ.map f) ↔ AEMeasurable (g ∘ f) μ := by
refine ⟨fun H => H.comp_measurable hf.measurable, ?_⟩
rintro ⟨g₁, hgm₁, heq⟩
rcases hf.exists_measurable_extend hgm₁ fun x => ⟨g x⟩ with ⟨g₂, hgm₂, rfl⟩
exact ⟨g₂, hgm₂, hf.ae_map_iff.2 heq⟩
theorem MeasurableEmbedding.aemeasurable_comp_iff {g : β → γ} (hg : MeasurableEmbedding g)
{μ : Measure α} : AEMeasurable (g ∘ f) μ ↔ AEMeasurable f μ := by
refine ⟨fun H => ?_, hg.measurable.comp_aemeasurable⟩
suffices AEMeasurable ((rangeSplitting g ∘ rangeFactorization g) ∘ f) μ by
rwa [(rightInverse_rangeSplitting hg.injective).comp_eq_id] at this
exact hg.measurable_rangeSplitting.comp_aemeasurable H.subtype_mk
theorem aemeasurable_restrict_iff_comap_subtype {s : Set α} (hs : MeasurableSet s) {μ : Measure α}
{f : α → β} : AEMeasurable f (μ.restrict s) ↔ AEMeasurable (f ∘ (↑) : s → β) (comap (↑) μ) := by
rw [← map_comap_subtype_coe hs, (MeasurableEmbedding.subtype_coe hs).aemeasurable_map_iff]
@[to_additive]
theorem aemeasurable_one [One β] : AEMeasurable (fun _ : α => (1 : β)) μ :=
measurable_one.aemeasurable
@[simp]
theorem aemeasurable_smul_measure_iff {c : ℝ≥0∞} (hc : c ≠ 0) :
AEMeasurable f (c • μ) ↔ AEMeasurable f μ :=
⟨fun h => ⟨h.mk f, h.measurable_mk, (ae_smul_measure_iff hc).1 h.ae_eq_mk⟩, fun h =>
⟨h.mk f, h.measurable_mk, (ae_smul_measure_iff hc).2 h.ae_eq_mk⟩⟩
theorem aemeasurable_of_aemeasurable_trim {α} {m m0 : MeasurableSpace α} {μ : Measure α}
(hm : m ≤ m0) {f : α → β} (hf : AEMeasurable f (μ.trim hm)) : AEMeasurable f μ :=
⟨hf.mk f, Measurable.mono hf.measurable_mk hm le_rfl, ae_eq_of_ae_eq_trim hf.ae_eq_mk⟩
theorem aemeasurable_restrict_of_measurable_subtype {s : Set α} (hs : MeasurableSet s)
(hf : Measurable fun x : s => f x) : AEMeasurable f (μ.restrict s) :=
(aemeasurable_restrict_iff_comap_subtype hs).2 hf.aemeasurable
theorem aemeasurable_map_equiv_iff (e : α ≃ᵐ β) {f : β → γ} :
AEMeasurable f (μ.map e) ↔ AEMeasurable (f ∘ e) μ :=
e.measurableEmbedding.aemeasurable_map_iff
end
theorem AEMeasurable.restrict (hfm : AEMeasurable f μ) {s} : AEMeasurable f (μ.restrict s) :=
⟨AEMeasurable.mk f hfm, hfm.measurable_mk, ae_restrict_of_ae hfm.ae_eq_mk⟩
theorem aemeasurable_Ioi_of_forall_Ioc {β} {mβ : MeasurableSpace β} [LinearOrder α]
[(atTop : Filter α).IsCountablyGenerated] {x : α} {g : α → β}
(g_meas : ∀ t > x, AEMeasurable g (μ.restrict (Ioc x t))) :
AEMeasurable g (μ.restrict (Ioi x)) := by
haveI : Nonempty α := ⟨x⟩
obtain ⟨u, hu_tendsto⟩ := exists_seq_tendsto (atTop : Filter α)
have Ioi_eq_iUnion : Ioi x = ⋃ n : ℕ, Ioc x (u n) := by
rw [iUnion_Ioc_eq_Ioi_self_iff.mpr _]
exact fun y _ => (hu_tendsto.eventually (eventually_ge_atTop y)).exists
rw [Ioi_eq_iUnion, aemeasurable_iUnion_iff]
intro n
rcases lt_or_ge x (u n) with h | h
· exact g_meas (u n) h
· rw [Ioc_eq_empty (not_lt.mpr h), Measure.restrict_empty]
exact aemeasurable_zero_measure
section Zero
variable [Zero β]
theorem aemeasurable_indicator_iff {s} (hs : MeasurableSet s) :
AEMeasurable (indicator s f) μ ↔ AEMeasurable f (μ.restrict s) := by
constructor
· intro h
exact (h.mono_measure Measure.restrict_le_self).congr (indicator_ae_eq_restrict hs)
· intro h
refine ⟨indicator s (h.mk f), h.measurable_mk.indicator hs, ?_⟩
have A : s.indicator f =ᵐ[μ.restrict s] s.indicator (AEMeasurable.mk f h) :=
(indicator_ae_eq_restrict hs).trans (h.ae_eq_mk.trans <| (indicator_ae_eq_restrict hs).symm)
have B : s.indicator f =ᵐ[μ.restrict sᶜ] s.indicator (AEMeasurable.mk f h) :=
(indicator_ae_eq_restrict_compl hs).trans (indicator_ae_eq_restrict_compl hs).symm
exact ae_of_ae_restrict_of_ae_restrict_compl _ A B
theorem aemeasurable_indicator_iff₀ {s} (hs : NullMeasurableSet s μ) :
AEMeasurable (indicator s f) μ ↔ AEMeasurable f (μ.restrict s) := by
rcases hs with ⟨t, ht, hst⟩
rw [← aemeasurable_congr (indicator_ae_eq_of_ae_eq_set hst.symm), aemeasurable_indicator_iff ht,
restrict_congr_set hst]
/-- A characterization of the a.e.-measurability of the indicator function which takes a constant
value `b` on a set `A` and `0` elsewhere. -/
lemma aemeasurable_indicator_const_iff {s} [MeasurableSingletonClass β] (b : β) [NeZero b] :
AEMeasurable (s.indicator (fun _ ↦ b)) μ ↔ NullMeasurableSet s μ := by
classical
constructor <;> intro h
· convert h.nullMeasurable (MeasurableSet.singleton (0 : β)).compl
rw [indicator_const_preimage_eq_union s {0}ᶜ b]
simp [NeZero.ne b]
· exact (aemeasurable_indicator_iff₀ h).mpr aemeasurable_const
@[measurability]
theorem AEMeasurable.indicator (hfm : AEMeasurable f μ) {s} (hs : MeasurableSet s) :
AEMeasurable (s.indicator f) μ :=
(aemeasurable_indicator_iff hs).mpr hfm.restrict
theorem AEMeasurable.indicator₀ (hfm : AEMeasurable f μ) {s} (hs : NullMeasurableSet s μ) :
AEMeasurable (s.indicator f) μ :=
(aemeasurable_indicator_iff₀ hs).mpr hfm.restrict
end Zero
theorem MeasureTheory.Measure.restrict_map_of_aemeasurable {f : α → δ} (hf : AEMeasurable f μ)
{s : Set δ} (hs : MeasurableSet s) : (μ.map f).restrict s = (μ.restrict <| f ⁻¹' s).map f :=
calc
(μ.map f).restrict s = (μ.map (hf.mk f)).restrict s := by
congr 1
apply Measure.map_congr hf.ae_eq_mk
_ = (μ.restrict <| hf.mk f ⁻¹' s).map (hf.mk f) := Measure.restrict_map hf.measurable_mk hs
_ = (μ.restrict <| hf.mk f ⁻¹' s).map f :=
(Measure.map_congr (ae_restrict_of_ae hf.ae_eq_mk.symm))
_ = (μ.restrict <| f ⁻¹' s).map f := by
apply congr_arg
ext1 t ht
simp only [ht, Measure.restrict_apply]
apply measure_congr
apply (EventuallyEq.refl _ _).inter (hf.ae_eq_mk.symm.preimage s)
theorem MeasureTheory.Measure.map_mono_of_aemeasurable {f : α → δ} (h : μ ≤ ν)
(hf : AEMeasurable f ν) : μ.map f ≤ ν.map f :=
le_iff.2 fun s hs ↦ by simpa [hf, hs, hf.mono_measure h] using h (f ⁻¹' s)
/-- If the `σ`-algebra of the codomain of a null measurable function is countably generated,
then the function is a.e.-measurable. -/
lemma MeasureTheory.NullMeasurable.aemeasurable {f : α → β}
[hc : MeasurableSpace.CountablyGenerated β] (h : NullMeasurable f μ) : AEMeasurable f μ := by
classical
nontriviality β; inhabit β
rcases hc.1 with ⟨S, hSc, rfl⟩
choose! T hTf hTm hTeq using fun s hs ↦ (h <| .basic s hs).exists_measurable_subset_ae_eq
choose! U hUf hUm hUeq using fun s hs ↦ (h <| .basic s hs).exists_measurable_superset_ae_eq
set v := ⋃ s ∈ S, U s \ T s
have hvm : MeasurableSet v := .biUnion hSc fun s hs ↦ (hUm s hs).diff (hTm s hs)
have hvμ : μ v = 0 := (measure_biUnion_null_iff hSc).2 fun s hs ↦ ae_le_set.1 <|
((hUeq s hs).trans (hTeq s hs).symm).le
refine ⟨v.piecewise (fun _ ↦ default) f, ?_, measure_mono_null (fun x ↦
not_imp_comm.2 fun hxv ↦ (piecewise_eq_of_notMem _ _ _ hxv).symm) hvμ⟩
refine measurable_of_restrict_of_restrict_compl hvm ?_ ?_
· rw [restrict_piecewise]
apply measurable_const
· rw [restrict_piecewise_compl, restrict_eq]
refine measurable_generateFrom fun s hs ↦ .of_subtype_image ?_
rw [preimage_comp, Subtype.image_preimage_coe]
convert (hTm s hs).diff hvm using 1
rw [inter_comm]
refine Set.ext fun x ↦ and_congr_left fun hxv ↦ ⟨fun hx ↦ ?_, fun hx ↦ hTf s hs hx⟩
exact by_contra fun hx' ↦ hxv <| mem_biUnion hs ⟨hUf s hs hx, hx'⟩
/-- Let `f : α → β` be a null measurable function
such that a.e. all values of `f` belong to a set `t`
such that the restriction of the `σ`-algebra in the codomain to `t` is countably generated,
then `f` is a.e.-measurable. -/
lemma MeasureTheory.NullMeasurable.aemeasurable_of_aerange {f : α → β} {t : Set β}
[MeasurableSpace.CountablyGenerated t] (h : NullMeasurable f μ) (hft : ∀ᵐ x ∂μ, f x ∈ t) :
AEMeasurable f μ := by
rcases eq_empty_or_nonempty t with rfl | hne
· obtain rfl : μ = 0 := by simpa using hft
apply aemeasurable_zero_measure
· rw [← μ.ae_completion] at hft
obtain ⟨f', hf'm, hf't, hff'⟩ :
∃ f' : α → β, NullMeasurable f' μ ∧ range f' ⊆ t ∧ f =ᵐ[μ] f' :=
h.measurable'.aemeasurable.exists_ae_eq_range_subset hft hne
rw [range_subset_iff] at hf't
lift f' to α → t using hf't
replace hf'm : NullMeasurable f' μ := hf'm.measurable'.subtype_mk
exact (measurable_subtype_coe.comp_aemeasurable hf'm.aemeasurable).congr hff'.symm
namespace MeasureTheory
namespace Measure
lemma map_sum {ι : Type*} {m : ι → Measure α} {f : α → β} (hf : AEMeasurable f (Measure.sum m)) :
Measure.map f (Measure.sum m) = Measure.sum (fun i ↦ Measure.map f (m i)) := by
ext s hs
rw [map_apply_of_aemeasurable hf hs, sum_apply₀ _ (hf.nullMeasurable hs), sum_apply _ hs]
have M i : AEMeasurable f (m i) := hf.mono_measure (le_sum m i)
simp_rw [map_apply_of_aemeasurable (M _) hs]
instance (μ : Measure α) (f : α → β) [SFinite μ] : SFinite (μ.map f) := by
by_cases H : AEMeasurable f μ
· rw [← sum_sfiniteSeq μ] at H ⊢
rw [map_sum H]
infer_instance
· rw [map_of_not_aemeasurable H]
infer_instance
end Measure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/EverywherePos.lean | import Mathlib.MeasureTheory.Group.Measure
import Mathlib.Tactic.Group
import Mathlib.Topology.UrysohnsLemma
/-!
# Everywhere positive sets in measure spaces
A set `s` in a topological space with a measure `μ` is *everywhere positive* (also called
*self-supporting*) if any neighborhood `n` of any point of `s` satisfies `μ (s ∩ n) > 0`.
## Main definitions and results
* `μ.IsEverywherePos s` registers that, for any point in `s`, all its neighborhoods have positive
measure inside `s`.
* `μ.everywherePosSubset s` is the subset of `s` made of those points all of whose neighborhoods
have positive measure inside `s`.
* `everywherePosSubset_ae_eq` shows that `s` and `μ.everywherePosSubset s` coincide almost
everywhere if `μ` is inner regular and `s` is measurable.
* `isEverywherePos_everywherePosSubset` shows that `μ.everywherePosSubset s` satisfies the property
`μ.IsEverywherePos` if `μ` is inner regular and `s` is measurable.
The latter two statements have also versions when `μ` is inner regular for finite measure sets,
assuming additionally that `s` has finite measure.
* `IsEverywherePos.IsGδ` proves that an everywhere positive compact closed set is a Gδ set,
in a topological group with a left-invariant measure. This is a nontrivial statement, used
crucially in the study of the uniqueness of Haar measures.
* `innerRegularWRT_preimage_one_hasCompactSupport_measure_ne_top`: for a Haar measure, any
finite measure set can be approximated from inside by level sets of continuous
compactly supported functions. This property is also known as completion-regularity of Haar
measures.
-/
open scoped Topology ENNReal NNReal
open Set Filter
namespace MeasureTheory.Measure
variable {α : Type*} [TopologicalSpace α] [MeasurableSpace α]
/-- A set `s` is *everywhere positive* (also called *self-supporting*) with respect to a
measure `μ` if it has positive measure around each of its points, i.e., if all neighborhoods `n`
of points of `s` satisfy `μ (s ∩ n) > 0`. -/
def IsEverywherePos (μ : Measure α) (s : Set α) : Prop :=
∀ x ∈ s, ∀ n ∈ 𝓝[s] x, 0 < μ n
/-- The everywhere positive subset of a set is the subset made of those points all of whose
neighborhoods have positive measure inside the set. -/
def everywherePosSubset (μ : Measure α) (s : Set α) : Set α :=
{x | x ∈ s ∧ ∀ n ∈ 𝓝[s] x, 0 < μ n}
lemma everywherePosSubset_subset (μ : Measure α) (s : Set α) : μ.everywherePosSubset s ⊆ s :=
fun _x hx ↦ hx.1
/-- The everywhere positive subset of a set is obtained by removing an open set. -/
lemma exists_isOpen_everywherePosSubset_eq_diff (μ : Measure α) (s : Set α) :
∃ u, IsOpen u ∧ μ.everywherePosSubset s = s \ u := by
refine ⟨{x | ∃ n ∈ 𝓝[s] x, μ n = 0}, ?_, by ext x; simp [everywherePosSubset, zero_lt_iff]⟩
rw [isOpen_iff_mem_nhds]
intro x ⟨n, ns, hx⟩
rcases mem_nhdsWithin_iff_exists_mem_nhds_inter.1 ns with ⟨v, vx, hv⟩
rcases mem_nhds_iff.1 vx with ⟨w, wv, w_open, xw⟩
have A : w ⊆ {x | ∃ n ∈ 𝓝[s] x, μ n = 0} := by
intro y yw
refine ⟨s ∩ w, inter_mem_nhdsWithin _ (w_open.mem_nhds yw), measure_mono_null ?_ hx⟩
rw [inter_comm]
exact (inter_subset_inter_left _ wv).trans hv
have B : w ∈ 𝓝 x := w_open.mem_nhds xw
exact mem_of_superset B A
variable {μ ν : Measure α} {s k : Set α}
protected lemma _root_.MeasurableSet.everywherePosSubset [OpensMeasurableSpace α]
(hs : MeasurableSet s) :
MeasurableSet (μ.everywherePosSubset s) := by
rcases exists_isOpen_everywherePosSubset_eq_diff μ s with ⟨u, u_open, hu⟩
rw [hu]
exact hs.diff u_open.measurableSet
protected lemma _root_.IsClosed.everywherePosSubset (hs : IsClosed s) :
IsClosed (μ.everywherePosSubset s) := by
rcases exists_isOpen_everywherePosSubset_eq_diff μ s with ⟨u, u_open, hu⟩
rw [hu]
exact hs.sdiff u_open
protected lemma _root_.IsCompact.everywherePosSubset (hs : IsCompact s) :
IsCompact (μ.everywherePosSubset s) := by
rcases exists_isOpen_everywherePosSubset_eq_diff μ s with ⟨u, u_open, hu⟩
rw [hu]
exact hs.diff u_open
/-- Any compact set contained in `s \ μ.everywherePosSubset s` has zero measure. -/
lemma measure_eq_zero_of_subset_diff_everywherePosSubset
(hk : IsCompact k) (h'k : k ⊆ s \ μ.everywherePosSubset s) : μ k = 0 := by
apply hk.induction_on (p := fun t ↦ μ t = 0)
· exact measure_empty
· exact fun s t hst ht ↦ measure_mono_null hst ht
· exact fun s t hs ht ↦ measure_union_null hs ht
· intro x hx
obtain ⟨u, ux, hu⟩ : ∃ u ∈ 𝓝[s] x, μ u = 0 := by
simpa [everywherePosSubset, (h'k hx).1] using (h'k hx).2
exact ⟨u, nhdsWithin_mono x (h'k.trans diff_subset) ux, hu⟩
/-- In a space with an inner regular measure, any measurable set coincides almost everywhere with
its everywhere positive subset. -/
lemma everywherePosSubset_ae_eq [OpensMeasurableSpace α] [InnerRegular μ] (hs : MeasurableSet s) :
μ.everywherePosSubset s =ᵐ[μ] s := by
simp only [ae_eq_set, diff_eq_empty.mpr (everywherePosSubset_subset μ s), measure_empty,
true_and, (hs.diff hs.everywherePosSubset).measure_eq_iSup_isCompact, ENNReal.iSup_eq_zero]
intro k hk h'k
exact measure_eq_zero_of_subset_diff_everywherePosSubset h'k hk
/-- In a space with an inner regular measure for finite measure sets, any measurable set of finite
measure coincides almost everywhere with its everywhere positive subset. -/
lemma everywherePosSubset_ae_eq_of_measure_ne_top
[OpensMeasurableSpace α] [InnerRegularCompactLTTop μ] (hs : MeasurableSet s) (h's : μ s ≠ ∞) :
μ.everywherePosSubset s =ᵐ[μ] s := by
have A : μ (s \ μ.everywherePosSubset s) ≠ ∞ :=
((measure_mono diff_subset).trans_lt h's.lt_top).ne
simp only [ae_eq_set, diff_eq_empty.mpr (everywherePosSubset_subset μ s), measure_empty,
true_and, (hs.diff hs.everywherePosSubset).measure_eq_iSup_isCompact_of_ne_top A,
ENNReal.iSup_eq_zero]
intro k hk h'k
exact measure_eq_zero_of_subset_diff_everywherePosSubset h'k hk
/-- In a space with an inner regular measure, the everywhere positive subset of a measurable set
is itself everywhere positive. This is not obvious as `μ.everywherePosSubset s` is defined as
the points whose neighborhoods intersect `s` along positive measure subsets, but this does not
say they also intersect `μ.everywherePosSubset s` along positive measure subsets. -/
lemma isEverywherePos_everywherePosSubset
[OpensMeasurableSpace α] [InnerRegular μ] (hs : MeasurableSet s) :
μ.IsEverywherePos (μ.everywherePosSubset s) := by
intro x hx n hn
rcases mem_nhdsWithin_iff_exists_mem_nhds_inter.1 hn with ⟨u, u_mem, hu⟩
have A : 0 < μ (u ∩ s) := by
have : u ∩ s ∈ 𝓝[s] x := by rw [inter_comm]; exact inter_mem_nhdsWithin s u_mem
exact hx.2 _ this
have B : (u ∩ μ.everywherePosSubset s : Set α) =ᵐ[μ] (u ∩ s : Set α) :=
ae_eq_set_inter (ae_eq_refl _) (everywherePosSubset_ae_eq hs)
rw [← B.measure_eq] at A
exact A.trans_le (measure_mono hu)
/-- In a space with an inner regular measure for finite measure sets, the everywhere positive subset
of a measurable set of finite measure is itself everywhere positive. This is not obvious as
`μ.everywherePosSubset s` is defined as the points whose neighborhoods intersect `s` along positive
measure subsets, but this does not say they also intersect `μ.everywherePosSubset s` along positive
measure subsets. -/
lemma isEverywherePos_everywherePosSubset_of_measure_ne_top
[OpensMeasurableSpace α] [InnerRegularCompactLTTop μ] (hs : MeasurableSet s) (h's : μ s ≠ ∞) :
μ.IsEverywherePos (μ.everywherePosSubset s) := by
intro x hx n hn
rcases mem_nhdsWithin_iff_exists_mem_nhds_inter.1 hn with ⟨u, u_mem, hu⟩
have A : 0 < μ (u ∩ s) := by
have : u ∩ s ∈ 𝓝[s] x := by rw [inter_comm]; exact inter_mem_nhdsWithin s u_mem
exact hx.2 _ this
have B : (u ∩ μ.everywherePosSubset s : Set α) =ᵐ[μ] (u ∩ s : Set α) :=
ae_eq_set_inter (ae_eq_refl _) (everywherePosSubset_ae_eq_of_measure_ne_top hs h's)
rw [← B.measure_eq] at A
exact A.trans_le (measure_mono hu)
lemma IsEverywherePos.smul_measure (hs : IsEverywherePos μ s) {c : ℝ≥0∞} (hc : c ≠ 0) :
IsEverywherePos (c • μ) s :=
fun x hx n hn ↦ by simpa [hc.bot_lt, hs x hx n hn] using hc.bot_lt
lemma IsEverywherePos.smul_measure_nnreal (hs : IsEverywherePos μ s) {c : ℝ≥0} (hc : c ≠ 0) :
IsEverywherePos (c • μ) s :=
hs.smul_measure (by simpa using hc)
/-- If two measures coincide locally, then a set which is everywhere positive for the former is
also everywhere positive for the latter. -/
lemma IsEverywherePos.of_forall_exists_nhds_eq (hs : IsEverywherePos μ s)
(h : ∀ x ∈ s, ∃ t ∈ 𝓝 x, ∀ u ⊆ t, ν u = μ u) : IsEverywherePos ν s := by
intro x hx n hn
rcases h x hx with ⟨t, t_mem, ht⟩
grw [← inter_subset_left (s := n)]
rw [ht (n ∩ t) inter_subset_right]
exact hs x hx _ (inter_mem hn (mem_nhdsWithin_of_mem_nhds t_mem))
/-- If two measures coincide locally, then a set is everywhere positive for the former iff it is
everywhere positive for the latter. -/
lemma isEverywherePos_iff_of_forall_exists_nhds_eq (h : ∀ x ∈ s, ∃ t ∈ 𝓝 x, ∀ u ⊆ t, ν u = μ u) :
IsEverywherePos ν s ↔ IsEverywherePos μ s := by
refine ⟨fun H ↦ H.of_forall_exists_nhds_eq ?_, fun H ↦ H.of_forall_exists_nhds_eq h⟩
intro x hx
rcases h x hx with ⟨t, ht, h't⟩
exact ⟨t, ht, fun u hu ↦ (h't u hu).symm⟩
/-- An open set is everywhere positive for a measure which is positive on open sets. -/
lemma _root_.IsOpen.isEverywherePos [IsOpenPosMeasure μ] (hs : IsOpen s) : IsEverywherePos μ s := by
intro x xs n hn
rcases mem_nhdsWithin.1 hn with ⟨u, u_open, xu, hu⟩
apply lt_of_lt_of_le _ (measure_mono hu)
exact (u_open.inter hs).measure_pos μ ⟨x, ⟨xu, xs⟩⟩
section IsTopologicalGroup
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
[LocallyCompactSpace G] [MeasurableSpace G] [BorelSpace G] {μ : Measure G}
[IsMulLeftInvariant μ] [IsFiniteMeasureOnCompacts μ] [InnerRegularCompactLTTop μ]
open Pointwise
/-- If a compact closed set is everywhere positive with respect to a left-invariant measure on a
topological group, then it is a Gδ set. This is nontrivial, as there is no second-countability or
metrizability assumption in the statement, so a general compact closed set has no reason to be
a countable intersection of open sets. -/
@[to_additive]
lemma IsEverywherePos.IsGdelta_of_isMulLeftInvariant
{k : Set G} (h : μ.IsEverywherePos k) (hk : IsCompact k) (h'k : IsClosed k) :
IsGδ k := by
/- Consider a decreasing sequence of open neighborhoods `Vₙ` of the identity, such that `g k \ k`
has small measure for all `g ∈ Vₙ`. We claim that `k = ⋂ Vₙ k`, which proves
the lemma as the sets on the right are open. The inclusion `⊆` is trivial.
Let us show the converse. Take `x` in the intersection. For each `n`, write `x = vₙ yₙ` with
`vₙ ∈ Vₙ` and `yₙ ∈ k`. Let `z ∈ k` be a cluster value of `yₙ`, by compactness. As multiplication
by `vₙ = x yₙ⁻¹ ∈ Vₙ` changes the measure of `k` by very little, passing to the limit we get
`μ (x z⁻¹ k \ k) = 0`. By invariance of the measure under `z x ⁻¹`, we get `μ (k \ z x⁻¹ k) = 0`.
Assume `x ∉ k`. Then `z ∈ k \ z x⁻¹ k`. Even more, this set is a neighborhood of `z` within `k`
(as `z x⁻¹ k` is closed), and it has zero measure. This contradicts the fact that `k` has
positive measure around the point `z`. -/
obtain ⟨u, -, u_mem, u_lim⟩ : ∃ u, StrictAnti u ∧ (∀ (n : ℕ), u n ∈ Ioo 0 1)
∧ Tendsto u atTop (𝓝 0) := exists_seq_strictAnti_tendsto' (zero_lt_one : (0 : ℝ≥0∞) < 1)
have : ∀ n, ∃ (W : Set G), IsOpen W ∧ 1 ∈ W ∧ ∀ g ∈ W * W, μ ((g • k) \ k) < u n :=
fun n ↦ exists_open_nhds_one_mul_subset
(eventually_nhds_one_measure_smul_diff_lt hk h'k (u_mem n).1.ne')
choose W W_open mem_W hW using this
let V n := ⋂ i ∈ Finset.range n, W i
suffices ⋂ n, V n * k ⊆ k by
replace : k = ⋂ n, V n * k := by
apply Subset.antisymm (subset_iInter_iff.2 (fun n ↦ ?_)) this
exact subset_mul_right k (by simp [V, mem_W])
rw [this]
refine .iInter_of_isOpen fun n ↦ ?_
exact .mul_right (isOpen_biInter_finset (fun i _hi ↦ W_open i))
intro x hx
choose v hv y hy hvy using mem_iInter.1 hx
obtain ⟨z, zk, hz⟩ : ∃ z ∈ k, MapClusterPt z atTop y := hk.exists_mapClusterPt (by simp [hy])
have A n : μ (((x * z ⁻¹) • k) \ k) ≤ u n := by
apply le_of_lt (hW _ _ ?_)
have : W n * {z} ∈ 𝓝 z := (IsOpen.mul_right (W_open n)).mem_nhds (by simp [mem_W])
obtain ⟨i, hi, ni⟩ : ∃ i, y i ∈ W n * {z} ∧ n < i :=
((hz.frequently this).and_eventually (eventually_gt_atTop n)).exists
refine ⟨x * (y i) ⁻¹, ?_, y i * z⁻¹, by simpa using hi, by group⟩
have I : V i ⊆ W n := iInter₂_subset n (by simp [ni])
have J : x * (y i) ⁻¹ ∈ V i := by simpa [← hvy i] using hv i
exact I J
have B : μ (((x * z ⁻¹) • k) \ k) = 0 :=
le_antisymm (ge_of_tendsto u_lim (Eventually.of_forall A)) bot_le
have C : μ (k \ (z * x⁻¹) • k) = 0 := by
have : μ ((z * x⁻¹) • (((x * z ⁻¹) • k) \ k)) = 0 := by rwa [measure_smul]
rw [← this, smul_set_sdiff, smul_smul]
group
simp
by_contra H
have : k ∩ ((z * x⁻¹) • k)ᶜ ∈ 𝓝[k] z := by
apply inter_mem_nhdsWithin k
apply IsOpen.mem_nhds (by simpa using h'k.smul _)
simp only [mem_compl_iff]
contrapose! H
simpa [mem_smul_set_iff_inv_smul_mem] using H
have : 0 < μ (k \ ((z * x⁻¹) • k)) := h z zk _ this
exact lt_irrefl _ (C.le.trans_lt this)
/-- **Halmos' theorem: Haar measure is completion regular.** More precisely, any finite measure
set can be approximated from inside by a level set of a continuous function with compact support. -/
@[to_additive innerRegularWRT_preimage_one_hasCompactSupport_measure_ne_top_of_addGroup]
theorem innerRegularWRT_preimage_one_hasCompactSupport_measure_ne_top_of_group :
InnerRegularWRT μ (fun s ↦ ∃ (f : G → ℝ), Continuous f ∧ HasCompactSupport f ∧ s = f ⁻¹' {1})
(fun s ↦ MeasurableSet s ∧ μ s ≠ ∞) := by
/- First, approximate a measurable set from inside by a compact closed set `K`. Then notice that
the everywhere positive subset of `K` is a Gδ,
by Lemma `IsEverywherePos.IsGdelta_of_isMulLeftInvariant`, and therefore the level set of a
continuous compactly supported function. Moreover, it has the same measure as `K`. -/
apply InnerRegularWRT.trans _ innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group
intro K ⟨K_comp, K_closed⟩ r hr
let L := μ.everywherePosSubset K
have L_comp : IsCompact L := K_comp.everywherePosSubset
have L_closed : IsClosed L := K_closed.everywherePosSubset
refine ⟨L, everywherePosSubset_subset μ K, ?_, ?_⟩
· have : μ.IsEverywherePos L :=
isEverywherePos_everywherePosSubset_of_measure_ne_top K_closed.measurableSet
K_comp.measure_lt_top.ne
have L_Gδ : IsGδ L := this.IsGdelta_of_isMulLeftInvariant L_comp L_closed
obtain ⟨⟨f, f_cont⟩, Lf, -, f_comp, -⟩ : ∃ f : C(G, ℝ), L = f ⁻¹' {1} ∧ EqOn f 0 ∅
∧ HasCompactSupport f ∧ ∀ x, f x ∈ Icc (0 : ℝ) 1 :=
exists_continuous_one_zero_of_isCompact_of_isGδ L_comp L_Gδ isClosed_empty
(disjoint_empty L)
exact ⟨f, f_cont, f_comp, Lf⟩
· convert hr using 1
apply measure_congr
exact everywherePosSubset_ae_eq_of_measure_ne_top K_closed.measurableSet
K_comp.measure_lt_top.ne
end IsTopologicalGroup
end Measure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/LevyProkhorovMetric.lean | import Mathlib.MeasureTheory.Measure.Portmanteau
import Mathlib.MeasureTheory.Integral.DominatedConvergence
import Mathlib.MeasureTheory.Integral.Layercake
import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction
/-!
# The Lévy-Prokhorov distance on spaces of finite measures and probability measures
## Main definitions
* `MeasureTheory.levyProkhorovEDist`: The Lévy-Prokhorov edistance between two measures.
* `MeasureTheory.levyProkhorovDist`: The Lévy-Prokhorov distance between two finite measures.
## Main results
* `LevyProkhorov.instPseudoMetricSpaceFiniteMeasure`: The Lévy-Prokhorov distance is a
pseudometric on the space of finite measures.
* `LevyProkhorov.instPseudoMetricSpaceProbabilityMeasure`: The Lévy-Prokhorov distance is a
pseudometric on the space of probability measures.
* `LevyProkhorov.le_convergenceInDistribution`: The topology of the Lévy-Prokhorov metric on
probability measures is always at least as fine as the topology of convergence in distribution.
* `LevyProkhorov.eq_convergenceInDistribution`: The topology of the Lévy-Prokhorov metric on
probability measures on a separable space coincides with the topology of convergence in
distribution, and in particular convergence in distribution is then pseudometrizable.
## Tags
finite measure, probability measure, weak convergence, convergence in distribution, metrizability
-/
open Topology Metric Filter Set ENNReal NNReal
namespace MeasureTheory
open scoped Topology ENNReal NNReal BoundedContinuousFunction
section Levy_Prokhorov
/-! ### Lévy-Prokhorov metric -/
variable {Ω : Type*} [MeasurableSpace Ω] [PseudoEMetricSpace Ω]
/-- The Lévy-Prokhorov edistance between measures:
`d(μ,ν) = inf {r ≥ 0 | ∀ B, μ B ≤ ν Bᵣ + r ∧ ν B ≤ μ Bᵣ + r}`. -/
noncomputable def levyProkhorovEDist (μ ν : Measure Ω) : ℝ≥0∞ :=
sInf {ε | ∀ B, MeasurableSet B →
μ B ≤ ν (thickening ε.toReal B) + ε ∧ ν B ≤ μ (thickening ε.toReal B) + ε}
/- This result is not placed in earlier more generic files, since it is rather specialized;
it mixes measure and metric in a very particular way. -/
lemma meas_le_of_le_of_forall_le_meas_thickening_add {ε₁ ε₂ : ℝ≥0∞} (μ ν : Measure Ω)
(h_le : ε₁ ≤ ε₂) {B : Set Ω} (hε₁ : μ B ≤ ν (thickening ε₁.toReal B) + ε₁) :
μ B ≤ ν (thickening ε₂.toReal B) + ε₂ := by
by_cases ε_top : ε₂ = ∞
· simp only [ε_top, toReal_top,
add_top, le_top]
apply hε₁.trans (add_le_add ?_ h_le)
exact measure_mono (μ := ν) (thickening_mono (toReal_mono ε_top h_le) B)
lemma left_measure_le_of_levyProkhorovEDist_lt {μ ν : Measure Ω} {c : ℝ≥0∞}
(h : levyProkhorovEDist μ ν < c) {B : Set Ω} (B_mble : MeasurableSet B) :
μ B ≤ ν (thickening c.toReal B) + c := by
obtain ⟨c', ⟨hc', lt_c⟩⟩ := sInf_lt_iff.mp h
exact meas_le_of_le_of_forall_le_meas_thickening_add μ ν lt_c.le (hc' B B_mble).1
lemma right_measure_le_of_levyProkhorovEDist_lt {μ ν : Measure Ω} {c : ℝ≥0∞}
(h : levyProkhorovEDist μ ν < c) {B : Set Ω} (B_mble : MeasurableSet B) :
ν B ≤ μ (thickening c.toReal B) + c := by
obtain ⟨c', ⟨hc', lt_c⟩⟩ := sInf_lt_iff.mp h
exact meas_le_of_le_of_forall_le_meas_thickening_add ν μ lt_c.le (hc' B B_mble).2
/-- A general sufficient condition for bounding `levyProkhorovEDist` from above. -/
lemma levyProkhorovEDist_le_of_forall_add_pos_le (μ ν : Measure Ω) (δ : ℝ≥0∞)
(h : ∀ ε B, 0 < ε → ε < ∞ → MeasurableSet B →
μ B ≤ ν (thickening (δ + ε).toReal B) + δ + ε ∧
ν B ≤ μ (thickening (δ + ε).toReal B) + δ + ε) :
levyProkhorovEDist μ ν ≤ δ := by
apply ENNReal.le_of_forall_pos_le_add
intro ε hε _
by_cases ε_top : ε = ∞
· simp only [ε_top, add_top, le_top]
apply sInf_le
intro B B_mble
simpa only [add_assoc] using h ε B (by positivity) coe_lt_top B_mble
/-- A simple general sufficient condition for bounding `levyProkhorovEDist` from above. -/
lemma levyProkhorovEDist_le_of_forall (μ ν : Measure Ω) (δ : ℝ≥0∞)
(h : ∀ ε B, δ < ε → ε < ∞ → MeasurableSet B →
μ B ≤ ν (thickening ε.toReal B) + ε ∧ ν B ≤ μ (thickening ε.toReal B) + ε) :
levyProkhorovEDist μ ν ≤ δ := by
by_cases δ_top : δ = ∞
· simp only [δ_top, le_top]
apply levyProkhorovEDist_le_of_forall_add_pos_le
intro x B x_pos x_lt_top B_mble
simpa only [← add_assoc] using h (δ + x) B (ENNReal.lt_add_right δ_top x_pos.ne.symm)
(by simp only [add_lt_top, Ne.lt_top δ_top, x_lt_top, and_self]) B_mble
lemma levyProkhorovEDist_le_max_measure_univ (μ ν : Measure Ω) :
levyProkhorovEDist μ ν ≤ max (μ univ) (ν univ) := by
refine sInf_le fun B _ ↦ ⟨?_, ?_⟩ <;> apply le_add_left <;> simp [measure_mono]
@[simp] lemma levyProkhorovEDist_lt_top (μ ν : Measure Ω) [IsFiniteMeasure μ] [IsFiniteMeasure ν] :
levyProkhorovEDist μ ν < ∞ :=
(levyProkhorovEDist_le_max_measure_univ μ ν).trans_lt <| by simp [measure_lt_top]
@[simp] lemma levyProkhorovEDist_ne_top (μ ν : Measure Ω) [IsFiniteMeasure μ] [IsFiniteMeasure ν] :
levyProkhorovEDist μ ν ≠ ∞ := (levyProkhorovEDist_lt_top μ ν).ne
@[simp] lemma levyProkhorovEDist_self (μ : Measure Ω) : levyProkhorovEDist μ μ = 0 := by
rw [← nonpos_iff_eq_zero, ← csInf_Ioo zero_lt_top]
refine sInf_le_sInf fun ε ⟨hε₀, hε_top⟩ B _ ↦ and_self_iff.2 ?_
refine le_add_right <| measure_mono <| self_subset_thickening ?_ _
exact ENNReal.toReal_pos hε₀.ne' hε_top.ne
lemma levyProkhorovEDist_comm (μ ν : Measure Ω) :
levyProkhorovEDist μ ν = levyProkhorovEDist ν μ := by
simp only [levyProkhorovEDist, and_comm]
lemma levyProkhorovEDist_triangle [OpensMeasurableSpace Ω] (μ ν κ : Measure Ω) :
levyProkhorovEDist μ κ ≤ levyProkhorovEDist μ ν + levyProkhorovEDist ν κ := by
by_cases LPμν_finite : levyProkhorovEDist μ ν = ∞
· simp [LPμν_finite]
by_cases LPνκ_finite : levyProkhorovEDist ν κ = ∞
· simp [LPνκ_finite]
apply levyProkhorovEDist_le_of_forall_add_pos_le
intro ε B ε_pos ε_lt_top B_mble
have half_ε_pos : 0 < ε / 2 := ENNReal.div_pos ε_pos.ne' ofNat_ne_top
let r := levyProkhorovEDist μ ν + ε / 2
let s := levyProkhorovEDist ν κ + ε / 2
have lt_r : levyProkhorovEDist μ ν < r := lt_add_right LPμν_finite half_ε_pos.ne'
have lt_s : levyProkhorovEDist ν κ < s := lt_add_right LPνκ_finite half_ε_pos.ne'
have hs_add_r : s + r = levyProkhorovEDist μ ν + levyProkhorovEDist ν κ + ε := by
simp_rw [s, r, add_assoc, add_comm (ε / 2), add_assoc, ENNReal.add_halves, ← add_assoc,
add_comm (levyProkhorovEDist μ ν)]
have hs_add_r' : s.toReal + r.toReal
= (levyProkhorovEDist μ ν + levyProkhorovEDist ν κ + ε).toReal := by
rw [← hs_add_r, ← ENNReal.toReal_add]
· finiteness
· finiteness
rw [← hs_add_r', add_assoc, ← hs_add_r, add_assoc _ _ ε, ← hs_add_r]
refine ⟨?_, ?_⟩
· calc μ B ≤ ν (thickening r.toReal B) + r :=
left_measure_le_of_levyProkhorovEDist_lt lt_r B_mble
_ ≤ κ (thickening s.toReal (thickening r.toReal B)) + s + r := by
grw [left_measure_le_of_levyProkhorovEDist_lt lt_s isOpen_thickening.measurableSet]
_ = κ (thickening s.toReal (thickening r.toReal B)) + (s + r) := add_assoc _ _ _
_ ≤ κ (thickening (s.toReal + r.toReal) B) + (s + r) := by grw [thickening_thickening_subset]
· calc κ B ≤ ν (thickening s.toReal B) + s :=
right_measure_le_of_levyProkhorovEDist_lt lt_s B_mble
_ ≤ μ (thickening r.toReal (thickening s.toReal B)) + r + s := by
grw [right_measure_le_of_levyProkhorovEDist_lt lt_r isOpen_thickening.measurableSet]
_ = μ (thickening r.toReal (thickening s.toReal B)) + (s + r) := by rw [add_assoc, add_comm r]
_ ≤ μ (thickening (r.toReal + s.toReal) B) + (s + r) := by grw [thickening_thickening_subset]
_ = μ (thickening (s.toReal + r.toReal) B) + (s + r) := by rw [add_comm r.toReal]
/-- The Lévy-Prokhorov distance between finite measures:
`d(μ,ν) = inf {r ≥ 0 | ∀ B, μ B ≤ ν Bᵣ + r ∧ ν B ≤ μ Bᵣ + r}`. -/
noncomputable def levyProkhorovDist (μ ν : Measure Ω) : ℝ :=
(levyProkhorovEDist μ ν).toReal
lemma levyProkhorovDist_self (μ : Measure Ω) :
levyProkhorovDist μ μ = 0 := by
simp only [levyProkhorovDist, levyProkhorovEDist_self, toReal_zero]
lemma levyProkhorovDist_comm (μ ν : Measure Ω) :
levyProkhorovDist μ ν = levyProkhorovDist ν μ := by
simp only [levyProkhorovDist, levyProkhorovEDist_comm]
lemma levyProkhorovDist_triangle [OpensMeasurableSpace Ω] (μ ν κ : Measure Ω)
[IsFiniteMeasure μ] [IsFiniteMeasure ν] [IsFiniteMeasure κ] :
levyProkhorovDist μ κ ≤ levyProkhorovDist μ ν + levyProkhorovDist ν κ := by
have dμν_finite := (levyProkhorovEDist_lt_top μ ν).ne
have dνκ_finite := (levyProkhorovEDist_lt_top ν κ).ne
convert ENNReal.toReal_mono ?_ <| levyProkhorovEDist_triangle μ ν κ
· simp only [levyProkhorovDist, ENNReal.toReal_add dμν_finite dνκ_finite]
· exact ENNReal.add_ne_top.mpr ⟨dμν_finite, dνκ_finite⟩
variable [OpensMeasurableSpace Ω]
lemma measure_le_measure_closure_of_levyProkhorovEDist_eq_zero {μ ν : Measure Ω}
(hLP : levyProkhorovEDist μ ν = 0) {s : Set Ω} (s_mble : MeasurableSet s)
(h_finite : ∃ δ > 0, ν (thickening δ s) ≠ ∞) :
μ s ≤ ν (closure s) := by
have key : Tendsto (fun ε ↦ ν (thickening ε.toReal s)) (𝓝[>] (0 : ℝ≥0∞)) (𝓝 (ν (closure s))) := by
have aux : Tendsto ENNReal.toReal (𝓝[>] 0) (𝓝[>] 0) := by
apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within (s := Ioi 0) ENNReal.toReal
· exact tendsto_nhdsWithin_of_tendsto_nhds (continuousAt_toReal zero_ne_top).tendsto
· filter_upwards [Ioo_mem_nhdsGT zero_lt_one] with x hx
exact toReal_pos hx.1.ne' <| ne_top_of_lt hx.2
exact (tendsto_measure_thickening h_finite).comp aux
have obs := Tendsto.add key (tendsto_nhdsWithin_of_tendsto_nhds tendsto_id)
simp only [id_eq, add_zero] at obs
apply ge_of_tendsto (b := μ s) obs
filter_upwards [self_mem_nhdsWithin] with ε ε_pos
exact left_measure_le_of_levyProkhorovEDist_lt (B_mble := s_mble) (hLP ▸ ε_pos)
/-- Two measures at vanishing Lévy-Prokhorov distance from each other assign the same values to all
closed sets. -/
lemma measure_eq_measure_of_levyProkhorovEDist_eq_zero_of_isClosed {μ ν : Measure Ω}
(hLP : levyProkhorovEDist μ ν = 0) {s : Set Ω} (s_closed : IsClosed s)
(hμs : ∃ δ > 0, μ (thickening δ s) ≠ ∞) (hνs : ∃ δ > 0, ν (thickening δ s) ≠ ∞) :
μ s = ν s := by
apply le_antisymm
· exact measure_le_measure_closure_of_levyProkhorovEDist_eq_zero
hLP s_closed.measurableSet hνs |>.trans <|
le_of_eq (congr_arg _ s_closed.closure_eq)
· exact measure_le_measure_closure_of_levyProkhorovEDist_eq_zero
(levyProkhorovEDist_comm μ ν ▸ hLP) s_closed.measurableSet hμs |>.trans <|
le_of_eq (congr_arg _ s_closed.closure_eq)
/-- A simple sufficient condition for bounding `levyProkhorovEDist` between probability measures
from above. The condition involves only one of two natural bounds, the other bound is for free. -/
lemma levyProkhorovEDist_le_of_forall_le
(μ ν : Measure Ω) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (δ : ℝ≥0∞)
(h : ∀ ε B, δ < ε → ε < ∞ → MeasurableSet B → μ B ≤ ν (thickening ε.toReal B) + ε) :
levyProkhorovEDist μ ν ≤ δ := by
apply levyProkhorovEDist_le_of_forall μ ν δ
intro ε B ε_gt ε_lt_top B_mble
refine ⟨h ε B ε_gt ε_lt_top B_mble, ?_⟩
have B_subset := subset_compl_thickening_compl_thickening_self ε.toReal B
apply (measure_mono (μ := ν) B_subset).trans
rw [prob_compl_eq_one_sub isOpen_thickening.measurableSet]
have Tc_mble := (isOpen_thickening (δ := ε.toReal) (E := B)).isClosed_compl.measurableSet
specialize h ε (thickening ε.toReal B)ᶜ ε_gt ε_lt_top Tc_mble
rw [prob_compl_eq_one_sub isOpen_thickening.measurableSet] at h
have almost := add_le_add (c := μ (thickening ε.toReal B)) h rfl.le
rw [tsub_add_cancel_of_le prob_le_one, add_assoc] at almost
apply (tsub_le_tsub_right almost _).trans
rw [ENNReal.add_sub_cancel_left (measure_ne_top ν _), add_comm ε]
/-- A simple sufficient condition for bounding `levyProkhorovDist` between probability measures
from above. The condition involves only one of two natural bounds, the other bound is for free. -/
lemma levyProkhorovDist_le_of_forall_le
(μ ν : Measure Ω) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] {δ : ℝ} (δ_nn : 0 ≤ δ)
(h : ∀ ε B, δ < ε → MeasurableSet B → μ B ≤ ν (thickening ε B) + ENNReal.ofReal ε) :
levyProkhorovDist μ ν ≤ δ := by
apply toReal_le_of_le_ofReal δ_nn
apply levyProkhorovEDist_le_of_forall_le
intro ε B ε_gt ε_lt_top B_mble
have ε_gt' : δ < ε.toReal := by
refine (ofReal_lt_ofReal_iff ?_).mp ?_
· exact ENNReal.toReal_pos (ne_zero_of_lt ε_gt) ε_lt_top.ne
· simpa [ofReal_toReal_eq_iff.mpr ε_lt_top.ne] using ε_gt
convert h ε.toReal B ε_gt' B_mble
exact (ENNReal.ofReal_toReal ε_lt_top.ne).symm
/-! ### Equipping measures with the Lévy-Prokhorov metric -/
/-- A type synonym, to be used for `Measure α`, `FiniteMeasure α`, or `ProbabilityMeasure α`,
when they are to be equipped with the Lévy-Prokhorov distance. -/
structure LevyProkhorov (α : Type*) where
/-- Turn a measure into the corresponding element of the space of measures equipped with the
Lévy-Prokhorov metric. -/
ofMeasure ::
/-- Turn an element of the space of measure equipped with the Lévy-Prokhorov metric into the
corresponding measure. -/
toMeasure : α
open Lean.PrettyPrinter.Delaborator in
/-- This prevents `ofMeasure x` being printed as `{ toMeasure := x }` by `delabStructureInstance`.
-/
@[app_delab LevyProkhorov.ofMeasure]
def LevyProkhorov.delabOfMeasure : Delab := delabApp
namespace LevyProkhorov
lemma toMeasure_injective {α : Type*} : (toMeasure : LevyProkhorov α → α).Injective :=
fun ⟨μ⟩ ⟨ν⟩ => by congr!
/-- `LevyProkhorov.toMeasure` as an equiv. -/
@[simps]
def toMeasureEquiv {α : Type*} : LevyProkhorov α ≃ α where
toFun := toMeasure
invFun := ofMeasure
@[deprecated (since := "2025-10-28")] alias equiv := toMeasureEquiv
/-- The Lévy-Prokhorov distance `levyProkhorovEDist` makes `Measure Ω` a pseudoemetric
space. The instance is recorded on the type synonym `LevyProkhorov (Measure Ω) := Measure Ω`. -/
noncomputable instance instPseudoEMetricSpaceMeasure :
PseudoEMetricSpace (LevyProkhorov (Measure Ω)) where
edist μ ν := levyProkhorovEDist μ.toMeasure ν.toMeasure
edist_self _ := levyProkhorovEDist_self _
edist_comm _ _ := levyProkhorovEDist_comm ..
edist_triangle _ _ _ := levyProkhorovEDist_triangle ..
/-- The Lévy-Prokhorov distance `levyProkhorovDist` makes `FiniteMeasure Ω` a pseudometric
space. The instance is recorded on the type synonym
`LevyProkhorov (FiniteMeasure Ω) := FiniteMeasure Ω`. -/
noncomputable instance instPseudoMetricSpaceFiniteMeasure :
PseudoMetricSpace (LevyProkhorov (FiniteMeasure Ω)) where
edist μ ν := levyProkhorovEDist μ.toMeasure.toMeasure ν.toMeasure.toMeasure
dist μ ν := levyProkhorovDist μ.toMeasure.toMeasure ν.toMeasure.toMeasure
dist_self _ := levyProkhorovDist_self _
dist_comm _ _ := levyProkhorovDist_comm ..
dist_triangle _ _ _ := levyProkhorovDist_triangle ..
edist_dist μ ν := by simp [levyProkhorovDist, levyProkhorovEDist_ne_top]
/-- The Lévy-Prokhorov distance `levyProkhorovDist` makes `ProbabilityMeasure Ω` a pseudometric
space. The instance is recorded on the type synonym
`LevyProkhorov (ProbabilityMeasure Ω) := ProbabilityMeasure Ω`.
Note: For this pseudometric to give the topology of convergence in distribution, one must
furthermore assume that `Ω` is separable. -/
noncomputable instance instPseudoMetricSpaceProbabilityMeasure :
PseudoMetricSpace (LevyProkhorov (ProbabilityMeasure Ω)) :=
.induced (LevyProkhorov.ofMeasure ·.toMeasure.toFiniteMeasure) inferInstance
lemma edist_measure_def (μ ν : LevyProkhorov (Measure Ω)) :
edist μ ν = levyProkhorovEDist μ.toMeasure ν.toMeasure := rfl
lemma edist_finiteMeasure_def (μ ν : LevyProkhorov (FiniteMeasure Ω)) :
edist μ ν = levyProkhorovEDist μ.toMeasure.toMeasure ν.toMeasure.toMeasure := rfl
lemma dist_finiteMeasure_def (μ ν : LevyProkhorov (FiniteMeasure Ω)) :
dist μ ν = levyProkhorovDist μ.toMeasure.toMeasure ν.toMeasure.toMeasure := rfl
lemma edist_probabilityMeasure_def (μ ν : LevyProkhorov (ProbabilityMeasure Ω)) :
edist μ ν = levyProkhorovEDist μ.toMeasure.toMeasure ν.toMeasure.toMeasure := rfl
lemma dist_probabilityMeasure_def (μ ν : LevyProkhorov (ProbabilityMeasure Ω)) :
dist μ ν = levyProkhorovDist μ.toMeasure.toMeasure ν.toMeasure.toMeasure := rfl
@[deprecated (since := "2025-10-28")] alias dist_def := dist_probabilityMeasure_def
/-- If `Ω` is a Borel space, then the Lévy-Prokhorov distance `levyProkhorovDist` makes
`ProbabilityMeasure Ω` into a metric space. The instance is recorded on the type synonym
`LevyProkhorov (ProbabilityMeasure Ω) := ProbabilityMeasure Ω`.
Note: For this metric to give the topology of convergence in distribution, one must
furthermore assume that `Ω` is separable. -/
noncomputable instance levyProkhorovDist_metricSpace_probabilityMeasure [BorelSpace Ω] :
MetricSpace (LevyProkhorov (ProbabilityMeasure Ω)) where
eq_of_dist_eq_zero {μ ν} h := by
apply toMeasure_injective
apply ProbabilityMeasure.toMeasure_injective
refine ext_of_generate_finite _ ?_ isPiSystem_isClosed (fun A hA ↦ ?_) (by simp)
· rw [BorelSpace.measurable_eq (α := Ω), borel_eq_generateFrom_isClosed]
refine measure_eq_measure_of_levyProkhorovEDist_eq_zero_of_isClosed ?_ hA ?_ ?_
· simpa [dist_probabilityMeasure_def, levyProkhorovDist, toReal_eq_zero_iff] using h
· exact ⟨1, Real.zero_lt_one, measure_ne_top _ _⟩
· exact ⟨1, Real.zero_lt_one, measure_ne_top _ _⟩
end LevyProkhorov
end Levy_Prokhorov --section
section Levy_Prokhorov_is_finer
/-! ### The Lévy-Prokhorov topology is at least as fine as convergence in distribution -/
open BoundedContinuousFunction
variable {Ω : Type*} [MeasurableSpace Ω]
variable [PseudoMetricSpace Ω] [OpensMeasurableSpace Ω]
/-- A version of the layer cake formula for bounded continuous functions which have finite integral:
∫ f dμ = ∫ t in (0, ‖f‖], μ {x | f(x) ≥ t} dt. -/
lemma BoundedContinuousFunction.integral_eq_integral_meas_le_of_hasFiniteIntegral
{α : Type*} [MeasurableSpace α] [TopologicalSpace α] [OpensMeasurableSpace α]
(f : α →ᵇ ℝ) (μ : Measure α) (f_nn : 0 ≤ᵐ[μ] f) (hf : HasFiniteIntegral f μ) :
∫ ω, f ω ∂μ = ∫ t in Ioc 0 ‖f‖, μ.real {a : α | t ≤ f a} := by
rw [Integrable.integral_eq_integral_Ioc_meas_le (M := ‖f‖) ?_ f_nn ?_]
· exact ⟨f.continuous.measurable.aestronglyMeasurable, hf⟩
· exact Eventually.of_forall (fun x ↦ BoundedContinuousFunction.apply_le_norm f x)
/-- A version of the layer cake formula for bounded continuous functions and finite measures:
∫ f dμ = ∫ t in (0, ‖f‖], μ {x | f(x) ≥ t} dt. -/
lemma BoundedContinuousFunction.integral_eq_integral_meas_le
{α : Type*} [MeasurableSpace α] [TopologicalSpace α] [OpensMeasurableSpace α]
(f : α →ᵇ ℝ) (μ : Measure α) [IsFiniteMeasure μ] (f_nn : 0 ≤ᵐ[μ] f) :
∫ ω, f ω ∂μ = ∫ t in Ioc 0 ‖f‖, μ.real {a : α | t ≤ f a} :=
integral_eq_integral_meas_le_of_hasFiniteIntegral _ _ f_nn (f.integrable μ).2
/-- Assuming `levyProkhorovEDist μ ν < ε`, we can bound `∫ f ∂μ` in terms of
`∫ t in (0, ‖f‖], ν (thickening ε {x | f(x) ≥ t}) dt` and `‖f‖`. -/
lemma BoundedContinuousFunction.integral_le_of_levyProkhorovEDist_lt (μ ν : Measure Ω)
[IsFiniteMeasure μ] [IsFiniteMeasure ν] {ε : ℝ} (ε_pos : 0 < ε)
(hμν : levyProkhorovEDist μ ν < ENNReal.ofReal ε) (f : Ω →ᵇ ℝ) (f_nn : 0 ≤ᵐ[μ] f) :
∫ ω, f ω ∂μ
≤ (∫ t in Ioc 0 ‖f‖, ν.real (thickening ε {a | t ≤ f a})) + ε * ‖f‖ := by
rw [BoundedContinuousFunction.integral_eq_integral_meas_le f μ f_nn]
have key : (fun (t : ℝ) ↦ μ.real {a | t ≤ f a})
≤ (fun (t : ℝ) ↦ ν.real (thickening ε {a | t ≤ f a}) + ε) := by
intro t
simp only [measureReal_def]
convert ENNReal.toReal_mono ?_ <| left_measure_le_of_levyProkhorovEDist_lt hμν
(B := {a | t ≤ f a}) (f.continuous.measurable measurableSet_Ici)
· rw [ENNReal.toReal_add (measure_ne_top ν _) ofReal_ne_top, ENNReal.toReal_ofReal ε_pos.le]
· exact ENNReal.add_ne_top.mpr ⟨measure_ne_top ν _, ofReal_ne_top⟩
have intble₁ : IntegrableOn (fun t ↦ μ.real {a | t ≤ f a}) (Ioc 0 ‖f‖) := by
apply Measure.integrableOn_of_bounded (M := μ.real univ) measure_Ioc_lt_top.ne
· apply (Measurable.ennreal_toReal (Antitone.measurable ?_)).aestronglyMeasurable
exact fun _ _ hst ↦ measure_mono (fun _ h ↦ hst.trans h)
· apply Eventually.of_forall <| fun t ↦ ?_
simp only [Real.norm_eq_abs, abs_of_nonneg measureReal_nonneg]
exact measureReal_mono (subset_univ _)
have intble₂ : IntegrableOn (fun t ↦ ν.real (thickening ε {a | t ≤ f a})) (Ioc 0 ‖f‖) := by
apply Measure.integrableOn_of_bounded (M := ν.real univ) measure_Ioc_lt_top.ne
· apply (Measurable.ennreal_toReal (Antitone.measurable ?_)).aestronglyMeasurable
exact fun _ _ hst ↦ measure_mono <| thickening_subset_of_subset ε (fun _ h ↦ hst.trans h)
· apply Eventually.of_forall <| fun t ↦ ?_
simp only [Real.norm_eq_abs, abs_of_nonneg measureReal_nonneg]
exact ENNReal.toReal_mono (by finiteness) <| measure_mono (subset_univ _)
apply le_trans (setIntegral_mono (s := Ioc 0 ‖f‖) ?_ ?_ key)
· rw [integral_add]
· simp [(mul_comm _ ε).le]
· exact intble₂
· exact integrable_const ε
· exact intble₁
· exact intble₂.add <| integrable_const ε
/-- A monotone decreasing convergence lemma for integrals of measures of thickenings:
`∫ t in (0, ‖f‖], μ (thickening ε {x | f(x) ≥ t}) dt` tends to
`∫ t in (0, ‖f‖], μ {x | f(x) ≥ t} dt` as `ε → 0`. -/
lemma tendsto_integral_meas_thickening_le (f : Ω →ᵇ ℝ)
{A : Set ℝ} (A_finmeas : volume A ≠ ∞) (μ : ProbabilityMeasure Ω) :
Tendsto (fun ε ↦ ∫ t in A, (Measure.real μ (thickening ε {a | t ≤ f a}))) (𝓝[>] (0 : ℝ))
(𝓝 (∫ t in A, (Measure.real μ {a | t ≤ f a}))) := by
apply tendsto_integral_filter_of_dominated_convergence (G := ℝ) (μ := volume.restrict A)
(F := fun ε t ↦ (μ (thickening ε {a | t ≤ f a}))) (f := fun t ↦ (μ {a | t ≤ f a})) 1
· apply Eventually.of_forall fun n ↦ Measurable.aestronglyMeasurable ?_
simp only [measurable_coe_nnreal_real_iff]
apply measurable_toNNReal.comp <| Antitone.measurable (fun s t hst ↦ ?_)
exact measure_mono <| thickening_subset_of_subset _ <| fun ω h ↦ hst.trans h
· apply Eventually.of_forall (fun i ↦ ?_)
apply Eventually.of_forall (fun t ↦ ?_)
simp only [Real.norm_eq_abs, NNReal.abs_eq, Pi.one_apply]
exact ENNReal.toReal_mono one_ne_top prob_le_one
· have aux : IsFiniteMeasure (volume.restrict A) := ⟨by simp [lt_top_iff_ne_top, A_finmeas]⟩
apply integrable_const
· apply Eventually.of_forall (fun t ↦ ?_)
simp only [NNReal.tendsto_coe]
apply (ENNReal.tendsto_toNNReal _).comp
· apply tendsto_measure_thickening_of_isClosed ?_ ?_
· exact ⟨1, ⟨Real.zero_lt_one, measure_ne_top _ _⟩⟩
· exact isClosed_le continuous_const f.continuous
· finiteness
/-- The identity map `LevyProkhorov (ProbabilityMeasure Ω) → ProbabilityMeasure Ω` is continuous. -/
lemma LevyProkhorov.continuous_toMeasure_probabilityMeasure :
Continuous (toMeasure (α := ProbabilityMeasure Ω)) := by
refine SeqContinuous.continuous ?_
intro μs ν hμs
set P := ν.toMeasure -- more palatable notation
set Ps := LevyProkhorov.toMeasure ∘ μs -- more palatable notation
rw [ProbabilityMeasure.tendsto_iff_forall_integral_tendsto]
refine fun f ↦ tendsto_integral_of_forall_limsup_integral_le_integral ?_ f
intro f f_nn
by_cases f_zero : ‖f‖ = 0
· simp only [norm_eq_zero] at f_zero
simp [f_zero, limsup_const]
have norm_f_pos : 0 < ‖f‖ := lt_of_le_of_ne (norm_nonneg _) (fun a => f_zero a.symm)
apply _root_.le_of_forall_pos_le_add
intro δ δ_pos
apply limsup_le_of_le ?_
· obtain ⟨εs, _, εs_pos, εs_lim⟩ := exists_seq_strictAnti_tendsto (0 : ℝ)
have ε_of_room := Tendsto.add (tendsto_iff_dist_tendsto_zero.mp hμs) εs_lim
have ε_of_room' : Tendsto (fun n ↦ dist (μs n) ν + εs n) atTop (𝓝[>] 0) := by
rw [tendsto_nhdsWithin_iff]
refine ⟨by simpa using ε_of_room, Eventually.of_forall fun n ↦ ?_⟩
· rw [mem_Ioi]
linarith [εs_pos n, dist_nonneg (x := μs n) (y := ν)]
rw [add_zero] at ε_of_room
have key := (tendsto_integral_meas_thickening_le f (A := Ioc 0 ‖f‖) (by simp) P).comp ε_of_room'
have aux : ∀ (z : ℝ), Iio (z + δ/2) ∈ 𝓝 z := fun z ↦ Iio_mem_nhds (by linarith)
filter_upwards [key (aux _), ε_of_room <| Iio_mem_nhds <| half_pos <|
mul_pos (inv_pos.mpr norm_f_pos) δ_pos]
with n hn hn'
simp only [mem_preimage, Function.comp_def, mem_Iio] at *
specialize εs_pos n
have bound := BoundedContinuousFunction.integral_le_of_levyProkhorovEDist_lt
(Ps n) P (ε := dist (μs n) ν + εs n) ?_ ?_ f ?_
· grw [bound, hn, BoundedContinuousFunction.integral_eq_integral_meas_le _ _ <| .of_forall f_nn,
add_assoc, mul_comm]
gcongr
calc
δ / 2 + ‖f‖ * (dist (μs n) ν + εs n)
_ ≤ δ / 2 + ‖f‖ * (‖f‖⁻¹ * δ / 2) := by gcongr
_ = δ := by field
· positivity
· rw [ENNReal.ofReal_add (by positivity) (by positivity), ← add_zero (levyProkhorovEDist _ _)]
apply ENNReal.add_lt_add_of_le_of_lt (levyProkhorovEDist_ne_top _ _)
(le_of_eq ?_) (ofReal_pos.mpr εs_pos)
rw [LevyProkhorov.dist_probabilityMeasure_def, levyProkhorovDist,
ofReal_toReal (levyProkhorovEDist_ne_top _ _)]
rfl
· exact Eventually.of_forall f_nn
· simp only [IsCoboundedUnder, IsCobounded, eventually_map, eventually_atTop,
forall_exists_index]
refine ⟨0, fun a i hia ↦ le_trans (integral_nonneg f_nn) (hia i le_rfl)⟩
@[deprecated (since := "2025-10-28")]
alias LevyProkhorov.continuous_equiv_probabilityMeasure :=
LevyProkhorov.continuous_toMeasure_probabilityMeasure
/-- The topology of the Lévy-Prokhorov metric is at least as fine as the topology of convergence in
distribution. -/
theorem LevyProkhorov.le_convergenceInDistribution :
TopologicalSpace.coinduced (LevyProkhorov.toMeasure (α := ProbabilityMeasure Ω)) inferInstance
≤ (inferInstance : TopologicalSpace (ProbabilityMeasure Ω)) :=
LevyProkhorov.continuous_toMeasure_probabilityMeasure.coinduced_le
@[deprecated (since := "2025-10-28")]
alias _root_.MeasureTheory.levyProkhorov_le_convergenceInDistribution :=
LevyProkhorov.le_convergenceInDistribution
end Levy_Prokhorov_is_finer
section Levy_Prokhorov_metrizes_convergence_in_distribution
/-! ### On separable spaces the Lévy-Prokhorov distance metrizes convergence in distribution -/
open BoundedContinuousFunction TopologicalSpace
variable {Ω : Type*} [PseudoMetricSpace Ω]
variable [MeasurableSpace Ω] [OpensMeasurableSpace Ω]
lemma ProbabilityMeasure.toMeasure_add_pos_gt_mem_nhds (P : ProbabilityMeasure Ω)
{G : Set Ω} (G_open : IsOpen G) {ε : ℝ≥0∞} (ε_pos : 0 < ε) :
{Q | P.toMeasure G < Q.toMeasure G + ε} ∈ 𝓝 P := by
by_cases! easy : P.toMeasure G < ε
· exact Eventually.of_forall (fun _ ↦ lt_of_lt_of_le easy le_add_self)
by_cases ε_top : ε = ∞
· simp [ε_top, measure_lt_top]
have aux : P.toMeasure G - ε < liminf (fun Q ↦ Q.toMeasure G) (𝓝 P) := by
apply lt_of_lt_of_le (ENNReal.sub_lt_self (by finiteness) _ _)
<| ProbabilityMeasure.le_liminf_measure_open_of_tendsto tendsto_id G_open
· exact (lt_of_lt_of_le ε_pos easy).ne.symm
· exact ε_pos.ne.symm
filter_upwards [gt_mem_sets_of_limsInf_gt (α := ℝ≥0∞) isBounded_ge_of_bot
(show P.toMeasure G - ε < limsInf ((𝓝 P).map (fun Q ↦ Q.toMeasure G)) from aux)] with Q hQ
simp only [preimage_setOf_eq, mem_setOf_eq] at hQ
convert ENNReal.add_lt_add_right ε_top hQ
exact (tsub_add_cancel_of_le easy).symm
variable [SeparableSpace Ω]
variable (Ω) in
/-- In a separable pseudometric space, for any ε > 0 there exists a countable collection of
disjoint Borel measurable subsets of diameter at most ε that cover the whole space. -/
lemma SeparableSpace.exists_measurable_partition_diam_le {ε : ℝ} (ε_pos : 0 < ε) :
∃ (As : ℕ → Set Ω), (∀ n, MeasurableSet (As n)) ∧ (∀ n, Bornology.IsBounded (As n)) ∧
(∀ n, diam (As n) ≤ ε) ∧ (⋃ n, As n = univ) ∧
(Pairwise (fun (n m : ℕ) ↦ Disjoint (As n) (As m))) := by
cases isEmpty_or_nonempty Ω
· refine ⟨fun _ ↦ ∅, fun _ ↦ MeasurableSet.empty, fun _ ↦ Bornology.isBounded_empty, ?_, ?_,
fun _ _ _ ↦ disjoint_of_subsingleton⟩
· intro n
simpa only [diam_empty] using ε_pos.le
· subsingleton
obtain ⟨xs, xs_dense⟩ := exists_dense_seq Ω
have half_ε_pos : 0 < ε / 2 := half_pos ε_pos
set Bs := fun n ↦ Metric.ball (xs n) (ε / 2)
set As := disjointed Bs
refine ⟨As, ?_, ?_, ?_, ?_, ?_⟩
· exact MeasurableSet.disjointed (fun n ↦ measurableSet_ball)
· exact fun n ↦ Bornology.IsBounded.subset isBounded_ball <| disjointed_subset Bs n
· intro n
apply (diam_mono (disjointed_subset Bs n) isBounded_ball).trans
convert diam_ball half_ε_pos.le
ring
· have aux : ⋃ n, Bs n = univ := by
convert DenseRange.iUnion_uniformity_ball xs_dense <| Metric.dist_mem_uniformity half_ε_pos
exact (ball_eq_ball' _ _).symm
simpa only [← aux] using iUnion_disjointed
· exact disjoint_disjointed Bs
namespace LevyProkhorov
lemma continuous_ofMeasure_probabilityMeasure :
Continuous (ofMeasure (α := ProbabilityMeasure Ω)) := by
-- We check continuity of `id : ProbabilityMeasure Ω → LevyProkhorov (ProbabilityMeasure Ω)` at
-- each point `P : ProbabilityMeasure Ω`.
rw [continuous_iff_continuousAt]
intro P
-- To check continuity, fix `ε > 0`. To leave some wiggle room, be ready to use `ε/3 > 0` instead.
rw [continuousAt_iff']
intro ε ε_pos
have third_ε_pos : 0 < ε / 3 := by linarith
have third_ε_pos' : 0 < ENNReal.ofReal (ε / 3) := ofReal_pos.mpr third_ε_pos
-- First use separability to choose a countable partition of `Ω` into measurable
-- subsets `Es n ⊆ Ω` of small diameter, `diam (Es n) < ε/3`.
obtain ⟨Es, Es_mble, Es_bdd, Es_diam, Es_cover, Es_disjoint⟩ :=
SeparableSpace.exists_measurable_partition_diam_le Ω third_ε_pos
-- Instead of the whole space `Ω = ⋃ n ∈ ℕ, Es n`, focus on a large but finite
-- union `⋃ n < N, Es n`, chosen in such a way that the complement has small `P`-mass,
-- `P (⋃ n < N, Es n)ᶜ < ε/3`.
obtain ⟨N, hN⟩ : ∃ N, P.toMeasure (⋃ j ∈ Iio N, Es j)ᶜ < ENNReal.ofReal (ε/3) := by
have exhaust := @tendsto_measure_biUnion_Ici_zero_of_pairwise_disjoint Ω _ P.toMeasure _
Es (fun n ↦ (Es_mble n).nullMeasurableSet) Es_disjoint
simp only [tendsto_atTop_nhds, Function.comp_apply] at exhaust
obtain ⟨N, hN⟩ := exhaust (Iio (ENNReal.ofReal (ε / 3))) third_ε_pos' isOpen_Iio
refine ⟨N, ?_⟩
have rewr : ⋃ i, ⋃ (_ : N ≤ i), Es i = (⋃ i, ⋃ (_ : i < N), Es i)ᶜ := by
simpa only [mem_Iio, compl_Iio, mem_Ici] using
(biUnion_compl_eq_of_pairwise_disjoint_of_iUnion_eq_univ Es_cover Es_disjoint (Iio N)).symm
simpa only [mem_Iio, ← rewr, gt_iff_lt] using hN N le_rfl
-- With the finite `N` fixed above, consider the finite collection of open sets of the form
-- `Gs J = thickening (ε/3) (⋃ j ∈ J, Es j)`, where `J ⊆ {0, 1, ..., N-1}`.
have Js_finite : Set.Finite {J | J ⊆ Iio N} := Finite.finite_subsets <| finite_Iio N
set Gs := (fun (J : Set ℕ) ↦ thickening (ε/3) (⋃ j ∈ J, Es j)) '' {J | J ⊆ Iio N}
have Gs_open : ∀ (J : Set ℕ), IsOpen (thickening (ε/3) (⋃ j ∈ J, Es j)) :=
fun J ↦ isOpen_thickening
-- Any open set `G ⊆ Ω` determines a neighborhood of `P` consisting of those `Q` that
-- satisfy `P G < Q G + ε/3`.
have mem_nhds_P (G : Set Ω) (G_open : IsOpen G) :
{Q | P.toMeasure G < Q.toMeasure G + ENNReal.ofReal (ε/3)} ∈ 𝓝 P :=
P.toMeasure_add_pos_gt_mem_nhds G_open third_ε_pos'
-- Assume that `Q` is in the neighborhood of `P` such that for each `J ⊆ {0, 1, ..., N-1}`
-- we have `P (Gs J) < Q (Gs J) + ε/3`.
filter_upwards [(Finset.iInter_mem_sets Js_finite.toFinset).mpr <|
fun J _ ↦ mem_nhds_P _ (Gs_open J)] with Q hQ
simp only [Finite.mem_toFinset, mem_setOf_eq, thickening_iUnion, mem_iInter] at hQ
-- Note that in order to show that the Lévy-Prokhorov distance between `P` and `Q` is small
-- (`≤ 2*ε/3`), it suffices to show that for arbitrary subsets `B ⊆ Ω`, the measure `P B` is
-- bounded above up to a small error by the `Q`-measure of a small thickening of `B`.
apply lt_of_le_of_lt ?_ (show 2*(ε/3) < ε by linarith)
rw [dist_comm, dist_probabilityMeasure_def]
-- Fix an arbitrary set `B ⊆ Ω`, and an arbitrary `δ > 2*ε/3` to gain some room for error
-- and for thickening.
apply levyProkhorovDist_le_of_forall_le _ _ (by linarith) (fun δ B δ_gt _ ↦ ?_)
-- Let `JB ⊆ {0, 1, ..., N-1}` consist of those indices `j` such that `B` intersects `Es j`.
-- Then the open set `Gs JB` approximates `B` rather well:
-- except for what happens in the small complement `(⋃ n < N, Es n)ᶜ`, the set `B` is
-- contained in `Gs JB`, and conversely `Gs JB` only contains points within `δ` from `B`.
set JB := {i | B ∩ Es i ≠ ∅ ∧ i ∈ Iio N}
have B_subset : B ⊆ (⋃ i ∈ JB, thickening (ε/3) (Es i)) ∪ (⋃ j ∈ Iio N, Es j)ᶜ := by
suffices B ⊆ (⋃ i ∈ JB, thickening (ε/3) (Es i)) ∪ (⋃ j ∈ Ici N, Es j) by
refine this.trans <| union_subset_union le_rfl ?_
intro ω hω
simp only [mem_Ici, mem_iUnion, exists_prop] at hω
obtain ⟨i, i_large, ω_in_Esi⟩ := hω
by_contra con
simp only [mem_Iio, compl_iUnion, mem_iInter, mem_compl_iff, not_forall, not_not,
exists_prop] at con
obtain ⟨j, j_small, ω_in_Esj⟩ := con
exact disjoint_left.mp (Es_disjoint (show j ≠ i by cutsat)) ω_in_Esj ω_in_Esi
intro ω ω_in_B
obtain ⟨i, hi⟩ := show ∃ n, ω ∈ Es n by simp only [← mem_iUnion, Es_cover, mem_univ]
simp only [mem_Ici, mem_union, mem_iUnion, exists_prop]
by_cases i_small : i ∈ Iio N
· refine Or.inl ⟨i, ?_, self_subset_thickening third_ε_pos _ hi⟩
simp only [mem_Iio, mem_setOf_eq, JB]
push_neg
exact ⟨Set.nonempty_of_mem <| mem_inter ω_in_B hi, i_small⟩
· exact Or.inr ⟨i, by simpa only [mem_Iio, not_lt] using i_small, hi⟩
have subset_thickB : ⋃ i ∈ JB, thickening (ε / 3) (Es i) ⊆ thickening δ B := by
intro ω ω_in_U
simp only [mem_iUnion, exists_prop] at ω_in_U
obtain ⟨k, ⟨B_intersects, _⟩, ω_in_thEk⟩ := ω_in_U
rw [mem_thickening_iff] at ω_in_thEk ⊢
obtain ⟨w, w_in_Ek, w_near⟩ := ω_in_thEk
obtain ⟨z, ⟨z_in_B, z_in_Ek⟩⟩ := nonempty_iff_ne_empty.mpr B_intersects
refine ⟨z, z_in_B, lt_of_le_of_lt (dist_triangle ω w z) ?_⟩
apply lt_of_le_of_lt (add_le_add w_near.le <|
(dist_le_diam_of_mem (Es_bdd k) w_in_Ek z_in_Ek).trans <| Es_diam k)
linarith
-- We use the resulting upper bound `P B ≤ P (Gs JB) + P (small complement)`.
apply (measure_mono B_subset).trans ((measure_union_le _ _).trans ?_)
-- From the choice of `Q` in a suitable neighborhood, we have `P (Gs JB) < Q (Gs JB) + ε/3`.
specialize hQ _ (show JB ⊆ Iio N from fun _ h ↦ h.2)
-- Now it remains to add the pieces and use the above estimates.
apply (add_le_add hQ.le hN.le).trans
rw [add_assoc, ← ENNReal.ofReal_add third_ε_pos.le third_ε_pos.le, ← two_mul]
apply add_le_add (measure_mono subset_thickB) (ofReal_le_ofReal _)
exact δ_gt.le
@[deprecated (since := "2025-10-28")]
alias continuous_equiv_symm_probabilityMeasure := continuous_ofMeasure_probabilityMeasure
/-- The topology of the Lévy-Prokhorov metric on probability measures on a separable space
coincides with the topology of convergence in distribution. -/
theorem eq_convergenceInDistribution :
(inferInstance : TopologicalSpace (ProbabilityMeasure Ω))
= TopologicalSpace.coinduced LevyProkhorov.toMeasure inferInstance :=
le_convergenceInDistribution.antisymm' fun s hs ↦ by
simpa using hs.preimage continuous_ofMeasure_probabilityMeasure
@[deprecated (since := "2025-10-28")]
alias _root_.MeasureTheory.levyProkhorov_eq_convergenceInDistribution :=
eq_convergenceInDistribution
/-- The identity map is a homeomorphism from `ProbabilityMeasure Ω` with the topology of
convergence in distribution to `ProbabilityMeasure Ω` with the Lévy-Prokhorov (pseudo)metric. -/
noncomputable def probabilityMeasureHomeomorph :
ProbabilityMeasure Ω ≃ₜ LevyProkhorov (ProbabilityMeasure Ω) where
toFun := LevyProkhorov.ofMeasure
invFun := LevyProkhorov.toMeasure
left_inv _ := rfl
right_inv _ := rfl
continuous_toFun := LevyProkhorov.continuous_ofMeasure_probabilityMeasure
continuous_invFun := LevyProkhorov.continuous_toMeasure_probabilityMeasure
@[deprecated (since := "2025-10-28")]
alias _root_.MeasureTheory.homeomorph_probabilityMeasure_levyProkhorov :=
probabilityMeasureHomeomorph
end LevyProkhorov
/-- The topology of convergence in distribution on a separable space is pseudo-metrizable. -/
instance (X : Type*) [TopologicalSpace X] [PseudoMetrizableSpace X] [SeparableSpace X]
[MeasurableSpace X] [OpensMeasurableSpace X] :
PseudoMetrizableSpace (ProbabilityMeasure X) :=
letI : PseudoMetricSpace X := TopologicalSpace.pseudoMetrizableSpacePseudoMetric X
(LevyProkhorov.probabilityMeasureHomeomorph (Ω := X)).isInducing.pseudoMetrizableSpace
/-- The topology of convergence in distribution on a separable Borel space is metrizable. -/
instance instMetrizableSpaceProbabilityMeasure (X : Type*) [TopologicalSpace X]
[PseudoMetrizableSpace X] [SeparableSpace X] [MeasurableSpace X] [BorelSpace X] :
MetrizableSpace (ProbabilityMeasure X) := by
letI : PseudoMetricSpace X := TopologicalSpace.pseudoMetrizableSpacePseudoMetric X
exact LevyProkhorov.probabilityMeasureHomeomorph.isEmbedding.metrizableSpace
end Levy_Prokhorov_metrizes_convergence_in_distribution
end MeasureTheory -- namespace |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/QuasiMeasurePreserving.lean | import Mathlib.MeasureTheory.Measure.AbsolutelyContinuous
import Mathlib.MeasureTheory.OuterMeasure.BorelCantelli
/-!
# Quasi-Measure-Preserving Functions
A map `f : α → β` is said to be *quasi-measure-preserving* (a.k.a. non-singular) w.r.t. measures
`μa` and `μb` if it is measurable and `μb s = 0` implies `μa (f ⁻¹' s) = 0`.
That last condition can also be written `μa.map f ≪ μb` (the map of `μa` by `f` is
absolutely continuous with respect to `μb`).
## Main definitions
* `MeasureTheory.Measure.QuasiMeasurePreserving f μa μb`: `f` is quasi-measure-preserving with
respect to `μa` and `μb`.
-/
variable {α β γ δ : Type*}
namespace MeasureTheory
open Set Function ENNReal
open Filter hiding map
variable {mα : MeasurableSpace α} {mβ : MeasurableSpace β} {mγ : MeasurableSpace γ}
{μ ν : Measure α} {s : Set α}
namespace Measure
/-- A map `f : α → β` is said to be *quasi-measure-preserving* (a.k.a. non-singular) w.r.t. measures
`μa` and `μb` if it is measurable and `μb s = 0` implies `μa (f ⁻¹' s) = 0`. -/
@[fun_prop]
structure QuasiMeasurePreserving {m0 : MeasurableSpace α} (f : α → β)
(μa : Measure α := by volume_tac)
(μb : Measure β := by volume_tac) : Prop where
protected measurable : Measurable f
protected absolutelyContinuous : μa.map f ≪ μb
attribute [fun_prop] QuasiMeasurePreserving.measurable
namespace QuasiMeasurePreserving
@[fun_prop]
protected theorem id {_m0 : MeasurableSpace α} (μ : Measure α) : QuasiMeasurePreserving id μ μ :=
⟨measurable_id, map_id.absolutelyContinuous⟩
variable {μa μa' : Measure α} {μb μb' : Measure β} {μc : Measure γ} {f : α → β}
protected theorem _root_.Measurable.quasiMeasurePreserving
{_m0 : MeasurableSpace α} (hf : Measurable f) (μ : Measure α) :
QuasiMeasurePreserving f μ (μ.map f) :=
⟨hf, AbsolutelyContinuous.rfl⟩
theorem mono_left (h : QuasiMeasurePreserving f μa μb) (ha : μa' ≪ μa) :
QuasiMeasurePreserving f μa' μb :=
⟨h.1, (ha.map h.1).trans h.2⟩
theorem mono_right (h : QuasiMeasurePreserving f μa μb) (ha : μb ≪ μb') :
QuasiMeasurePreserving f μa μb' :=
⟨h.1, h.2.trans ha⟩
@[mono]
theorem mono (ha : μa' ≪ μa) (hb : μb ≪ μb') (h : QuasiMeasurePreserving f μa μb) :
QuasiMeasurePreserving f μa' μb' :=
(h.mono_left ha).mono_right hb
@[fun_prop]
protected theorem comp {g : β → γ} {f : α → β} (hg : QuasiMeasurePreserving g μb μc)
(hf : QuasiMeasurePreserving f μa μb) : QuasiMeasurePreserving (g ∘ f) μa μc :=
⟨hg.measurable.comp hf.measurable, by
rw [← map_map hg.1 hf.1]
exact (hf.2.map hg.1).trans hg.2⟩
protected theorem iterate {f : α → α} (hf : QuasiMeasurePreserving f μa μa) :
∀ n, QuasiMeasurePreserving f^[n] μa μa
| 0 => QuasiMeasurePreserving.id μa
| n + 1 => (hf.iterate n).comp hf
protected theorem aemeasurable (hf : QuasiMeasurePreserving f μa μb) : AEMeasurable f μa :=
hf.1.aemeasurable
theorem smul_measure {R : Type*} [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
(hf : QuasiMeasurePreserving f μa μb) (c : R) : QuasiMeasurePreserving f (c • μa) (c • μb) :=
⟨hf.1, by rw [Measure.map_smul]; exact hf.2.smul c⟩
theorem ae_map_le (h : QuasiMeasurePreserving f μa μb) : ae (μa.map f) ≤ ae μb :=
h.2.ae_le
theorem tendsto_ae (h : QuasiMeasurePreserving f μa μb) : Tendsto f (ae μa) (ae μb) :=
(tendsto_ae_map h.aemeasurable).mono_right h.ae_map_le
theorem ae (h : QuasiMeasurePreserving f μa μb) {p : β → Prop} (hg : ∀ᵐ x ∂μb, p x) :
∀ᵐ x ∂μa, p (f x) :=
h.tendsto_ae hg
theorem ae_eq (h : QuasiMeasurePreserving f μa μb) {g₁ g₂ : β → δ} (hg : g₁ =ᵐ[μb] g₂) :
g₁ ∘ f =ᵐ[μa] g₂ ∘ f :=
h.ae hg
theorem preimage_null (h : QuasiMeasurePreserving f μa μb) {s : Set β} (hs : μb s = 0) :
μa (f ⁻¹' s) = 0 :=
preimage_null_of_map_null h.aemeasurable (h.2 hs)
theorem preimage_mono_ae {s t : Set β} (hf : QuasiMeasurePreserving f μa μb) (h : s ≤ᵐ[μb] t) :
f ⁻¹' s ≤ᵐ[μa] f ⁻¹' t :=
eventually_map.mp <|
Eventually.filter_mono (tendsto_ae_map hf.aemeasurable) (Eventually.filter_mono hf.ae_map_le h)
theorem preimage_ae_eq {s t : Set β} (hf : QuasiMeasurePreserving f μa μb) (h : s =ᵐ[μb] t) :
f ⁻¹' s =ᵐ[μa] f ⁻¹' t :=
EventuallyLE.antisymm (hf.preimage_mono_ae h.le) (hf.preimage_mono_ae h.symm.le)
/-- The preimage of a null measurable set under a (quasi-)measure-preserving map is a null
measurable set. -/
theorem _root_.MeasureTheory.NullMeasurableSet.preimage {s : Set β} (hs : NullMeasurableSet s μb)
(hf : QuasiMeasurePreserving f μa μb) : NullMeasurableSet (f ⁻¹' s) μa :=
let ⟨t, htm, hst⟩ := hs
⟨f ⁻¹' t, hf.measurable htm, hf.preimage_ae_eq hst⟩
theorem preimage_iterate_ae_eq {s : Set α} {f : α → α} (hf : QuasiMeasurePreserving f μ μ) (k : ℕ)
(hs : f ⁻¹' s =ᵐ[μ] s) : f^[k] ⁻¹' s =ᵐ[μ] s := by
induction k with
| zero => rfl
| succ k ih =>
rw [iterate_succ, preimage_comp]
exact EventuallyEq.trans (hf.preimage_ae_eq ih) hs
theorem image_zpow_ae_eq {s : Set α} {e : α ≃ α} (he : QuasiMeasurePreserving e μ μ)
(he' : QuasiMeasurePreserving e.symm μ μ) (k : ℤ) (hs : e '' s =ᵐ[μ] s) :
(⇑(e ^ k)) '' s =ᵐ[μ] s := by
rw [Equiv.image_eq_preimage_symm]
obtain ⟨k, rfl | rfl⟩ := k.eq_nat_or_neg
· replace hs : (⇑e⁻¹) ⁻¹' s =ᵐ[μ] s := by rwa [Equiv.image_eq_preimage_symm] at hs
replace he' : (⇑e⁻¹)^[k] ⁻¹' s =ᵐ[μ] s := he'.preimage_iterate_ae_eq k hs
rwa [Equiv.Perm.iterate_eq_pow e⁻¹ k, inv_pow e k] at he'
· rw [zpow_neg, zpow_natCast]
replace hs : e ⁻¹' s =ᵐ[μ] s := by
convert he.preimage_ae_eq hs.symm
rw [Equiv.preimage_image]
replace he : (⇑e)^[k] ⁻¹' s =ᵐ[μ] s := he.preimage_iterate_ae_eq k hs
rwa [Equiv.Perm.iterate_eq_pow e k] at he
-- Need to specify `α := Set α` below because of diamond; see https://github.com/leanprover-community/mathlib4/issues/10941
theorem limsup_preimage_iterate_ae_eq {f : α → α} (hf : QuasiMeasurePreserving f μ μ)
(hs : f ⁻¹' s =ᵐ[μ] s) : limsup (α := Set α) (fun n => (preimage f)^[n] s) atTop =ᵐ[μ] s :=
limsup_ae_eq_of_forall_ae_eq (fun n => (preimage f)^[n] s) fun n ↦ by
simpa only [Set.preimage_iterate_eq] using hf.preimage_iterate_ae_eq n hs
-- Need to specify `α := Set α` below because of diamond; see https://github.com/leanprover-community/mathlib4/issues/10941
theorem liminf_preimage_iterate_ae_eq {f : α → α} (hf : QuasiMeasurePreserving f μ μ)
(hs : f ⁻¹' s =ᵐ[μ] s) : liminf (α := Set α) (fun n => (preimage f)^[n] s) atTop =ᵐ[μ] s :=
liminf_ae_eq_of_forall_ae_eq (fun n => (preimage f)^[n] s) fun n ↦ by
simpa only [Set.preimage_iterate_eq] using hf.preimage_iterate_ae_eq n hs
/-- For a quasi-measure-preserving self-map `f`, if a null measurable set `s` is a.e. invariant,
then it is a.e. equal to a measurable invariant set.
-/
theorem exists_preimage_eq_of_preimage_ae {f : α → α} (h : QuasiMeasurePreserving f μ μ)
(hs : NullMeasurableSet s μ) (hs' : f ⁻¹' s =ᵐ[μ] s) :
∃ t : Set α, MeasurableSet t ∧ t =ᵐ[μ] s ∧ f ⁻¹' t = t := by
obtain ⟨t, htm, ht⟩ := hs
refine ⟨limsup (f^[·] ⁻¹' t) atTop, ?_, ?_, ?_⟩
· exact .measurableSet_limsup fun n ↦ h.measurable.iterate n htm
· have : f ⁻¹' t =ᵐ[μ] t := (h.preimage_ae_eq ht.symm).trans (hs'.trans ht)
exact limsup_ae_eq_of_forall_ae_eq _ fun n ↦ .trans (h.preimage_iterate_ae_eq _ this) ht.symm
· simp only [Set.preimage_iterate_eq]
exact CompleteLatticeHom.apply_limsup_iterate (CompleteLatticeHom.setPreimage f) t
open Pointwise
@[to_additive]
theorem smul_ae_eq_of_ae_eq {G α : Type*} [Group G] [MulAction G α] {_ : MeasurableSpace α}
{s t : Set α} {μ : Measure α} (g : G)
(h_qmp : QuasiMeasurePreserving (g⁻¹ • · : α → α) μ μ)
(h_ae_eq : s =ᵐ[μ] t) : (g • s : Set α) =ᵐ[μ] (g • t : Set α) := by
simpa only [← preimage_smul_inv] using h_qmp.ae_eq h_ae_eq
end QuasiMeasurePreserving
section Pointwise
open Pointwise
@[to_additive]
theorem pairwise_aedisjoint_of_aedisjoint_forall_ne_one {G α : Type*} [Group G] [MulAction G α]
{_ : MeasurableSpace α} {μ : Measure α} {s : Set α}
(h_ae_disjoint : ∀ g ≠ (1 : G), AEDisjoint μ (g • s) s)
(h_qmp : ∀ g : G, QuasiMeasurePreserving (g • ·) μ μ) :
Pairwise (AEDisjoint μ on fun g : G => g • s) := by
intro g₁ g₂ hg
let g := g₂⁻¹ * g₁
replace hg : g ≠ 1 := by
rw [Ne, inv_mul_eq_one]
exact hg.symm
have : (g₂⁻¹ • ·) ⁻¹' (g • s ∩ s) = g₁ • s ∩ g₂ • s := by
rw [preimage_eq_iff_eq_image (MulAction.bijective g₂⁻¹), image_smul, smul_set_inter, smul_smul,
smul_smul, inv_mul_cancel, one_smul]
change μ (g₁ • s ∩ g₂ • s) = 0
exact this ▸ (h_qmp g₂⁻¹).preimage_null (h_ae_disjoint g hg)
end Pointwise
end Measure
open Measure
theorem NullMeasurable.comp_quasiMeasurePreserving {ν : Measure β}
{f : α → β} {g : β → γ} (hg : NullMeasurable g ν) (hf : QuasiMeasurePreserving f μ ν) :
NullMeasurable (g ∘ f) μ := fun _s hs ↦ (hg hs).preimage hf
theorem NullMeasurableSet.mono_ac (h : NullMeasurableSet s μ) (hle : ν ≪ μ) :
NullMeasurableSet s ν :=
h.preimage <| (QuasiMeasurePreserving.id μ).mono_left hle
theorem NullMeasurableSet.mono (h : NullMeasurableSet s μ) (hle : ν ≤ μ) : NullMeasurableSet s ν :=
h.mono_ac hle.absolutelyContinuous
lemma NullMeasurableSet.smul_measure (h : NullMeasurableSet s μ) (c : ℝ≥0∞) :
NullMeasurableSet s (c • μ) :=
h.mono_ac (Measure.AbsolutelyContinuous.rfl.smul_left c)
lemma nullMeasurableSet_smul_measure_iff {c : ℝ≥0∞} (hc : c ≠ 0) :
NullMeasurableSet s (c • μ) ↔ NullMeasurableSet s μ :=
⟨fun h ↦ h.mono_ac (Measure.absolutelyContinuous_smul hc), fun h ↦ h.smul_measure c⟩
theorem AEDisjoint.preimage {ν : Measure β} {f : α → β} {s t : Set β} (ht : AEDisjoint ν s t)
(hf : QuasiMeasurePreserving f μ ν) : AEDisjoint μ (f ⁻¹' s) (f ⁻¹' t) :=
hf.preimage_null ht
end MeasureTheory
open MeasureTheory
namespace MeasurableEquiv
variable {_ : MeasurableSpace α} [MeasurableSpace β] {μ : Measure α} {ν : Measure β}
theorem quasiMeasurePreserving_symm (μ : Measure α) (e : α ≃ᵐ β) :
Measure.QuasiMeasurePreserving e.symm (μ.map e) μ :=
⟨e.symm.measurable, by rw [Measure.map_map, e.symm_comp_self, Measure.map_id] <;> measurability⟩
end MeasurableEquiv |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/GiryMonad.lean | import Mathlib.MeasureTheory.Integral.Lebesgue.Countable
/-!
# The Giry monad
Let X be a measurable space. The collection of all measures on X again
forms a measurable space. This construction forms a monad on
measurable spaces and measurable functions, called the Giry monad.
Note that most sources use the term "Giry monad" for the restriction
to *probability* measures. Here we include all measures on X.
See also `MeasureTheory/Category/MeasCat.lean`, containing an upgrade of the type-level
monad to an honest monad of the functor `measure : MeasCat ⥤ MeasCat`.
## References
* <https://ncatlab.org/nlab/show/Giry+monad>
## Tags
giry monad
-/
noncomputable section
open ENNReal Set Filter
variable {α β : Type*}
namespace MeasureTheory
namespace Measure
variable {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
/-- Measurability structure on `Measure`: Measures are measurable w.r.t. all projections -/
instance instMeasurableSpace : MeasurableSpace (Measure α) :=
⨆ (s : Set α) (_ : MeasurableSet s), (borel ℝ≥0∞).comap fun μ => μ s
theorem measurable_coe {s : Set α} (hs : MeasurableSet s) : Measurable fun μ : Measure α => μ s :=
Measurable.of_comap_le <| le_iSup_of_le s <| le_iSup_of_le hs <| le_rfl
theorem measurable_of_measurable_coe (f : β → Measure α)
(h : ∀ (s : Set α), MeasurableSet s → Measurable fun b => f b s) : Measurable f :=
Measurable.of_le_map <|
iSup₂_le fun s hs =>
MeasurableSpace.comap_le_iff_le_map.2 <| by rw [MeasurableSpace.map_comp]; exact h s hs
instance instMeasurableAdd₂ {α : Type*} {m : MeasurableSpace α} : MeasurableAdd₂ (Measure α) := by
refine ⟨Measure.measurable_of_measurable_coe _ fun s hs => ?_⟩
simp_rw [Measure.coe_add, Pi.add_apply]
refine Measurable.add ?_ ?_
· exact (Measure.measurable_coe hs).comp measurable_fst
· exact (Measure.measurable_coe hs).comp measurable_snd
-- There is no typeclass for measurability of `SMul` only on that side, otherwise we could
-- turn that into an instance.
@[fun_prop]
lemma _root_.Measurable.smul_measure {f : α → ℝ≥0∞} (hf : Measurable f) (μ : Measure β) :
Measurable (fun x ↦ f x • μ) := by
refine Measure.measurable_of_measurable_coe _ fun s hs ↦ ?_
simp only [Measure.smul_apply, smul_eq_mul]
fun_prop
theorem measurable_measure {μ : α → Measure β} :
Measurable μ ↔ ∀ (s : Set β), MeasurableSet s → Measurable fun b => μ b s :=
⟨fun hμ _s hs => (measurable_coe hs).comp hμ, measurable_of_measurable_coe μ⟩
theorem _root_.Measurable.measure_of_isPiSystem {μ : α → Measure β} [∀ a, IsFiniteMeasure (μ a)]
{S : Set (Set β)} (hgen : ‹MeasurableSpace β› = .generateFrom S) (hpi : IsPiSystem S)
(h_basic : ∀ s ∈ S, Measurable fun a ↦ μ a s) (h_univ : Measurable fun a ↦ μ a univ) :
Measurable μ := by
rw [measurable_measure]
intro s hs
induction s, hs using MeasurableSpace.induction_on_inter hgen hpi with
| empty => simp
| basic s hs => exact h_basic s hs
| compl s hsm ihs =>
simp only [measure_compl hsm (measure_ne_top _ _)]
exact h_univ.sub ihs
| iUnion f hfd hfm ihf =>
simpa only [measure_iUnion hfd hfm] using .ennreal_tsum ihf
theorem _root_.Measurable.measure_of_isPiSystem_of_isProbabilityMeasure {μ : α → Measure β}
[∀ a, IsProbabilityMeasure (μ a)]
{S : Set (Set β)} (hgen : ‹MeasurableSpace β› = .generateFrom S) (hpi : IsPiSystem S)
(h_basic : ∀ s ∈ S, Measurable fun a ↦ μ a s) : Measurable μ :=
.measure_of_isPiSystem hgen hpi h_basic <| by simp
@[fun_prop]
theorem measurable_map (f : α → β) (hf : Measurable f) :
Measurable fun μ : Measure α => map f μ := by
refine measurable_of_measurable_coe _ fun s hs => ?_
simp_rw [map_apply hf hs]
exact measurable_coe (hf hs)
@[fun_prop]
theorem measurable_dirac : Measurable (Measure.dirac : α → Measure α) := by
refine measurable_of_measurable_coe _ fun s hs => ?_
simp_rw [dirac_apply' _ hs]
exact measurable_one.indicator hs
@[fun_prop]
theorem measurable_lintegral {f : α → ℝ≥0∞} (hf : Measurable f) :
Measurable fun μ : Measure α => ∫⁻ x, f x ∂μ := by
simp only [lintegral_eq_iSup_eapprox_lintegral, hf, SimpleFunc.lintegral]
refine .iSup fun n => Finset.measurable_fun_sum _ fun i _ => ?_
refine Measurable.const_mul ?_ _
exact measurable_coe ((SimpleFunc.eapprox f n).measurableSet_preimage _)
/-- Monadic join on `Measure` in the category of measurable spaces and measurable
functions. -/
def join (m : Measure (Measure α)) : Measure α :=
Measure.ofMeasurable (fun s _ => ∫⁻ μ, μ s ∂m)
(by simp only [measure_empty, lintegral_const, zero_mul])
(by
intro f hf h
simp_rw [measure_iUnion h hf]
apply lintegral_tsum
intro i; exact (measurable_coe (hf i)).aemeasurable)
@[simp]
theorem join_apply {m : Measure (Measure α)} {s : Set α} (hs : MeasurableSet s) :
join m s = ∫⁻ μ, μ s ∂m :=
Measure.ofMeasurable_apply s hs
theorem le_join_apply (m : Measure (Measure α)) (s : Set α) : ∫⁻ μ, μ s ∂m ≤ join m s := by
rw [measure_eq_iInf]
exact le_iInf₂ fun t hst ↦ le_iInf fun htm ↦ join_apply htm ▸ by gcongr
@[simp]
theorem join_smul {R : Type*} [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞] (c : R)
(m : Measure (Measure α)) : (c • m).join = c • m.join := by
ext s hs
simp [hs]
@[simp]
theorem join_dirac (μ : Measure α) : join (dirac μ) = μ := by
ext s hs
simp [hs, lintegral_dirac', measurable_coe]
theorem le_ae_join (m : Measure (Measure α)) : (ae m).bind ae ≤ ae m.join := by
intro s hs
rcases exists_measurable_superset_of_null hs with ⟨t, hst, htm, ht⟩
rw [join_apply htm, lintegral_eq_zero_iff (measurable_coe htm)] at ht
rw [mem_bind']
exact ht.mono fun _ ↦ measure_mono_null hst
theorem ae_ae_of_ae_join {m : Measure (Measure α)} {p : α → Prop} (h : ∀ᵐ a ∂m.join, p a) :
∀ᵐ μ ∂m, ∀ᵐ a ∂μ, p a :=
le_ae_join m h
theorem _root_.AEMeasurable.ae_of_join {m : Measure (Measure α)} {f : α → β}
(h : AEMeasurable f m.join) : ∀ᵐ μ ∂m, AEMeasurable f μ :=
let ⟨g, hgm, hg⟩ := h; (ae_ae_of_ae_join hg).mono fun _μ hμ ↦ ⟨g, hgm, hμ⟩
theorem aemeasurable_lintegral {m : Measure (Measure α)} {f : α → ℝ≥0∞}
(h : AEMeasurable f m.join) : AEMeasurable (fun μ ↦ ∫⁻ a, f a ∂μ) m :=
let ⟨g, hgm, hfg⟩ := h
⟨fun μ ↦ ∫⁻ a, g a ∂μ, measurable_lintegral hgm,
(ae_ae_of_ae_join hfg).mono fun _ ↦ lintegral_congr_ae⟩
@[simp]
theorem join_zero : (0 : Measure (Measure α)).join = 0 := by
ext1 s hs
simp [hs]
@[fun_prop]
theorem measurable_join : Measurable (join : Measure (Measure α) → Measure α) :=
measurable_of_measurable_coe _ fun s hs => by
simp only [join_apply hs, measurable_lintegral (measurable_coe hs)]
theorem lintegral_join {m : Measure (Measure α)} {f : α → ℝ≥0∞} (hf : AEMeasurable f (join m)) :
∫⁻ x, f x ∂join m = ∫⁻ μ, ∫⁻ x, f x ∂μ ∂m := by
wlog hfm : Measurable f generalizing f
· rcases hf with ⟨g, hgm, hfg⟩
rw [lintegral_congr_ae hfg, this hgm.aemeasurable hgm]
exact lintegral_congr_ae <| (ae_ae_of_ae_join hfg).mono fun μ hμ ↦
.symm <| lintegral_congr_ae hμ
simp_rw [lintegral_eq_iSup_eapprox_lintegral hfm, SimpleFunc.lintegral,
join_apply (SimpleFunc.measurableSet_preimage _ _)]
clear hf
suffices
∀ (s : ℕ → Finset ℝ≥0∞) (f : ℕ → ℝ≥0∞ → Measure α → ℝ≥0∞), (∀ n r, Measurable (f n r)) →
Monotone (fun n μ => ∑ r ∈ s n, r * f n r μ) →
⨆ n, ∑ r ∈ s n, r * ∫⁻ μ, f n r μ ∂m = ∫⁻ μ, ⨆ n, ∑ r ∈ s n, r * f n r μ ∂m by
refine
this (fun n => SimpleFunc.range (SimpleFunc.eapprox f n))
(fun n r μ => μ (SimpleFunc.eapprox f n ⁻¹' {r})) ?_ ?_
· exact fun n r => measurable_coe (SimpleFunc.measurableSet_preimage _ _)
· exact fun n m h μ => SimpleFunc.lintegral_mono (SimpleFunc.monotone_eapprox _ h) le_rfl
intro s f hf hm
rw [lintegral_iSup _ hm]
swap
· fun_prop
congr
funext n
rw [lintegral_finset_sum (s n)]
· simp_rw [lintegral_const_mul _ (hf _ _)]
· exact fun r _ => (hf _ _).const_mul _
theorem lintegral_join_le (f : α → ℝ≥0∞) (m : Measure (Measure α)) :
∫⁻ x, f x ∂join m ≤ ∫⁻ μ, ∫⁻ x, f x ∂μ ∂m := by
rcases exists_measurable_le_lintegral_eq (join m) f with ⟨g, hgm, hgf, hfg_int⟩
rw [hfg_int, lintegral_join hgm.aemeasurable]
gcongr
apply hgf
/-- Monadic bind on `Measure`, only works in the category of measurable spaces and measurable
functions. When the function `f` is not measurable the result is not well defined. -/
def bind (m : Measure α) (f : α → Measure β) : Measure β :=
join (map f m)
@[simp]
theorem bind_zero_left (f : α → Measure β) : bind (0 : Measure α) f = 0 := by simp [bind]
@[simp]
theorem bind_apply {m : Measure α} {f : α → Measure β} {s : Set β} (hs : MeasurableSet s)
(hf : AEMeasurable f m) : bind m f s = ∫⁻ a, f a s ∂m := by
rw [bind, join_apply hs, lintegral_map' (measurable_coe hs).aemeasurable hf]
theorem bind_apply_le {m : Measure α} (f : α → Measure β) {s : Set β} (hs : MeasurableSet s) :
bind m f s ≤ ∫⁻ a, f a s ∂m := by
rw [bind, join_apply hs]
apply lintegral_map_le
theorem ae_ae_of_ae_bind {m : Measure α} {f : α → Measure β} {p : β → Prop} (hf : AEMeasurable f m)
(h : ∀ᵐ b ∂m.bind f, p b) : ∀ᵐ a ∂m, ∀ᵐ b ∂ f a, p b :=
ae_of_ae_map hf <| ae_ae_of_ae_join h
theorem _root_.AEMeasurable.ae_of_bind {γ : Type*} {_ : MeasurableSpace γ} {m : Measure α}
{f : α → Measure β} {g : β → γ} (hf : AEMeasurable f m) (hg : AEMeasurable g (m.bind f)) :
∀ᵐ a ∂m, AEMeasurable g (f a) :=
ae_of_ae_map hf hg.ae_of_join
theorem bind_congr_right {μ : Measure α} {f g : α → Measure β} (h : f =ᵐ[μ] g) :
μ.bind f = μ.bind g :=
congrArg join <| map_congr h
@[simp]
lemma bind_const {m : Measure α} {ν : Measure β} : m.bind (fun _ ↦ ν) = m Set.univ • ν := by
simp [bind]
theorem bind_zero_right' (m : Measure α) : bind m (fun _ => 0 : α → Measure β) = 0 := by simp
@[simp]
theorem bind_zero_right (m : Measure α) : bind m (0 : α → Measure β) = 0 := bind_zero_right' m
@[fun_prop]
theorem measurable_bind' {g : α → Measure β} (hg : Measurable g) :
Measurable fun m : Measure α => bind m g :=
measurable_join.comp (measurable_map _ hg)
theorem aemeasurable_bind {g : α → Measure β} {m : Measure (Measure α)}
(hg : AEMeasurable g m.join) : AEMeasurable (bind · g) m :=
let ⟨f, hfm, hf⟩ := hg
⟨(bind · f), measurable_bind' hfm, (ae_ae_of_ae_join hf).mono fun _ ↦ bind_congr_right⟩
theorem lintegral_bind {m : Measure α} {μ : α → Measure β} {f : β → ℝ≥0∞} (hμ : AEMeasurable μ m)
(hf : AEMeasurable f (bind m μ)) : ∫⁻ x, f x ∂bind m μ = ∫⁻ a, ∫⁻ x, f x ∂μ a ∂m :=
(lintegral_join hf).trans (lintegral_map' (aemeasurable_lintegral hf) hμ)
theorem lintegral_bind_le (f : β → ℝ≥0∞) (m : Measure α) (μ : α → Measure β) :
∫⁻ x, f x ∂bind m μ ≤ ∫⁻ a, ∫⁻ x, f x ∂μ a ∂m :=
(lintegral_join_le _ _).trans (lintegral_map_le _ _)
theorem bind_bind {γ} [MeasurableSpace γ] {m : Measure α} {f : α → Measure β} {g : β → Measure γ}
(hf : AEMeasurable f m) (hg : AEMeasurable g (m.bind f)) :
bind (bind m f) g = bind m fun a => bind (f a) g := by
ext1 s hs
rw [bind_apply hs hg, lintegral_bind hf, bind_apply hs]
· exact lintegral_congr_ae <| (hf.ae_of_bind hg).mono fun a ha ↦ .symm <| bind_apply hs ha
· exact (aemeasurable_bind hg).comp_aemeasurable hf
· exact (measurable_coe hs).comp_aemeasurable hg
@[simp]
theorem dirac_bind {f : α → Measure β} (hf : Measurable f) (a : α) : bind (dirac a) f = f a := by
simp [bind, map_dirac hf]
@[simp]
theorem bind_dirac {m : Measure α} : bind m dirac = m := by
ext1 s hs
simp only [bind_apply hs measurable_dirac.aemeasurable, dirac_apply' _ hs, lintegral_indicator hs,
Pi.one_apply, lintegral_one, restrict_apply, MeasurableSet.univ, univ_inter]
@[simp]
lemma bind_dirac_eq_map (m : Measure α) {f : α → β} (hf : Measurable f) :
m.bind (fun x ↦ Measure.dirac (f x)) = m.map f := by
rw [← bind_dirac (m := m.map f), bind, bind, map_map, Function.comp_def]
exacts [measurable_dirac, hf]
theorem join_eq_bind (μ : Measure (Measure α)) : join μ = bind μ id := by rw [bind, map_id]
theorem join_map_map {f : α → β} (hf : Measurable f) (μ : Measure (Measure α)) :
join (map (map f) μ) = map f (join μ) := by
ext1 s hs
rw [join_apply hs, map_apply hf hs, join_apply (hf hs),
lintegral_map (measurable_coe hs) (measurable_map f hf)]
simp_rw [map_apply hf hs]
theorem join_map_join (μ : Measure (Measure (Measure α))) : join (map join μ) = join (join μ) := by
change bind μ join = join (join μ)
rw [join_eq_bind, join_eq_bind, bind_bind aemeasurable_id aemeasurable_id]
apply congr_arg (bind μ)
funext ν
exact join_eq_bind ν
theorem join_map_dirac (μ : Measure α) : join (map dirac μ) = μ := bind_dirac
end Measure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Typeclasses.lean | import Mathlib.MeasureTheory.Measure.Typeclasses.Finite
import Mathlib.MeasureTheory.Measure.Typeclasses.NoAtoms
import Mathlib.MeasureTheory.Measure.Typeclasses.Probability
import Mathlib.MeasureTheory.Measure.Typeclasses.SFinite
deprecated_module (since := "2025-04-13") |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/ContinuousPreimage.lean | import Mathlib.Topology.CompactOpen
import Mathlib.Dynamics.Ergodic.MeasurePreserving
import Mathlib.MeasureTheory.Measure.Regular
/-!
# Continuity of the preimage of a set under a measure-preserving continuous function
In this file we prove that the preimage of a null measurable set `s : Set Y`
under a measure-preserving continuous function `f : C(X, Y)` is continuous in `f`
in the sense that `μ ((f a ⁻¹' s) ∆ (g ⁻¹' s))` tends to zero as `f a` tends to `g`.
As a corollary, we show that
for a continuous family of continuous maps `f z : C(X, Y)`,
a null measurable set `s`, and a null measurable set `t` of finite measure,
the set of parameters `z` such that `f z ⁻¹' t` is a.e. equal to `s` is a closed set.
-/
open Filter Set
open scoped ENNReal symmDiff Topology
namespace MeasureTheory
variable {α X Y Z : Type*}
[TopologicalSpace X] [MeasurableSpace X] [BorelSpace X] [R1Space X]
[TopologicalSpace Y] [MeasurableSpace Y] [BorelSpace Y] [R1Space Y]
[TopologicalSpace Z]
{μ : Measure X} {ν : Measure Y} [μ.InnerRegularCompactLTTop] [IsLocallyFiniteMeasure ν]
/-- Let `X` and `Y` be R₁ topological spaces
with Borel σ-algebras and measures `μ` and `ν`, respectively.
Suppose that `μ` is inner regular for finite measure sets with respect to compact sets
and `ν` is a locally finite measure.
Let `f : α → C(X, Y)` be a family of continuous maps
that converges to a continuous map `g : C(X, Y)` in the compact-open topology along a filter `l`.
Suppose that `g` is a measure-preserving map
and `f a` is a measure-preserving map eventually along `l`.
Then for any finite measure measurable set `s`,
the preimages `f a ⁻¹' s` tend to the preimage `g ⁻¹' s` in measure.
More precisely, the measure of the symmetric difference of these two sets tends to zero. -/
theorem tendsto_measure_symmDiff_preimage_nhds_zero
{l : Filter α} {f : α → C(X, Y)} {g : C(X, Y)} {s : Set Y} (hfg : Tendsto f l (𝓝 g))
(hf : ∀ᶠ a in l, MeasurePreserving (f a) μ ν) (hg : MeasurePreserving g μ ν)
(hs : NullMeasurableSet s ν) (hνs : ν s ≠ ∞) :
Tendsto (fun a ↦ μ ((f a ⁻¹' s) ∆ (g ⁻¹' s))) l (𝓝 0) := by
have : ν.InnerRegularCompactLTTop := by
rw [← hg.map_eq]
exact .map_of_continuous (map_continuous _)
rw [ENNReal.tendsto_nhds_zero]
intro ε hε
-- Without loss of generality, `s` is an open set.
wlog hso : IsOpen s generalizing s ε
· have H : 0 < ε / 3 := ENNReal.div_pos hε.ne' ENNReal.coe_ne_top
-- Indeed, we can choose an open set `U` such that `ν (U ∆ s) < ε / 3`,
-- apply the lemma to `U`, then use the triangle inequality for `μ (_ ∆ _)`.
rcases hs.exists_isOpen_symmDiff_lt hνs H.ne' with ⟨U, hUo, hU, hUs⟩
have hmU : NullMeasurableSet U ν := hUo.measurableSet.nullMeasurableSet
replace hUs := hUs.le
filter_upwards [hf, this hmU hU.ne _ H hUo] with a hfa ha
calc
μ ((f a ⁻¹' s) ∆ (g ⁻¹' s))
≤ μ ((f a ⁻¹' s) ∆ (f a ⁻¹' U)) + μ ((f a ⁻¹' U) ∆ (g ⁻¹' U))
+ μ ((g ⁻¹' U) ∆ (g ⁻¹' s)) := by
refine (measure_symmDiff_le _ (g ⁻¹' U) _).trans ?_
gcongr
apply measure_symmDiff_le
_ ≤ ε / 3 + ε / 3 + ε / 3 := by
gcongr
· rwa [← preimage_symmDiff, hfa.measure_preimage (hs.symmDiff hmU), symmDiff_comm]
· rwa [← preimage_symmDiff, hg.measure_preimage (hmU.symmDiff hs)]
_ = ε := by simp
-- Take a compact closed subset `K ⊆ g ⁻¹' s` of almost full measure,
-- `μ (g ⁻¹' s \ K) < ε / 2`.
have hνs' : μ (g ⁻¹' s) ≠ ∞ := by rwa [hg.measure_preimage hs]
obtain ⟨K, hKg, hKco, hKcl, hKμ⟩ :
∃ K, MapsTo g K s ∧ IsCompact K ∧ IsClosed K ∧ μ (g ⁻¹' s \ K) < ε / 2 :=
(hg.measurable hso.measurableSet).exists_isCompact_isClosed_diff_lt hνs' <| by simp [hε.ne']
have hKm : NullMeasurableSet K μ := hKcl.nullMeasurableSet
-- Take `a` such that `f a` is measure preserving and maps `K` to `s`.
-- This is possible, because `K` is a compact set and `s` is an open set.
filter_upwards [hf, ContinuousMap.tendsto_nhds_compactOpen.mp hfg K hKco s hso hKg] with a hfa ha
-- Then each of the sets `g ⁻¹' s ∆ K = g ⁻¹' s \ K` and `f a ⁻¹' s ∆ K = f a ⁻¹' s \ K`
-- have measure at most `ε / 2`, thus `f a ⁻¹' s ∆ g ⁻¹' s` has measure at most `ε`.
rw [← ENNReal.add_halves ε]
refine (measure_symmDiff_le _ K _).trans ?_
rw [symmDiff_of_ge ha.subset_preimage, symmDiff_of_le hKg.subset_preimage]
gcongr
have hK' : μ K ≠ ∞ := ne_top_of_le_ne_top hνs' <| measure_mono hKg.subset_preimage
rw [measure_diff_le_iff_le_add hKm ha.subset_preimage hK', hfa.measure_preimage hs,
← hg.measure_preimage hs, ← measure_diff_le_iff_le_add hKm hKg.subset_preimage hK']
exact hKμ.le
/-- Let `f : Z → C(X, Y)` be a continuous (in the compact open topology) family
of continuous measure-preserving maps.
Let `t : Set Y` be a null measurable set of finite measure.
Then for any `s`, the set of parameters `z`
such that the preimage of `t` under `f_z` is a.e. equal to `s`
is a closed set.
In particular, if `X = Y` and `s = t`,
then we see that the a.e. stabilizer of a set is a closed set. -/
theorem isClosed_setOf_preimage_ae_eq {f : Z → C(X, Y)} (hf : Continuous f)
(hfm : ∀ z, MeasurePreserving (f z) μ ν) (s : Set X)
{t : Set Y} (htm : NullMeasurableSet t ν) (ht : ν t ≠ ∞) :
IsClosed {z | f z ⁻¹' t =ᵐ[μ] s} := by
rw [← isOpen_compl_iff, isOpen_iff_mem_nhds]
intro z hz
replace hz : ∀ᶠ ε : ℝ≥0∞ in 𝓝 0, ε < μ ((f z ⁻¹' t) ∆ s) := by
apply gt_mem_nhds
rwa [pos_iff_ne_zero, ne_eq, measure_symmDiff_eq_zero_iff]
filter_upwards [(tendsto_measure_symmDiff_preimage_nhds_zero (hf.tendsto z)
(.of_forall hfm) (hfm z) htm ht).eventually hz] with w hw
intro (hw' : f w ⁻¹' t =ᵐ[μ] s)
rw [measure_congr (hw'.symmDiff (ae_eq_refl _)), symmDiff_comm] at hw
exact hw.false
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/HasOuterApproxClosed.lean | import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction
import Mathlib.Topology.MetricSpace.ThickenedIndicator
/-!
# Spaces where indicators of closed sets have decreasing approximations by continuous functions
In this file we define a typeclass `HasOuterApproxClosed` for topological spaces in which indicator
functions of closed sets have sequences of bounded continuous functions approximating them from
above. All pseudo-emetrizable spaces have this property, see `instHasOuterApproxClosed`.
In spaces with the `HasOuterApproxClosed` property, finite Borel measures are uniquely characterized
by the integrals of bounded continuous functions. Also weak convergence of finite measures and
convergence in distribution for random variables behave somewhat well in spaces with this property.
## Main definitions
* `HasOuterApproxClosed`: the typeclass for topological spaces in which indicator functions of
closed sets have sequences of bounded continuous functions approximating them.
* `IsClosed.apprSeq`: a (non-constructive) choice of an approximating sequence to the indicator
function of a closed set.
## Main results
* `instHasOuterApproxClosed`: Any pseudo-emetrizable space has the property `HasOuterApproxClosed`.
* `tendsto_lintegral_apprSeq`: The integrals of the approximating functions to the indicator of a
closed set tend to the measure of the set.
* `ext_of_forall_lintegral_eq_of_IsFiniteMeasure`: Two finite measures are equal if the integrals
of all bounded continuous functions with respect to both agree.
-/
open BoundedContinuousFunction MeasureTheory Topology Metric Filter Set ENNReal NNReal
open scoped Topology ENNReal NNReal BoundedContinuousFunction
section auxiliary
namespace MeasureTheory
variable {Ω : Type*} [TopologicalSpace Ω] [MeasurableSpace Ω] [OpensMeasurableSpace Ω]
/-- A bounded convergence theorem for a finite measure:
If bounded continuous non-negative functions are uniformly bounded by a constant and tend to a
limit, then their integrals against the finite measure tend to the integral of the limit.
This formulation assumes:
* the functions tend to a limit along a countably generated filter;
* the limit is in the almost everywhere sense;
* boundedness holds almost everywhere;
* integration is `MeasureTheory.lintegral`, i.e., the functions and their integrals are
`ℝ≥0∞`-valued.
-/
theorem tendsto_lintegral_nn_filter_of_le_const {ι : Type*} {L : Filter ι} [L.IsCountablyGenerated]
(μ : Measure Ω) [IsFiniteMeasure μ] {fs : ι → Ω →ᵇ ℝ≥0} {c : ℝ≥0}
(fs_le_const : ∀ᶠ i in L, ∀ᵐ ω : Ω ∂μ, fs i ω ≤ c) {f : Ω → ℝ≥0}
(fs_lim : ∀ᵐ ω : Ω ∂μ, Tendsto (fun i ↦ fs i ω) L (𝓝 (f ω))) :
Tendsto (fun i ↦ ∫⁻ ω, fs i ω ∂μ) L (𝓝 (∫⁻ ω, f ω ∂μ)) := by
refine tendsto_lintegral_filter_of_dominated_convergence (fun _ ↦ c)
(Eventually.of_forall fun i ↦ (ENNReal.continuous_coe.comp (fs i).continuous).measurable) ?_
(@lintegral_const_lt_top _ _ μ _ _ (@ENNReal.coe_ne_top c)).ne ?_
· simpa only [Function.comp_apply, ENNReal.coe_le_coe] using fs_le_const
· simpa only [Function.comp_apply, ENNReal.tendsto_coe] using fs_lim
/-- If bounded continuous functions tend to the indicator of a measurable set and are
uniformly bounded, then their integrals against a finite measure tend to the measure of the set.
This formulation assumes:
* the functions tend to a limit along a countably generated filter;
* the limit is in the almost everywhere sense;
* boundedness holds almost everywhere.
-/
theorem measure_of_cont_bdd_of_tendsto_filter_indicator {ι : Type*} {L : Filter ι}
[L.IsCountablyGenerated] (μ : Measure Ω)
[IsFiniteMeasure μ] {c : ℝ≥0} {E : Set Ω} (E_mble : MeasurableSet E) (fs : ι → Ω →ᵇ ℝ≥0)
(fs_bdd : ∀ᶠ i in L, ∀ᵐ ω : Ω ∂μ, fs i ω ≤ c)
(fs_lim : ∀ᵐ ω ∂μ, Tendsto (fun i ↦ fs i ω) L (𝓝 (indicator E (fun _ ↦ (1 : ℝ≥0)) ω))) :
Tendsto (fun n ↦ lintegral μ fun ω ↦ fs n ω) L (𝓝 (μ E)) := by
convert tendsto_lintegral_nn_filter_of_le_const μ fs_bdd fs_lim
have aux : ∀ ω, indicator E (fun _ ↦ (1 : ℝ≥0∞)) ω = ↑(indicator E (fun _ ↦ (1 : ℝ≥0)) ω) :=
fun ω ↦ by simp only [ENNReal.coe_indicator, ENNReal.coe_one]
simp_rw [← aux, lintegral_indicator E_mble]
simp only [lintegral_one, Measure.restrict_apply, MeasurableSet.univ, univ_inter]
/-- If a sequence of bounded continuous functions tends to the indicator of a measurable set and
the functions are uniformly bounded, then their integrals against a finite measure tend to the
measure of the set.
A similar result with more general assumptions is
`MeasureTheory.measure_of_cont_bdd_of_tendsto_filter_indicator`.
-/
theorem measure_of_cont_bdd_of_tendsto_indicator
(μ : Measure Ω) [IsFiniteMeasure μ] {c : ℝ≥0} {E : Set Ω} (E_mble : MeasurableSet E)
(fs : ℕ → Ω →ᵇ ℝ≥0) (fs_bdd : ∀ n ω, fs n ω ≤ c)
(fs_lim : Tendsto (fun n ω ↦ fs n ω) atTop (𝓝 (indicator E fun _ ↦ (1 : ℝ≥0)))) :
Tendsto (fun n ↦ lintegral μ fun ω ↦ fs n ω) atTop (𝓝 (μ E)) := by
have fs_lim' :
∀ ω, Tendsto (fun n : ℕ ↦ (fs n ω : ℝ≥0)) atTop (𝓝 (indicator E (fun _ ↦ (1 : ℝ≥0)) ω)) := by
rw [tendsto_pi_nhds] at fs_lim
exact fun ω ↦ fs_lim ω
apply measure_of_cont_bdd_of_tendsto_filter_indicator μ E_mble fs
(Eventually.of_forall fun n ↦ Eventually.of_forall (fs_bdd n)) (Eventually.of_forall fs_lim')
/-- The integrals of thickened indicators of a closed set against a finite measure tend to the
measure of the closed set if the thickening radii tend to zero. -/
theorem tendsto_lintegral_thickenedIndicator_of_isClosed {Ω : Type*} {mΩ : MeasurableSpace Ω}
[PseudoEMetricSpace Ω] [OpensMeasurableSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ] {F : Set Ω}
(F_closed : IsClosed F) {δs : ℕ → ℝ} (δs_pos : ∀ n, 0 < δs n)
(δs_lim : Tendsto δs atTop (𝓝 0)) :
Tendsto (fun n ↦ lintegral μ fun ω ↦ (thickenedIndicator (δs_pos n) F ω : ℝ≥0∞)) atTop
(𝓝 (μ F)) := by
apply measure_of_cont_bdd_of_tendsto_indicator μ F_closed.measurableSet
(fun n ↦ thickenedIndicator (δs_pos n) F) fun n ω ↦ thickenedIndicator_le_one (δs_pos n) F ω
have key := thickenedIndicator_tendsto_indicator_closure δs_pos δs_lim F
rwa [F_closed.closure_eq] at key
/-- A thickened indicator is integrable. -/
lemma integrable_thickenedIndicator {Ω : Type*} {mΩ : MeasurableSpace Ω}
[PseudoEMetricSpace Ω] [OpensMeasurableSpace Ω] {μ : Measure Ω} [IsFiniteMeasure μ] (F : Set Ω)
{δ : ℝ} (δ_pos : 0 < δ) :
Integrable (fun ω ↦ (thickenedIndicator δ_pos F ω : ℝ)) μ := by
refine .of_bound (by fun_prop) 1 (ae_of_all _ fun x ↦ ?_)
simpa using thickenedIndicator_le_one δ_pos F x
/-- The integrals of thickened indicators of a closed set against a finite measure tend to the
measure of the closed set if the thickening radii tend to zero. -/
lemma tendsto_integral_thickenedIndicator_of_isClosed {Ω : Type*} {mΩ : MeasurableSpace Ω}
[PseudoEMetricSpace Ω] [OpensMeasurableSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ] {F : Set Ω}
(F_closed : IsClosed F) {δs : ℕ → ℝ} (δs_pos : ∀ (n : ℕ), 0 < δs n)
(δs_lim : Tendsto δs atTop (𝓝 0)) :
Tendsto (fun n : ℕ ↦ ∫ ω, (thickenedIndicator (δs_pos n) F ω : ℝ) ∂μ) atTop (𝓝 (μ.real F)) := by
-- we switch to the `lintegral` formulation and apply the corresponding lemma there
let fs : ℕ → Ω → ℝ := fun n ω ↦ thickenedIndicator (δs_pos n) F ω
have h := tendsto_lintegral_thickenedIndicator_of_isClosed μ F_closed δs_pos δs_lim
have h_eq (n : ℕ) : ∫⁻ ω, thickenedIndicator (δs_pos n) F ω ∂μ
= ENNReal.ofReal (∫ ω, fs n ω ∂μ) := by
rw [lintegral_coe_eq_integral]
exact integrable_thickenedIndicator F (δs_pos _)
simp_rw [h_eq] at h
rw [Measure.real_def]
have h_eq' : (fun n ↦ ∫ ω, fs n ω ∂μ) = fun n ↦ (ENNReal.ofReal (∫ ω, fs n ω ∂μ)).toReal := by
ext n
rw [ENNReal.toReal_ofReal]
exact integral_nonneg fun x ↦ by simp [fs]
rwa [h_eq', ENNReal.tendsto_toReal_iff (by simp) (by finiteness)]
end MeasureTheory -- namespace
end auxiliary -- section
section HasOuterApproxClosed
/-- A type class for topological spaces in which the indicator functions of closed sets can be
approximated pointwise from above by a sequence of bounded continuous functions. -/
class HasOuterApproxClosed (X : Type*) [TopologicalSpace X] : Prop where
exAppr : ∀ (F : Set X), IsClosed F → ∃ (fseq : ℕ → (X →ᵇ ℝ≥0)),
(∀ n x, fseq n x ≤ 1) ∧ (∀ n x, x ∈ F → 1 ≤ fseq n x) ∧
Tendsto (fun n : ℕ ↦ (fun x ↦ fseq n x)) atTop (𝓝 (indicator F fun _ ↦ (1 : ℝ≥0)))
namespace HasOuterApproxClosed
variable {X : Type*} [TopologicalSpace X] [HasOuterApproxClosed X]
variable {F : Set X} (hF : IsClosed F)
/-- A sequence of continuous functions `X → [0,1]` tending to the indicator of a closed set. -/
noncomputable def _root_.IsClosed.apprSeq : ℕ → (X →ᵇ ℝ≥0) :=
Exists.choose (HasOuterApproxClosed.exAppr F hF)
lemma apprSeq_apply_le_one (n : ℕ) (x : X) :
hF.apprSeq n x ≤ 1 :=
(Exists.choose_spec (HasOuterApproxClosed.exAppr F hF)).1 n x
lemma apprSeq_apply_eq_one (n : ℕ) {x : X} (hxF : x ∈ F) :
hF.apprSeq n x = 1 :=
le_antisymm (apprSeq_apply_le_one _ _ _)
((Exists.choose_spec (HasOuterApproxClosed.exAppr F hF)).2.1 n x hxF)
lemma tendsto_apprSeq :
Tendsto (fun n : ℕ ↦ (fun x ↦ hF.apprSeq n x)) atTop (𝓝 (indicator F fun _ ↦ (1 : ℝ≥0))) :=
(Exists.choose_spec (HasOuterApproxClosed.exAppr F hF)).2.2
lemma indicator_le_apprSeq (n : ℕ) :
indicator F (fun _ ↦ 1) ≤ hF.apprSeq n := by
intro x
by_cases hxF : x ∈ F
· simp only [hxF, indicator_of_mem, apprSeq_apply_eq_one hF n, le_refl]
· simp only [hxF, not_false_eq_true, indicator_of_notMem, zero_le]
/-- The measure of a closed set is at most the integral of any function in a decreasing
approximating sequence to the indicator of the set. -/
theorem measure_le_lintegral [MeasurableSpace X] [OpensMeasurableSpace X] (μ : Measure X) (n : ℕ) :
μ F ≤ ∫⁻ x, (hF.apprSeq n x : ℝ≥0∞) ∂μ := by
convert_to ∫⁻ x, (F.indicator (fun _ ↦ (1 : ℝ≥0∞))) x ∂μ ≤ ∫⁻ x, hF.apprSeq n x ∂μ
· rw [lintegral_indicator hF.measurableSet]
simp only [lintegral_one, MeasurableSet.univ, Measure.restrict_apply, univ_inter]
· apply lintegral_mono
intro x
by_cases hxF : x ∈ F
· simp only [hxF, indicator_of_mem, apprSeq_apply_eq_one hF n hxF, ENNReal.coe_one, le_refl]
· simp only [hxF, not_false_eq_true, indicator_of_notMem, zero_le]
/-- The integrals along a decreasing approximating sequence to the indicator of a closed set
tend to the measure of the closed set. -/
lemma tendsto_lintegral_apprSeq [MeasurableSpace X] [OpensMeasurableSpace X]
(μ : Measure X) [IsFiniteMeasure μ] :
Tendsto (fun n ↦ ∫⁻ x, hF.apprSeq n x ∂μ) atTop (𝓝 ((μ : Measure X) F)) :=
measure_of_cont_bdd_of_tendsto_indicator μ hF.measurableSet hF.apprSeq
(apprSeq_apply_le_one hF) (tendsto_apprSeq hF)
end HasOuterApproxClosed --namespace
noncomputable instance (X : Type*) [TopologicalSpace X]
[TopologicalSpace.PseudoMetrizableSpace X] : HasOuterApproxClosed X := by
letI : PseudoMetricSpace X := TopologicalSpace.pseudoMetrizableSpacePseudoMetric X
refine ⟨fun F hF ↦ ?_⟩
use fun n ↦ thickenedIndicator (δ := (1 : ℝ) / (n + 1)) Nat.one_div_pos_of_nat F
refine ⟨?_, ⟨?_, ?_⟩⟩
· exact fun n x ↦ thickenedIndicator_le_one Nat.one_div_pos_of_nat F x
· exact fun n x hxF ↦ one_le_thickenedIndicator_apply X Nat.one_div_pos_of_nat hxF
· have key := thickenedIndicator_tendsto_indicator_closure
(δseq := fun (n : ℕ) ↦ (1 : ℝ) / (n + 1))
(fun _ ↦ Nat.one_div_pos_of_nat) tendsto_one_div_add_atTop_nhds_zero_nat F
rw [tendsto_pi_nhds] at *
intro x
nth_rw 2 [← IsClosed.closure_eq hF]
exact key x
namespace MeasureTheory
/-- Two finite measures give equal values to all closed sets if the integrals of all bounded
continuous functions with respect to the two measures agree. -/
theorem measure_isClosed_eq_of_forall_lintegral_eq_of_isFiniteMeasure {Ω : Type*}
[MeasurableSpace Ω] [TopologicalSpace Ω] [HasOuterApproxClosed Ω]
[OpensMeasurableSpace Ω] {μ ν : Measure Ω} [IsFiniteMeasure μ]
(h : ∀ (f : Ω →ᵇ ℝ≥0), ∫⁻ x, f x ∂μ = ∫⁻ x, f x ∂ν) {F : Set Ω} (F_closed : IsClosed F) :
μ F = ν F := by
have ν_finite : IsFiniteMeasure ν := by
constructor
have whole := h 1
simp only [BoundedContinuousFunction.coe_one, Pi.one_apply, ENNReal.coe_one, lintegral_const,
one_mul] at whole
simp [← whole]
have obs_μ := HasOuterApproxClosed.tendsto_lintegral_apprSeq F_closed μ
have obs_ν := HasOuterApproxClosed.tendsto_lintegral_apprSeq F_closed ν
simp_rw [h] at obs_μ
exact tendsto_nhds_unique obs_μ obs_ν
/-- Two finite Borel measures are equal if the integrals of all non-negative bounded continuous
functions with respect to both agree. -/
theorem ext_of_forall_lintegral_eq_of_IsFiniteMeasure {Ω : Type*}
[MeasurableSpace Ω] [TopologicalSpace Ω] [HasOuterApproxClosed Ω]
[BorelSpace Ω] {μ ν : Measure Ω} [IsFiniteMeasure μ]
(h : ∀ (f : Ω →ᵇ ℝ≥0), ∫⁻ x, f x ∂μ = ∫⁻ x, f x ∂ν) :
μ = ν := by
have key := @measure_isClosed_eq_of_forall_lintegral_eq_of_isFiniteMeasure Ω _ _ _ _ μ ν _ h
apply ext_of_generate_finite _ ?_ isPiSystem_isClosed
· exact fun F F_closed ↦ key F_closed
· exact key isClosed_univ
· rw [BorelSpace.measurable_eq (α := Ω), borel_eq_generateFrom_isClosed]
/-- Two finite Borel measures are equal if the integrals of all bounded continuous functions with
respect to both agree. -/
theorem ext_of_forall_integral_eq_of_IsFiniteMeasure {Ω : Type*}
[MeasurableSpace Ω] [TopologicalSpace Ω] [HasOuterApproxClosed Ω]
[BorelSpace Ω] {μ ν : Measure Ω} [IsFiniteMeasure μ] [IsFiniteMeasure ν]
(h : ∀ (f : Ω →ᵇ ℝ), ∫ x, f x ∂μ = ∫ x, f x ∂ν) :
μ = ν := by
apply ext_of_forall_lintegral_eq_of_IsFiniteMeasure
intro f
apply (ENNReal.toReal_eq_toReal_iff' (lintegral_lt_top_of_nnreal μ f).ne
(lintegral_lt_top_of_nnreal ν f).ne).mp
rw [toReal_lintegral_coe_eq_integral f μ, toReal_lintegral_coe_eq_integral f ν]
exact h ⟨⟨fun x => (f x).toReal, Continuous.comp' NNReal.continuous_coe f.continuous⟩,
f.map_bounded'⟩
end MeasureTheory -- namespace
end HasOuterApproxClosed -- section |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Stieltjes.lean | import Mathlib.MeasureTheory.Constructions.BorelSpace.Order
import Mathlib.MeasureTheory.Measure.Typeclasses.Probability
import Mathlib.Topology.Algebra.UniformMulAction
import Mathlib.Topology.Order.LeftRightLim
/-!
# Stieltjes measures on the real line
Consider a function `f : ℝ → ℝ` which is monotone and right-continuous. Then one can define a
corresponding measure, giving mass `f b - f a` to the interval `(a, b]`.
## Main definitions
* `StieltjesFunction` is a structure containing a function from `ℝ → ℝ`, together with the
assertions that it is monotone and right-continuous. To `f : StieltjesFunction`, one associates
a Borel measure `f.measure`.
* `f.measure_Ioc` asserts that `f.measure (Ioc a b) = ofReal (f b - f a)`
* `f.measure_Ioo` asserts that `f.measure (Ioo a b) = ofReal (leftLim f b - f a)`.
* `f.measure_Icc` and `f.measure_Ico` are analogous.
-/
noncomputable section
open Set Filter Function ENNReal NNReal Topology MeasureTheory
open ENNReal (ofReal)
/-! ### Basic properties of Stieltjes functions -/
/-- Bundled monotone right-continuous real functions, used to construct Stieltjes measures. -/
structure StieltjesFunction where
/-- The underlying function `ℝ → ℝ`.
Do NOT use directly. Use the coercion instead. -/
toFun : ℝ → ℝ
mono' : Monotone toFun
right_continuous' : ∀ x, ContinuousWithinAt toFun (Ici x) x
namespace StieltjesFunction
attribute [coe] toFun
instance instCoeFun : CoeFun StieltjesFunction fun _ => ℝ → ℝ :=
⟨toFun⟩
initialize_simps_projections StieltjesFunction (toFun → apply)
@[ext] lemma ext {f g : StieltjesFunction} (h : ∀ x, f x = g x) : f = g := by
exact (StieltjesFunction.mk.injEq ..).mpr (funext h)
variable (f : StieltjesFunction)
theorem mono : Monotone f :=
f.mono'
theorem right_continuous (x : ℝ) : ContinuousWithinAt f (Ici x) x :=
f.right_continuous' x
theorem rightLim_eq (f : StieltjesFunction) (x : ℝ) : Function.rightLim f x = f x := by
rw [← f.mono.continuousWithinAt_Ioi_iff_rightLim_eq, continuousWithinAt_Ioi_iff_Ici]
exact f.right_continuous' x
theorem iInf_Ioi_eq (f : StieltjesFunction) (x : ℝ) : ⨅ r : Ioi x, f r = f x := by
suffices Function.rightLim f x = ⨅ r : Ioi x, f r by rw [← this, f.rightLim_eq]
rw [f.mono.rightLim_eq_sInf, sInf_image']
rw [← neBot_iff]
infer_instance
theorem iInf_rat_gt_eq (f : StieltjesFunction) (x : ℝ) :
⨅ r : { r' : ℚ // x < r' }, f r = f x := by
rw [← iInf_Ioi_eq f x]
refine (Real.iInf_Ioi_eq_iInf_rat_gt _ ?_ f.mono).symm
refine ⟨f x, fun y => ?_⟩
rintro ⟨y, hy_mem, rfl⟩
exact f.mono (le_of_lt hy_mem)
/-- The identity of `ℝ` as a Stieltjes function, used to construct Lebesgue measure. -/
@[simps]
protected def id : StieltjesFunction where
toFun := id
mono' _ _ := id
right_continuous' _ := continuousWithinAt_id
@[simp]
theorem id_leftLim (x : ℝ) : leftLim StieltjesFunction.id x = x :=
tendsto_nhds_unique (StieltjesFunction.id.mono.tendsto_leftLim x) <|
continuousAt_id.tendsto.mono_left nhdsWithin_le_nhds
instance instInhabited : Inhabited StieltjesFunction :=
⟨StieltjesFunction.id⟩
/-- Constant functions are Stieltjes function. -/
protected def const (c : ℝ) : StieltjesFunction where
toFun := fun _ ↦ c
mono' _ _ := by simp
right_continuous' _ := continuousWithinAt_const
@[simp] lemma const_apply (c x : ℝ) : (StieltjesFunction.const c) x = c := rfl
/-- The sum of two Stieltjes functions is a Stieltjes function. -/
protected def add (f g : StieltjesFunction) : StieltjesFunction where
toFun := fun x => f x + g x
mono' := f.mono.add g.mono
right_continuous' := fun x => (f.right_continuous x).add (g.right_continuous x)
instance : AddZeroClass StieltjesFunction where
add := StieltjesFunction.add
zero := StieltjesFunction.const 0
zero_add _ := ext fun _ ↦ zero_add _
add_zero _ := ext fun _ ↦ add_zero _
instance : AddCommMonoid StieltjesFunction where
nsmul n f := nsmulRec n f
add_assoc _ _ _ := ext fun _ ↦ add_assoc _ _ _
add_comm _ _ := ext fun _ ↦ add_comm _ _
__ := StieltjesFunction.instAddZeroClass
instance : Module ℝ≥0 StieltjesFunction where
smul c f := {
toFun := fun x ↦ c * f x
mono' := f.mono.const_mul c.2
right_continuous' := fun x ↦ (f.right_continuous x).const_smul c.1}
one_smul _ := ext fun _ ↦ one_mul _
mul_smul _ _ _ := ext fun _ ↦ mul_assoc _ _ _
smul_zero _ := ext fun _ ↦ mul_zero _
smul_add _ _ _ := ext fun _ ↦ mul_add _ _ _
add_smul _ _ _ := ext fun _ ↦ add_mul _ _ _
zero_smul _ := ext fun _ ↦ zero_mul _
@[simp] lemma zero_apply (x : ℝ) : (0 : StieltjesFunction) x = 0 := rfl
@[simp] lemma add_apply (f g : StieltjesFunction) (x : ℝ) : (f + g) x = f x + g x := rfl
/-- If a function `f : ℝ → ℝ` is monotone, then the function mapping `x` to the right limit of `f`
at `x` is a Stieltjes function, i.e., it is monotone and right-continuous. -/
noncomputable def _root_.Monotone.stieltjesFunction {f : ℝ → ℝ} (hf : Monotone f) :
StieltjesFunction where
toFun := rightLim f
mono' _ _ hxy := hf.rightLim hxy
right_continuous' := by
intro x s hs
obtain ⟨l, u, hlu, lus⟩ : ∃ l u : ℝ, rightLim f x ∈ Ioo l u ∧ Ioo l u ⊆ s :=
mem_nhds_iff_exists_Ioo_subset.1 hs
obtain ⟨y, xy, h'y⟩ : ∃ (y : ℝ), x < y ∧ Ioc x y ⊆ f ⁻¹' Ioo l u :=
mem_nhdsGT_iff_exists_Ioc_subset.1 (hf.tendsto_rightLim x (Ioo_mem_nhds hlu.1 hlu.2))
change ∀ᶠ y in 𝓝[≥] x, rightLim f y ∈ s
filter_upwards [Ico_mem_nhdsGE xy] with z hz
apply lus
refine ⟨hlu.1.trans_le (hf.rightLim hz.1), ?_⟩
obtain ⟨a, za, ay⟩ : ∃ a : ℝ, z < a ∧ a < y := exists_between hz.2
calc
rightLim f z ≤ f a := hf.rightLim_le za
_ < u := (h'y ⟨hz.1.trans_lt za, ay.le⟩).2
theorem _root_.Monotone.stieltjesFunction_eq {f : ℝ → ℝ} (hf : Monotone f) (x : ℝ) :
hf.stieltjesFunction x = rightLim f x :=
rfl
theorem countable_leftLim_ne (f : StieltjesFunction) : Set.Countable { x | leftLim f x ≠ f x } := by
refine Countable.mono ?_ f.mono.countable_not_continuousAt
intro x hx h'x
apply hx
exact tendsto_nhds_unique (f.mono.tendsto_leftLim x) (h'x.tendsto.mono_left nhdsWithin_le_nhds)
/-! ### The outer measure associated to a Stieltjes function -/
/-- Length of an interval. This is the largest monotone function which correctly measures all
intervals. -/
def length (s : Set ℝ) : ℝ≥0∞ :=
⨅ (a) (b) (_ : s ⊆ Ioc a b), ofReal (f b - f a)
@[simp]
theorem length_empty : f.length ∅ = 0 :=
nonpos_iff_eq_zero.1 <| iInf_le_of_le 0 <| iInf_le_of_le 0 <| by simp
@[simp]
theorem length_Ioc (a b : ℝ) : f.length (Ioc a b) = ofReal (f b - f a) := by
refine
le_antisymm (iInf_le_of_le a <| iInf₂_le b Subset.rfl)
(le_iInf fun a' => le_iInf fun b' => le_iInf fun h => ENNReal.coe_le_coe.2 ?_)
rcases le_or_gt b a with ab | ab
· rw [Real.toNNReal_of_nonpos (sub_nonpos.2 (f.mono ab))]
apply zero_le
obtain ⟨h₁, h₂⟩ := (Ioc_subset_Ioc_iff ab).1 h
exact Real.toNNReal_le_toNNReal (sub_le_sub (f.mono h₁) (f.mono h₂))
theorem length_mono {s₁ s₂ : Set ℝ} (h : s₁ ⊆ s₂) : f.length s₁ ≤ f.length s₂ :=
iInf_mono fun _ => biInf_mono fun _ => h.trans
open MeasureTheory
/-- The Stieltjes outer measure associated to a Stieltjes function. -/
protected def outer : OuterMeasure ℝ :=
OuterMeasure.ofFunction f.length f.length_empty
theorem outer_le_length (s : Set ℝ) : f.outer s ≤ f.length s :=
OuterMeasure.ofFunction_le _
/-- If a compact interval `[a, b]` is covered by a union of open interval `(c i, d i)`, then
`f b - f a ≤ ∑ f (d i) - f (c i)`. This is an auxiliary technical statement to prove the same
statement for half-open intervals, the point of the current statement being that one can use
compactness to reduce it to a finite sum, and argue by induction on the size of the covering set. -/
theorem length_subadditive_Icc_Ioo {a b : ℝ} {c d : ℕ → ℝ} (ss : Icc a b ⊆ ⋃ i, Ioo (c i) (d i)) :
ofReal (f b - f a) ≤ ∑' i, ofReal (f (d i) - f (c i)) := by
suffices
∀ (s : Finset ℕ) (b), Icc a b ⊆ (⋃ i ∈ (s : Set ℕ), Ioo (c i) (d i)) →
(ofReal (f b - f a) : ℝ≥0∞) ≤ ∑ i ∈ s, ofReal (f (d i) - f (c i)) by
rcases isCompact_Icc.elim_finite_subcover_image
(fun (i : ℕ) (_ : i ∈ univ) => @isOpen_Ioo _ _ _ _ (c i) (d i)) (by simpa using ss) with
⟨s, _, hf, hs⟩
have e : ⋃ i ∈ (hf.toFinset : Set ℕ), Ioo (c i) (d i) = ⋃ i ∈ s, Ioo (c i) (d i) := by
simp only [Finset.set_biUnion_coe,
Finite.mem_toFinset]
rw [ENNReal.tsum_eq_iSup_sum]
refine le_trans ?_ (le_iSup _ hf.toFinset)
exact this hf.toFinset _ (by simpa only [e] )
clear ss b
refine fun s => Finset.strongInductionOn s fun s IH b cv => ?_
rcases le_total b a with ab | ab
· rw [ENNReal.ofReal_eq_zero.2 (sub_nonpos.2 (f.mono ab))]
exact zero_le _
have := cv ⟨ab, le_rfl⟩
simp only [Finset.mem_coe, mem_iUnion, mem_Ioo, exists_and_left,
exists_prop] at this
rcases this with ⟨i, cb, is, bd⟩
rw [← Finset.insert_erase is] at cv ⊢
rw [Finset.coe_insert, biUnion_insert] at cv
rw [Finset.sum_insert (Finset.notMem_erase _ _)]
grw [← IH _ (Finset.erase_ssubset is) (c i), ← ENNReal.ofReal_add_le]
· gcongr
rw [sub_add_sub_cancel]
exact sub_le_sub_right (f.mono bd.le) _
· rintro x ⟨h₁, h₂⟩
exact (cv ⟨h₁, le_trans h₂ (le_of_lt cb)⟩).resolve_left (mt And.left (not_lt_of_ge h₂))
@[simp]
theorem outer_Ioc (a b : ℝ) : f.outer (Ioc a b) = ofReal (f b - f a) := by
/- It suffices to show that, if `(a, b]` is covered by sets `s i`, then `f b - f a` is bounded
by `∑ f.length (s i) + ε`. The difficulty is that `f.length` is expressed in terms of half-open
intervals, while we would like to have a compact interval covered by open intervals to use
compactness and finite sums, as provided by `length_subadditive_Icc_Ioo`. The trick is to use
the right-continuity of `f`. If `a'` is close enough to `a` on its right, then `[a', b]` is
still covered by the sets `s i` and moreover `f b - f a'` is very close to `f b - f a`
(up to `ε/2`).
Also, by definition one can cover `s i` by a half-closed interval `(p i, q i]` with `f`-length
very close to that of `s i` (within a suitably small `ε' i`, say). If one moves `q i` very
slightly to the right, then the `f`-length will change very little by right continuity, and we
will get an open interval `(p i, q' i)` covering `s i` with `f (q' i) - f (p i)` within `ε' i`
of the `f`-length of `s i`. -/
refine
le_antisymm
(by
rw [← f.length_Ioc]
apply outer_le_length)
(le_iInf₂ fun s hs => ENNReal.le_of_forall_pos_le_add fun ε εpos h => ?_)
let δ := ε / 2
have δpos : 0 < (δ : ℝ≥0∞) := by simpa [δ] using εpos.ne'
rcases ENNReal.exists_pos_sum_of_countable δpos.ne' ℕ with ⟨ε', ε'0, hε⟩
obtain ⟨a', ha', aa'⟩ : ∃ a', f a' - f a < δ ∧ a < a' := by
have A : ContinuousWithinAt (fun r => f r - f a) (Ioi a) a := by
refine ContinuousWithinAt.sub ?_ continuousWithinAt_const
exact (f.right_continuous a).mono Ioi_subset_Ici_self
have B : f a - f a < δ := by rwa [sub_self, NNReal.coe_pos, ← ENNReal.coe_pos]
exact (((tendsto_order.1 A).2 _ B).and self_mem_nhdsWithin).exists
have : ∀ i, ∃ p : ℝ × ℝ, s i ⊆ Ioo p.1 p.2 ∧
(ofReal (f p.2 - f p.1) : ℝ≥0∞) < f.length (s i) + ε' i := by
intro i
have hl :=
ENNReal.lt_add_right ((ENNReal.le_tsum i).trans_lt h).ne (ENNReal.coe_ne_zero.2 (ε'0 i).ne')
conv at hl =>
lhs
rw [length]
simp only [iInf_lt_iff, exists_prop] at hl
rcases hl with ⟨p, q', spq, hq'⟩
have : ContinuousWithinAt (fun r => ofReal (f r - f p)) (Ioi q') q' := by
apply ENNReal.continuous_ofReal.continuousAt.comp_continuousWithinAt
refine ContinuousWithinAt.sub ?_ continuousWithinAt_const
exact (f.right_continuous q').mono Ioi_subset_Ici_self
rcases (((tendsto_order.1 this).2 _ hq').and self_mem_nhdsWithin).exists with ⟨q, hq, q'q⟩
exact ⟨⟨p, q⟩, spq.trans (Ioc_subset_Ioo_right q'q), hq⟩
choose g hg using this
have I_subset : Icc a' b ⊆ ⋃ i, Ioo (g i).1 (g i).2 :=
calc
Icc a' b ⊆ Ioc a b := fun x hx => ⟨aa'.trans_le hx.1, hx.2⟩
_ ⊆ ⋃ i, s i := hs
_ ⊆ ⋃ i, Ioo (g i).1 (g i).2 := iUnion_mono fun i => (hg i).1
calc
ofReal (f b - f a) = ofReal (f b - f a' + (f a' - f a)) := by rw [sub_add_sub_cancel]
_ ≤ ofReal (f b - f a') + ofReal (f a' - f a) := ENNReal.ofReal_add_le
_ ≤ ∑' i, ofReal (f (g i).2 - f (g i).1) + ofReal δ :=
(add_le_add (f.length_subadditive_Icc_Ioo I_subset) (ENNReal.ofReal_le_ofReal ha'.le))
_ ≤ ∑' i, (f.length (s i) + ε' i) + δ :=
(add_le_add (ENNReal.tsum_le_tsum fun i => (hg i).2.le)
(by simp only [ENNReal.ofReal_coe_nnreal, le_rfl]))
_ = ∑' i, f.length (s i) + ∑' i, (ε' i : ℝ≥0∞) + δ := by rw [ENNReal.tsum_add]
_ ≤ ∑' i, f.length (s i) + δ + δ := add_le_add (add_le_add le_rfl hε.le) le_rfl
_ = ∑' i : ℕ, f.length (s i) + ε := by simp [δ, add_assoc, ENNReal.add_halves]
theorem measurableSet_Ioi {c : ℝ} : MeasurableSet[f.outer.caratheodory] (Ioi c) := by
refine OuterMeasure.ofFunction_caratheodory fun t => ?_
refine le_iInf fun a => le_iInf fun b => le_iInf fun h => ?_
refine
le_trans
(add_le_add (f.length_mono <| inter_subset_inter_left _ h)
(f.length_mono <| diff_subset_diff_left h)) ?_
rcases le_total a c with hac | hac <;> rcases le_total b c with hbc | hbc
· simp only [Ioc_inter_Ioi, f.length_Ioc, hac, hbc, le_refl, Ioc_eq_empty,
max_eq_right, min_eq_left, Ioc_diff_Ioi, f.length_empty, zero_add, not_lt]
· simp only [hac, hbc, Ioc_inter_Ioi, Ioc_diff_Ioi, f.length_Ioc, min_eq_right,
← ENNReal.ofReal_add, f.mono hac, f.mono hbc, sub_nonneg,
sub_add_sub_cancel, le_refl,
max_eq_right]
· simp only [hbc, le_refl, Ioc_eq_empty, Ioc_inter_Ioi, min_eq_left, Ioc_diff_Ioi, f.length_empty,
zero_add, or_true, le_sup_iff, f.length_Ioc, not_lt]
· simp only [hac, hbc, Ioc_inter_Ioi, Ioc_diff_Ioi, f.length_Ioc, min_eq_right,
le_refl, Ioc_eq_empty, add_zero, max_eq_left, f.length_empty, not_lt]
theorem outer_trim : f.outer.trim = f.outer := by
refine le_antisymm (fun s => ?_) (OuterMeasure.le_trim _)
rw [OuterMeasure.trim_eq_iInf]
refine le_iInf fun t => le_iInf fun ht => ENNReal.le_of_forall_pos_le_add fun ε ε0 h => ?_
rcases ENNReal.exists_pos_sum_of_countable (ENNReal.coe_pos.2 ε0).ne' ℕ with ⟨ε', ε'0, hε⟩
grw [← hε]
rw [← ENNReal.tsum_add]
choose g hg using
show ∀ i, ∃ s, t i ⊆ s ∧ MeasurableSet s ∧ f.outer s ≤ f.length (t i) + ofReal (ε' i) by
intro i
have hl :=
ENNReal.lt_add_right ((ENNReal.le_tsum i).trans_lt h).ne (ENNReal.coe_pos.2 (ε'0 i)).ne'
conv at hl =>
lhs
rw [length]
simp only [iInf_lt_iff] at hl
rcases hl with ⟨a, b, h₁, h₂⟩
rw [← f.outer_Ioc] at h₂
exact ⟨_, h₁, measurableSet_Ioc, le_of_lt <| by simpa using h₂⟩
simp only [ofReal_coe_nnreal] at hg
apply iInf_le_of_le (iUnion g) _
apply iInf_le_of_le (ht.trans <| iUnion_mono fun i => (hg i).1) _
apply iInf_le_of_le (MeasurableSet.iUnion fun i => (hg i).2.1) _
exact le_trans (measure_iUnion_le _) (ENNReal.tsum_le_tsum fun i => (hg i).2.2)
theorem borel_le_measurable : borel ℝ ≤ f.outer.caratheodory := by
rw [borel_eq_generateFrom_Ioi]
refine MeasurableSpace.generateFrom_le ?_
simp +contextual [f.measurableSet_Ioi]
/-! ### The measure associated to a Stieltjes function -/
/-- The measure associated to a Stieltjes function, giving mass `f b - f a` to the
interval `(a, b]`. -/
protected irreducible_def measure : Measure ℝ where
toOuterMeasure := f.outer
m_iUnion _s hs := f.outer.iUnion_eq_of_caratheodory fun i => f.borel_le_measurable _ (hs i)
trim_le := f.outer_trim.le
@[simp]
theorem measure_Ioc (a b : ℝ) : f.measure (Ioc a b) = ofReal (f b - f a) := by
rw [StieltjesFunction.measure]
exact f.outer_Ioc a b
@[simp]
theorem measure_singleton (a : ℝ) : f.measure {a} = ofReal (f a - leftLim f a) := by
obtain ⟨u, u_mono, u_lt_a, u_lim⟩ :
∃ u : ℕ → ℝ, StrictMono u ∧ (∀ n : ℕ, u n < a) ∧ Tendsto u atTop (𝓝 a) :=
exists_seq_strictMono_tendsto a
have A : {a} = ⋂ n, Ioc (u n) a := by
refine Subset.antisymm (fun x hx => by simp [mem_singleton_iff.1 hx, u_lt_a]) fun x hx => ?_
replace hx : ∀ (i : ℕ), u i < x ∧ x ≤ a := by simpa using hx
have : a ≤ x := le_of_tendsto' u_lim fun n => (hx n).1.le
simp [le_antisymm this (hx 0).2]
have L1 : Tendsto (fun n => f.measure (Ioc (u n) a)) atTop (𝓝 (f.measure {a})) := by
rw [A]
refine tendsto_measure_iInter_atTop (fun n => nullMeasurableSet_Ioc)
(fun m n hmn => ?_) ?_
· exact Ioc_subset_Ioc_left (u_mono.monotone hmn)
· exact ⟨0, by simpa only [measure_Ioc] using ENNReal.ofReal_ne_top⟩
have L2 :
Tendsto (fun n => f.measure (Ioc (u n) a)) atTop (𝓝 (ofReal (f a - leftLim f a))) := by
simp only [measure_Ioc]
have : Tendsto (fun n => f (u n)) atTop (𝓝 (leftLim f a)) := by
apply (f.mono.tendsto_leftLim a).comp
exact
tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ u_lim
(Eventually.of_forall fun n => u_lt_a n)
exact ENNReal.continuous_ofReal.continuousAt.tendsto.comp (tendsto_const_nhds.sub this)
exact tendsto_nhds_unique L1 L2
@[simp]
theorem measure_Icc (a b : ℝ) : f.measure (Icc a b) = ofReal (f b - leftLim f a) := by
rcases le_or_gt a b with (hab | hab)
· have A : Disjoint {a} (Ioc a b) := by simp
simp [← Icc_union_Ioc_eq_Icc le_rfl hab, -singleton_union, ← ENNReal.ofReal_add,
f.mono.leftLim_le, measure_union A measurableSet_Ioc, f.mono hab]
· simp only [hab, measure_empty, Icc_eq_empty, not_le]
symm
simp [ENNReal.ofReal_eq_zero, f.mono.le_leftLim hab]
@[simp]
theorem measure_Ioo {a b : ℝ} : f.measure (Ioo a b) = ofReal (leftLim f b - f a) := by
rcases le_or_gt b a with (hab | hab)
· simp only [hab, measure_empty, Ioo_eq_empty, not_lt]
symm
simp [ENNReal.ofReal_eq_zero, f.mono.leftLim_le hab]
· have A : Disjoint (Ioo a b) {b} := by simp
have D : f b - f a = f b - leftLim f b + (leftLim f b - f a) := by abel
have := f.measure_Ioc a b
simp only [← Ioo_union_Icc_eq_Ioc hab le_rfl, measure_singleton,
measure_union A (measurableSet_singleton b), Icc_self] at this
rw [D, ENNReal.ofReal_add, add_comm] at this
· simpa only [ENNReal.add_right_inj ENNReal.ofReal_ne_top]
· simp only [f.mono.leftLim_le le_rfl, sub_nonneg]
· simp only [f.mono.le_leftLim hab, sub_nonneg]
@[simp]
theorem measure_Ico (a b : ℝ) : f.measure (Ico a b) = ofReal (leftLim f b - leftLim f a) := by
rcases le_or_gt b a with (hab | hab)
· simp only [hab, measure_empty, Ico_eq_empty, not_lt]
symm
simp [ENNReal.ofReal_eq_zero, f.mono.leftLim hab]
· have A : Disjoint {a} (Ioo a b) := by simp
simp [← Icc_union_Ioo_eq_Ico le_rfl hab, -singleton_union, f.mono.leftLim_le,
measure_union A measurableSet_Ioo, f.mono.le_leftLim hab, ← ENNReal.ofReal_add]
theorem measure_Iic {l : ℝ} (hf : Tendsto f atBot (𝓝 l)) (x : ℝ) :
f.measure (Iic x) = ofReal (f x - l) := by
refine tendsto_nhds_unique (tendsto_measure_Ioc_atBot _ _) ?_
simp_rw [measure_Ioc]
exact ENNReal.tendsto_ofReal (Tendsto.const_sub _ hf)
lemma measure_Iio {l : ℝ} (hf : Tendsto f atBot (𝓝 l)) (x : ℝ) :
f.measure (Iio x) = ofReal (leftLim f x - l) := by
rw [← Iic_diff_right, measure_diff _ (nullMeasurableSet_singleton x), measure_singleton,
f.measure_Iic hf, ← ofReal_sub _ (sub_nonneg.mpr <| Monotone.leftLim_le f.mono' le_rfl)]
<;> simp
theorem measure_Ici {l : ℝ} (hf : Tendsto f atTop (𝓝 l)) (x : ℝ) :
f.measure (Ici x) = ofReal (l - leftLim f x) := by
refine tendsto_nhds_unique (tendsto_measure_Ico_atTop _ _) ?_
simp_rw [measure_Ico]
refine ENNReal.tendsto_ofReal (Tendsto.sub_const ?_ _)
have h_le1 : ∀ x, f (x - 1) ≤ leftLim f x := fun x => Monotone.le_leftLim f.mono (sub_one_lt x)
have h_le2 : ∀ x, leftLim f x ≤ f x := fun x => Monotone.leftLim_le f.mono le_rfl
refine tendsto_of_tendsto_of_tendsto_of_le_of_le (hf.comp ?_) hf h_le1 h_le2
rw [tendsto_atTop_atTop]
exact fun y => ⟨y + 1, fun z hyz => by rwa [le_sub_iff_add_le]⟩
lemma measure_Ioi {l : ℝ} (hf : Tendsto f atTop (𝓝 l)) (x : ℝ) :
f.measure (Ioi x) = ofReal (l - f x) := by
rw [← Ici_diff_left, measure_diff _ (nullMeasurableSet_singleton x), measure_singleton,
f.measure_Ici hf, ← ofReal_sub _ (sub_nonneg.mpr <| Monotone.leftLim_le f.mono' le_rfl)]
<;> simp
lemma measure_Ioi_of_tendsto_atTop_atTop (hf : Tendsto f atTop atTop) (x : ℝ) :
f.measure (Ioi x) = ∞ := by
refine ENNReal.eq_top_of_forall_nnreal_le fun r ↦ ?_
obtain ⟨N, hN⟩ := eventually_atTop.mp (tendsto_atTop.mp hf (r + f x))
exact (f.measure_Ioc x (max x N) ▸ ENNReal.coe_nnreal_eq r ▸ (ENNReal.ofReal_le_ofReal <|
le_tsub_of_add_le_right <| hN _ (le_max_right x N))).trans (measure_mono Ioc_subset_Ioi_self)
lemma measure_Ici_of_tendsto_atTop_atTop (hf : Tendsto f atTop atTop) (x : ℝ) :
f.measure (Ici x) = ∞ := by
rw [← top_le_iff, ← f.measure_Ioi_of_tendsto_atTop_atTop hf x]
exact measure_mono Ioi_subset_Ici_self
lemma measure_Iic_of_tendsto_atBot_atBot (hf : Tendsto f atBot atBot) (x : ℝ) :
f.measure (Iic x) = ∞ := by
refine ENNReal.eq_top_of_forall_nnreal_le fun r ↦ ?_
obtain ⟨N, hN⟩ := eventually_atBot.mp (tendsto_atBot.mp hf (f x - r))
exact (f.measure_Ioc (min x N) x ▸ ENNReal.coe_nnreal_eq r ▸ (ENNReal.ofReal_le_ofReal <|
le_sub_comm.mp <| hN _ (min_le_right x N))).trans (measure_mono Ioc_subset_Iic_self)
lemma measure_Iio_of_tendsto_atBot_atBot (hf : Tendsto f atBot atBot) (x : ℝ) :
f.measure (Iio x) = ∞ := by
rw [← top_le_iff, ← f.measure_Iic_of_tendsto_atBot_atBot hf (x - 1)]
exact measure_mono <| Set.Iic_subset_Iio.mpr <| sub_one_lt x
theorem measure_univ {l u : ℝ} (hfl : Tendsto f atBot (𝓝 l)) (hfu : Tendsto f atTop (𝓝 u)) :
f.measure univ = ofReal (u - l) := by
refine tendsto_nhds_unique (tendsto_measure_Iic_atTop _) ?_
simp_rw [measure_Iic f hfl]
exact ENNReal.tendsto_ofReal (Tendsto.sub_const hfu _)
lemma measure_univ_of_tendsto_atTop_atTop (hf : Tendsto f atTop atTop) :
f.measure univ = ∞ := by
rw [← top_le_iff, ← f.measure_Ioi_of_tendsto_atTop_atTop hf 0]
exact measure_mono (subset_univ _)
lemma measure_univ_of_tendsto_atBot_atBot (hf : Tendsto f atBot atBot) :
f.measure univ = ∞ := by
rw [← top_le_iff, ← f.measure_Iio_of_tendsto_atBot_atBot hf 0]
exact measure_mono (subset_univ _)
lemma isFiniteMeasure {l u : ℝ} (hfl : Tendsto f atBot (𝓝 l)) (hfu : Tendsto f atTop (𝓝 u)) :
IsFiniteMeasure f.measure := ⟨by simp [f.measure_univ hfl hfu]⟩
lemma isProbabilityMeasure (hf_bot : Tendsto f atBot (𝓝 0)) (hf_top : Tendsto f atTop (𝓝 1)) :
IsProbabilityMeasure f.measure := ⟨by simp [f.measure_univ hf_bot hf_top]⟩
instance instIsLocallyFiniteMeasure : IsLocallyFiniteMeasure f.measure :=
⟨fun x => ⟨Ioo (x - 1) (x + 1), Ioo_mem_nhds (by linarith) (by linarith), by simp⟩⟩
lemma eq_of_measure_of_tendsto_atBot (g : StieltjesFunction) {l : ℝ}
(hfg : f.measure = g.measure) (hfl : Tendsto f atBot (𝓝 l)) (hgl : Tendsto g atBot (𝓝 l)) :
f = g := by
ext x
have hf := measure_Iic f hfl x
rw [hfg, measure_Iic g hgl x, ENNReal.ofReal_eq_ofReal_iff, eq_comm] at hf
· simpa using hf
· rw [sub_nonneg]
exact Monotone.le_of_tendsto g.mono hgl x
· rw [sub_nonneg]
exact Monotone.le_of_tendsto f.mono hfl x
lemma eq_of_measure_of_eq (g : StieltjesFunction) {y : ℝ}
(hfg : f.measure = g.measure) (hy : f y = g y) :
f = g := by
ext x
cases le_total x y with
| inl hxy =>
have hf := measure_Ioc f x y
rw [hfg, measure_Ioc g x y, ENNReal.ofReal_eq_ofReal_iff, eq_comm, hy] at hf
· simpa using hf
· rw [sub_nonneg]
exact g.mono hxy
· rw [sub_nonneg]
exact f.mono hxy
| inr hxy =>
have hf := measure_Ioc f y x
rw [hfg, measure_Ioc g y x, ENNReal.ofReal_eq_ofReal_iff, eq_comm, hy] at hf
· simpa using hf
· rw [sub_nonneg]
exact g.mono hxy
· rw [sub_nonneg]
exact f.mono hxy
@[simp]
lemma measure_zero : StieltjesFunction.measure 0 = 0 :=
Measure.ext_of_Ioc _ _ (by simp)
@[simp]
lemma measure_const (c : ℝ) : (StieltjesFunction.const c).measure = 0 :=
Measure.ext_of_Ioc _ _ (by simp)
@[simp]
lemma measure_add (f g : StieltjesFunction) : (f + g).measure = f.measure + g.measure := by
refine Measure.ext_of_Ioc _ _ (fun a b h ↦ ?_)
simp only [measure_Ioc, add_apply, Measure.coe_add, Pi.add_apply]
rw [← ENNReal.ofReal_add (sub_nonneg_of_le (f.mono h.le)) (sub_nonneg_of_le (g.mono h.le))]
ring_nf
@[simp]
lemma measure_smul (c : ℝ≥0) (f : StieltjesFunction) : (c • f).measure = c • f.measure := by
refine Measure.ext_of_Ioc _ _ (fun a b _ ↦ ?_)
simp only [measure_Ioc, Measure.smul_apply]
change ofReal (c * f b - c * f a) = c • ofReal (f b - f a)
rw [← _root_.mul_sub, ENNReal.ofReal_mul zero_le_coe, ofReal_coe_nnreal, ← smul_eq_mul]
rfl
end StieltjesFunction |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Sub.lean | import Mathlib.MeasureTheory.Measure.Typeclasses.Finite
/-!
# Subtraction of measures
In this file we define `μ - ν` to be the least measure `τ` such that `μ ≤ τ + ν`.
It is the equivalent of `(μ - ν) ⊔ 0` if `μ` and `ν` were signed measures.
Compare with `ENNReal.instSub`.
Specifically, note that if you have `α = {1,2}`, and `μ {1} = 2`, `μ {2} = 0`, and
`ν {2} = 2`, `ν {1} = 0`, then `(μ - ν) {1, 2} = 2`. However, if `μ ≤ ν`, and
`ν univ ≠ ∞`, then `(μ - ν) + ν = μ`.
-/
open Set
namespace MeasureTheory
namespace Measure
/-- The measure `μ - ν` is defined to be the least measure `τ` such that `μ ≤ τ + ν`.
It is the equivalent of `(μ - ν) ⊔ 0` if `μ` and `ν` were signed measures.
Compare with `ENNReal.instSub`.
Specifically, note that if you have `α = {1,2}`, and `μ {1} = 2`, `μ {2} = 0`, and
`ν {2} = 2`, `ν {1} = 0`, then `(μ - ν) {1, 2} = 2`. However, if `μ ≤ ν`, and
`ν univ ≠ ∞`, then `(μ - ν) + ν = μ`. -/
noncomputable instance instSub {α : Type*} [MeasurableSpace α] : Sub (Measure α) :=
⟨fun μ ν => sInf { τ | μ ≤ τ + ν }⟩
variable {α : Type*} {m : MeasurableSpace α} {μ ν : Measure α} {s : Set α}
theorem sub_def : μ - ν = sInf { d | μ ≤ d + ν } := rfl
theorem sub_le_of_le_add {d} (h : μ ≤ d + ν) : μ - ν ≤ d :=
sInf_le h
theorem sub_eq_zero_of_le (h : μ ≤ ν) : μ - ν = 0 :=
nonpos_iff_eq_zero'.1 <| sub_le_of_le_add <| by rwa [zero_add]
theorem sub_le : μ - ν ≤ μ :=
sub_le_of_le_add <| Measure.le_add_right le_rfl
@[simp]
theorem sub_top : μ - ⊤ = 0 :=
sub_eq_zero_of_le le_top
@[simp]
theorem zero_sub : 0 - μ = 0 :=
sub_eq_zero_of_le μ.zero_le
@[simp]
theorem sub_self : μ - μ = 0 :=
sub_eq_zero_of_le le_rfl
@[simp]
protected theorem sub_zero : μ - 0 = μ := by
rw [sub_def]
apply le_antisymm
· simp [sInf_le]
· simp
/-- This application lemma only works in special circumstances. Given knowledge of
when `μ ≤ ν` and `ν ≤ μ`, a more general application lemma can be written. -/
theorem sub_apply [IsFiniteMeasure ν] (h₁ : MeasurableSet s) (h₂ : ν ≤ μ) :
(μ - ν) s = μ s - ν s := by
-- We begin by defining `measure_sub`, which will be equal to `(μ - ν)`.
let measure_sub : Measure α := MeasureTheory.Measure.ofMeasurable
(fun (t : Set α) (_ : MeasurableSet t) => μ t - ν t) (by simp)
(fun g h_meas h_disj ↦ by
simp only [measure_iUnion h_disj h_meas]
rw [ENNReal.tsum_sub _ (h₂ <| g ·)]
rw [← measure_iUnion h_disj h_meas]
apply measure_ne_top)
-- Now, we demonstrate `μ - ν = measure_sub`, and apply it.
have h_measure_sub_add : ν + measure_sub = μ := by
ext1 t h_t_measurable_set
simp only [Pi.add_apply, coe_add]
rw [MeasureTheory.Measure.ofMeasurable_apply _ h_t_measurable_set, add_comm,
tsub_add_cancel_of_le (h₂ t)]
have h_measure_sub_eq : μ - ν = measure_sub := by
rw [MeasureTheory.Measure.sub_def]
apply le_antisymm
· apply sInf_le
simp [le_refl, add_comm, h_measure_sub_add]
apply le_sInf
intro d h_d
rw [← h_measure_sub_add, mem_setOf_eq, add_comm d] at h_d
apply Measure.le_of_add_le_add_left h_d
rw [h_measure_sub_eq]
apply Measure.ofMeasurable_apply _ h₁
theorem sub_add_cancel_of_le [IsFiniteMeasure ν] (h₁ : ν ≤ μ) : μ - ν + ν = μ := by
ext1 s h_s_meas
rw [add_apply, sub_apply h_s_meas h₁, tsub_add_cancel_of_le (h₁ s)]
@[simp]
protected lemma add_sub_cancel [IsFiniteMeasure ν] : μ + ν - ν = μ := by
ext1 s hs
rw [sub_apply hs (Measure.le_add_left (le_refl _)), add_apply,
ENNReal.add_sub_cancel_right (measure_ne_top ν s)]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
(μ - ν).restrict s = μ.restrict s - ν.restrict s := by
repeat rw [sub_def]
have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
apply le_antisymm
· refine sInf_le_sInf_of_isCoinitialFor ?_
intro ν' h_ν'_in
rw [mem_setOf_eq] at h_ν'_in
refine ⟨ν'.restrict s, ?_, restrict_le_self⟩
refine ⟨ν' + (⊤ : Measure α).restrict sᶜ, ?_, ?_⟩
· rw [mem_setOf_eq, add_right_comm, Measure.le_iff]
intro t h_meas_t
repeat rw [← measure_inter_add_diff t h_meas_s]
refine add_le_add ?_ ?_
· rw [add_apply, add_apply]
apply le_add_right _
rw [← restrict_eq_self μ inter_subset_right,
← restrict_eq_self ν inter_subset_right]
apply h_ν'_in
· rw [add_apply, restrict_apply (h_meas_t.diff h_meas_s), diff_eq, inter_assoc, inter_self,
← add_apply]
have h_mu_le_add_top : μ ≤ ν' + ν + ⊤ := by simp only [add_top, le_top]
exact Measure.le_iff'.1 h_mu_le_add_top _
· ext1 t h_meas_t
simp [restrict_apply h_meas_t, restrict_apply (h_meas_t.inter h_meas_s), inter_assoc]
· refine sInf_le_sInf_of_isCoinitialFor ?_
refine forall_mem_image.2 fun t h_t_in => ⟨t.restrict s, ?_, le_rfl⟩
rw [Set.mem_setOf_eq, ← restrict_add]
exact restrict_mono Subset.rfl h_t_in
theorem sub_apply_eq_zero_of_restrict_le_restrict (h_le : μ.restrict s ≤ ν.restrict s)
(h_meas_s : MeasurableSet s) : (μ - ν) s = 0 := by
rw [← restrict_apply_self, restrict_sub_eq_restrict_sub_restrict, sub_eq_zero_of_le] <;> simp [*]
instance isFiniteMeasure_sub [IsFiniteMeasure μ] : IsFiniteMeasure (μ - ν) :=
isFiniteMeasure_of_le μ sub_le
end Measure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Real.lean | import Mathlib.MeasureTheory.Measure.Typeclasses.Probability
import Mathlib.MeasureTheory.Measure.Typeclasses.SFinite
/-!
# Measures as real-valued functions
Given a measure `μ`, we have defined `μ.real` as the function sending a set `s` to `(μ s).toReal`.
In this file, we develop a basic API around this notion.
We essentially copy relevant lemmas from the files `MeasureSpaceDef.lean`, `NullMeasurable.lean` and
`MeasureSpace.lean`, and adapt them by replacing in their name `measure` with `measureReal`.
Many lemmas require an assumption that some set has finite measure. These assumptions are written
in the form `(h : μ s ≠ ∞ := by finiteness)`, where `finiteness` is a tactic for goals of
the form `≠ ∞`.
There are certainly many missing lemmas. The missing ones should be added as they are needed.
There are no lemmas on infinite sums, as summability issues are really
more painful with reals than nonnegative extended reals. They should probably be added in the long
run.
-/
open MeasureTheory Measure Set
open scoped ENNReal NNReal Function symmDiff
namespace MeasureTheory
variable {α β ι : Type*} {_ : MeasurableSpace α} {μ : Measure α} {s s₁ s₂ s₃ t t₁ t₂ u : Set α}
theorem measureReal_eq_zero_iff (h : μ s ≠ ∞ := by finiteness) :
μ.real s = 0 ↔ μ s = 0 := by
rw [Measure.real, ENNReal.toReal_eq_zero_iff]
exact or_iff_left h
theorem measureReal_ne_zero_iff (h : μ s ≠ ∞ := by finiteness) :
μ.real s ≠ 0 ↔ μ s ≠ 0 := by
simp [measureReal_eq_zero_iff, h]
@[simp] theorem measureReal_zero : (0 : Measure α).real = 0 := rfl
theorem measureReal_zero_apply (s : Set α) : (0 : Measure α).real s = 0 := rfl
@[simp] theorem measureReal_nonneg : 0 ≤ μ.real s := ENNReal.toReal_nonneg
@[simp] theorem measureReal_empty : μ.real ∅ = 0 := by simp [Measure.real]
@[simp] theorem measureReal_univ_eq_one [IsProbabilityMeasure μ] :
μ.real Set.univ = 1 := by
simp [Measure.real]
@[simp]
theorem measureReal_univ_pos [IsFiniteMeasure μ] [NeZero μ] : 0 < μ.real Set.univ :=
ENNReal.toReal_pos (NeZero.ne (μ Set.univ)) (by finiteness)
theorem measureReal_univ_ne_zero [IsFiniteMeasure μ] [NeZero μ] : μ.real Set.univ ≠ 0 :=
measureReal_univ_pos.ne'
@[simp]
theorem ofReal_measureReal (h : μ s ≠ ∞ := by finiteness) : ENNReal.ofReal (μ.real s) = μ s := by
simp [measureReal_def, h]
theorem nonempty_of_measureReal_ne_zero (h : μ.real s ≠ 0) : s.Nonempty :=
nonempty_iff_ne_empty.2 fun h' ↦ h <| h'.symm ▸ measureReal_empty
@[simp] theorem measureReal_ennreal_smul_apply (c : ℝ≥0∞) :
(c • μ).real s = c.toReal * μ.real s := by
simp [Measure.real]
@[simp] theorem measureReal_nnreal_smul_apply (c : ℝ≥0) :
(c • μ).real s = c * μ.real s := by
simp [measureReal_def]
theorem map_measureReal_apply [MeasurableSpace β] {f : α → β} (hf : Measurable f)
{s : Set β} (hs : MeasurableSet s) : (μ.map f).real s = μ.real (f ⁻¹' s) := by
simp_rw [measureReal_def, map_apply hf hs]
@[gcongr] theorem measureReal_mono (h : s₁ ⊆ s₂) (h₂ : μ s₂ ≠ ∞ := by finiteness) :
μ.real s₁ ≤ μ.real s₂ :=
ENNReal.toReal_mono h₂ (measure_mono h)
theorem measureReal_eq_measureReal_iff {m : MeasurableSpace β} {ν : Measure β} {t : Set β}
(h₁ : μ s ≠ ∞ := by finiteness) (h₂ : ν t ≠ ∞ := by finiteness) :
μ.real s = ν.real t ↔ μ s = ν t := by
simp [measureReal_def, ENNReal.toReal_eq_toReal_iff' h₁ h₂]
theorem measureReal_restrict_apply₀ (ht : NullMeasurableSet t (μ.restrict s)) :
(μ.restrict s).real t = μ.real (t ∩ s) := by
simp only [measureReal_def, restrict_apply₀ ht]
@[simp]
theorem measureReal_restrict_apply (ht : MeasurableSet t) :
(μ.restrict s).real t = μ.real (t ∩ s) := by
simp only [measureReal_def, restrict_apply ht]
theorem measureReal_restrict_apply_univ (s : Set α) : (μ.restrict s).real univ = μ.real s := by
simp
@[simp]
theorem measureReal_restrict_apply' (hs : MeasurableSet s) :
(μ.restrict s).real t = μ.real (t ∩ s) := by
simp only [measureReal_def, restrict_apply' hs]
theorem measureReal_restrict_apply₀' (hs : NullMeasurableSet s μ) : μ.restrict s t = μ (t ∩ s) := by
simp only [restrict_apply₀' hs]
@[simp]
theorem measureReal_restrict_apply_self (s : Set α) : (μ.restrict s).real s = μ.real s := by
simp [measureReal_def]
theorem measureReal_mono_null (h : s₁ ⊆ s₂) (h₂ : μ.real s₂ = 0) (h'₂ : μ s₂ ≠ ∞ := by finiteness) :
μ.real s₁ = 0 := by
rw [measureReal_eq_zero_iff h'₂] at h₂
simp [Measure.real, measure_mono_null h h₂]
theorem measureReal_le_measureReal_union_left (h : μ t ≠ ∞ := by finiteness) :
μ.real s ≤ μ.real (s ∪ t) := by
rcases eq_top_or_lt_top (μ s) with hs | hs
· simp [Measure.real, hs]
· exact measureReal_mono subset_union_left (measure_union_lt_top hs h.lt_top).ne
theorem measureReal_le_measureReal_union_right (h : μ s ≠ ∞ := by finiteness) :
μ.real t ≤ μ.real (s ∪ t) := by
rw [union_comm]
exact measureReal_le_measureReal_union_left h
theorem measureReal_union_le (s₁ s₂ : Set α) : μ.real (s₁ ∪ s₂) ≤ μ.real s₁ + μ.real s₂ := by
rcases eq_top_or_lt_top (μ (s₁ ∪ s₂)) with h | h
· simp only [Measure.real, h, ENNReal.toReal_top]
exact add_nonneg ENNReal.toReal_nonneg ENNReal.toReal_nonneg
· have A : μ s₁ ≠ ∞ := measure_ne_top_of_subset subset_union_left h.ne
have B : μ s₂ ≠ ∞ := measure_ne_top_of_subset subset_union_right h.ne
simp only [Measure.real, ← ENNReal.toReal_add A B]
exact ENNReal.toReal_mono (by simp [A, B]) (measure_union_le _ _)
theorem measureReal_biUnion_finset_le (s : Finset β) (f : β → Set α) :
μ.real (⋃ b ∈ s, f b) ≤ ∑ p ∈ s, μ.real (f p) := by
classical
induction s using Finset.induction_on with
| empty => simp
| insert _ _ hx IH =>
simp only [hx, Finset.mem_insert, iUnion_iUnion_eq_or_left, not_false_eq_true,
Finset.sum_insert]
exact (measureReal_union_le _ _).trans (by gcongr)
theorem measureReal_iUnion_fintype_le [Fintype β] (f : β → Set α) :
μ.real (⋃ b, f b) ≤ ∑ p, μ.real (f p) := by
convert measureReal_biUnion_finset_le Finset.univ f
simp
theorem measureReal_iUnion_fintype [Fintype β] {f : β → Set α} (hn : Pairwise (Disjoint on f))
(h : ∀ i, MeasurableSet (f i)) (h' : ∀ i, μ (f i) ≠ ∞ := by finiteness) :
μ.real (⋃ b, f b) = ∑ p, μ.real (f p) := by
simp_rw [measureReal_def, measure_iUnion hn h, tsum_fintype,
ENNReal.toReal_sum (fun i _hi ↦ h' i)]
theorem measureReal_union_null (h₁ : μ.real s₁ = 0) (h₂ : μ.real s₂ = 0) :
μ.real (s₁ ∪ s₂) = 0 :=
le_antisymm ((measureReal_union_le s₁ s₂).trans (by simp [h₁, h₂])) measureReal_nonneg
@[simp]
theorem measureReal_union_null_iff
(h₁ : μ s₁ ≠ ∞ := by finiteness) (h₂ : μ s₂ ≠ ∞ := by finiteness) :
μ.real (s₁ ∪ s₂) = 0 ↔ μ.real s₁ = 0 ∧ μ.real s₂ = 0 :=
⟨fun h ↦ ⟨measureReal_mono_null subset_union_left h (by finiteness),
measureReal_mono_null subset_union_right h (by finiteness)⟩,
fun h ↦ measureReal_union_null h.1 h.2⟩
/-- If two sets are equal modulo a set of measure zero, then `μ.real s = μ.real t`. -/
theorem measureReal_congr (H : s =ᵐ[μ] t) : μ.real s = μ.real t := by
simp [Measure.real, measure_congr H]
theorem measureReal_inter_add_diff₀ (ht : NullMeasurableSet t μ)
(h : μ s ≠ ∞ := by finiteness) :
μ.real (s ∩ t) + μ.real (s \ t) = μ.real s := by
simp only [measureReal_def]
rw [← ENNReal.toReal_add, measure_inter_add_diff₀ s ht]
· exact measure_ne_top_of_subset inter_subset_left h
· exact measure_ne_top_of_subset diff_subset h
theorem measureReal_union_add_inter₀ (ht : NullMeasurableSet t μ)
(h₁ : μ s ≠ ∞ := by finiteness) (h₂ : μ t ≠ ∞ := by finiteness) :
μ.real (s ∪ t) + μ.real (s ∩ t) = μ.real s + μ.real t := by
have : μ (s ∪ t) ≠ ∞ :=
((measure_union_le _ _).trans_lt (ENNReal.add_lt_top.2 ⟨h₁.lt_top, h₂.lt_top⟩ )).ne
rw [← measureReal_inter_add_diff₀ ht this, Set.union_inter_cancel_right, union_diff_right,
← measureReal_inter_add_diff₀ ht h₁]
ac_rfl
theorem measureReal_union_add_inter₀' (hs : NullMeasurableSet s μ)
(h₁ : μ s ≠ ∞ := by finiteness) (h₂ : μ t ≠ ∞ := by finiteness) :
μ.real (s ∪ t) + μ.real (s ∩ t) = μ.real s + μ.real t := by
rw [union_comm, inter_comm, measureReal_union_add_inter₀ hs h₂ h₁, add_comm]
theorem measureReal_union₀ (ht : NullMeasurableSet t μ) (hd : AEDisjoint μ s t)
(h₁ : μ s ≠ ∞ := by finiteness) (h₂ : μ t ≠ ∞ := by finiteness) :
μ.real (s ∪ t) = μ.real s + μ.real t := by
simp only [Measure.real]
rw [measure_union₀ ht hd, ENNReal.toReal_add h₁ h₂]
theorem measureReal_union₀' (hs : NullMeasurableSet s μ) (hd : AEDisjoint μ s t)
(h₁ : μ s ≠ ∞ := by finiteness) (h₂ : μ t ≠ ∞ := by finiteness) :
μ.real (s ∪ t) = μ.real s + μ.real t := by
rw [union_comm, measureReal_union₀ hs (AEDisjoint.symm hd) h₂ h₁, add_comm]
theorem measureReal_add_measureReal_compl₀ [IsFiniteMeasure μ] (hs : NullMeasurableSet s μ) :
μ.real s + μ.real sᶜ = μ.real univ := by
rw [← measureReal_union₀' hs aedisjoint_compl_right, union_compl_self]
theorem measureReal_add_measureReal_compl [IsFiniteMeasure μ] (h : MeasurableSet s) :
μ.real s + μ.real sᶜ = μ.real univ :=
measureReal_add_measureReal_compl₀ h.nullMeasurableSet
theorem measureReal_union (hd : Disjoint s₁ s₂) (h : MeasurableSet s₂)
(h₁ : μ s₁ ≠ ∞ := by finiteness) (h₂ : μ s₂ ≠ ∞ := by finiteness) :
μ.real (s₁ ∪ s₂) = μ.real s₁ + μ.real s₂ :=
measureReal_union₀ h.nullMeasurableSet hd.aedisjoint h₁ h₂
theorem measureReal_union' (hd : Disjoint s₁ s₂) (h : MeasurableSet s₁)
(h₁ : μ s₁ ≠ ∞ := by finiteness) (h₂ : μ s₂ ≠ ∞ := by finiteness) :
μ.real (s₁ ∪ s₂) = μ.real s₁ + μ.real s₂ :=
measureReal_union₀' h.nullMeasurableSet hd.aedisjoint h₁ h₂
theorem measureReal_inter_add_diff (ht : MeasurableSet t)
(h : μ s ≠ ∞ := by finiteness) :
μ.real (s ∩ t) + μ.real (s \ t) = μ.real s := by
simp only [Measure.real]
rw [← ENNReal.toReal_add, measure_inter_add_diff _ ht]
· exact measure_ne_top_of_subset inter_subset_left h
· exact measure_ne_top_of_subset diff_subset h
theorem measureReal_diff_add_inter (ht : MeasurableSet t)
(h : μ s ≠ ∞ := by finiteness) :
μ.real (s \ t) + μ.real (s ∩ t) = μ.real s :=
(add_comm _ _).trans (measureReal_inter_add_diff ht h)
theorem measureReal_union_add_inter (ht : MeasurableSet t)
(h₁ : μ s ≠ ∞ := by finiteness) (h₂ : μ t ≠ ∞ := by finiteness) :
μ.real (s ∪ t) + μ.real (s ∩ t) = μ.real s + μ.real t :=
measureReal_union_add_inter₀ ht.nullMeasurableSet h₁ h₂
theorem measureReal_union_add_inter' (hs : MeasurableSet s)
(h₁ : μ s ≠ ∞ := by finiteness) (h₂ : μ t ≠ ∞ := by finiteness) :
μ.real (s ∪ t) + μ.real (s ∩ t) = μ.real s + μ.real t :=
measureReal_union_add_inter₀' hs.nullMeasurableSet h₁ h₂
lemma measureReal_symmDiff_eq (hs : MeasurableSet s) (ht : MeasurableSet t)
(h₁ : μ s ≠ ∞ := by finiteness) (h₂ : μ t ≠ ∞ := by finiteness) :
μ.real (s ∆ t) = μ.real (s \ t) + μ.real (t \ s) := by
simp only [Measure.real]
rw [← ENNReal.toReal_add, measure_symmDiff_eq hs.nullMeasurableSet ht.nullMeasurableSet]
· exact measure_ne_top_of_subset diff_subset h₁
· exact measure_ne_top_of_subset diff_subset h₂
lemma measureReal_symmDiff_le (u : Set α)
(h₁ : μ s ≠ ∞ := by finiteness) (h₂ : μ t ≠ ∞ := by finiteness) :
μ.real (s ∆ u) ≤ μ.real (s ∆ t) + μ.real (t ∆ u) := by
rcases eq_top_or_lt_top (μ u) with hu | hu
· simp only [measureReal_def, measure_symmDiff_eq_top h₁ hu, ENNReal.toReal_top]
exact add_nonneg ENNReal.toReal_nonneg ENNReal.toReal_nonneg
· exact le_trans (measureReal_mono (symmDiff_triangle s t u)
(measure_union_ne_top (by finiteness) (by finiteness)))
(measureReal_union_le (s ∆ t) (t ∆ u))
theorem measureReal_biUnion_finset₀ {s : Finset ι} {f : ι → Set α}
(hd : Set.Pairwise (↑s) (AEDisjoint μ on f)) (hm : ∀ b ∈ s, NullMeasurableSet (f b) μ)
(h : ∀ b ∈ s, μ (f b) ≠ ∞ := by finiteness) :
μ.real (⋃ b ∈ s, f b) = ∑ p ∈ s, μ.real (f p) := by
simp only [measureReal_def, measure_biUnion_finset₀ hd hm, ENNReal.toReal_sum h]
theorem measureReal_biUnion_finset {s : Finset ι} {f : ι → Set α} (hd : PairwiseDisjoint (↑s) f)
(hm : ∀ b ∈ s, MeasurableSet (f b)) (h : ∀ b ∈ s, μ (f b) ≠ ∞ := by finiteness) :
μ.real (⋃ b ∈ s, f b) = ∑ p ∈ s, μ.real (f p) :=
measureReal_biUnion_finset₀ hd.aedisjoint (fun b hb ↦ (hm b hb).nullMeasurableSet) h
/-- If `s` is a `Finset`, then the measure of its preimage can be found as the sum of measures
of the fibers `f ⁻¹' {y}`. -/
theorem sum_measureReal_preimage_singleton (s : Finset β) {f : α → β}
(hf : ∀ y ∈ s, MeasurableSet (f ⁻¹' {y})) (h : ∀ a ∈ s, μ (f ⁻¹' {a}) ≠ ∞ := by finiteness) :
(∑ b ∈ s, μ.real (f ⁻¹' {b})) = μ.real (f ⁻¹' s) := by
simp only [measureReal_def, ← sum_measure_preimage_singleton s hf, ENNReal.toReal_sum h]
/-- If `s` is a `Finset`, then the sums of the real measures of the singletons in the set is the
real measure of the set. -/
@[simp] theorem sum_measureReal_singleton [MeasurableSingletonClass α] [SigmaFinite μ]
(s : Finset α) :
(∑ b ∈ s, μ.real {b}) = μ.real s := by
simp [measureReal_def, ← ENNReal.toReal_sum (fun _ _ ↦ ne_of_lt measure_singleton_lt_top)]
theorem measureReal_diff_null' (h : μ.real (s₁ ∩ s₂) = 0) (h' : μ s₁ ≠ ∞ := by finiteness) :
μ.real (s₁ \ s₂) = μ.real s₁ := by
simp only [measureReal_def]
rw [measure_diff_null']
exact (measureReal_eq_zero_iff (measure_ne_top_of_subset inter_subset_left h')).1 h
theorem measureReal_diff_null (h : μ.real s₂ = 0) (h' : μ s₂ ≠ ∞ := by finiteness) :
μ.real (s₁ \ s₂) = μ.real s₁ := by
rcases eq_top_or_lt_top (μ s₁) with H | H
· simp [measureReal_def, H, measure_diff_eq_top H h']
· exact measureReal_diff_null' (measureReal_mono_null inter_subset_right h h') H.ne
theorem measureReal_add_diff (hs : MeasurableSet s)
(h₁ : μ s ≠ ∞ := by finiteness) (h₂ : μ t ≠ ∞ := by finiteness) :
μ.real s + μ.real (t \ s) = μ.real (s ∪ t) := by
rw [← measureReal_union' (@disjoint_sdiff_right _ s t) hs h₁
(measure_ne_top_of_subset diff_subset h₂), union_diff_self]
theorem measureReal_diff' (hm : MeasurableSet t)
(h₁ : μ s ≠ ∞ := by finiteness) (h₂ : μ t ≠ ∞ := by finiteness) :
μ.real (s \ t) = μ.real (s ∪ t) - μ.real t := by
rw [union_comm, ← measureReal_add_diff hm h₂ h₁]
ring
theorem measureReal_diff (h : s₂ ⊆ s₁) (h₂ : MeasurableSet s₂) (h₁ : μ s₁ ≠ ∞ := by finiteness) :
μ.real (s₁ \ s₂) = μ.real s₁ - μ.real s₂ := by
rw [measureReal_diff' h₂ h₁ (measure_ne_top_of_subset h h₁), union_eq_self_of_subset_right h]
theorem le_measureReal_diff (h : μ s₂ ≠ ∞ := by finiteness) :
μ.real s₁ - μ.real s₂ ≤ μ.real (s₁ \ s₂) := by
simp only [tsub_le_iff_left]
calc
μ.real s₁ ≤ μ.real (s₂ ∪ s₁) := measureReal_le_measureReal_union_right h
_ = μ.real (s₂ ∪ s₁ \ s₂) := congr_arg μ.real union_diff_self.symm
_ ≤ μ.real s₂ + μ.real (s₁ \ s₂) := measureReal_union_le _ _
theorem measureReal_diff_lt_of_lt_add (hs : MeasurableSet s) (hst : s ⊆ t) (ε : ℝ)
(h : μ.real t < μ.real s + ε) (ht' : μ t ≠ ∞ := by finiteness) :
μ.real (t \ s) < ε := by
rw [measureReal_diff hst hs ht']; linarith
theorem measureReal_diff_le_iff_le_add (hs : MeasurableSet s) (hst : s ⊆ t) (ε : ℝ)
(ht' : μ t ≠ ∞ := by finiteness) :
μ.real (t \ s) ≤ ε ↔ μ.real t ≤ μ.real s + ε := by
rw [measureReal_diff hst hs ht', tsub_le_iff_left]
theorem measureReal_eq_measureReal_of_null_diff (hst : s ⊆ t)
(h_nulldiff : μ.real (t \ s) = 0) (h : μ (t \ s) ≠ ∞ := by finiteness) :
μ.real s = μ.real t := by
rw [measureReal_eq_zero_iff h] at h_nulldiff
simp [measureReal_def, measure_eq_measure_of_null_diff hst h_nulldiff]
theorem measureReal_eq_measureReal_of_between_null_diff
(h12 : s₁ ⊆ s₂) (h23 : s₂ ⊆ s₃) (h_nulldiff : μ.real (s₃ \ s₁) = 0)
(h' : μ (s₃ \ s₁) ≠ ∞ := by finiteness) :
μ.real s₁ = μ.real s₂ ∧ μ.real s₂ = μ.real s₃ := by
have A : μ s₁ = μ s₂ ∧ μ s₂ = μ s₃ :=
measure_eq_measure_of_between_null_diff h12 h23 ((measureReal_eq_zero_iff h').1 h_nulldiff)
simp [measureReal_def, A.1, A.2]
theorem measureReal_eq_measureReal_smaller_of_between_null_diff (h12 : s₁ ⊆ s₂)
(h23 : s₂ ⊆ s₃) (h_nulldiff : μ.real (s₃ \ s₁) = 0)
(h' : μ (s₃ \ s₁) ≠ ∞ := by finiteness) :
μ.real s₁ = μ.real s₂ :=
(measureReal_eq_measureReal_of_between_null_diff h12 h23 h_nulldiff h').1
theorem measureReal_eq_measureReal_larger_of_between_null_diff (h12 : s₁ ⊆ s₂)
(h23 : s₂ ⊆ s₃) (h_nulldiff : μ.real (s₃ \ s₁) = 0) (h' : μ (s₃ \ s₁) ≠ ∞ := by finiteness) :
μ.real s₂ = μ.real s₃ :=
(measureReal_eq_measureReal_of_between_null_diff h12 h23 h_nulldiff h').2
theorem measureReal_compl [IsFiniteMeasure μ] (h₁ : MeasurableSet s) :
μ.real sᶜ = μ.real univ - μ.real s := by
rw [compl_eq_univ_diff]
exact measureReal_diff (subset_univ s) h₁
theorem measureReal_compl₀ [IsFiniteMeasure μ] (h₁ : NullMeasurableSet s μ) :
μ.real sᶜ = μ.real univ - μ.real s := by
linarith [measureReal_add_measureReal_compl₀ h₁]
theorem measureReal_union_congr_of_subset (hs : s₁ ⊆ s₂)
(hsμ : μ.real s₂ ≤ μ.real s₁) (ht : t₁ ⊆ t₂) (htμ : μ.real t₂ ≤ μ.real t₁)
(h₁ : μ s₂ ≠ ∞ := by finiteness) (h₂ : μ t₂ ≠ ∞ := by finiteness) :
μ.real (s₁ ∪ t₁) = μ.real (s₂ ∪ t₂) := by
simp only [measureReal_def]
rw [measure_union_congr_of_subset hs _ ht]
· exact (ENNReal.toReal_le_toReal h₂ (measure_ne_top_of_subset ht h₂)).1 htμ
· exact (ENNReal.toReal_le_toReal h₁ (measure_ne_top_of_subset hs h₁)).1 hsμ
theorem sum_measureReal_le_measureReal_univ [IsFiniteMeasure μ] {s : Finset ι} {t : ι → Set α}
(h : ∀ i ∈ s, MeasurableSet (t i)) (H : Set.PairwiseDisjoint (↑s) t) :
(∑ i ∈ s, μ.real (t i)) ≤ μ.real univ := by
simp only [measureReal_def]
rw [← ENNReal.toReal_sum (by finiteness)]
apply ENNReal.toReal_mono (by finiteness)
exact sum_measure_le_measure_univ (fun i mi ↦ (h i mi).nullMeasurableSet) H.aedisjoint
theorem measureReal_add_apply {μ₁ μ₂ : Measure α} (h₁ : μ₁ s ≠ ∞ := by finiteness)
(h₂ : μ₂ s ≠ ∞ := by finiteness) :
(μ₁ + μ₂).real s = μ₁.real s + μ₂.real s := by
simp only [measureReal_def, add_apply, ENNReal.toReal_add h₁ h₂]
/-- Pigeonhole principle for measure spaces: if `s` is a `Finset` and
`∑ i ∈ s, μ.real (t i) > μ.real univ`, then one of the intersections `t i ∩ t j` is not empty. -/
theorem exists_nonempty_inter_of_measureReal_univ_lt_sum_measureReal [IsFiniteMeasure μ]
{s : Finset ι} {t : ι → Set α} (h : ∀ i ∈ s, MeasurableSet (t i))
(H : μ.real univ < ∑ i ∈ s, μ.real (t i)) :
∃ i ∈ s, ∃ j ∈ s, ∃ _h : i ≠ j, (t i ∩ t j).Nonempty := by
apply exists_nonempty_inter_of_measure_univ_lt_sum_measure μ
(fun i mi ↦ (h i mi).nullMeasurableSet)
simp only [Measure.real] at H
apply (ENNReal.toReal_lt_toReal (by finiteness) _).1
· convert H
rw [ENNReal.toReal_sum (by finiteness)]
· exact (ENNReal.sum_lt_top.mpr (fun i hi ↦ measure_lt_top ..)).ne
/-- If two sets `s` and `t` are included in a set `u` of finite measure,
and `μ.real s + μ.real t > μ.real u`, then `s` intersects `t`.
Version assuming that `t` is measurable. -/
theorem nonempty_inter_of_measureReal_lt_add
(ht : MeasurableSet t) (h's : s ⊆ u) (h't : t ⊆ u) (h : μ.real u < μ.real s + μ.real t)
(hu : μ u ≠ ∞ := by finiteness) :
(s ∩ t).Nonempty := by
apply nonempty_inter_of_measure_lt_add μ ht h's h't ?_
apply (ENNReal.toReal_lt_toReal hu _).1
· rw [ENNReal.toReal_add (measure_ne_top_of_subset h's hu) (measure_ne_top_of_subset h't hu)]
exact h
· exact ENNReal.add_ne_top.2 ⟨measure_ne_top_of_subset h's hu, measure_ne_top_of_subset h't hu⟩
/-- If two sets `s` and `t` are included in a set `u` of finite measure,
and `μ.real s + μ.real t > μ.real u`, then `s` intersects `t`.
Version assuming that `s` is measurable. -/
theorem nonempty_inter_of_measureReal_lt_add'
(hs : MeasurableSet s) (h's : s ⊆ u) (h't : t ⊆ u) (h : μ.real u < μ.real s + μ.real t)
(hu : μ u ≠ ∞ := by finiteness) :
(s ∩ t).Nonempty := by
rw [add_comm] at h
rw [inter_comm]
exact nonempty_inter_of_measureReal_lt_add hs h't h's h hu
end MeasureTheory
namespace Mathlib.Meta.Positivity
open Lean Meta Qq Function
/-- Extension for the `positivity` tactic: applications of `μ.real` are nonnegative. -/
@[positivity MeasureTheory.Measure.real _ _]
def evalMeasureReal : PositivityExt where eval {_ _} _zα _pα e := do
let .app (.app _ a) b ← whnfR e | throwError "not measureReal"
let p ← mkAppOptM ``MeasureTheory.measureReal_nonneg #[none, none, a, b]
pure (.nonnegative p)
end Mathlib.Meta.Positivity |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Haar/MulEquivHaarChar.lean | import Mathlib.MeasureTheory.Measure.Haar.Unique
/-!
# Scaling Haar measure by a continuous isomorphism
If `G` is a locally compact topological group and `μ` is a regular Haar measure
on `G`, then an isomorphism `φ : G ≃ₜ* G` scales this measure by some positive
real constant which we call `mulEquivHaarChar φ`.
## Main definitions
* `mulEquivHaarChar φ`: the positive real such that `(mulEquivHaarChar φ) • map φ μ = μ`
for `μ` a regular Haar measure.
* `addEquivAddHaarChar φ`: the additive version.
-/
open MeasureTheory.Measure
open scoped NNReal Pointwise ENNReal
namespace MeasureTheory
variable {G : Type*} [Group G] [TopologicalSpace G] [MeasurableSpace G]
[BorelSpace G] [IsTopologicalGroup G] [LocallyCompactSpace G]
/-- If `φ : G ≃ₜ* G` then `mulEquivHaarChar φ` is the positive real factor by which
`φ` scales Haar measures on `G`. -/
@[to_additive /-- If `φ : A ≃ₜ+ A` then `addEquivAddHaarChar φ` is the positive
real factor by which `φ` scales Haar measures on `A`. -/]
noncomputable def mulEquivHaarChar (φ : G ≃ₜ* G) : ℝ≥0 :=
haarScalarFactor haar (haar.map φ)
@[to_additive]
lemma mulEquivHaarChar_pos (φ : G ≃ₜ* G) : 0 < mulEquivHaarChar φ :=
haarScalarFactor_pos_of_isHaarMeasure _ _
@[to_additive]
lemma mulEquivHaarChar_eq (μ : Measure G) [IsHaarMeasure μ]
[Regular μ] (φ : G ≃ₜ* G) :
mulEquivHaarChar φ = haarScalarFactor μ (μ.map φ) := by
have smul := isMulLeftInvariant_eq_smul_of_regular haar μ
unfold mulEquivHaarChar
conv =>
enter [1, 1]
rw [smul]
conv =>
enter [1, 2, 2]
rw [smul]
simp_rw [MeasureTheory.Measure.map_smul]
exact haarScalarFactor_smul_smul _ _ (haarScalarFactor_pos_of_isHaarMeasure haar μ).ne'
@[to_additive addEquivAddHaarChar_smul_map]
lemma mulEquivHaarChar_smul_map (μ : Measure G)
[IsHaarMeasure μ] [Regular μ] (φ : G ≃ₜ* G) :
mulEquivHaarChar φ • μ.map φ = μ := by
rw [mulEquivHaarChar_eq μ φ]
have : Regular (map φ μ) := Regular.map φ.toHomeomorph
exact (isMulLeftInvariant_eq_smul_of_regular μ (map φ μ)).symm
@[to_additive addEquivAddHaarChar_smul_eq_comap]
lemma mulEquivHaarChar_smul_eq_comap (μ : Measure G)
[IsHaarMeasure μ] [Regular μ] (φ : G ≃ₜ* G) :
(mulEquivHaarChar φ) • μ = μ.comap φ := by
let e := φ.toHomeomorph.toMeasurableEquiv
rw [show ⇑φ = ⇑e from rfl, ← e.map_symm, show ⇑e.symm = ⇑φ.symm from rfl]
have : (map (φ.symm) μ).Regular := Regular.map φ.symm.toHomeomorph
rw [← mulEquivHaarChar_smul_map (map φ.symm μ) φ, map_map]
· simp
· fun_prop
· fun_prop
@[to_additive addEquivAddHaarChar_smul_integral_map]
lemma mulEquivHaarChar_smul_integral_map (μ : Measure G)
[IsHaarMeasure μ] [Regular μ] {f : G → ℝ} (φ : G ≃ₜ* G) :
mulEquivHaarChar φ • ∫ a, f a ∂(μ.map φ) = ∫ a, f a ∂μ := by
nth_rw 2 [← mulEquivHaarChar_smul_map μ φ]
simp
@[to_additive integral_comap_eq_addEquivAddHaarChar_smul]
lemma integral_comap_eq_mulEquivHaarChar_smul (μ : Measure G)
[IsHaarMeasure μ] [Regular μ] {f : G → ℝ} (φ : G ≃ₜ* G) :
∫ a, f a ∂(μ.comap φ) = mulEquivHaarChar φ • ∫ a, f a ∂μ := by
let e := φ.toHomeomorph.toMeasurableEquiv
change ∫ a, f a ∂(comap e μ) = mulEquivHaarChar φ • ∫ a, f a ∂μ
have : (map (e.symm) μ).IsHaarMeasure := φ.symm.isHaarMeasure_map μ
have : (map (e.symm) μ).Regular := Regular.map φ.symm.toHomeomorph
rw [← e.map_symm, ← mulEquivHaarChar_smul_integral_map (map e.symm μ) φ,
map_map (by exact φ.toHomeomorph.toMeasurableEquiv.measurable) e.symm.measurable]
-- congr -- breaks to_additive
rw [show ⇑φ ∘ ⇑e.symm = id by ext; simp [e]]
simp
@[to_additive addEquivAddHaarChar_smul_preimage]
lemma mulEquivHaarChar_smul_preimage
(μ : Measure G) [IsHaarMeasure μ] [Regular μ] {X : Set G} (φ : G ≃ₜ* G) :
mulEquivHaarChar φ • μ (φ ⁻¹' X) = μ X := by
nth_rw 2 [← mulEquivHaarChar_smul_map μ φ]
simp only [smul_apply, nnreal_smul_coe_apply]
exact congr_arg _ <| (MeasurableEquiv.map_apply φ.toMeasurableEquiv X).symm
@[to_additive (attr := simp)]
lemma mulEquivHaarChar_refl :
mulEquivHaarChar (ContinuousMulEquiv.refl G) = 1 := by
simp [mulEquivHaarChar, Function.id_def]
@[to_additive]
lemma mulEquivHaarChar_trans {φ ψ : G ≃ₜ* G} :
mulEquivHaarChar (ψ.trans φ) = mulEquivHaarChar ψ * mulEquivHaarChar φ := by
rw [mulEquivHaarChar_eq haar ψ, mulEquivHaarChar_eq haar (ψ.trans φ)]
have hφ : Measurable φ := by fun_prop
have hψ : Measurable ψ := by fun_prop
simp_rw [ContinuousMulEquiv.coe_trans, ← map_map hφ hψ]
have h_reg : (haar.map ψ).Regular := Regular.map ψ.toHomeomorph
rw [MeasureTheory.Measure.haarScalarFactor_eq_mul haar (haar.map ψ),
← mulEquivHaarChar_eq (haar.map ψ)]
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Haar/Basic.lean | import Mathlib.MeasureTheory.Measure.Content
import Mathlib.MeasureTheory.Group.Prod
import Mathlib.Topology.Algebra.Group.Compact
/-!
# Haar measure
In this file we prove the existence of Haar measure for a locally compact Hausdorff topological
group.
We follow the write-up by Jonathan Gleason, *Existence and Uniqueness of Haar Measure*.
This is essentially the same argument as in
https://en.wikipedia.org/wiki/Haar_measure#A_construction_using_compact_subsets.
We construct the Haar measure first on compact sets. For this we define `(K : U)` as the (smallest)
number of left-translates of `U` that are needed to cover `K` (`index` in the formalization).
Then we define a function `h` on compact sets as `lim_U (K : U) / (K₀ : U)`,
where `U` becomes a smaller and smaller open neighborhood of `1`, and `K₀` is a fixed compact set
with nonempty interior. This function is `chaar` in the formalization, and we define the limit
formally using Tychonoff's theorem.
This function `h` forms a content, which we can extend to an outer measure and then a measure
(`haarMeasure`).
We normalize the Haar measure so that the measure of `K₀` is `1`.
Note that `μ` need not coincide with `h` on compact sets, according to
[halmos1950measure, ch. X, §53 p.233]. However, we know that `h(K)` lies between `μ(Kᵒ)` and `μ(K)`,
where `ᵒ` denotes the interior.
We also give a form of uniqueness of Haar measure, for σ-finite measures on second-countable
locally compact groups. For more involved statements not assuming second-countability, see
the file `Mathlib/MeasureTheory/Measure/Haar/Unique.lean`.
## Main Declarations
* `haarMeasure`: the Haar measure on a locally compact Hausdorff group. This is a left invariant
regular measure. It takes as argument a compact set of the group (with non-empty interior),
and is normalized so that the measure of the given set is 1.
* `haarMeasure_self`: the Haar measure is normalized.
* `isMulLeftInvariant_haarMeasure`: the Haar measure is left invariant.
* `regular_haarMeasure`: the Haar measure is a regular measure.
* `isHaarMeasure_haarMeasure`: the Haar measure satisfies the `IsHaarMeasure` typeclass, i.e.,
it is invariant and gives finite mass to compact sets and positive mass to nonempty open sets.
* `haar` : some choice of a Haar measure, on a locally compact Hausdorff group, constructed as
`haarMeasure K` where `K` is some arbitrary choice of a compact set with nonempty interior.
* `haarMeasure_unique`: Every σ-finite left invariant measure on a second-countable locally compact
Hausdorff group is a scalar multiple of the Haar measure.
## References
* Paul Halmos (1950), Measure Theory, §53
* Jonathan Gleason, Existence and Uniqueness of Haar Measure
- Note: step 9, page 8 contains a mistake: the last defined `μ` does not extend the `μ` on compact
sets, see Halmos (1950) p. 233, bottom of the page. This makes some other steps (like step 11)
invalid.
* https://en.wikipedia.org/wiki/Haar_measure
-/
noncomputable section
open Set Inv Function TopologicalSpace MeasurableSpace
open scoped NNReal ENNReal Pointwise Topology
namespace MeasureTheory
namespace Measure
section Group
variable {G : Type*} [Group G]
/-! We put the internal functions in the construction of the Haar measure in a namespace,
so that the chosen names don't clash with other declarations.
We first define a couple of the functions before proving the properties (that require that `G`
is a topological group). -/
namespace haar
/-- The index or Haar covering number or ratio of `K` w.r.t. `V`, denoted `(K : V)`:
it is the smallest number of (left) translates of `V` that is necessary to cover `K`.
It is defined to be 0 if no finite number of translates cover `K`. -/
@[to_additive addIndex /-- additive version of `MeasureTheory.Measure.haar.index` -/]
noncomputable def index (K V : Set G) : ℕ :=
sInf <| Finset.card '' { t : Finset G | K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V }
@[to_additive addIndex_empty]
theorem index_empty {V : Set G} : index ∅ V = 0 := by simp [index]
variable [TopologicalSpace G]
/-- `prehaar K₀ U K` is a weighted version of the index, defined as `(K : U)/(K₀ : U)`.
In the applications `K₀` is compact with non-empty interior, `U` is open containing `1`,
and `K` is any compact set.
The argument `K` is a (bundled) compact set, so that we can consider `prehaar K₀ U` as an
element of `haarProduct` (below). -/
@[to_additive /-- additive version of `MeasureTheory.Measure.haar.prehaar` -/]
noncomputable def prehaar (K₀ U : Set G) (K : Compacts G) : ℝ :=
(index (K : Set G) U : ℝ) / index K₀ U
@[to_additive]
theorem prehaar_empty (K₀ : PositiveCompacts G) {U : Set G} : prehaar (K₀ : Set G) U ⊥ = 0 := by
rw [prehaar, Compacts.coe_bot, index_empty, Nat.cast_zero, zero_div]
@[to_additive]
theorem prehaar_nonneg (K₀ : PositiveCompacts G) {U : Set G} (K : Compacts G) :
0 ≤ prehaar (K₀ : Set G) U K := by apply div_nonneg <;> norm_cast <;> apply zero_le
/-- `haarProduct K₀` is the product of intervals `[0, (K : K₀)]`, for all compact sets `K`.
For all `U`, we can show that `prehaar K₀ U ∈ haarProduct K₀`. -/
@[to_additive /-- additive version of `MeasureTheory.Measure.haar.haarProduct` -/]
def haarProduct (K₀ : Set G) : Set (Compacts G → ℝ) :=
pi univ fun K => Icc 0 <| index (K : Set G) K₀
@[to_additive (attr := simp)]
theorem mem_prehaar_empty {K₀ : Set G} {f : Compacts G → ℝ} :
f ∈ haarProduct K₀ ↔ ∀ K : Compacts G, f K ∈ Icc (0 : ℝ) (index (K : Set G) K₀) := by
simp only [haarProduct, Set.pi, forall_prop_of_true, mem_univ, mem_setOf_eq]
/-- The closure of the collection of elements of the form `prehaar K₀ U`,
for `U` open neighbourhoods of `1`, contained in `V`. The closure is taken in the space
`compacts G → ℝ`, with the topology of pointwise convergence.
We show that the intersection of all these sets is nonempty, and the Haar measure
on compact sets is defined to be an element in the closure of this intersection. -/
@[to_additive /-- additive version of `MeasureTheory.Measure.haar.clPrehaar` -/]
def clPrehaar (K₀ : Set G) (V : OpenNhdsOf (1 : G)) : Set (Compacts G → ℝ) :=
closure <| prehaar K₀ '' { U : Set G | U ⊆ V.1 ∧ IsOpen U ∧ (1 : G) ∈ U }
variable [IsTopologicalGroup G]
/-!
### Lemmas about `index`
-/
/-- If `K` is compact and `V` has nonempty interior, then the index `(K : V)` is well-defined,
there is a finite set `t` satisfying the desired properties. -/
@[to_additive addIndex_defined
/-- If `K` is compact and `V` has nonempty interior, then the index `(K : V)` is well-defined,
there is a finite set `t` satisfying the desired properties. -/]
theorem index_defined {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) :
∃ n : ℕ, n ∈ Finset.card '' { t : Finset G | K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V } := by
rcases compact_covered_by_mul_left_translates hK hV with ⟨t, ht⟩; exact ⟨t.card, t, ht, rfl⟩
@[to_additive addIndex_elim]
theorem index_elim {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) :
∃ t : Finset G, (K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V) ∧ Finset.card t = index K V := by
have := Nat.sInf_mem (index_defined hK hV); rwa [mem_image] at this
@[to_additive le_addIndex_mul]
theorem le_index_mul (K₀ : PositiveCompacts G) (K : Compacts G) {V : Set G}
(hV : (interior V).Nonempty) :
index (K : Set G) V ≤ index (K : Set G) K₀ * index (K₀ : Set G) V := by
classical
obtain ⟨s, h1s, h2s⟩ := index_elim K.isCompact K₀.interior_nonempty
obtain ⟨t, h1t, h2t⟩ := index_elim K₀.isCompact hV
rw [← h2s, ← h2t, mul_comm]
refine le_trans ?_ Finset.card_mul_le
apply Nat.sInf_le; refine ⟨_, ?_, rfl⟩; rw [mem_setOf_eq]; refine Subset.trans h1s ?_
apply iUnion₂_subset; intro g₁ hg₁; rw [preimage_subset_iff]; intro g₂ hg₂
have := h1t hg₂
rcases this with ⟨_, ⟨g₃, rfl⟩, A, ⟨hg₃, rfl⟩, h2V⟩; rw [mem_preimage, ← mul_assoc] at h2V
exact mem_biUnion (Finset.mul_mem_mul hg₃ hg₁) h2V
@[to_additive addIndex_pos]
theorem index_pos (K : PositiveCompacts G) {V : Set G} (hV : (interior V).Nonempty) :
0 < index (K : Set G) V := by
classical
rw [index, Nat.sInf_def, Nat.find_pos, mem_image]
· rintro ⟨t, h1t, h2t⟩; rw [Finset.card_eq_zero] at h2t; subst h2t
obtain ⟨g, hg⟩ := K.interior_nonempty
change g ∈ (∅ : Set G)
convert h1t (interior_subset hg); symm
simp only [Finset.notMem_empty, iUnion_of_empty, iUnion_empty]
· exact index_defined K.isCompact hV
@[to_additive addIndex_mono]
theorem index_mono {K K' V : Set G} (hK' : IsCompact K') (h : K ⊆ K') (hV : (interior V).Nonempty) :
index K V ≤ index K' V := by
rcases index_elim hK' hV with ⟨s, h1s, h2s⟩
apply Nat.sInf_le; rw [mem_image]; exact ⟨s, Subset.trans h h1s, h2s⟩
@[to_additive addIndex_union_le]
theorem index_union_le (K₁ K₂ : Compacts G) {V : Set G} (hV : (interior V).Nonempty) :
index (K₁.1 ∪ K₂.1) V ≤ index K₁.1 V + index K₂.1 V := by
classical
rcases index_elim K₁.2 hV with ⟨s, h1s, h2s⟩
rcases index_elim K₂.2 hV with ⟨t, h1t, h2t⟩
rw [← h2s, ← h2t]
refine le_trans (Nat.sInf_le ⟨_, ?_, rfl⟩) (Finset.card_union_le _ _)
rw [mem_setOf_eq, Finset.set_biUnion_union]
gcongr
@[to_additive addIndex_union_eq]
theorem index_union_eq (K₁ K₂ : Compacts G) {V : Set G} (hV : (interior V).Nonempty)
(h : Disjoint (K₁.1 * V⁻¹) (K₂.1 * V⁻¹)) :
index (K₁.1 ∪ K₂.1) V = index K₁.1 V + index K₂.1 V := by
classical
apply le_antisymm (index_union_le K₁ K₂ hV)
rcases index_elim (K₁.2.union K₂.2) hV with ⟨s, h1s, h2s⟩; rw [← h2s]
have (K : Set G) (hK : K ⊆ ⋃ g ∈ s, (g * ·) ⁻¹' V) :
index K V ≤ {g ∈ s | ((g * ·) ⁻¹' V ∩ K).Nonempty}.card := by
apply Nat.sInf_le; refine ⟨_, ?_, rfl⟩; rw [mem_setOf_eq]
intro g hg; rcases hK hg with ⟨_, ⟨g₀, rfl⟩, _, ⟨h1g₀, rfl⟩, h2g₀⟩
simp only [mem_preimage] at h2g₀
simp only [mem_iUnion]; use g₀; constructor; swap
· simp only [Finset.mem_filter, h1g₀, true_and]; use g
simp [hg, h2g₀]
exact h2g₀
refine
le_trans
(add_le_add (this K₁.1 <| Subset.trans subset_union_left h1s)
(this K₂.1 <| Subset.trans subset_union_right h1s)) ?_
rw [← Finset.card_union_of_disjoint, Finset.filter_union_right]
· exact s.card_filter_le _
apply Finset.disjoint_filter.mpr
rintro g₁ _ ⟨g₂, h1g₂, h2g₂⟩ ⟨g₃, h1g₃, h2g₃⟩
simp only [mem_preimage] at h1g₃ h1g₂
refine h.le_bot (?_ : g₁⁻¹ ∈ _)
constructor <;> simp only [Set.mem_inv, Set.mem_mul]
· refine ⟨_, h2g₂, (g₁ * g₂)⁻¹, ?_, ?_⟩
· simp only [inv_inv, h1g₂]
· simp only [mul_inv_rev, mul_inv_cancel_left]
· refine ⟨_, h2g₃, (g₁ * g₃)⁻¹, ?_, ?_⟩
· simp only [inv_inv, h1g₃]
· simp only [mul_inv_rev, mul_inv_cancel_left]
@[to_additive add_left_addIndex_le]
theorem mul_left_index_le {K : Set G} (hK : IsCompact K) {V : Set G} (hV : (interior V).Nonempty)
(g : G) : index ((fun h => g * h) '' K) V ≤ index K V := by
rcases index_elim hK hV with ⟨s, h1s, h2s⟩; rw [← h2s]
apply Nat.sInf_le; rw [mem_image]
refine ⟨s.map (Equiv.mulRight g⁻¹).toEmbedding, ?_, Finset.card_map _⟩
simp only [mem_setOf_eq]; refine Subset.trans (image_mono h1s) ?_
rintro _ ⟨g₁, ⟨_, ⟨g₂, rfl⟩, ⟨_, ⟨hg₂, rfl⟩, hg₁⟩⟩, rfl⟩
simp only [mem_preimage] at hg₁
simp only [exists_prop, mem_iUnion, Finset.mem_map, Equiv.coe_mulRight,
exists_exists_and_eq_and, mem_preimage, Equiv.toEmbedding_apply]
refine ⟨_, hg₂, ?_⟩; simp only [mul_assoc, hg₁, inv_mul_cancel_left]
@[to_additive is_left_invariant_addIndex]
theorem is_left_invariant_index {K : Set G} (hK : IsCompact K) (g : G) {V : Set G}
(hV : (interior V).Nonempty) : index ((fun h => g * h) '' K) V = index K V := by
refine le_antisymm (mul_left_index_le hK hV g) ?_
convert mul_left_index_le (hK.image <| continuous_mul_left g) hV g⁻¹
rw [image_image]; symm; convert image_id' _ with h; apply inv_mul_cancel_left
/-!
### Lemmas about `prehaar`
-/
@[to_additive add_prehaar_le_addIndex]
theorem prehaar_le_index (K₀ : PositiveCompacts G) {U : Set G} (K : Compacts G)
(hU : (interior U).Nonempty) : prehaar (K₀ : Set G) U K ≤ index (K : Set G) K₀ := by
unfold prehaar; rw [div_le_iff₀] <;> norm_cast
· apply le_index_mul K₀ K hU
· exact index_pos K₀ hU
@[to_additive]
theorem prehaar_pos (K₀ : PositiveCompacts G) {U : Set G} (hU : (interior U).Nonempty) {K : Set G}
(h1K : IsCompact K) (h2K : (interior K).Nonempty) : 0 < prehaar (K₀ : Set G) U ⟨K, h1K⟩ := by
apply div_pos <;> norm_cast
· apply index_pos ⟨⟨K, h1K⟩, h2K⟩ hU
· exact index_pos K₀ hU
@[to_additive]
theorem prehaar_mono {K₀ : PositiveCompacts G} {U : Set G} (hU : (interior U).Nonempty)
{K₁ K₂ : Compacts G} (h : (K₁ : Set G) ⊆ K₂.1) :
prehaar (K₀ : Set G) U K₁ ≤ prehaar (K₀ : Set G) U K₂ := by
simp only [prehaar]; rw [div_le_div_iff_of_pos_right]
· exact mod_cast index_mono K₂.2 h hU
· exact mod_cast index_pos K₀ hU
@[to_additive]
theorem prehaar_self {K₀ : PositiveCompacts G} {U : Set G} (hU : (interior U).Nonempty) :
prehaar (K₀ : Set G) U K₀.toCompacts = 1 :=
div_self <| ne_of_gt <| mod_cast index_pos K₀ hU
@[to_additive]
theorem prehaar_sup_le {K₀ : PositiveCompacts G} {U : Set G} (K₁ K₂ : Compacts G)
(hU : (interior U).Nonempty) :
prehaar (K₀ : Set G) U (K₁ ⊔ K₂) ≤ prehaar (K₀ : Set G) U K₁ + prehaar (K₀ : Set G) U K₂ := by
simp only [prehaar]; rw [← add_div, div_le_div_iff_of_pos_right]
· exact mod_cast index_union_le K₁ K₂ hU
· exact mod_cast index_pos K₀ hU
@[to_additive]
theorem prehaar_sup_eq {K₀ : PositiveCompacts G} {U : Set G} {K₁ K₂ : Compacts G}
(hU : (interior U).Nonempty) (h : Disjoint (K₁.1 * U⁻¹) (K₂.1 * U⁻¹)) :
prehaar (K₀ : Set G) U (K₁ ⊔ K₂) = prehaar (K₀ : Set G) U K₁ + prehaar (K₀ : Set G) U K₂ := by
simp only [prehaar]; rw [← add_div]
-- Porting note: Here was `congr`, but `to_additive` failed to generate a theorem.
refine congr_arg (fun x : ℝ => x / index K₀ U) ?_
exact mod_cast index_union_eq K₁ K₂ hU h
@[to_additive]
theorem is_left_invariant_prehaar {K₀ : PositiveCompacts G} {U : Set G} (hU : (interior U).Nonempty)
(g : G) (K : Compacts G) :
prehaar (K₀ : Set G) U (K.map _ <| continuous_mul_left g) = prehaar (K₀ : Set G) U K := by
simp only [prehaar, Compacts.coe_map, is_left_invariant_index K.isCompact _ hU]
/-!
### Lemmas about `haarProduct`
-/
@[to_additive]
theorem prehaar_mem_haarProduct (K₀ : PositiveCompacts G) {U : Set G} (hU : (interior U).Nonempty) :
prehaar (K₀ : Set G) U ∈ haarProduct (K₀ : Set G) := by
rintro ⟨K, hK⟩ _; rw [mem_Icc]; exact ⟨prehaar_nonneg K₀ _, prehaar_le_index K₀ _ hU⟩
@[to_additive]
theorem nonempty_iInter_clPrehaar (K₀ : PositiveCompacts G) :
(haarProduct (K₀ : Set G) ∩ ⋂ V : OpenNhdsOf (1 : G), clPrehaar K₀ V).Nonempty := by
have : IsCompact (haarProduct (K₀ : Set G)) := by
apply isCompact_univ_pi; intro K; apply isCompact_Icc
refine this.inter_iInter_nonempty (clPrehaar K₀) (fun s => isClosed_closure) fun t => ?_
let V₀ := ⋂ V ∈ t, (V : OpenNhdsOf (1 : G)).carrier
have h1V₀ : IsOpen V₀ := isOpen_biInter_finset <| by rintro ⟨⟨V, hV₁⟩, hV₂⟩ _; exact hV₁
have h2V₀ : (1 : G) ∈ V₀ := by simp only [V₀, mem_iInter]; rintro ⟨⟨V, hV₁⟩, hV₂⟩ _; exact hV₂
refine ⟨prehaar K₀ V₀, ?_⟩
constructor
· apply prehaar_mem_haarProduct K₀; use 1; rwa [h1V₀.interior_eq]
· simp only [mem_iInter]; rintro ⟨V, hV⟩ h2V; apply subset_closure
apply mem_image_of_mem; rw [mem_setOf_eq]
exact ⟨Subset.trans (iInter_subset _ ⟨V, hV⟩) (iInter_subset _ h2V), h1V₀, h2V₀⟩
/-!
### Lemmas about `chaar`
-/
/-- This is the "limit" of `prehaar K₀ U K` as `U` becomes a smaller and smaller open
neighborhood of `(1 : G)`. More precisely, it is defined to be an arbitrary element
in the intersection of all the sets `clPrehaar K₀ V` in `haarProduct K₀`.
This is roughly equal to the Haar measure on compact sets,
but it can differ slightly. We do know that
`haarMeasure K₀ (interior K) ≤ chaar K₀ K ≤ haarMeasure K₀ K`. -/
@[to_additive addCHaar /-- additive version of `MeasureTheory.Measure.haar.chaar` -/]
noncomputable def chaar (K₀ : PositiveCompacts G) (K : Compacts G) : ℝ :=
Classical.choose (nonempty_iInter_clPrehaar K₀) K
@[to_additive addCHaar_mem_addHaarProduct]
theorem chaar_mem_haarProduct (K₀ : PositiveCompacts G) : chaar K₀ ∈ haarProduct (K₀ : Set G) :=
(Classical.choose_spec (nonempty_iInter_clPrehaar K₀)).1
@[to_additive addCHaar_mem_clAddPrehaar]
theorem chaar_mem_clPrehaar (K₀ : PositiveCompacts G) (V : OpenNhdsOf (1 : G)) :
chaar K₀ ∈ clPrehaar (K₀ : Set G) V := by
have := (Classical.choose_spec (nonempty_iInter_clPrehaar K₀)).2; rw [mem_iInter] at this
exact this V
@[to_additive addCHaar_nonneg]
theorem chaar_nonneg (K₀ : PositiveCompacts G) (K : Compacts G) : 0 ≤ chaar K₀ K := by
have := chaar_mem_haarProduct K₀ K (mem_univ _); rw [mem_Icc] at this; exact this.1
@[to_additive addCHaar_empty]
theorem chaar_empty (K₀ : PositiveCompacts G) : chaar K₀ ⊥ = 0 := by
let eval : (Compacts G → ℝ) → ℝ := fun f => f ⊥
have : Continuous eval := continuous_apply ⊥
change chaar K₀ ∈ eval ⁻¹' {(0 : ℝ)}
apply mem_of_subset_of_mem _ (chaar_mem_clPrehaar K₀ ⊤)
unfold clPrehaar; rw [IsClosed.closure_subset_iff]
· rintro _ ⟨U, _, rfl⟩; apply prehaar_empty
· apply continuous_iff_isClosed.mp this; exact isClosed_singleton
@[to_additive addCHaar_self]
theorem chaar_self (K₀ : PositiveCompacts G) : chaar K₀ K₀.toCompacts = 1 := by
let eval : (Compacts G → ℝ) → ℝ := fun f => f K₀.toCompacts
have : Continuous eval := continuous_apply _
change chaar K₀ ∈ eval ⁻¹' {(1 : ℝ)}
apply mem_of_subset_of_mem _ (chaar_mem_clPrehaar K₀ ⊤)
unfold clPrehaar; rw [IsClosed.closure_subset_iff]
· rintro _ ⟨U, ⟨_, h2U, h3U⟩, rfl⟩; apply prehaar_self
rw [h2U.interior_eq]; exact ⟨1, h3U⟩
· apply continuous_iff_isClosed.mp this; exact isClosed_singleton
@[to_additive addCHaar_mono]
theorem chaar_mono {K₀ : PositiveCompacts G} {K₁ K₂ : Compacts G} (h : (K₁ : Set G) ⊆ K₂) :
chaar K₀ K₁ ≤ chaar K₀ K₂ := by
let eval : (Compacts G → ℝ) → ℝ := fun f => f K₂ - f K₁
have : Continuous eval := (continuous_apply K₂).sub (continuous_apply K₁)
rw [← sub_nonneg]; change chaar K₀ ∈ eval ⁻¹' Ici (0 : ℝ)
apply mem_of_subset_of_mem _ (chaar_mem_clPrehaar K₀ ⊤)
unfold clPrehaar; rw [IsClosed.closure_subset_iff]
· rintro _ ⟨U, ⟨_, h2U, h3U⟩, rfl⟩; simp only [eval, mem_preimage, mem_Ici, sub_nonneg]
apply prehaar_mono _ h; rw [h2U.interior_eq]; exact ⟨1, h3U⟩
· apply continuous_iff_isClosed.mp this; exact isClosed_Ici
@[to_additive addCHaar_sup_le]
theorem chaar_sup_le {K₀ : PositiveCompacts G} (K₁ K₂ : Compacts G) :
chaar K₀ (K₁ ⊔ K₂) ≤ chaar K₀ K₁ + chaar K₀ K₂ := by
let eval : (Compacts G → ℝ) → ℝ := fun f => f K₁ + f K₂ - f (K₁ ⊔ K₂)
have : Continuous eval := by
exact ((continuous_apply K₁).add (continuous_apply K₂)).sub (continuous_apply (K₁ ⊔ K₂))
rw [← sub_nonneg]; change chaar K₀ ∈ eval ⁻¹' Ici (0 : ℝ)
apply mem_of_subset_of_mem _ (chaar_mem_clPrehaar K₀ ⊤)
unfold clPrehaar; rw [IsClosed.closure_subset_iff]
· rintro _ ⟨U, ⟨_, h2U, h3U⟩, rfl⟩; simp only [eval, mem_preimage, mem_Ici, sub_nonneg]
apply prehaar_sup_le; rw [h2U.interior_eq]; exact ⟨1, h3U⟩
· apply continuous_iff_isClosed.mp this; exact isClosed_Ici
@[to_additive addCHaar_sup_eq]
theorem chaar_sup_eq {K₀ : PositiveCompacts G}
{K₁ K₂ : Compacts G} (h : Disjoint K₁.1 K₂.1) (h₂ : IsClosed K₂.1) :
chaar K₀ (K₁ ⊔ K₂) = chaar K₀ K₁ + chaar K₀ K₂ := by
rcases SeparatedNhds.of_isCompact_isCompact_isClosed K₁.2 K₂.2 h₂ h
with ⟨U₁, U₂, h1U₁, h1U₂, h2U₁, h2U₂, hU⟩
rcases compact_open_separated_mul_right K₁.2 h1U₁ h2U₁ with ⟨L₁, h1L₁, h2L₁⟩
rcases mem_nhds_iff.mp h1L₁ with ⟨V₁, h1V₁, h2V₁, h3V₁⟩
replace h2L₁ := Subset.trans (mul_subset_mul_left h1V₁) h2L₁
rcases compact_open_separated_mul_right K₂.2 h1U₂ h2U₂ with ⟨L₂, h1L₂, h2L₂⟩
rcases mem_nhds_iff.mp h1L₂ with ⟨V₂, h1V₂, h2V₂, h3V₂⟩
replace h2L₂ := Subset.trans (mul_subset_mul_left h1V₂) h2L₂
let eval : (Compacts G → ℝ) → ℝ := fun f => f K₁ + f K₂ - f (K₁ ⊔ K₂)
have : Continuous eval :=
((continuous_apply K₁).add (continuous_apply K₂)).sub (continuous_apply (K₁ ⊔ K₂))
rw [eq_comm, ← sub_eq_zero]; change chaar K₀ ∈ eval ⁻¹' {(0 : ℝ)}
let V := V₁ ∩ V₂
apply
mem_of_subset_of_mem _
(chaar_mem_clPrehaar K₀
⟨⟨V⁻¹, (h2V₁.inter h2V₂).preimage continuous_inv⟩, by
simp only [V, mem_inv, inv_one, h3V₁, h3V₂, mem_inter_iff, true_and]⟩)
unfold clPrehaar; rw [IsClosed.closure_subset_iff]
· rintro _ ⟨U, ⟨h1U, h2U, h3U⟩, rfl⟩
simp only [eval, mem_preimage, sub_eq_zero, mem_singleton_iff]; rw [eq_comm]
apply prehaar_sup_eq
· rw [h2U.interior_eq]; exact ⟨1, h3U⟩
· refine disjoint_of_subset ?_ ?_ hU
· refine Subset.trans (mul_subset_mul Subset.rfl ?_) h2L₁
exact Subset.trans (inv_subset.mpr h1U) inter_subset_left
· refine Subset.trans (mul_subset_mul Subset.rfl ?_) h2L₂
exact Subset.trans (inv_subset.mpr h1U) inter_subset_right
· apply continuous_iff_isClosed.mp this; exact isClosed_singleton
@[to_additive is_left_invariant_addCHaar]
theorem is_left_invariant_chaar {K₀ : PositiveCompacts G} (g : G) (K : Compacts G) :
chaar K₀ (K.map _ <| continuous_mul_left g) = chaar K₀ K := by
let eval : (Compacts G → ℝ) → ℝ := fun f => f (K.map _ <| continuous_mul_left g) - f K
have : Continuous eval := (continuous_apply (K.map _ _)).sub (continuous_apply K)
rw [← sub_eq_zero]; change chaar K₀ ∈ eval ⁻¹' {(0 : ℝ)}
apply mem_of_subset_of_mem _ (chaar_mem_clPrehaar K₀ ⊤)
unfold clPrehaar; rw [IsClosed.closure_subset_iff]
· rintro _ ⟨U, ⟨_, h2U, h3U⟩, rfl⟩
simp only [eval, mem_singleton_iff, mem_preimage, sub_eq_zero]
apply is_left_invariant_prehaar; rw [h2U.interior_eq]; exact ⟨1, h3U⟩
· apply continuous_iff_isClosed.mp this; exact isClosed_singleton
/-- The function `chaar` interpreted in `ℝ≥0`, as a content -/
@[to_additive /-- additive version of `MeasureTheory.Measure.haar.haarContent` -/]
noncomputable def haarContent (K₀ : PositiveCompacts G) : Content G where
toFun K := ⟨chaar K₀ K, chaar_nonneg _ _⟩
mono' K₁ K₂ h := by simp only [← NNReal.coe_le_coe, NNReal.toReal, chaar_mono, h]
sup_disjoint' K₁ K₂ h _h₁ h₂ := by simp only [chaar_sup_eq h]; rfl
sup_le' K₁ K₂ := by
simp only [← NNReal.coe_le_coe, NNReal.coe_add]
simp only [NNReal.toReal, chaar_sup_le]
/-! We only prove the properties for `haarContent` that we use at least twice below. -/
@[to_additive]
theorem haarContent_apply (K₀ : PositiveCompacts G) (K : Compacts G) :
haarContent K₀ K = show NNReal from ⟨chaar K₀ K, chaar_nonneg _ _⟩ :=
rfl
/-- The variant of `chaar_self` for `haarContent` -/
@[to_additive /-- The variant of `addCHaar_self` for `addHaarContent`. -/]
theorem haarContent_self {K₀ : PositiveCompacts G} : haarContent K₀ K₀.toCompacts = 1 := by
simp_rw [← ENNReal.coe_one, haarContent_apply, ENNReal.coe_inj, chaar_self]; rfl
/-- The variant of `is_left_invariant_chaar` for `haarContent` -/
@[to_additive /-- The variant of `is_left_invariant_addCHaar` for `addHaarContent` -/]
theorem is_left_invariant_haarContent {K₀ : PositiveCompacts G} (g : G) (K : Compacts G) :
haarContent K₀ (K.map _ <| continuous_mul_left g) = haarContent K₀ K := by
simpa only [ENNReal.coe_inj, ← NNReal.coe_inj, haarContent_apply] using
is_left_invariant_chaar g K
@[to_additive]
theorem haarContent_outerMeasure_self_pos (K₀ : PositiveCompacts G) :
0 < (haarContent K₀).outerMeasure K₀ := by
refine zero_lt_one.trans_le ?_
rw [Content.outerMeasure_eq_iInf]
refine le_iInf₂ fun U hU => le_iInf fun hK₀ => le_trans ?_ <| le_iSup₂ K₀.toCompacts hK₀
exact haarContent_self.ge
@[to_additive]
theorem haarContent_outerMeasure_closure_pos (K₀ : PositiveCompacts G) :
0 < (haarContent K₀).outerMeasure (closure K₀) :=
(haarContent_outerMeasure_self_pos K₀).trans_le (OuterMeasure.mono _ subset_closure)
end haar
open haar
/-!
### The Haar measure
-/
variable [TopologicalSpace G] [IsTopologicalGroup G] [MeasurableSpace G] [BorelSpace G]
/-- The Haar measure on the locally compact group `G`, scaled so that `haarMeasure K₀ K₀ = 1`. -/
@[to_additive
/-- The Haar measure on the locally compact additive group `G`, scaled so that
`addHaarMeasure K₀ K₀ = 1`. -/]
noncomputable def haarMeasure (K₀ : PositiveCompacts G) : Measure G :=
((haarContent K₀).measure K₀)⁻¹ • (haarContent K₀).measure
@[to_additive]
theorem haarMeasure_apply {K₀ : PositiveCompacts G} {s : Set G} (hs : MeasurableSet s) :
haarMeasure K₀ s = (haarContent K₀).outerMeasure s / (haarContent K₀).measure K₀ := by
change ((haarContent K₀).measure K₀)⁻¹ * (haarContent K₀).measure s = _
simp only [hs, div_eq_mul_inv, mul_comm, Content.measure_apply]
@[to_additive]
instance isMulLeftInvariant_haarMeasure (K₀ : PositiveCompacts G) :
IsMulLeftInvariant (haarMeasure K₀) := by
rw [← forall_measure_preimage_mul_iff]
intro g A hA
rw [haarMeasure_apply hA, haarMeasure_apply (measurable_const_mul g hA)]
-- Porting note: Here was `congr 1`, but `to_additive` failed to generate a theorem.
refine congr_arg (fun x : ℝ≥0∞ => x / (haarContent K₀).measure K₀) ?_
apply Content.is_mul_left_invariant_outerMeasure
apply is_left_invariant_haarContent
@[to_additive]
theorem haarMeasure_self {K₀ : PositiveCompacts G} : haarMeasure K₀ K₀ = 1 := by
haveI : LocallyCompactSpace G := K₀.locallyCompactSpace_of_group
simp only [haarMeasure, coe_smul, Pi.smul_apply, smul_eq_mul]
rw [← K₀.isCompact.measure_closure,
Content.measure_apply _ isClosed_closure.measurableSet, ENNReal.inv_mul_cancel]
· exact (haarContent_outerMeasure_closure_pos K₀).ne'
· exact (Content.outerMeasure_lt_top_of_isCompact _ K₀.isCompact.closure).ne
/-- The Haar measure is regular. -/
@[to_additive /-- The additive Haar measure is regular. -/]
instance regular_haarMeasure {K₀ : PositiveCompacts G} : (haarMeasure K₀).Regular := by
haveI : LocallyCompactSpace G := K₀.locallyCompactSpace_of_group
apply Regular.smul
rw [← K₀.isCompact.measure_closure,
Content.measure_apply _ isClosed_closure.measurableSet, ENNReal.inv_ne_top]
exact (haarContent_outerMeasure_closure_pos K₀).ne'
@[to_additive]
theorem haarMeasure_closure_self {K₀ : PositiveCompacts G} : haarMeasure K₀ (closure K₀) = 1 := by
rw [K₀.isCompact.measure_closure, haarMeasure_self]
/-- The Haar measure is sigma-finite in a second countable group. -/
@[to_additive /-- The additive Haar measure is sigma-finite in a second countable group. -/]
instance sigmaFinite_haarMeasure [SecondCountableTopology G] {K₀ : PositiveCompacts G} :
SigmaFinite (haarMeasure K₀) := by
haveI : LocallyCompactSpace G := K₀.locallyCompactSpace_of_group; infer_instance
/-- The Haar measure is a Haar measure, i.e., it is invariant and gives finite mass to compact
sets and positive mass to nonempty open sets. -/
@[to_additive
/-- The additive Haar measure is an additive Haar measure, i.e., it is invariant and gives finite
mass to compact sets and positive mass to nonempty open sets. -/]
instance isHaarMeasure_haarMeasure (K₀ : PositiveCompacts G) : IsHaarMeasure (haarMeasure K₀) := by
apply
isHaarMeasure_of_isCompact_nonempty_interior (haarMeasure K₀) K₀ K₀.isCompact
K₀.interior_nonempty
· simp only [haarMeasure_self]; exact one_ne_zero
· simp only [haarMeasure_self, ne_eq, ENNReal.one_ne_top, not_false_eq_true]
/-- `haar` is some choice of a Haar measure, on a locally compact group. -/
@[to_additive
/-- `addHaar` is some choice of a Haar measure, on a locally compact additive group. -/]
noncomputable abbrev haar [LocallyCompactSpace G] : Measure G :=
haarMeasure <| Classical.arbitrary _
/-! Steinhaus theorem: if `E` has positive measure, then `E / E` contains a neighborhood of zero.
Note that this is not true for general regular Haar measures: in `ℝ × ℝ` where the first factor
has the discrete topology, then `E = ℝ × {0}` has infinite measure for the regular Haar measure,
but `E / E` does not contain a neighborhood of zero. On the other hand, it is always true for
inner regular Haar measures (and in particular for any Haar measure on a second countable group).
-/
open Pointwise
@[to_additive]
private lemma steinhaus_mul_aux (μ : Measure G) [IsHaarMeasure μ] [μ.InnerRegularCompactLTTop]
[LocallyCompactSpace G] (E : Set G) (hE : MeasurableSet E)
(hEapprox : ∃ K ⊆ E, IsCompact K ∧ 0 < μ K) : E / E ∈ 𝓝 (1 : G) := by
/- For any measure `μ` and set `E` containing a compact set `K` of positive measure, there exists
a neighborhood `V` of the identity such that `v • K \ K` has small measure for all `v ∈ V`, say
`< μ K`. Then `v • K` and `K` cannot be disjoint, as otherwise `μ (v • K \ K) = μ (v • K) = μ K`.
This show that `K / K` contains the neighborhood `V` of `1`, and therefore that it is
itself such a neighborhood. -/
obtain ⟨K, hKE, hK, K_closed, hKpos⟩ : ∃ K ⊆ E, IsCompact K ∧ IsClosed K ∧ 0 < μ K := by
obtain ⟨K, hKE, hK_comp, hK_meas⟩ := hEapprox
exact ⟨closure K, hK_comp.closure_subset_measurableSet hE hKE, hK_comp.closure,
isClosed_closure, by rwa [hK_comp.measure_closure]⟩
filter_upwards [eventually_nhds_one_measure_smul_diff_lt hK K_closed hKpos.ne' (μ := μ)] with g hg
obtain ⟨_, ⟨x, hxK, rfl⟩, hgxK⟩ : ∃ x ∈ g • K, x ∈ K :=
not_disjoint_iff.1 fun hd ↦ by simp [hd.symm.sdiff_eq_right, measure_smul] at hg
simpa using div_mem_div (hKE hgxK) (hKE hxK)
/-- **Steinhaus Theorem** for finite mass sets.
In any locally compact group `G` with an Haar measure `μ` that's inner regular on finite measure
sets, for any measurable set `E` of finite positive measure, the set `E / E` is a neighbourhood of
`1`. -/
@[to_additive
/-- **Steinhaus Theorem** for finite mass sets.
In any locally compact group `G` with an Haar measure `μ` that's inner regular on finite measure
sets, for any measurable set `E` of finite positive measure, the set `E - E` is a neighbourhood of
`0`. -/]
theorem div_mem_nhds_one_of_haar_pos_ne_top (μ : Measure G) [IsHaarMeasure μ]
[LocallyCompactSpace G] [μ.InnerRegularCompactLTTop] (E : Set G) (hE : MeasurableSet E)
(hEpos : 0 < μ E) (hEfin : μ E ≠ ∞) : E / E ∈ 𝓝 (1 : G) :=
steinhaus_mul_aux μ E hE <| hE.exists_lt_isCompact_of_ne_top hEfin hEpos
/-- **Steinhaus Theorem**.
In any locally compact group `G` with an inner regular Haar measure `μ`,
for any measurable set `E` of positive measure, the set `E / E` is a neighbourhood of `1`. -/
@[to_additive
/-- **Steinhaus Theorem**.
In any locally compact group `G` with an inner regular Haar measure `μ`,
for any measurable set `E` of positive measure, the set `E - E` is a neighbourhood of `0`. -/]
theorem div_mem_nhds_one_of_haar_pos (μ : Measure G) [IsHaarMeasure μ] [LocallyCompactSpace G]
[InnerRegular μ] (E : Set G) (hE : MeasurableSet E) (hEpos : 0 < μ E) :
E / E ∈ 𝓝 (1 : G) := steinhaus_mul_aux μ E hE <| hE.exists_lt_isCompact hEpos
section SecondCountable_SigmaFinite
/-! In this section, we investigate uniqueness of left-invariant measures without assuming that
the measure is finite on compact sets, but assuming σ-finiteness instead. We also rely on
second-countability, to ensure that the group operations are measurable: in this case, one can
bypass all topological arguments, and conclude using uniqueness of σ-finite left-invariant measures
in measurable groups.
For more general uniqueness statements without second-countability assumptions,
see the file `Mathlib/MeasureTheory/Measure/Haar/Unique.lean`.
-/
variable [SecondCountableTopology G]
/-- **Uniqueness of left-invariant measures**: In a second-countable locally compact group, any
σ-finite left-invariant measure is a scalar multiple of the Haar measure.
This is slightly weaker than assuming that `μ` is a Haar measure (in particular we don't require
`μ ≠ 0`).
See also `isMulLeftInvariant_eq_smul_of_regular`
for a statement not assuming second-countability. -/
@[to_additive
/-- **Uniqueness of left-invariant measures**: In a second-countable locally compact additive group,
any σ-finite left-invariant measure is a scalar multiple of the additive Haar measure.
This is slightly weaker than assuming that `μ` is a additive Haar measure (in particular we don't
require `μ ≠ 0`).
See also `isAddLeftInvariant_eq_smul_of_regular`
for a statement not assuming second-countability. -/]
theorem haarMeasure_unique (μ : Measure G) [SigmaFinite μ] [IsMulLeftInvariant μ]
(K₀ : PositiveCompacts G) : μ = μ K₀ • haarMeasure K₀ := by
have A : Set.Nonempty (interior (closure (K₀ : Set G))) :=
K₀.interior_nonempty.mono (interior_mono subset_closure)
have := measure_eq_div_smul μ (haarMeasure K₀)
(measure_pos_of_nonempty_interior _ A).ne' K₀.isCompact.closure.measure_ne_top
rwa [haarMeasure_closure_self, div_one, K₀.isCompact.measure_closure] at this
/-- Let `μ` be a σ-finite left invariant measure on `G`. Then `μ` is equal to the Haar measure
defined by `K₀` iff `μ K₀ = 1`. -/
@[to_additive]
theorem haarMeasure_eq_iff (K₀ : PositiveCompacts G) (μ : Measure G) [SigmaFinite μ]
[IsMulLeftInvariant μ] :
haarMeasure K₀ = μ ↔ μ K₀ = 1 :=
⟨fun h => h.symm ▸ haarMeasure_self, fun h => by rw [haarMeasure_unique μ K₀, h, one_smul]⟩
example [LocallyCompactSpace G] (μ : Measure G) [IsHaarMeasure μ] (K₀ : PositiveCompacts G) :
μ = μ K₀.1 • haarMeasure K₀ :=
haarMeasure_unique μ K₀
/-- To show that an invariant σ-finite measure is regular it is sufficient to show that it is finite
on some compact set with non-empty interior. -/
@[to_additive
/-- To show that an invariant σ-finite measure is regular it is sufficient to show that it is
finite on some compact set with non-empty interior. -/]
theorem regular_of_isMulLeftInvariant {μ : Measure G} [SigmaFinite μ] [IsMulLeftInvariant μ]
{K : Set G} (hK : IsCompact K) (h2K : (interior K).Nonempty) (hμK : μ K ≠ ∞) : Regular μ := by
rw [haarMeasure_unique μ ⟨⟨K, hK⟩, h2K⟩]; exact Regular.smul hμK
end SecondCountable_SigmaFinite
end Group
end Measure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Haar/Quotient.lean | import Mathlib.Algebra.Group.Opposite
import Mathlib.MeasureTheory.Constructions.Polish.Basic
import Mathlib.MeasureTheory.Group.FundamentalDomain
import Mathlib.MeasureTheory.Integral.DominatedConvergence
import Mathlib.MeasureTheory.Measure.Haar.Basic
/-!
# Haar quotient measure
In this file, we consider properties of fundamental domains and measures for the action of a
subgroup `Γ` of a topological group `G` on `G` itself. Let `μ` be a measure on `G ⧸ Γ`.
## Main results
* `MeasureTheory.QuotientMeasureEqMeasurePreimage.smulInvariantMeasure_quotient`: If `μ` satisfies
`QuotientMeasureEqMeasurePreimage` relative to a both left- and right-invariant measure on `G`,
then it is a `G` invariant measure on `G ⧸ Γ`.
The next two results assume that `Γ` is normal, and that `G` is equipped with a left- and
right-invariant measure.
* `MeasureTheory.QuotientMeasureEqMeasurePreimage.mulInvariantMeasure_quotient`: If `μ` satisfies
`QuotientMeasureEqMeasurePreimage`, then `μ` is a left-invariant measure.
* `MeasureTheory.leftInvariantIsQuotientMeasureEqMeasurePreimage`: If `μ` is left-invariant, and
the action of `Γ` on `G` has finite covolume, and `μ` satisfies the right scaling condition, then
it satisfies `QuotientMeasureEqMeasurePreimage`. This is a converse to
`MeasureTheory.QuotientMeasureEqMeasurePreimage.mulInvariantMeasure_quotient`.
The last result assumes that `G` is locally compact, that `Γ` is countable and normal, that its
action on `G` has a fundamental domain, and that `μ` is a finite measure. We also assume that `G`
is equipped with a sigma-finite Haar measure.
* `MeasureTheory.QuotientMeasureEqMeasurePreimage.haarMeasure_quotient`: If `μ` satisfies
`QuotientMeasureEqMeasurePreimage`, then it is itself Haar. This is a variant of
`MeasureTheory.QuotientMeasureEqMeasurePreimage.mulInvariantMeasure_quotient`.
Note that a group `G` with Haar measure that is both left and right invariant is called
**unimodular**.
-/
open Set MeasureTheory TopologicalSpace MeasureTheory.Measure
open scoped Pointwise NNReal ENNReal
section
/-- Measurability of the action of the topological group `G` on the left-coset space `G / Γ`. -/
@[to_additive /-- Measurability of the action of the additive topological group `G` on the
left-coset space `G / Γ`. -/]
instance QuotientGroup.measurableSMul {G : Type*} [Group G] {Γ : Subgroup G} [MeasurableSpace G]
[TopologicalSpace G] [IsTopologicalGroup G] [BorelSpace G] [BorelSpace (G ⧸ Γ)] :
MeasurableSMul G (G ⧸ Γ) where
measurable_const_smul g := (continuous_const_smul g).measurable
measurable_smul_const _ := (continuous_id.smul continuous_const).measurable
end
section smulInvariantMeasure
variable {G : Type*} [Group G] [MeasurableSpace G] (ν : Measure G) {Γ : Subgroup G}
{μ : Measure (G ⧸ Γ)}
[QuotientMeasureEqMeasurePreimage ν μ]
/-- Given a subgroup `Γ` of a topological group `G` with measure `ν`, and a measure 'μ' on the
quotient `G ⧸ Γ` satisfying `QuotientMeasureEqMeasurePreimage`, the restriction
of `ν` to a fundamental domain is measure-preserving with respect to `μ`. -/
@[to_additive]
theorem measurePreserving_quotientGroup_mk_of_QuotientMeasureEqMeasurePreimage
{𝓕 : Set G} (h𝓕 : IsFundamentalDomain Γ.op 𝓕 ν) (μ : Measure (G ⧸ Γ))
[QuotientMeasureEqMeasurePreimage ν μ] :
MeasurePreserving (@QuotientGroup.mk G _ Γ) (ν.restrict 𝓕) μ :=
h𝓕.measurePreserving_quotient_mk μ
local notation "π" => @QuotientGroup.mk G _ Γ
variable [TopologicalSpace G] [IsTopologicalGroup G] [BorelSpace G] [PolishSpace G]
[T2Space (G ⧸ Γ)] [SecondCountableTopology (G ⧸ Γ)]
/-- If `μ` satisfies `QuotientMeasureEqMeasurePreimage` relative to a both left- and right-
invariant measure `ν` on `G`, then it is a `G` invariant measure on `G ⧸ Γ`. -/
@[to_additive]
lemma MeasureTheory.QuotientMeasureEqMeasurePreimage.smulInvariantMeasure_quotient
[IsMulLeftInvariant ν] [hasFun : HasFundamentalDomain Γ.op G ν] :
SMulInvariantMeasure G (G ⧸ Γ) μ where
measure_preimage_smul g A hA := by
have meas_π : Measurable π := continuous_quotient_mk'.measurable
obtain ⟨𝓕, h𝓕⟩ := hasFun.ExistsIsFundamentalDomain
have h𝓕_translate_fundom : IsFundamentalDomain Γ.op (g • 𝓕) ν := h𝓕.smul_of_comm g
-- TODO: why `rw` fails with both of these rewrites?
erw [h𝓕.projection_respects_measure_apply (μ := μ)
(meas_π (measurableSet_preimage (measurable_const_smul g) hA)),
h𝓕_translate_fundom.projection_respects_measure_apply (μ := μ) hA]
change ν ((π ⁻¹' _) ∩ _) = ν ((π ⁻¹' _) ∩ _)
set π_preA := π ⁻¹' A
have : π ⁻¹' ((fun x : G ⧸ Γ => g • x) ⁻¹' A) = (g * ·) ⁻¹' π_preA := by ext1; simp [π_preA]
rw [this]
have : ν ((g * ·) ⁻¹' π_preA ∩ 𝓕) = ν (π_preA ∩ (g⁻¹ * ·) ⁻¹' 𝓕) := by
trans ν ((g * ·) ⁻¹' (π_preA ∩ (g⁻¹ * ·) ⁻¹' 𝓕))
· rw [preimage_inter]
congr 2
simp [Set.preimage]
rw [measure_preimage_mul]
rw [this, ← preimage_smul_inv]; rfl
end smulInvariantMeasure
section normal
variable {G : Type*} [Group G] [MeasurableSpace G] [TopologicalSpace G] [IsTopologicalGroup G]
[BorelSpace G] [PolishSpace G] {Γ : Subgroup G} [Subgroup.Normal Γ]
[T2Space (G ⧸ Γ)] [SecondCountableTopology (G ⧸ Γ)] {μ : Measure (G ⧸ Γ)}
section mulInvariantMeasure
variable (ν : Measure G) [IsMulLeftInvariant ν]
/-- If `μ` on `G ⧸ Γ` satisfies `QuotientMeasureEqMeasurePreimage` relative to a both left- and
right-invariant measure on `G` and `Γ` is a normal subgroup, then `μ` is a left-invariant
measure. -/
@[to_additive /-- If `μ` on `G ⧸ Γ` satisfies `AddQuotientMeasureEqMeasurePreimage` relative to a
both left- and right-invariant measure on `G` and `Γ` is a normal subgroup, then `μ` is a
left-invariant measure. -/]
lemma MeasureTheory.QuotientMeasureEqMeasurePreimage.mulInvariantMeasure_quotient
[hasFun : HasFundamentalDomain Γ.op G ν] [QuotientMeasureEqMeasurePreimage ν μ] :
μ.IsMulLeftInvariant where
map_mul_left_eq_self x := by
ext A hA
obtain ⟨x₁, h⟩ := @Quotient.exists_rep _ (QuotientGroup.leftRel Γ) x
convert measure_preimage_smul μ x₁ A using 1
· rw [← h, Measure.map_apply (measurable_const_mul _) hA]
simp [← MulAction.Quotient.coe_smul_out, ← Quotient.mk''_eq_mk]
exact smulInvariantMeasure_quotient ν
variable [Countable Γ] [IsMulRightInvariant ν] [SigmaFinite ν]
[IsMulLeftInvariant μ] [SigmaFinite μ]
local notation "π" => @QuotientGroup.mk G _ Γ
/-- Assume that a measure `μ` is `IsMulLeftInvariant`, that the action of `Γ` on `G` has a
measurable fundamental domain `s` with positive finite volume, and that there is a single measurable
set `V ⊆ G ⧸ Γ` along which the pullback of `μ` and `ν` agree (so the scaling is right). Then
`μ` satisfies `QuotientMeasureEqMeasurePreimage`. The main tool of the proof is the uniqueness of
left invariant measures, if normalized by a single positive finite-measured set. -/
@[to_additive
/-- Assume that a measure `μ` is `IsAddLeftInvariant`, that the action of `Γ` on `G` has a
measurable fundamental domain `s` with positive finite volume, and that there is a single measurable
set `V ⊆ G ⧸ Γ` along which the pullback of `μ` and `ν` agree (so the scaling is right). Then
`μ` satisfies `AddQuotientMeasureEqMeasurePreimage`. The main tool of the proof is the uniqueness of
left invariant measures, if normalized by a single positive finite-measured set. -/]
theorem MeasureTheory.Measure.IsMulLeftInvariant.quotientMeasureEqMeasurePreimage_of_set {s : Set G}
(fund_dom_s : IsFundamentalDomain Γ.op s ν) {V : Set (G ⧸ Γ)}
(meas_V : MeasurableSet V) (neZeroV : μ V ≠ 0) (hV : μ V = ν (π ⁻¹' V ∩ s))
(neTopV : μ V ≠ ⊤) : QuotientMeasureEqMeasurePreimage ν μ := by
apply fund_dom_s.quotientMeasureEqMeasurePreimage
ext U _
have meas_π : Measurable (QuotientGroup.mk : G → G ⧸ Γ) := continuous_quotient_mk'.measurable
let μ' : Measure (G ⧸ Γ) := (ν.restrict s).map π
haveI has_fund : HasFundamentalDomain Γ.op G ν := ⟨⟨s, fund_dom_s⟩⟩
have i : QuotientMeasureEqMeasurePreimage ν μ' :=
fund_dom_s.quotientMeasureEqMeasurePreimage_quotientMeasure
have : μ'.IsMulLeftInvariant :=
MeasureTheory.QuotientMeasureEqMeasurePreimage.mulInvariantMeasure_quotient ν
suffices μ = μ' by
rw [this]
rfl
have : SigmaFinite μ' := i.sigmaFiniteQuotient
rw [measure_eq_div_smul μ' μ neZeroV neTopV, hV]
symm
suffices (μ' V / ν (QuotientGroup.mk ⁻¹' V ∩ s)) = 1 by rw [this, one_smul]
rw [Measure.map_apply meas_π meas_V, Measure.restrict_apply]
· convert ENNReal.div_self ..
· exact trans hV.symm neZeroV
· exact trans hV.symm neTopV
exact measurableSet_quotient.mp meas_V
/-- If a measure `μ` is left-invariant and satisfies the right scaling condition, then it
satisfies `QuotientMeasureEqMeasurePreimage`. -/
@[to_additive /-- If a measure `μ` is
left-invariant and satisfies the right scaling condition, then it satisfies
`AddQuotientMeasureEqMeasurePreimage`. -/]
theorem MeasureTheory.leftInvariantIsQuotientMeasureEqMeasurePreimage [IsFiniteMeasure μ]
[hasFun : HasFundamentalDomain Γ.op G ν]
(h : covolume Γ.op G ν = μ univ) : QuotientMeasureEqMeasurePreimage ν μ := by
obtain ⟨s, fund_dom_s⟩ := hasFun.ExistsIsFundamentalDomain
have finiteCovol : μ univ < ⊤ := measure_lt_top μ univ
rw [fund_dom_s.covolume_eq_volume] at h
by_cases meas_s_ne_zero : ν s = 0
· convert fund_dom_s.quotientMeasureEqMeasurePreimage_of_zero meas_s_ne_zero
rw [← @measure_univ_eq_zero, ← h, meas_s_ne_zero]
apply IsMulLeftInvariant.quotientMeasureEqMeasurePreimage_of_set (fund_dom_s := fund_dom_s)
(meas_V := MeasurableSet.univ)
· rw [← h]
exact meas_s_ne_zero
· rw [← h]
simp
· rw [← h]
convert finiteCovol.ne
end mulInvariantMeasure
section haarMeasure
variable [Countable Γ] (ν : Measure G) [IsHaarMeasure ν] [IsMulRightInvariant ν]
local notation "π" => @QuotientGroup.mk G _ Γ
/-- If a measure `μ` on the quotient `G ⧸ Γ` of a group `G` by a discrete normal subgroup `Γ` having
fundamental domain, satisfies `QuotientMeasureEqMeasurePreimage` relative to a standardized choice
of Haar measure on `G`, and assuming `μ` is finite, then `μ` is itself Haar.
TODO: Is it possible to drop the assumption that `μ` is finite? -/
@[to_additive /-- If a measure `μ` on the quotient `G ⧸ Γ` of an additive group `G` by a discrete
normal subgroup `Γ` having fundamental domain, satisfies `AddQuotientMeasureEqMeasurePreimage`
relative to a standardized choice of Haar measure on `G`, and assuming `μ` is finite, then `μ` is
itself Haar. -/]
theorem MeasureTheory.QuotientMeasureEqMeasurePreimage.haarMeasure_quotient [LocallyCompactSpace G]
[QuotientMeasureEqMeasurePreimage ν μ] [i : HasFundamentalDomain Γ.op G ν]
[IsFiniteMeasure μ] : IsHaarMeasure μ := by
obtain ⟨K⟩ := PositiveCompacts.nonempty' (α := G)
let K' : PositiveCompacts (G ⧸ Γ) :=
K.map π QuotientGroup.continuous_mk QuotientGroup.isOpenMap_coe
haveI : IsMulLeftInvariant μ :=
MeasureTheory.QuotientMeasureEqMeasurePreimage.mulInvariantMeasure_quotient ν
rw [haarMeasure_unique μ K']
have finiteCovol : covolume Γ.op G ν ≠ ⊤ :=
ne_top_of_lt <| QuotientMeasureEqMeasurePreimage.covolume_ne_top μ (ν := ν)
obtain ⟨s, fund_dom_s⟩ := i
rw [fund_dom_s.covolume_eq_volume] at finiteCovol
-- TODO: why `rw` fails?
erw [fund_dom_s.projection_respects_measure_apply μ K'.isCompact.measurableSet]
apply IsHaarMeasure.smul
· intro h
haveI i' : IsOpenPosMeasure (ν : Measure G) := inferInstance
apply IsOpenPosMeasure.open_pos (interior K) (μ := ν) (self := i')
· exact isOpen_interior
· exact K.interior_nonempty
rw [← le_zero_iff,
← fund_dom_s.measure_zero_of_invariant _ (fun g ↦ QuotientGroup.sound _ _ g) h]
apply measure_mono
refine interior_subset.trans ?_
rw [QuotientGroup.coe_mk']
change (K : Set G) ⊆ π ⁻¹' (π '' K)
exact subset_preimage_image π K
· change ν (π ⁻¹' (π '' K) ∩ s) ≠ ⊤
apply ne_of_lt
refine lt_of_le_of_lt ?_ finiteCovol.lt_top
apply measure_mono
exact inter_subset_right
variable [SigmaFinite ν]
/-- Given a normal subgroup `Γ` of a topological group `G` with Haar measure `μ`, which is also
right-invariant, and a finite volume fundamental domain `𝓕`, the quotient map to `G ⧸ Γ`,
properly normalized, satisfies `QuotientMeasureEqMeasurePreimage`. -/
@[to_additive /-- Given a normal
subgroup `Γ` of an additive topological group `G` with Haar measure `μ`, which is also
right-invariant, and a finite volume fundamental domain `𝓕`, the quotient map to `G ⧸ Γ`,
properly normalized, satisfies `AddQuotientMeasureEqMeasurePreimage`. -/]
theorem IsFundamentalDomain.QuotientMeasureEqMeasurePreimage_HaarMeasure {𝓕 : Set G}
(h𝓕 : IsFundamentalDomain Γ.op 𝓕 ν) [IsMulLeftInvariant μ] [SigmaFinite μ]
{V : Set (G ⧸ Γ)} (hV : (interior V).Nonempty) (meas_V : MeasurableSet V)
(hμK : μ V = ν ((π ⁻¹' V) ∩ 𝓕)) (neTopV : μ V ≠ ⊤) :
QuotientMeasureEqMeasurePreimage ν μ := by
apply IsMulLeftInvariant.quotientMeasureEqMeasurePreimage_of_set (fund_dom_s := h𝓕)
(meas_V := meas_V)
· rw [hμK]
intro c_eq_zero
apply IsOpenPosMeasure.open_pos (interior (π ⁻¹' V)) (μ := ν)
· simp
· apply Set.Nonempty.mono (preimage_interior_subset_interior_preimage continuous_coinduced_rng)
apply hV.preimage'
simp
· apply measure_mono_null (h := interior_subset)
apply h𝓕.measure_zero_of_invariant (ht := fun g ↦ QuotientGroup.sound _ _ g)
exact c_eq_zero
· exact hμK
· exact neTopV
variable (K : PositiveCompacts (G ⧸ Γ))
/-- Given a normal subgroup `Γ` of a topological group `G` with Haar measure `μ`, which is also
right-invariant, and a finite volume fundamental domain `𝓕`, the quotient map to `G ⧸ Γ`,
properly normalized, satisfies `QuotientMeasureEqMeasurePreimage`. -/
@[to_additive /-- Given a
normal subgroup `Γ` of an additive topological group `G` with Haar measure `μ`, which is also
right-invariant, and a finite volume fundamental domain `𝓕`, the quotient map to `G ⧸ Γ`,
properly normalized, satisfies `AddQuotientMeasureEqMeasurePreimage`. -/]
theorem IsFundamentalDomain.QuotientMeasureEqMeasurePreimage_smulHaarMeasure {𝓕 : Set G}
(h𝓕 : IsFundamentalDomain Γ.op 𝓕 ν) (h𝓕_finite : ν 𝓕 ≠ ⊤) :
QuotientMeasureEqMeasurePreimage ν
((ν ((π ⁻¹' (K : Set (G ⧸ Γ))) ∩ 𝓕)) • haarMeasure K) := by
set c := ν ((π ⁻¹' (K : Set (G ⧸ Γ))) ∩ 𝓕)
have c_ne_top : c ≠ ∞ := by
contrapose! h𝓕_finite
have : c ≤ ν 𝓕 := measure_mono (Set.inter_subset_right)
rw [h𝓕_finite] at this
exact top_unique this
set μ := c • haarMeasure K
have hμK : μ K = c := by simp [μ, haarMeasure_self]
haveI : SigmaFinite μ := by
clear_value c
lift c to NNReal using c_ne_top
exact SMul.sigmaFinite c
apply IsFundamentalDomain.QuotientMeasureEqMeasurePreimage_HaarMeasure (h𝓕 := h𝓕)
(meas_V := K.isCompact.measurableSet) (μ := μ)
· exact K.interior_nonempty
· exact hμK
· rw [hμK]
exact c_ne_top
end haarMeasure
end normal
section UnfoldingTrick
variable {G : Type*} [Group G] [MeasurableSpace G] [TopologicalSpace G] [IsTopologicalGroup G]
[BorelSpace G] {μ : Measure G} {Γ : Subgroup G}
variable {𝓕 : Set G} (h𝓕 : IsFundamentalDomain Γ.op 𝓕 μ)
include h𝓕
variable [Countable Γ] [MeasurableSpace (G ⧸ Γ)] [BorelSpace (G ⧸ Γ)]
local notation "μ_𝓕" => Measure.map (@QuotientGroup.mk G _ Γ) (μ.restrict 𝓕)
/-- The `essSup` of a function `g` on the quotient space `G ⧸ Γ` with respect to the pushforward
of the restriction, `μ_𝓕`, of a right-invariant measure `μ` to a fundamental domain `𝓕`, is the
same as the `essSup` of `g`'s lift to the universal cover `G` with respect to `μ`. -/
@[to_additive /-- The `essSup` of a function `g` on the additive quotient space `G ⧸ Γ` with respect
to the pushforward of the restriction, `μ_𝓕`, of a right-invariant measure `μ` to a fundamental
domain `𝓕`, is the same as the `essSup` of `g`'s lift to the universal cover `G` with respect
to `μ`. -/]
lemma essSup_comp_quotientGroup_mk [μ.IsMulRightInvariant] {g : G ⧸ Γ → ℝ≥0∞}
(g_ae_measurable : AEMeasurable g μ_𝓕) : essSup g μ_𝓕 = essSup (fun (x : G) ↦ g x) μ := by
have hπ : Measurable (QuotientGroup.mk : G → G ⧸ Γ) := continuous_quotient_mk'.measurable
rw [essSup_map_measure g_ae_measurable hπ.aemeasurable]
refine h𝓕.essSup_measure_restrict ?_
intro ⟨γ, hγ⟩ x
dsimp
congr 1
exact QuotientGroup.mk_mul_of_mem x hγ
/-- Given a quotient space `G ⧸ Γ` where `Γ` is `Countable`, and the restriction,
`μ_𝓕`, of a right-invariant measure `μ` on `G` to a fundamental domain `𝓕`, a set
in the quotient which has `μ_𝓕`-measure zero, also has measure zero under the
folding of `μ` under the quotient. Note that, if `Γ` is infinite, then the folded map
will take the value `∞` on any open set in the quotient! -/
@[to_additive /-- Given an additive quotient space `G ⧸ Γ` where `Γ` is `Countable`, and the
restriction, `μ_𝓕`, of a right-invariant measure `μ` on `G` to a fundamental domain `𝓕`, a set
in the quotient which has `μ_𝓕`-measure zero, also has measure zero under the
folding of `μ` under the quotient. Note that, if `Γ` is infinite, then the folded map
will take the value `∞` on any open set in the quotient! -/]
lemma _root_.MeasureTheory.IsFundamentalDomain.absolutelyContinuous_map
[μ.IsMulRightInvariant] :
map (QuotientGroup.mk : G → G ⧸ Γ) μ ≪ map (QuotientGroup.mk : G → G ⧸ Γ) (μ.restrict 𝓕) := by
set π : G → G ⧸ Γ := QuotientGroup.mk
have meas_π : Measurable π := continuous_quotient_mk'.measurable
apply AbsolutelyContinuous.mk
intro s s_meas hs
rw [map_apply meas_π s_meas] at hs ⊢
rw [Measure.restrict_apply] at hs
· apply h𝓕.measure_zero_of_invariant _ _ hs
intro γ
ext g
rw [Set.mem_smul_set_iff_inv_smul_mem, mem_preimage, mem_preimage]
congr! 1
convert QuotientGroup.mk_mul_of_mem g (γ⁻¹).2 using 1
exact MeasurableSet.preimage s_meas meas_π
attribute [-instance] Quotient.instMeasurableSpace
/-- This is a simple version of the **Unfolding Trick**: Given a subgroup `Γ` of a group `G`, the
integral of a function `f` on `G` with respect to a right-invariant measure `μ` is equal to the
integral over the quotient `G ⧸ Γ` of the automorphization of `f`. -/
@[to_additive /-- This is a simple version of the **Unfolding Trick**: Given a subgroup `Γ` of an
additive group `G`, the integral of a function `f` on `G` with respect to a right-invariant
measure `μ` is equal to the integral over the quotient `G ⧸ Γ` of the automorphization of `f`. -/]
lemma QuotientGroup.integral_eq_integral_automorphize {E : Type*} [NormedAddCommGroup E]
[NormedSpace ℝ E] [μ.IsMulRightInvariant] {f : G → E}
(hf₁ : Integrable f μ) (hf₂ : AEStronglyMeasurable (automorphize f) μ_𝓕) :
∫ x : G, f x ∂μ = ∫ x : G ⧸ Γ, automorphize f x ∂μ_𝓕 := by
calc ∫ x : G, f x ∂μ = ∑' γ : Γ.op, ∫ x in 𝓕, f (γ • x) ∂μ :=
h𝓕.integral_eq_tsum'' f hf₁
_ = ∫ x in 𝓕, ∑' γ : Γ.op, f (γ • x) ∂μ := ?_
_ = ∫ x : G ⧸ Γ, automorphize f x ∂μ_𝓕 :=
(integral_map continuous_quotient_mk'.aemeasurable hf₂).symm
rw [integral_tsum]
· exact fun i ↦ (hf₁.1.comp_quasiMeasurePreserving
(measurePreserving_smul i μ).quasiMeasurePreserving).restrict
· rw [← h𝓕.lintegral_eq_tsum'' (‖f ·‖ₑ)]
exact ne_of_lt hf₁.2
-- we can't use `to_additive`, because it tries to translate `*` into `+`
/-- This is the **Unfolding Trick**: Given a subgroup `Γ` of a group `G`, the integral of a
function `f` on `G` times the lift to `G` of a function `g` on the quotient `G ⧸ Γ` with respect
to a right-invariant measure `μ` on `G`, is equal to the integral over the quotient of the
automorphization of `f` times `g`. -/
lemma QuotientGroup.integral_mul_eq_integral_automorphize_mul {K : Type*} [NormedField K]
[NormedSpace ℝ K] [μ.IsMulRightInvariant] {f : G → K}
(f_ℒ_1 : Integrable f μ) {g : G ⧸ Γ → K} (hg : AEStronglyMeasurable g μ_𝓕)
(g_ℒ_infinity : essSup (fun x ↦ ↑‖g x‖ₑ) μ_𝓕 ≠ ∞)
(F_ae_measurable : AEStronglyMeasurable (QuotientGroup.automorphize f) μ_𝓕) :
∫ x : G, g (x : G ⧸ Γ) * (f x) ∂μ
= ∫ x : G ⧸ Γ, g x * (QuotientGroup.automorphize f x) ∂μ_𝓕 := by
let π : G → G ⧸ Γ := QuotientGroup.mk
have meas_π : Measurable π := continuous_quotient_mk'.measurable
have H₀ : QuotientGroup.automorphize ((g ∘ π) * f) = g * (QuotientGroup.automorphize f) := by
exact QuotientGroup.automorphize_smul_left f g
calc ∫ (x : G), g (π x) * (f x) ∂μ =
∫ (x : G ⧸ Γ), QuotientGroup.automorphize ((g ∘ π) * f) x ∂μ_𝓕 := ?_
_ = ∫ (x : G ⧸ Γ), g x * (QuotientGroup.automorphize f x) ∂μ_𝓕 := by simp [H₀]
have H₁ : Integrable ((g ∘ π) * f) μ := by
have : AEStronglyMeasurable (fun (x : G) ↦ g (x : (G ⧸ Γ))) μ :=
(hg.mono_ac h𝓕.absolutelyContinuous_map).comp_measurable meas_π
refine Integrable.essSup_smul f_ℒ_1 this ?_
have hg' : AEStronglyMeasurable (‖g ·‖ₑ) μ_𝓕 := continuous_enorm.comp_aestronglyMeasurable hg
rw [← essSup_comp_quotientGroup_mk h𝓕 hg'.aemeasurable]
exact g_ℒ_infinity
have H₂ : AEStronglyMeasurable (QuotientGroup.automorphize ((g ∘ π) * f)) μ_𝓕 := by
simp_rw [H₀]
exact hg.mul F_ae_measurable
apply QuotientGroup.integral_eq_integral_automorphize h𝓕 H₁ H₂
end UnfoldingTrick
section
variable {G' : Type*} [AddGroup G'] [MeasurableSpace G'] [TopologicalSpace G']
[IsTopologicalAddGroup G'] [BorelSpace G'] {μ' : Measure G'} {Γ' : AddSubgroup G'}
{𝓕' : Set G'} (h𝓕 : IsAddFundamentalDomain Γ'.op 𝓕' μ')
[Countable Γ'] [MeasurableSpace (G' ⧸ Γ')] [BorelSpace (G' ⧸ Γ')]
include h𝓕
local notation "μ_𝓕" => Measure.map (@QuotientAddGroup.mk G' _ Γ') (μ'.restrict 𝓕')
/-- This is the **Unfolding Trick**: Given an additive subgroup `Γ'` of an additive group `G'`, the
integral of a function `f` on `G'` times the lift to `G'` of a function `g` on the quotient
`G' ⧸ Γ'` with respect to a right-invariant measure `μ` on `G'`, is equal to the integral over
the quotient of the automorphization of `f` times `g`. -/
lemma QuotientAddGroup.integral_mul_eq_integral_automorphize_mul {K : Type*} [NormedField K]
[NormedSpace ℝ K] [μ'.IsAddRightInvariant] {f : G' → K}
(f_ℒ_1 : Integrable f μ') {g : G' ⧸ Γ' → K} (hg : AEStronglyMeasurable g μ_𝓕)
(g_ℒ_infinity : essSup (‖g ·‖ₑ) μ_𝓕 ≠ ∞)
(F_ae_measurable : AEStronglyMeasurable (QuotientAddGroup.automorphize f) μ_𝓕) :
∫ x : G', g (x : G' ⧸ Γ') * (f x) ∂μ'
= ∫ x : G' ⧸ Γ', g x * (QuotientAddGroup.automorphize f x) ∂μ_𝓕 := by
let π : G' → G' ⧸ Γ' := QuotientAddGroup.mk
have meas_π : Measurable π := continuous_quotient_mk'.measurable
have H₀ : QuotientAddGroup.automorphize ((g ∘ π) * f) = g * (QuotientAddGroup.automorphize f) :=
by exact QuotientAddGroup.automorphize_smul_left f g
calc ∫ (x : G'), g (π x) * f x ∂μ' =
∫ (x : G' ⧸ Γ'), QuotientAddGroup.automorphize ((g ∘ π) * f) x ∂μ_𝓕 := ?_
_ = ∫ (x : G' ⧸ Γ'), g x * (QuotientAddGroup.automorphize f x) ∂μ_𝓕 := by simp [H₀]
have H₁ : Integrable ((g ∘ π) * f) μ' := by
have : AEStronglyMeasurable (fun (x : G') ↦ g (x : (G' ⧸ Γ'))) μ' :=
(hg.mono_ac h𝓕.absolutelyContinuous_map).comp_measurable meas_π
refine Integrable.essSup_smul f_ℒ_1 this ?_
have hg' : AEStronglyMeasurable (‖g ·‖ₑ) μ_𝓕 := continuous_enorm.comp_aestronglyMeasurable hg
rw [← essSup_comp_quotientAddGroup_mk h𝓕 hg'.aemeasurable]
exact g_ℒ_infinity
have H₂ : AEStronglyMeasurable (QuotientAddGroup.automorphize ((g ∘ π) * f)) μ_𝓕 := by
simp_rw [H₀]
exact hg.mul F_ae_measurable
apply QuotientAddGroup.integral_eq_integral_automorphize h𝓕 H₁ H₂
end |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Haar/Unique.lean | import Mathlib.MeasureTheory.Function.LocallyIntegrable
import Mathlib.MeasureTheory.Group.Integral
import Mathlib.MeasureTheory.Integral.Prod
import Mathlib.MeasureTheory.Integral.Bochner.Set
import Mathlib.MeasureTheory.Measure.EverywherePos
import Mathlib.MeasureTheory.Measure.Haar.Basic
import Mathlib.Topology.Metrizable.Urysohn
import Mathlib.Topology.UrysohnsLemma
import Mathlib.Topology.ContinuousMap.Ordered
/-!
# Uniqueness of Haar measure in locally compact groups
## Main results
In a locally compact group, we prove that two left-invariant measures `μ'` and `μ` which are finite
on compact sets coincide, up to a normalizing scalar that we denote with `haarScalarFactor μ' μ`,
in the following sense:
* `integral_isMulLeftInvariant_eq_smul_of_hasCompactSupport`: they give the same value to the
integral of continuous compactly supported functions, up to a scalar.
* `measure_isMulInvariant_eq_smul_of_isCompact_closure`: they give the same value to sets with
compact closure, up to a scalar.
* `measure_isHaarMeasure_eq_smul_of_isOpen`: they give the same value to open sets, up to a scalar.
To get genuine equality of measures, we typically need additional regularity assumptions:
* `isMulLeftInvariant_eq_smul_of_innerRegular`: two left invariant measures which are
inner regular coincide up to a scalar.
* `isMulLeftInvariant_eq_smul_of_regular`: two left invariant measure which are
regular coincide up to a scalar.
* `isHaarMeasure_eq_smul`: in a second countable space, two Haar measures coincide up to a
scalar.
* `isMulInvariant_eq_smul_of_compactSpace`: two left-invariant measures on a compact group coincide
up to a scalar.
* `isHaarMeasure_eq_of_isProbabilityMeasure`: two Haar measures which are probability measures
coincide exactly.
In general, uniqueness statements for Haar measures in the literature make some assumption of
regularity, either regularity or inner regularity. We have tried to minimize the assumptions in the
theorems above, and cover the different results that exist in the literature.
## Implementation
The first result `integral_isMulLeftInvariant_eq_smul_of_hasCompactSupport` is classical. To prove
it, we use a change of variables to express integrals with respect to a left-invariant measure as
integrals with respect to a given right-invariant measure (with a suitable density function).
The uniqueness readily follows.
Uniqueness results for the measure of compact sets and open sets, without any regularity assumption,
are significantly harder. They rely on the completion-regularity of the standard regular Haar
measure. We follow McQuillan's answer at https://mathoverflow.net/questions/456670/.
On second-countable groups, one can arrive to slightly different uniqueness results by using that
the operations are measurable. In particular, one can get uniqueness assuming σ-finiteness of
the measures but discarding the assumption that they are finite on compact sets. See
`haarMeasure_unique` in the file `Mathlib/MeasureTheory/Measure/Haar/Basic.lean`.
## References
[Halmos, Measure Theory][halmos1950measure]
[Fremlin, *Measure Theory* (volume 4)][fremlin_vol4]
-/
open Filter Set TopologicalSpace Function MeasureTheory Measure
open scoped Uniformity Topology ENNReal Pointwise NNReal
/-- In a locally compact regular space with an inner regular measure, the measure of a compact
set `k` is the infimum of the integrals of compactly supported functions equal to `1` on `k`. -/
lemma IsCompact.measure_eq_biInf_integral_hasCompactSupport
{X : Type*} [TopologicalSpace X] [MeasurableSpace X] [BorelSpace X]
{k : Set X} (hk : IsCompact k)
(μ : Measure X) [IsFiniteMeasureOnCompacts μ] [InnerRegularCompactLTTop μ]
[LocallyCompactSpace X] [RegularSpace X] :
μ k = ⨅ (f : X → ℝ) (_ : Continuous f) (_ : HasCompactSupport f) (_ : EqOn f 1 k)
(_ : 0 ≤ f), ENNReal.ofReal (∫ x, f x ∂μ) := by
apply le_antisymm
· simp only [le_iInf_iff]
intro f f_cont f_comp fk f_nonneg
apply (f_cont.integrable_of_hasCompactSupport f_comp).measure_le_integral
· exact Eventually.of_forall f_nonneg
· exact fun x hx ↦ by simp [fk hx]
· apply le_of_forall_gt (fun r hr ↦ ?_)
simp only [iInf_lt_iff, exists_prop]
obtain ⟨U, kU, U_open, mu_U⟩ : ∃ U, k ⊆ U ∧ IsOpen U ∧ μ U < r :=
hk.exists_isOpen_lt_of_lt r hr
obtain ⟨⟨f, f_cont⟩, fk, fU, f_comp, f_range⟩ : ∃ (f : C(X, ℝ)), EqOn f 1 k ∧ EqOn f 0 Uᶜ
∧ HasCompactSupport f ∧ ∀ (x : X), f x ∈ Icc 0 1 := exists_continuous_one_zero_of_isCompact
hk U_open.isClosed_compl (disjoint_compl_right_iff_subset.mpr kU)
refine ⟨f, f_cont, f_comp, fk, fun x ↦ (f_range x).1, ?_⟩
exact (integral_le_measure (fun x _hx ↦ (f_range x).2) (fun x hx ↦ (fU hx).le)).trans_lt mu_U
namespace MeasureTheory
/-- The parameterized integral `x ↦ ∫ y, g (y⁻¹ * x) ∂μ` depends continuously on `y` when `g` is a
compactly supported continuous function on a topological group `G`, and `μ` is finite on compact
sets. -/
@[to_additive]
lemma continuous_integral_apply_inv_mul
{G : Type*} [TopologicalSpace G] [LocallyCompactSpace G] [Group G] [IsTopologicalGroup G]
[MeasurableSpace G] [BorelSpace G]
{μ : Measure G} [IsFiniteMeasureOnCompacts μ] {E : Type*} [NormedAddCommGroup E]
[NormedSpace ℝ E] {g : G → E}
(hg : Continuous g) (h'g : HasCompactSupport g) :
Continuous (fun (x : G) ↦ ∫ y, g (y⁻¹ * x) ∂μ) := by
let k := tsupport g
have k_comp : IsCompact k := h'g
apply continuous_iff_continuousAt.2 (fun x₀ ↦ ?_)
obtain ⟨t, t_comp, ht⟩ : ∃ t, IsCompact t ∧ t ∈ 𝓝 x₀ := exists_compact_mem_nhds x₀
let k' : Set G := t • k⁻¹
have k'_comp : IsCompact k' := t_comp.smul_set k_comp.inv
have A : ContinuousOn (fun (x : G) ↦ ∫ y, g (y⁻¹ * x) ∂μ) t := by
apply continuousOn_integral_of_compact_support k'_comp
· exact (hg.comp (continuous_snd.inv.mul continuous_fst)).continuousOn
· intro p x hp hx
contrapose! hx
refine ⟨p, hp, p⁻¹ * x, ?_, by simp⟩
simpa only [Set.mem_inv, mul_inv_rev, inv_inv] using subset_tsupport _ hx
exact A.continuousAt ht
namespace Measure
section Group
variable {G : Type*} [TopologicalSpace G] [Group G] [IsTopologicalGroup G]
[MeasurableSpace G] [BorelSpace G]
/-!
### Uniqueness of integrals of compactly supported functions
Two left invariant measures coincide when integrating continuous compactly supported functions,
up to a scalar that we denote with `haarScalarFactor μ' μ `.
This is proved by relating the integral for arbitrary left invariant and right invariant measures,
applying a version of Fubini.
As one may use the same right invariant measure, this shows that two different left invariant
measures will give the same integral, up to some fixed scalar.
-/
/-- In a group with a left invariant measure `μ` and a right invariant measure `ν`, one can express
integrals with respect to `μ` as integrals with respect to `ν` up to a constant scaling factor
(given in the statement as `∫ x, g x ∂μ` where `g` is a fixed reference function) and an
explicit density `y ↦ 1/∫ z, g (z⁻¹ * y) ∂ν`. -/
@[to_additive]
lemma integral_isMulLeftInvariant_isMulRightInvariant_combo
{μ ν : Measure G} [IsFiniteMeasureOnCompacts μ] [IsFiniteMeasureOnCompacts ν]
[IsMulLeftInvariant μ] [IsMulRightInvariant ν] [IsOpenPosMeasure ν]
{f g : G → ℝ} (hf : Continuous f) (h'f : HasCompactSupport f)
(hg : Continuous g) (h'g : HasCompactSupport g) (g_nonneg : 0 ≤ g) {x₀ : G} (g_pos : g x₀ ≠ 0) :
∫ x, f x ∂μ = (∫ y, f y * (∫ z, g (z⁻¹ * y) ∂ν)⁻¹ ∂ν) * ∫ x, g x ∂μ := by
-- The group has to be locally compact, otherwise all integrals vanish and the result is trivial.
rcases h'f.eq_zero_or_locallyCompactSpace_of_group hf with Hf|Hf
· simp [Hf]
let D : G → ℝ := fun (x : G) ↦ ∫ y, g (y⁻¹ * x) ∂ν
have D_cont : Continuous D := continuous_integral_apply_inv_mul hg h'g
have D_pos : ∀ x, 0 < D x := by
intro x
have C : Continuous (fun y ↦ g (y⁻¹ * x)) := hg.comp (continuous_inv.mul continuous_const)
apply (integral_pos_iff_support_of_nonneg _ _).2
· apply C.isOpen_support.measure_pos ν
exact ⟨x * x₀⁻¹, by simpa using g_pos⟩
· exact fun y ↦ g_nonneg (y⁻¹ * x)
· apply C.integrable_of_hasCompactSupport
exact h'g.comp_homeomorph ((Homeomorph.inv G).trans (Homeomorph.mulRight x))
calc
∫ x, f x ∂μ = ∫ x, f x * (D x)⁻¹ * D x ∂μ := by
congr with x; rw [mul_assoc, inv_mul_cancel₀ (D_pos x).ne', mul_one]
_ = ∫ x, (∫ y, f x * (D x)⁻¹ * g (y⁻¹ * x) ∂ν) ∂μ := by simp_rw [D, integral_const_mul]
_ = ∫ y, (∫ x, f x * (D x)⁻¹ * g (y⁻¹ * x) ∂μ) ∂ν := by
apply integral_integral_swap_of_hasCompactSupport
· apply Continuous.mul
· exact (hf.comp continuous_fst).mul
((D_cont.comp continuous_fst).inv₀ (fun x ↦ (D_pos _).ne'))
· exact hg.comp (continuous_snd.inv.mul continuous_fst)
· let K := tsupport f
have K_comp : IsCompact K := h'f
let L := tsupport g
have L_comp : IsCompact L := h'g
let M := (fun (p : G × G) ↦ p.1 * p.2⁻¹) '' (K ×ˢ L)
have M_comp : IsCompact M :=
(K_comp.prod L_comp).image (continuous_fst.mul continuous_snd.inv)
have M'_comp : IsCompact (closure M) := M_comp.closure
have : ∀ (p : G × G), p ∉ K ×ˢ closure M → f p.1 * (D p.1)⁻¹ * g (p.2⁻¹ * p.1) = 0 := by
rintro ⟨x, y⟩ hxy
by_cases H : x ∈ K; swap
· simp [image_eq_zero_of_notMem_tsupport H]
have : g (y⁻¹ * x) = 0 := by
apply image_eq_zero_of_notMem_tsupport
contrapose! hxy
simp only [mem_prod, H, true_and]
apply subset_closure
simp only [M, mem_image, mem_prod, Prod.exists]
exact ⟨x, y⁻¹ * x, ⟨H, hxy⟩, by group⟩
simp [this]
apply HasCompactSupport.intro' (K_comp.prod M'_comp) ?_ this
exact (isClosed_tsupport f).prod isClosed_closure
_ = ∫ y, (∫ x, f (y * x) * (D (y * x))⁻¹ * g x ∂μ) ∂ν := by
congr with y
rw [← integral_mul_left_eq_self _ y]
simp
_ = ∫ x, (∫ y, f (y * x) * (D (y * x))⁻¹ * g x ∂ν) ∂μ := by
apply (integral_integral_swap_of_hasCompactSupport _ _).symm
· apply Continuous.mul ?_ (hg.comp continuous_fst)
exact (hf.comp (continuous_snd.mul continuous_fst)).mul
((D_cont.comp (continuous_snd.mul continuous_fst)).inv₀ (fun x ↦ (D_pos _).ne'))
· let K := tsupport f
have K_comp : IsCompact K := h'f
let L := tsupport g
have L_comp : IsCompact L := h'g
let M := (fun (p : G × G) ↦ p.1 * p.2⁻¹) '' (K ×ˢ L)
have M_comp : IsCompact M :=
(K_comp.prod L_comp).image (continuous_fst.mul continuous_snd.inv)
have M'_comp : IsCompact (closure M) := M_comp.closure
have : ∀ (p : G × G), p ∉ L ×ˢ closure M →
f (p.2 * p.1) * (D (p.2 * p.1))⁻¹ * g p.1 = 0 := by
rintro ⟨x, y⟩ hxy
by_cases H : x ∈ L; swap
· simp [image_eq_zero_of_notMem_tsupport H]
have : f (y * x) = 0 := by
apply image_eq_zero_of_notMem_tsupport
contrapose! hxy
simp only [mem_prod, H, true_and]
apply subset_closure
simp only [M, mem_image, mem_prod, Prod.exists]
exact ⟨y * x, x, ⟨hxy, H⟩, by group⟩
simp [this]
apply HasCompactSupport.intro' (L_comp.prod M'_comp) ?_ this
exact (isClosed_tsupport g).prod isClosed_closure
_ = ∫ x, (∫ y, f y * (D y)⁻¹ ∂ν) * g x ∂μ := by
simp_rw [integral_mul_const]
congr with x
conv_rhs => rw [← integral_mul_right_eq_self _ x]
_ = (∫ y, f y * (D y)⁻¹ ∂ν) * ∫ x, g x ∂μ := integral_const_mul _ _
/-- Given two left-invariant measures which are finite on
compacts, they coincide in the following sense: they give the same value to the integral of
continuous compactly supported functions, up to a multiplicative constant. -/
@[to_additive exists_integral_isAddLeftInvariant_eq_smul_of_hasCompactSupport]
lemma exists_integral_isMulLeftInvariant_eq_smul_of_hasCompactSupport (μ' μ : Measure G)
[IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ'] :
∃ (c : ℝ≥0), ∀ (f : G → ℝ), Continuous f → HasCompactSupport f →
∫ x, f x ∂μ' = ∫ x, f x ∂(c • μ) := by
-- The group has to be locally compact, otherwise all integrals vanish and the result is trivial.
by_cases H : LocallyCompactSpace G; swap
· refine ⟨0, fun f f_cont f_comp ↦ ?_⟩
rcases f_comp.eq_zero_or_locallyCompactSpace_of_group f_cont with hf|hf
· simp [hf]
· exact (H hf).elim
-- Fix some nonzero continuous function with compact support `g`.
obtain ⟨⟨g, g_cont⟩, g_comp, g_nonneg, g_one⟩ :
∃ (g : C(G, ℝ)), HasCompactSupport g ∧ 0 ≤ g ∧ g 1 ≠ 0 := exists_continuous_nonneg_pos 1
have int_g_pos : 0 < ∫ x, g x ∂μ :=
g_cont.integral_pos_of_hasCompactSupport_nonneg_nonzero g_comp g_nonneg g_one
-- The proportionality constant we are looking for will be the ratio of the integrals of `g`
-- with respect to `μ'` and `μ`.
let c : ℝ := (∫ x, g x ∂μ) ⁻¹ * (∫ x, g x ∂μ')
have c_nonneg : 0 ≤ c :=
mul_nonneg (inv_nonneg.2 (integral_nonneg g_nonneg)) (integral_nonneg g_nonneg)
refine ⟨⟨c, c_nonneg⟩, fun f f_cont f_comp ↦ ?_⟩
/- use the lemma `integral_mulLeftInvariant_mulRightInvariant_combo` for `μ` and then `μ'`
to reexpress the integral of `f` as the integral of `g` times a factor which only depends
on a right-invariant measure `ν`. We use `ν = μ.inv` for convenience. -/
let ν := μ.inv
have A : ∫ x, f x ∂μ = (∫ y, f y * (∫ z, g (z⁻¹ * y) ∂ν)⁻¹ ∂ν) * ∫ x, g x ∂μ :=
integral_isMulLeftInvariant_isMulRightInvariant_combo f_cont f_comp g_cont g_comp g_nonneg g_one
rw [← mul_inv_eq_iff_eq_mul₀ int_g_pos.ne'] at A
have B : ∫ x, f x ∂μ' = (∫ y, f y * (∫ z, g (z⁻¹ * y) ∂ν)⁻¹ ∂ν) * ∫ x, g x ∂μ' :=
integral_isMulLeftInvariant_isMulRightInvariant_combo f_cont f_comp g_cont g_comp g_nonneg g_one
/- Since the `ν`-factor is the same for `μ` and `μ'`, this gives the result. -/
rw [← A, mul_assoc, mul_comm] at B
simp [B, integral_smul_nnreal_measure, c, NNReal.smul_def]
open scoped Classical in
/-- Given two left-invariant measures which are finite on compacts, `haarScalarFactor μ' μ` is a
scalar such that `∫ f dμ' = (haarScalarFactor μ' μ) ∫ f dμ` for any compactly supported continuous
function `f`.
Note that there is a dissymmetry in the assumptions between `μ'` and `μ`: the measure `μ'` needs
only be finite on compact sets, while `μ` has to be finite on compact sets and positive on open
sets, i.e., a Haar measure, to exclude for instance the case where `μ = 0`, where the definition
doesn't make sense. -/
@[to_additive /-- Given two left-invariant measures which are finite on compacts,
`addHaarScalarFactor μ' μ` is a scalar such that `∫ f dμ' = (addHaarScalarFactor μ' μ) ∫ f dμ` for
any compactly supported continuous function `f`.
Note that there is a dissymmetry in the assumptions between `μ'` and `μ`: the measure `μ'` needs
only be finite on compact sets, while `μ` has to be finite on compact sets and positive on open
sets, i.e., an additive Haar measure, to exclude for instance the case where `μ = 0`, where the
definition doesn't make sense. -/]
noncomputable def haarScalarFactor
(μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ'] :
ℝ≥0 :=
if ¬ LocallyCompactSpace G then 1
else (exists_integral_isMulLeftInvariant_eq_smul_of_hasCompactSupport μ' μ).choose
/-- Two left invariant measures integrate in the same way continuous compactly supported functions,
up to the scalar `haarScalarFactor μ' μ`. See also
`measure_isMulInvariant_eq_smul_of_isCompact_closure`, which gives the same result for compact
sets, and `measure_isHaarMeasure_eq_smul_of_isOpen` for open sets. -/
@[to_additive integral_isAddLeftInvariant_eq_smul_of_hasCompactSupport
/-- Two left invariant measures integrate in the same way continuous compactly supported functions,
up to the scalar `addHaarScalarFactor μ' μ`. See also
`measure_isAddInvariant_eq_smul_of_isCompact_closure`, which gives the same result for compact
sets, and `measure_isAddHaarMeasure_eq_smul_of_isOpen` for open sets. -/]
theorem integral_isMulLeftInvariant_eq_smul_of_hasCompactSupport
(μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ']
{f : G → ℝ} (hf : Continuous f) (h'f : HasCompactSupport f) :
∫ x, f x ∂μ' = ∫ x, f x ∂(haarScalarFactor μ' μ • μ) := by
classical
rcases h'f.eq_zero_or_locallyCompactSpace_of_group hf with Hf|Hf
· simp [Hf]
· simp only [haarScalarFactor, Hf, not_true_eq_false, ite_false]
exact (exists_integral_isMulLeftInvariant_eq_smul_of_hasCompactSupport μ' μ).choose_spec
f hf h'f
@[to_additive addHaarScalarFactor_eq_integral_div]
lemma haarScalarFactor_eq_integral_div (μ' μ : Measure G) [IsHaarMeasure μ]
[IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ'] {f : G → ℝ} (hf : Continuous f)
(h'f : HasCompactSupport f) (int_nonzero : ∫ x, f x ∂μ ≠ 0) :
haarScalarFactor μ' μ = (∫ x, f x ∂μ') / ∫ x, f x ∂μ := by
have := integral_isMulLeftInvariant_eq_smul_of_hasCompactSupport μ' μ hf h'f
rw [integral_smul_nnreal_measure] at this
exact EuclideanDomain.eq_div_of_mul_eq_left int_nonzero this.symm
@[to_additive (attr := simp) addHaarScalarFactor_smul]
lemma haarScalarFactor_smul [LocallyCompactSpace G] (μ' μ : Measure G) [IsHaarMeasure μ]
[IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ'] {c : ℝ≥0} :
haarScalarFactor (c • μ') μ = c • haarScalarFactor μ' μ := by
obtain ⟨⟨g, g_cont⟩, g_comp, g_nonneg, g_one⟩ :
∃ g : C(G, ℝ), HasCompactSupport g ∧ 0 ≤ g ∧ g 1 ≠ 0 := exists_continuous_nonneg_pos 1
have int_g_ne_zero : ∫ x, g x ∂μ ≠ 0 :=
ne_of_gt (g_cont.integral_pos_of_hasCompactSupport_nonneg_nonzero g_comp g_nonneg g_one)
apply NNReal.coe_injective
calc
haarScalarFactor (c • μ') μ = (∫ x, g x ∂(c • μ')) / ∫ x, g x ∂μ :=
haarScalarFactor_eq_integral_div _ _ g_cont g_comp int_g_ne_zero
_ = (c • (∫ x, g x ∂μ')) / ∫ x, g x ∂μ := by simp
_ = c • ((∫ x, g x ∂μ') / ∫ x, g x ∂μ) := smul_div_assoc c _ _
_ = c • haarScalarFactor μ' μ := by
rw [← haarScalarFactor_eq_integral_div _ _ g_cont g_comp int_g_ne_zero]
@[to_additive mul_addHaarScalarFactor_smul]
lemma mul_haarScalarFactor_smul [LocallyCompactSpace G] (μ' μ : Measure G)
[IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ'] {c : ℝ≥0}
(hc : c ≠ 0) :
haveI : IsHaarMeasure (c • μ) := IsHaarMeasure.nnreal_smul _ hc
c * haarScalarFactor μ' (c • μ) = haarScalarFactor μ' μ := by
have : IsHaarMeasure (c • μ) := IsHaarMeasure.nnreal_smul _ hc
obtain ⟨⟨g, g_cont⟩, g_comp, g_nonneg, g_one⟩ :
∃ g : C(G, ℝ), HasCompactSupport g ∧ 0 ≤ g ∧ g 1 ≠ 0 := exists_continuous_nonneg_pos 1
have int_g_ne_zero : ∫ x, g x ∂μ ≠ 0 :=
ne_of_gt (g_cont.integral_pos_of_hasCompactSupport_nonneg_nonzero g_comp g_nonneg g_one)
apply NNReal.coe_injective
calc
c * haarScalarFactor μ' (c • μ) = c * ((∫ x, g x ∂μ') / ∫ x, g x ∂(c • μ)) :=
by rw [haarScalarFactor_eq_integral_div _ _ g_cont g_comp (by simp [int_g_ne_zero, hc])]
_ = c * ((∫ x, g x ∂μ') / (c • ∫ x, g x ∂μ)) := by simp
_ = (∫ x, g x ∂μ') / (∫ x, g x ∂μ) := by
rw [NNReal.smul_def, smul_eq_mul, ← mul_div_assoc]
exact mul_div_mul_left (∫ (x : G), g x ∂μ') (∫ (x : G), g x ∂μ) (by simp [hc])
_ = μ'.haarScalarFactor μ :=
(haarScalarFactor_eq_integral_div _ _ g_cont g_comp int_g_ne_zero).symm
@[to_additive addHaarScalarFactor_smul_smul]
lemma haarScalarFactor_smul_smul [LocallyCompactSpace G] (μ' μ : Measure G)
[IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ'] {c : ℝ≥0}
(hc : c ≠ 0) :
haveI : IsHaarMeasure (c • μ) := IsHaarMeasure.nnreal_smul _ hc
haarScalarFactor (c • μ') (c • μ) = haarScalarFactor μ' μ := by
rw [haarScalarFactor_smul, smul_eq_mul, mul_haarScalarFactor_smul _ _ hc]
@[to_additive (attr := simp)]
lemma haarScalarFactor_self (μ : Measure G) [IsHaarMeasure μ] :
haarScalarFactor μ μ = 1 := by
by_cases hG : LocallyCompactSpace G; swap
· simp [haarScalarFactor, hG]
obtain ⟨⟨g, g_cont⟩, g_comp, g_nonneg, g_one⟩ :
∃ g : C(G, ℝ), HasCompactSupport g ∧ 0 ≤ g ∧ g 1 ≠ 0 := exists_continuous_nonneg_pos 1
have int_g_ne_zero : ∫ x, g x ∂μ ≠ 0 :=
ne_of_gt (g_cont.integral_pos_of_hasCompactSupport_nonneg_nonzero g_comp g_nonneg g_one)
apply NNReal.coe_injective
calc
haarScalarFactor μ μ = (∫ x, g x ∂μ) / ∫ x, g x ∂μ :=
haarScalarFactor_eq_integral_div _ _ g_cont g_comp int_g_ne_zero
_ = 1 := div_self int_g_ne_zero
@[to_additive addHaarScalarFactor_eq_mul]
lemma haarScalarFactor_eq_mul (μ' μ ν : Measure G)
[IsHaarMeasure μ] [IsHaarMeasure ν] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ'] :
haarScalarFactor μ' ν = haarScalarFactor μ' μ * haarScalarFactor μ ν := by
-- The group has to be locally compact, otherwise the scalar factor is 1 by definition.
by_cases hG : LocallyCompactSpace G; swap
· simp [haarScalarFactor, hG]
-- Fix some nonzero continuous function with compact support `g`.
obtain ⟨⟨g, g_cont⟩, g_comp, g_nonneg, g_one⟩ :
∃ (g : C(G, ℝ)), HasCompactSupport g ∧ 0 ≤ g ∧ g 1 ≠ 0 := exists_continuous_nonneg_pos 1
have Z := integral_isMulLeftInvariant_eq_smul_of_hasCompactSupport μ' μ g_cont g_comp
simp only [integral_smul_nnreal_measure, smul_smul,
integral_isMulLeftInvariant_eq_smul_of_hasCompactSupport μ' ν g_cont g_comp,
integral_isMulLeftInvariant_eq_smul_of_hasCompactSupport μ ν g_cont g_comp] at Z
have int_g_pos : 0 < ∫ x, g x ∂ν := by
apply (integral_pos_iff_support_of_nonneg g_nonneg _).2
· exact IsOpen.measure_pos ν g_cont.isOpen_support ⟨1, g_one⟩
· exact g_cont.integrable_of_hasCompactSupport g_comp
change (haarScalarFactor μ' ν : ℝ) * ∫ (x : G), g x ∂ν =
(haarScalarFactor μ' μ * haarScalarFactor μ ν : ℝ≥0) * ∫ (x : G), g x ∂ν at Z
simpa only [mul_eq_mul_right_iff (M₀ := ℝ), int_g_pos.ne', or_false, ← NNReal.eq_iff] using Z
/-- The scalar factor between two left-invariant measures is non-zero when both measures are
positive on open sets. -/
@[to_additive]
lemma haarScalarFactor_pos_of_isHaarMeasure (μ' μ : Measure G) [IsHaarMeasure μ]
[IsHaarMeasure μ'] : 0 < haarScalarFactor μ' μ :=
pos_iff_ne_zero.2 (fun H ↦ by simpa [H] using haarScalarFactor_eq_mul μ' μ μ')
/-!
### Uniqueness of measure of sets with compact closure
Two left invariant measures give the same measure to sets with compact closure, up to the
scalar `haarScalarFactor μ' μ`.
This is a tricky argument, typically not done in textbooks (the textbooks version all require one
version of regularity or another). Here is a sketch, based on
McQuillan's answer at https://mathoverflow.net/questions/456670/.
Assume for simplicity that all measures are normalized, so that the scalar factors are all `1`.
First, from the fact that `μ` and `μ'` integrate in the same way compactly supported functions,
they give the same measure to compact "zero sets", i.e., sets of the form `f⁻¹ {1}`
for `f` continuous and compactly supported.
See `measure_preimage_isMulLeftInvariant_eq_smul_of_hasCompactSupport`.
If `μ` is inner regular, a theorem of Halmos shows that any measurable set `s` of finite measure can
be approximated from inside by a compact zero set `k`. Then `μ s ≤ μ k + ε = μ' k + ε ≤ μ' s + ε`.
Letting `ε` tend to zero, one gets `μ s ≤ μ' s`.
See `smul_measure_isMulInvariant_le_of_isCompact_closure`.
Assume now that `s` is a measurable set of compact closure. It is contained in a compact
zero set `t`. The same argument applied to `t - s` gives `μ (t \ s) ≤ μ' (t \ s)`, i.e.,
`μ t - μ s ≤ μ' t - μ' s`. As `μ t = μ' t` (since these are zero sets), we get the inequality
`μ' s ≤ μ s`. Together with the previous one, this gives `μ' s = μ s`.
See `measure_isMulInvariant_eq_smul_of_isCompact_closure_of_innerRegularCompactLTTop`.
If neither `μ` nor `μ'` is inner regular, we can use the existence of another inner regular
left-invariant measure `ν`, so get `μ s = ν s = μ' s`, by applying twice the previous argument.
Here, the uniqueness argument uses the existence of a Haar measure with a nice behavior!
See `measure_isMulInvariant_eq_smul_of_isCompact_closure_of_measurableSet`.
Finally, if `s` has compact closure but is not measurable, its measure is the infimum of the
measures of its measurable supersets, and even of those contained in `closure s`. As `μ`
and `μ'` coincide on these supersets, this yields `μ s = μ' s`.
See `measure_isMulInvariant_eq_smul_of_isCompact_closure`.
-/
/-- Two left invariant measures give the same mass to level sets of continuous compactly supported
functions, up to the scalar `haarScalarFactor μ' μ`.
Auxiliary lemma in the proof of the more general
`measure_isMulInvariant_eq_smul_of_isCompact_closure`, which works for any set with
compact closure. -/
@[to_additive measure_preimage_isAddLeftInvariant_eq_smul_of_hasCompactSupport
/-- Two left invariant measures give the same mass to level sets of continuous compactly supported
functions, up to the scalar `addHaarScalarFactor μ' μ`.
Auxiliary lemma in the proof of the more general
`measure_isAddInvariant_eq_smul_of_isCompact_closure`, which works for any set with
compact closure. -/]
lemma measure_preimage_isMulLeftInvariant_eq_smul_of_hasCompactSupport
(μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ']
{f : G → ℝ} (hf : Continuous f) (h'f : HasCompactSupport f) :
μ' (f ⁻¹' {1}) = haarScalarFactor μ' μ • μ (f ⁻¹' {1}) := by
/- This follows from the fact that the two measures integrate in the same way continuous
functions, by approximating the indicator function of `f ⁻¹' {1}` by continuous functions
(namely `vₙ ∘ f` where `vₙ` is equal to `1` at `1`, and `0` outside of a small neighborhood
`(1 - uₙ, 1 + uₙ)` where `uₙ` is a sequence tending to `0`).
We use `vₙ = thickenedIndicator uₙ {1}` to take advantage of existing lemmas. -/
obtain ⟨u, -, u_mem, u_lim⟩ : ∃ u, StrictAnti u ∧ (∀ (n : ℕ), u n ∈ Ioo 0 1)
∧ Tendsto u atTop (𝓝 0) := exists_seq_strictAnti_tendsto' (zero_lt_one : (0 : ℝ) < 1)
let v : ℕ → ℝ → ℝ := fun n x ↦ thickenedIndicator (u_mem n).1 ({1} : Set ℝ) x
have vf_cont n : Continuous ((v n) ∘ f) := by
apply Continuous.comp (continuous_induced_dom.comp ?_) hf
exact BoundedContinuousFunction.continuous (thickenedIndicator (u_mem n).left {1})
have I : ∀ (ν : Measure G), IsFiniteMeasureOnCompacts ν →
Tendsto (fun n ↦ ∫ x, v n (f x) ∂ν) atTop
(𝓝 (∫ x, Set.indicator ({1} : Set ℝ) (fun _ ↦ 1) (f x) ∂ν)) := by
intro ν hν
apply tendsto_integral_of_dominated_convergence
(bound := (tsupport f).indicator (fun (_ : G) ↦ (1 : ℝ)) )
· exact fun n ↦ (vf_cont n).aestronglyMeasurable
· apply IntegrableOn.integrable_indicator _ (isClosed_tsupport f).measurableSet
simpa using IsCompact.measure_lt_top h'f
· refine fun n ↦ Eventually.of_forall (fun x ↦ ?_)
by_cases hx : x ∈ tsupport f
· simp only [v, Real.norm_eq_abs, NNReal.abs_eq, hx, indicator_of_mem]
norm_cast
exact thickenedIndicator_le_one _ _ _
· simp only [v, Real.norm_eq_abs, NNReal.abs_eq, hx, not_false_eq_true, indicator_of_notMem]
rw [thickenedIndicator_zero]
· simp
· simpa [image_eq_zero_of_notMem_tsupport hx] using (u_mem n).2.le
· filter_upwards with x
have T := tendsto_pi_nhds.1 (thickenedIndicator_tendsto_indicator_closure
(fun n ↦ (u_mem n).1) u_lim ({1} : Set ℝ)) (f x)
simp only [thickenedIndicator_apply, closure_singleton] at T
convert NNReal.tendsto_coe.2 T
simp
have M n : ∫ (x : G), v n (f x) ∂μ' = ∫ (x : G), v n (f x) ∂(haarScalarFactor μ' μ • μ) := by
apply integral_isMulLeftInvariant_eq_smul_of_hasCompactSupport μ' μ (vf_cont n)
apply h'f.comp_left
simp only [v, thickenedIndicator_apply, NNReal.coe_eq_zero]
rw [thickenedIndicatorAux_zero (u_mem n).1]
· simp only [ENNReal.toNNReal_zero]
· simpa using (u_mem n).2.le
have I1 := I μ' (by infer_instance)
simp_rw [M] at I1
have J1 : ∫ (x : G), indicator {1} (fun _ ↦ (1 : ℝ)) (f x) ∂μ'
= ∫ (x : G), indicator {1} (fun _ ↦ 1) (f x) ∂(haarScalarFactor μ' μ • μ) :=
tendsto_nhds_unique I1 (I (haarScalarFactor μ' μ • μ) (by infer_instance))
have J2 : μ'.real (f ⁻¹' {1})
= (haarScalarFactor μ' μ • μ).real (f ⁻¹' {1}) := by
have : (fun x ↦ indicator {1} (fun _ ↦ (1 : ℝ)) (f x)) =
(fun x ↦ indicator (f ⁻¹' {1}) (fun _ ↦ (1 : ℝ)) x) := by
ext x
exact (indicator_comp_right f (s := ({1} : Set ℝ)) (g := (fun _ ↦ (1 : ℝ))) (x := x)).symm
have mf : MeasurableSet (f ⁻¹' {1}) := (isClosed_singleton.preimage hf).measurableSet
simpa only [this, mf, integral_indicator_const, smul_eq_mul, mul_one, Pi.smul_apply,
nnreal_smul_coe_apply, ENNReal.toReal_mul, ENNReal.coe_toReal] using J1
have C : IsCompact (f ⁻¹' {1}) := h'f.isCompact_preimage hf isClosed_singleton (by simp)
rw [measureReal_eq_measureReal_iff C.measure_lt_top.ne C.measure_lt_top.ne] at J2
simpa using J2
/-- If an invariant measure is inner regular, then it gives less mass to sets with compact closure
than any other invariant measure, up to the scalar `haarScalarFactor μ' μ`.
Auxiliary lemma in the proof of the more general
`measure_isMulInvariant_eq_smul_of_isCompact_closure`, which gives equality for any
set with compact closure. -/
@[to_additive smul_measure_isAddInvariant_le_of_isCompact_closure
/-- If an invariant measure is inner regular, then it gives less mass to sets with compact closure
than any other invariant measure, up to the scalar `addHaarScalarFactor μ' μ`.
Auxiliary lemma in the proof of the more general
`measure_isAddInvariant_eq_smul_of_isCompact_closure`, which gives equality for any
set with compact closure. -/]
lemma smul_measure_isMulInvariant_le_of_isCompact_closure [LocallyCompactSpace G]
(μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ']
[InnerRegularCompactLTTop μ]
{s : Set G} (hs : MeasurableSet s) (h's : IsCompact (closure s)) :
haarScalarFactor μ' μ • μ s ≤ μ' s := by
apply le_of_forall_lt (fun r hr ↦ ?_)
let ν := haarScalarFactor μ' μ • μ
have : ν s ≠ ∞ := ((measure_mono subset_closure).trans_lt h's.measure_lt_top).ne
obtain ⟨-, hf, ⟨f, f_cont, f_comp, rfl⟩, νf⟩ :
∃ K ⊆ s, (∃ f, Continuous f ∧ HasCompactSupport f ∧ K = f ⁻¹' {1}) ∧ r < ν K :=
innerRegularWRT_preimage_one_hasCompactSupport_measure_ne_top_of_group ⟨hs, this⟩ r
(by convert hr)
calc
r < ν (f ⁻¹' {1}) := νf
_ = μ' (f ⁻¹' {1}) :=
(measure_preimage_isMulLeftInvariant_eq_smul_of_hasCompactSupport _ _ f_cont f_comp).symm
_ ≤ μ' s := measure_mono hf
/-- If an invariant measure is inner regular, then it gives the same mass to measurable sets with
compact closure as any other invariant measure, up to the scalar `haarScalarFactor μ' μ`.
Auxiliary lemma in the proof of the more general
`measure_isMulInvariant_eq_smul_of_isCompact_closure`, which works for any set with
compact closure, and removes the inner regularity assumption. -/
@[to_additive measure_isAddInvariant_eq_smul_of_isCompact_closure_of_innerRegularCompactLTTop
/-- If an invariant measure is inner regular, then it gives the same mass to measurable sets with
compact closure as any other invariant measure, up to the scalar `addHaarScalarFactor μ' μ`.
Auxiliary lemma in the proof of the more general
`measure_isAddInvariant_eq_smul_of_isCompact_closure`, which works for any set with
compact closure, and removes the inner regularity assumption. -/]
lemma measure_isMulInvariant_eq_smul_of_isCompact_closure_of_innerRegularCompactLTTop
[LocallyCompactSpace G]
(μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ']
[InnerRegularCompactLTTop μ]
{s : Set G} (hs : MeasurableSet s) (h's : IsCompact (closure s)) :
μ' s = haarScalarFactor μ' μ • μ s := by
apply le_antisymm ?_ (smul_measure_isMulInvariant_le_of_isCompact_closure μ' μ hs h's)
let ν := haarScalarFactor μ' μ • μ
change μ' s ≤ ν s
obtain ⟨⟨f, f_cont⟩, hf, -, f_comp, -⟩ : ∃ f : C(G, ℝ), EqOn f 1 (closure s) ∧ EqOn f 0 ∅
∧ HasCompactSupport f ∧ ∀ x, f x ∈ Icc (0 : ℝ) 1 :=
exists_continuous_one_zero_of_isCompact h's isClosed_empty (disjoint_empty _)
let t := f ⁻¹' {1}
have t_closed : IsClosed t := isClosed_singleton.preimage f_cont
have t_comp : IsCompact t := f_comp.isCompact_preimage f_cont isClosed_singleton (by simp)
have st : s ⊆ t := (IsClosed.closure_subset_iff t_closed).mp hf
have A : ν (t \ s) ≤ μ' (t \ s) := by
apply smul_measure_isMulInvariant_le_of_isCompact_closure _ _ (t_closed.measurableSet.diff hs)
exact t_comp.closure_of_subset diff_subset
have B : μ' t = ν t :=
measure_preimage_isMulLeftInvariant_eq_smul_of_hasCompactSupport _ _ f_cont f_comp
rwa [measure_diff st hs.nullMeasurableSet, measure_diff st hs.nullMeasurableSet, ← B,
ENNReal.sub_le_sub_iff_left] at A
· exact measure_mono st
· exact t_comp.measure_lt_top.ne
· exact ((measure_mono st).trans_lt t_comp.measure_lt_top).ne
· exact ((measure_mono st).trans_lt t_comp.measure_lt_top).ne
/-- Given an invariant measure then it gives the same mass to measurable sets with
compact closure as any other invariant measure, up to the scalar `haarScalarFactor μ' μ`.
Auxiliary lemma in the proof of the more general
`measure_isMulInvariant_eq_smul_of_isCompact_closure`, which removes the
measurability assumption. -/
@[to_additive measure_isAddInvariant_eq_smul_of_isCompact_closure_of_measurableSet
/-- Given an invariant measure then it gives the same mass to measurable sets with
compact closure as any other invariant measure, up to the scalar `addHaarScalarFactor μ' μ`.
Auxiliary lemma in the proof of the more general
`measure_isAddInvariant_eq_smul_of_isCompact_closure`, which removes the
measurability assumption. -/]
lemma measure_isMulInvariant_eq_smul_of_isCompact_closure_of_measurableSet [LocallyCompactSpace G]
(μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ']
{s : Set G} (hs : MeasurableSet s) (h's : IsCompact (closure s)) :
μ' s = haarScalarFactor μ' μ • μ s := by
let ν : Measure G := haar
have A : μ' s = haarScalarFactor μ' ν • ν s :=
measure_isMulInvariant_eq_smul_of_isCompact_closure_of_innerRegularCompactLTTop μ' ν hs h's
have B : μ s = haarScalarFactor μ ν • ν s :=
measure_isMulInvariant_eq_smul_of_isCompact_closure_of_innerRegularCompactLTTop μ ν hs h's
rw [A, B, smul_smul, haarScalarFactor_eq_mul μ' μ ν]
/-- **Uniqueness of left-invariant measures**:
Given two left-invariant measures which are finite on compacts, they coincide in the following
sense: they give the same value to sets with compact closure, up to the multiplicative
constant `haarScalarFactor μ' μ`. -/
@[to_additive measure_isAddInvariant_eq_smul_of_isCompact_closure
/-- **Uniqueness of left-invariant measures**:
Given two left-invariant measures which are finite on compacts, they coincide in the following
sense: they give the same value to sets with compact closure, up to the multiplicative
constant `addHaarScalarFactor μ' μ`. -/]
theorem measure_isMulInvariant_eq_smul_of_isCompact_closure [LocallyCompactSpace G]
(μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ']
{s : Set G} (h's : IsCompact (closure s)) :
μ' s = haarScalarFactor μ' μ • μ s := by
let ν := haarScalarFactor μ' μ • μ
apply le_antisymm
· calc
μ' s ≤ μ' ((toMeasurable ν s) ∩ (closure s)) :=
measure_mono <| subset_inter (subset_toMeasurable ν s) subset_closure
_ = ν ((toMeasurable ν s) ∩ (closure s)) := by
apply measure_isMulInvariant_eq_smul_of_isCompact_closure_of_measurableSet _ _ _ _
· exact (measurableSet_toMeasurable ν s).inter isClosed_closure.measurableSet
· exact h's.closure_of_subset inter_subset_right
_ ≤ ν (toMeasurable ν s) := measure_mono inter_subset_left
_ = ν s := measure_toMeasurable s
· calc
ν s ≤ ν ((toMeasurable μ' s) ∩ (closure s)) :=
measure_mono <| subset_inter (subset_toMeasurable μ' s) subset_closure
_ = μ' ((toMeasurable μ' s) ∩ (closure s)) := by
apply (measure_isMulInvariant_eq_smul_of_isCompact_closure_of_measurableSet _ _ _ _).symm
· exact (measurableSet_toMeasurable μ' s).inter isClosed_closure.measurableSet
· exact h's.closure_of_subset inter_subset_right
_ ≤ μ' (toMeasurable μ' s) := measure_mono inter_subset_left
_ = μ' s := measure_toMeasurable s
/-- **Uniqueness of Haar measures**:
Two Haar measures on a compact group coincide up to a multiplicative factor. -/
@[to_additive isAddInvariant_eq_smul_of_compactSpace]
lemma isMulInvariant_eq_smul_of_compactSpace [CompactSpace G] (μ' μ : Measure G)
[IsHaarMeasure μ] [IsMulLeftInvariant μ'] [IsFiniteMeasureOnCompacts μ'] :
μ' = haarScalarFactor μ' μ • μ := by
ext s _hs
exact measure_isMulInvariant_eq_smul_of_isCompact_closure _ _ isClosed_closure.isCompact
@[to_additive]
instance (priority := 100) instInnerRegularOfIsHaarMeasureOfCompactSpace
[CompactSpace G] (μ : Measure G) [IsMulLeftInvariant μ] [IsFiniteMeasureOnCompacts μ] :
InnerRegular μ := by
rw [isMulInvariant_eq_smul_of_compactSpace μ haar]
infer_instance
@[to_additive]
instance (priority := 100) instRegularOfIsHaarMeasureOfCompactSpace
[CompactSpace G] (μ : Measure G) [IsMulLeftInvariant μ] [IsFiniteMeasureOnCompacts μ] :
Regular μ := by
rw [isMulInvariant_eq_smul_of_compactSpace μ haar]
infer_instance
/-- **Uniqueness of Haar measures**:
Two Haar measures which are probability measures coincide. -/
@[to_additive]
lemma isHaarMeasure_eq_of_isProbabilityMeasure [LocallyCompactSpace G] (μ' μ : Measure G)
[IsProbabilityMeasure μ] [IsProbabilityMeasure μ'] [IsHaarMeasure μ] [IsHaarMeasure μ'] :
μ' = μ := by
have : CompactSpace G := by
by_contra H
rw [not_compactSpace_iff] at H
simpa using measure_univ_of_isMulLeftInvariant μ
have A s : μ' s = haarScalarFactor μ' μ • μ s :=
measure_isMulInvariant_eq_smul_of_isCompact_closure _ _ isClosed_closure.isCompact
have Z := A univ
simp only [measure_univ, ENNReal.smul_def, smul_eq_mul, mul_one, ENNReal.one_eq_coe] at Z
ext s _hs
simp [A s, ← Z]
/-!
### Uniqueness of measure of open sets
Two Haar measures give the same measure to open sets (or more generally to sets which are everywhere
positive), up to the scalar `haarScalarFactor μ' μ `.
-/
@[to_additive measure_isAddHaarMeasure_eq_smul_of_isEverywherePos]
theorem measure_isHaarMeasure_eq_smul_of_isEverywherePos [LocallyCompactSpace G]
(μ' μ : Measure G) [IsHaarMeasure μ] [IsHaarMeasure μ']
{s : Set G} (hs : MeasurableSet s) (h's : IsEverywherePos μ s) :
μ' s = haarScalarFactor μ' μ • μ s := by
let ν := haarScalarFactor μ' μ • μ
change μ' s = ν s
/- Fix a compact neighborhood `k` of the identity, and consider a maximal disjoint family `m` of
sets `x • k` centered at points in `s`. Then `s` is covered by the sets `x • (k * k⁻¹)` by
maximality. If the family is countable, then since `μ'` and `ν` coincide in compact sets, and
the measure of a countable disjoint union is the sum of the measures, we get `μ' s = ν s`.
Otherwise, the family is uncountable, and each intersection with `s` has positive measure by
the everywhere positivity assumption, so `ν s = ∞`, and `μ' s = ∞` in the same way. -/
obtain ⟨k, k_comp, k_closed, k_mem⟩ : ∃ k, IsCompact k ∧ IsClosed k ∧ k ∈ 𝓝 (1 : G) := by
rcases exists_compact_mem_nhds (1 : G) with ⟨k, hk, hmem⟩
exact ⟨closure k, hk.closure, isClosed_closure, mem_of_superset hmem subset_closure⟩
have one_k : 1 ∈ k := mem_of_mem_nhds k_mem
let A : Set (Set G) := {t | t ⊆ s ∧ PairwiseDisjoint t (fun x ↦ x • k)}
obtain ⟨m, m_max⟩ : ∃ m, Maximal (· ∈ A) m := by
apply zorn_subset
intro c cA hc
refine ⟨⋃ a ∈ c, a, ⟨?_, ?_⟩, ?_⟩
· simp only [iUnion_subset_iff]
intro a ac x hx
simp only [A, subset_def, mem_setOf_eq] at cA
exact (cA _ ac).1 x hx
· rintro x hx y hy hxy
simp only [mem_iUnion, exists_prop] at hx hy
rcases hx with ⟨a, ac, xa⟩
rcases hy with ⟨b, bc, yb⟩
obtain ⟨m, mc, am, bm⟩ : ∃ m ∈ c, a ⊆ m ∧ b ⊆ m := hc.directedOn _ ac _ bc
exact (cA mc).2 (am xa) (bm yb) hxy
· intro a ac
exact subset_biUnion_of_mem (u := id) ac
obtain ⟨hms : m ⊆ s, hdj : PairwiseDisjoint m (fun x ↦ x • k)⟩ := m_max.prop
have sm : s ⊆ ⋃ x ∈ m, x • (k * k⁻¹) := by
intro y hy
by_cases h'y : m ∪ {y} ∈ A
· have ym : y ∈ m := m_max.mem_of_prop_insert (by simpa using h'y)
have : y ∈ y • (k * k⁻¹) := by
simpa using mem_leftCoset y (Set.mul_mem_mul one_k (Set.inv_mem_inv.mpr one_k))
exact mem_biUnion ym this
· obtain ⟨x, xm, -, z, zy, zx⟩ : ∃ x ∈ m, y ≠ x ∧ ∃ z, z ∈ y • k ∧ z ∈ x • k := by
simpa [A, hms, hy, insert_subset_iff, pairwiseDisjoint_insert, hdj, not_disjoint_iff]
using h'y
have : y ∈ x • (k * k⁻¹) := by
rw [show y = x * ((x⁻¹ * z) * (y⁻¹ * z)⁻¹) by group]
have : (x⁻¹ * z) * (y⁻¹ * z)⁻¹ ∈ k * k⁻¹ := Set.mul_mem_mul ((mem_leftCoset_iff x).mp zx)
(Set.inv_mem_inv.mpr ((mem_leftCoset_iff y).mp zy))
exact mem_leftCoset x this
exact mem_biUnion xm this
rcases eq_empty_or_nonempty m with rfl | hm
· simp only [mem_empty_iff_false, iUnion_of_empty, iUnion_empty, subset_empty_iff] at sm
simp [sm]
by_cases h'm : Set.Countable m
· rcases h'm.exists_eq_range hm with ⟨f, rfl⟩
have M i : MeasurableSet (disjointed (fun n ↦ s ∩ f n • (k * k⁻¹)) i) := by
apply MeasurableSet.disjointed (fun j ↦ hs.inter ?_)
have : IsClosed (k • k⁻¹) := IsClosed.smul_left_of_isCompact k_closed.inv k_comp
exact (IsClosed.smul this (f j)).measurableSet
simp only [mem_range, iUnion_exists, iUnion_iUnion_eq'] at sm
have s_eq : s = ⋃ n, s ∩ (f n • (k * k⁻¹)) := by rwa [← inter_iUnion, eq_comm, inter_eq_left]
have I : μ' s = ∑' n, μ' (disjointed (fun n ↦ s ∩ f n • (k * k⁻¹)) n) := by
rw [← measure_iUnion (disjoint_disjointed _) M, iUnion_disjointed, ← s_eq]
have J : ν s = ∑' n, ν (disjointed (fun n ↦ s ∩ f n • (k * k⁻¹)) n) := by
rw [← measure_iUnion (disjoint_disjointed _) M, iUnion_disjointed, ← s_eq]
rw [I, J]
congr with n
apply measure_isMulInvariant_eq_smul_of_isCompact_closure
have : IsCompact (f n • (k * k⁻¹)) := IsCompact.smul (f n) (k_comp.mul k_comp.inv)
exact this.closure_of_subset <| (disjointed_subset _ _).trans inter_subset_right
· have H : ∀ (ρ : Measure G), IsEverywherePos ρ s → ρ s = ∞ := by
intro ρ hρ
have M : ∀ (i : ↑m), MeasurableSet (s ∩ (i : G) • k) :=
fun i ↦ hs.inter (IsClosed.smul k_closed _).measurableSet
contrapose! h'm
have : ∑' (x : m), ρ (s ∩ ((x : G) • k)) < ∞ := by
apply lt_of_le_of_lt (MeasureTheory.tsum_meas_le_meas_iUnion_of_disjoint _ M _) _
· have I : PairwiseDisjoint m fun x ↦ s ∩ x • k :=
hdj.mono (fun x ↦ inter_subset_right)
exact I.on_injective Subtype.val_injective (fun x ↦ x.2)
· exact lt_of_le_of_lt (measure_mono (by simp [inter_subset_left])) h'm.lt_top
have C : Set.Countable (support fun (i : m) ↦ ρ (s ∩ (i : G) • k)) :=
Summable.countable_support_ennreal this.ne
have : support (fun (i : m) ↦ ρ (s ∩ (i : G) • k)) = univ := by
refine eq_univ_iff_forall.2 fun i ↦ ?_
refine ne_of_gt (hρ (i : G) (hms i.2) _ ?_)
exact inter_mem_nhdsWithin s (by simpa)
rw [this] at C
have : Countable m := countable_univ_iff.mp C
exact to_countable m
have Hν : IsEverywherePos ν s :=
h's.smul_measure_nnreal (haarScalarFactor_pos_of_isHaarMeasure _ _).ne'
have Hμ' : IsEverywherePos μ' s := by
apply Hν.of_forall_exists_nhds_eq (fun x _hx ↦ ?_)
obtain ⟨t, t_comp, t_mem⟩ : ∃ t, IsCompact t ∧ t ∈ 𝓝 x := exists_compact_mem_nhds x
refine ⟨t, t_mem, fun u hu ↦ ?_⟩
apply measure_isMulInvariant_eq_smul_of_isCompact_closure
exact t_comp.closure_of_subset hu
rw [H ν Hν, H μ' Hμ']
/-- **Uniqueness of Haar measures**:
Given two Haar measures, they coincide in the following sense: they give the same value to open
sets, up to the multiplicative constant `haarScalarFactor μ' μ`. -/
@[to_additive measure_isAddHaarMeasure_eq_smul_of_isOpen
/-- **Uniqueness of Haar measures**:
Given two additive Haar measures, they coincide in the following sense: they give the same value to
open sets, up to the multiplicative constant `addHaarScalarFactor μ' μ`. -/]
theorem measure_isHaarMeasure_eq_smul_of_isOpen [LocallyCompactSpace G]
(μ' μ : Measure G) [IsHaarMeasure μ] [IsHaarMeasure μ'] {s : Set G} (hs : IsOpen s) :
μ' s = haarScalarFactor μ' μ • μ s :=
measure_isHaarMeasure_eq_smul_of_isEverywherePos μ' μ hs.measurableSet hs.isEverywherePos
/-!
### Uniqueness of Haar measure under regularity assumptions.
-/
/-- **Uniqueness of left-invariant measures**:
Given two left-invariant measures which are finite on
compacts and inner regular for finite measure sets with respect to compact sets,
they coincide in the following sense: they give the same value to finite measure sets,
up to a multiplicative constant. -/
@[to_additive]
lemma measure_isMulLeftInvariant_eq_smul_of_ne_top [LocallyCompactSpace G]
(μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ']
[InnerRegularCompactLTTop μ] [InnerRegularCompactLTTop μ'] {s : Set G}
(hs : μ s ≠ ∞) (h's : μ' s ≠ ∞) : μ' s = haarScalarFactor μ' μ • μ s := by
/- We know that the measures integrate in the same way continuous compactly supported functions,
up to the factor `c = haarScalarFactor μ' μ`. -/
let c := haarScalarFactor μ' μ
/- By regularity, every measurable set of finite measure may be approximated by compact sets.
Therefore, the measures coincide on measurable sets of finite measure. -/
have B : ∀ s, MeasurableSet s → μ s < ∞ → μ' s < ∞ → μ' s = (c • μ) s := by
intro s s_meas hs h's
have : (c • μ) s ≠ ∞ := by simp [ENNReal.mul_eq_top, hs.ne]
rw [s_meas.measure_eq_iSup_isCompact_of_ne_top h's.ne,
s_meas.measure_eq_iSup_isCompact_of_ne_top this]
congr! 4 with K _Ks K_comp
exact measure_isMulInvariant_eq_smul_of_isCompact_closure μ' μ K_comp.closure
/- Finally, replace an arbitrary finite measure set with a measurable version, and use the
version for measurable sets. -/
let t := toMeasurable μ' s ∩ toMeasurable μ s
have st : s ⊆ t := subset_inter (subset_toMeasurable μ' s) (subset_toMeasurable μ s)
have mu'_t : μ' t = μ' s := by
apply le_antisymm
· exact (measure_mono inter_subset_left).trans (measure_toMeasurable s).le
· exact measure_mono st
have mu_t : μ t = μ s := by
apply le_antisymm
· exact (measure_mono inter_subset_right).trans (measure_toMeasurable s).le
· exact measure_mono st
simp only [← mu'_t, ← mu_t, nnreal_smul_coe_apply]
apply B
· exact (measurableSet_toMeasurable _ _).inter (measurableSet_toMeasurable _ _)
· exact mu_t.le.trans_lt hs.lt_top
· exact mu'_t.le.trans_lt h's.lt_top
/-- **Uniqueness of left-invariant measures**:
Given two left-invariant measures which are finite
on compacts and inner regular, they coincide up to a multiplicative constant. -/
@[to_additive isAddLeftInvariant_eq_smul_of_innerRegular]
lemma isMulLeftInvariant_eq_smul_of_innerRegular [LocallyCompactSpace G]
(μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ']
[InnerRegular μ] [InnerRegular μ'] :
μ' = haarScalarFactor μ' μ • μ := by
ext s hs
rw [hs.measure_eq_iSup_isCompact, hs.measure_eq_iSup_isCompact]
congr! 4 with K _Ks K_comp
exact measure_isMulLeftInvariant_eq_smul_of_ne_top μ' μ K_comp.measure_lt_top.ne
K_comp.measure_lt_top.ne
/-- **Uniqueness of left-invariant measures**:
Given two left-invariant measures which are finite
on compacts and regular, they coincide up to a multiplicative constant. -/
@[to_additive isAddLeftInvariant_eq_smul_of_regular]
lemma isMulLeftInvariant_eq_smul_of_regular [LocallyCompactSpace G]
(μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ']
[Regular μ] [Regular μ'] :
μ' = haarScalarFactor μ' μ • μ := by
have A : ∀ U, IsOpen U → μ' U = (haarScalarFactor μ' μ • μ) U := by
intro U hU
rw [hU.measure_eq_iSup_isCompact, hU.measure_eq_iSup_isCompact]
congr! 4 with K _KU K_comp
exact measure_isMulLeftInvariant_eq_smul_of_ne_top μ' μ K_comp.measure_lt_top.ne
K_comp.measure_lt_top.ne
ext s _hs
rw [s.measure_eq_iInf_isOpen, s.measure_eq_iInf_isOpen]
congr! 4 with U _sU U_open
exact A U U_open
/-- **Uniqueness of left-invariant measures**:
Two Haar measures coincide up to a multiplicative constant in a second countable group. -/
@[to_additive isAddLeftInvariant_eq_smul]
lemma isMulLeftInvariant_eq_smul [LocallyCompactSpace G] [SecondCountableTopology G]
(μ' μ : Measure G) [IsHaarMeasure μ] [IsFiniteMeasureOnCompacts μ'] [IsMulLeftInvariant μ'] :
μ' = haarScalarFactor μ' μ • μ :=
isMulLeftInvariant_eq_smul_of_regular μ' μ
-- one could use as well `isMulLeftInvariant_eq_smul_of_innerRegular`, as in a
-- second countable topological space all Haar measures are regular and inner regular
/-- An invariant σ-finite measure is absolutely continuous with respect to a Haar measure in a
second countable group. -/
@[to_additive
/-- An invariant measure is absolutely continuous with respect to an additive Haar measure. -/]
theorem absolutelyContinuous_isHaarMeasure [LocallyCompactSpace G]
[SecondCountableTopology G] (μ ν : Measure G)
[SigmaFinite μ] [IsMulLeftInvariant μ] [IsHaarMeasure ν] : μ ≪ ν := by
have K : PositiveCompacts G := Classical.arbitrary _
have h : haarMeasure K = (haarScalarFactor (haarMeasure K) ν : ℝ≥0∞) • ν :=
isMulLeftInvariant_eq_smul (haarMeasure K) ν
rw [haarMeasure_unique μ K, h, smul_smul]
exact smul_absolutelyContinuous
/-- A continuous surjective monoid homomorphism of topological groups with compact codomain
is measure preserving, provided that the Haar measures on the domain and on the codomain
have the same total mass.
-/
@[to_additive
/-- A continuous surjective additive monoid homomorphism of topological groups with compact
codomain is measure preserving, provided that the Haar measures on the domain and on the codomain
have the same total mass. -/]
theorem _root_.MonoidHom.measurePreserving
{H : Type*} [Group H] [TopologicalSpace H] [IsTopologicalGroup H] [CompactSpace H]
[MeasurableSpace H] [BorelSpace H]
{μ : Measure G} [IsHaarMeasure μ] {ν : Measure H} [IsHaarMeasure ν]
{f : G →* H} (hcont : Continuous f) (hsurj : Surjective f) (huniv : μ univ = ν univ) :
MeasurePreserving f μ ν where
measurable := hcont.measurable
map_eq := by
have : IsFiniteMeasure μ := ⟨by rw [huniv]; apply measure_lt_top⟩
have : (μ.map f).IsHaarMeasure := isHaarMeasure_map_of_isFiniteMeasure μ f hcont hsurj
set C : ℝ≥0 := haarScalarFactor (μ.map f) ν
have hC : μ.map f = C • ν := isMulLeftInvariant_eq_smul_of_innerRegular _ _
suffices C = 1 by rwa [this, one_smul] at hC
have : C * ν univ = 1 * ν univ := by
rw [one_mul, ← smul_eq_mul, ← ENNReal.smul_def, ← smul_apply, ← hC,
map_apply hcont.measurable .univ, preimage_univ, huniv]
rwa [ENNReal.mul_left_inj (NeZero.ne _) (measure_ne_top _ _), ENNReal.coe_eq_one] at this
end Group
section CommGroup
variable {G : Type*} [CommGroup G] [TopologicalSpace G] [IsTopologicalGroup G]
[MeasurableSpace G] [BorelSpace G] (μ : Measure G) [IsHaarMeasure μ]
/-- Any regular Haar measure is invariant under inversion in an abelian group. -/
@[to_additive
/-- Any regular additive Haar measure is invariant under negation in an abelian group. -/]
instance (priority := 100) IsHaarMeasure.isInvInvariant_of_regular
[LocallyCompactSpace G] [Regular μ] : IsInvInvariant μ := by
-- the image measure is a Haar measure. By uniqueness up to multiplication, it is of the form
-- `c μ`. Applying again inversion, one gets the measure `c^2 μ`. But since inversion is an
-- involution, this is also `μ`. Hence, `c^2 = 1`, which implies `c = 1`.
constructor
let c : ℝ≥0∞ := haarScalarFactor μ.inv μ
have hc : μ.inv = c • μ := isMulLeftInvariant_eq_smul_of_regular μ.inv μ
have : map Inv.inv (map Inv.inv μ) = c ^ 2 • μ := by
rw [← inv_def μ, hc, Measure.map_smul, ← inv_def μ, hc, smul_smul, pow_two]
have μeq : μ = c ^ 2 • μ := by
rw [map_map continuous_inv.measurable continuous_inv.measurable] at this
simpa only [inv_involutive, Involutive.comp_self, Measure.map_id]
have K : PositiveCompacts G := Classical.arbitrary _
have : c ^ 2 * μ K = 1 ^ 2 * μ K := by
conv_rhs => rw [μeq]
simp
have : c ^ 2 = 1 ^ 2 :=
(ENNReal.mul_left_inj (measure_pos_of_nonempty_interior _ K.interior_nonempty).ne'
K.isCompact.measure_lt_top.ne).1 this
have : c = 1 := (ENNReal.pow_right_strictMono two_ne_zero).injective this
rw [hc, this, one_smul]
/-- Any inner regular Haar measure is invariant under inversion in an abelian group. -/
@[to_additive
/-- Any regular additive Haar measure is invariant under negation in an abelian group. -/]
instance (priority := 100) IsHaarMeasure.isInvInvariant_of_innerRegular
[LocallyCompactSpace G] [InnerRegular μ] : IsInvInvariant μ := by
-- the image measure is a Haar measure. By uniqueness up to multiplication, it is of the form
-- `c μ`. Applying again inversion, one gets the measure `c^2 μ`. But since inversion is an
-- involution, this is also `μ`. Hence, `c^2 = 1`, which implies `c = 1`.
constructor
let c : ℝ≥0∞ := haarScalarFactor μ.inv μ
have hc : μ.inv = c • μ := isMulLeftInvariant_eq_smul_of_innerRegular μ.inv μ
have : map Inv.inv (map Inv.inv μ) = c ^ 2 • μ := by
rw [← inv_def μ, hc, Measure.map_smul, ← inv_def μ, hc, smul_smul, pow_two]
have μeq : μ = c ^ 2 • μ := by
rw [map_map continuous_inv.measurable continuous_inv.measurable] at this
simpa only [inv_involutive, Involutive.comp_self, Measure.map_id]
have K : PositiveCompacts G := Classical.arbitrary _
have : c ^ 2 * μ K = 1 ^ 2 * μ K := by
conv_rhs => rw [μeq]
simp
have : c ^ 2 = 1 ^ 2 :=
(ENNReal.mul_left_inj (measure_pos_of_nonempty_interior _ K.interior_nonempty).ne'
K.isCompact.measure_lt_top.ne).1 this
have : c = 1 := (ENNReal.pow_right_strictMono two_ne_zero).injective this
rw [hc, this, one_smul]
@[to_additive]
theorem measurePreserving_zpow [CompactSpace G] [RootableBy G ℤ] {n : ℤ} (hn : n ≠ 0) :
MeasurePreserving (fun g : G => g ^ n) μ μ :=
(zpowGroupHom n).measurePreserving (μ := μ) (continuous_zpow n)
(RootableBy.surjective_pow G ℤ hn) rfl
@[to_additive]
theorem MeasurePreserving.zpow [CompactSpace G] [RootableBy G ℤ]
{n : ℤ} (hn : n ≠ 0) {X : Type*}
[MeasurableSpace X] {μ' : Measure X} {f : X → G} (hf : MeasurePreserving f μ' μ) :
MeasurePreserving (fun x => f x ^ n) μ' μ :=
(measurePreserving_zpow μ hn).comp hf
end CommGroup
section DistribMulAction
variable {G A : Type*} [Group G] [AddCommGroup A] [DistribMulAction G A] [MeasurableSpace A]
[TopologicalSpace A] [BorelSpace A] [IsTopologicalAddGroup A] [LocallyCompactSpace A]
[ContinuousConstSMul G A] {μ ν : Measure A} [μ.IsAddHaarMeasure] [ν.IsAddHaarMeasure] {g : G}
variable (μ ν) in
lemma addHaarScalarFactor_domSMul (g : Gᵈᵐᵃ) :
addHaarScalarFactor (g • μ) (g • ν) = addHaarScalarFactor μ ν := by
obtain ⟨⟨f, f_cont⟩, f_comp, f_nonneg, f_zero⟩ :
∃ f : C(A, ℝ), HasCompactSupport f ∧ 0 ≤ f ∧ f 0 ≠ 0 := exists_continuous_nonneg_pos 0
have int_f_ne_zero : ∫ x, f x ∂g • ν ≠ 0 :=
(f_cont.integral_pos_of_hasCompactSupport_nonneg_nonzero f_comp f_nonneg f_zero).ne'
apply NNReal.coe_injective
rw [addHaarScalarFactor_eq_integral_div (g • μ) (g • ν) f_cont f_comp int_f_ne_zero,
integral_domSMul, integral_domSMul]
refine (addHaarScalarFactor_eq_integral_div _ _ (by fun_prop) ?_ ?_).symm
· exact f_comp.comp_isClosedEmbedding (Homeomorph.smul _).isClosedEmbedding
· rw [← integral_domSMul]
exact (f_cont.integral_pos_of_hasCompactSupport_nonneg_nonzero f_comp f_nonneg f_zero).ne'
variable (μ) in
lemma addHaarScalarFactor_smul_congr (g : Gᵈᵐᵃ) :
addHaarScalarFactor μ (g • μ) = addHaarScalarFactor ν (g • ν) := by
rw [addHaarScalarFactor_eq_mul _ (g • ν), addHaarScalarFactor_domSMul,
mul_comm, ← addHaarScalarFactor_eq_mul]
variable (μ) in
lemma addHaarScalarFactor_smul_congr' (g : Gᵈᵐᵃ) :
addHaarScalarFactor (g • μ) μ = addHaarScalarFactor (g • ν) ν := by
rw [addHaarScalarFactor_eq_mul _ (g • ν), addHaarScalarFactor_domSMul,
mul_comm, ← addHaarScalarFactor_eq_mul]
end DistribMulAction
end Measure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Haar/NormedSpace.lean | import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.MeasureTheory.Integral.Bochner.Set
/-!
# Basic properties of Haar measures on real vector spaces
-/
noncomputable section
open Function Filter Inv MeasureTheory.Measure Module Set TopologicalSpace
open scoped NNReal ENNReal Pointwise Topology
namespace MeasureTheory
namespace Measure
/- The instance `MeasureTheory.Measure.IsAddHaarMeasure.noAtoms` applies in particular to show that
an additive Haar measure on a nontrivial finite-dimensional real vector space has no atom. -/
example {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [Nontrivial E] [FiniteDimensional ℝ E]
[MeasurableSpace E] [BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] : NoAtoms μ := by
infer_instance
section LinearEquiv
variable {𝕜 G H : Type*} [MeasurableSpace G] [MeasurableSpace H] [NontriviallyNormedField 𝕜]
[TopologicalSpace G] [TopologicalSpace H] [AddCommGroup G] [AddCommGroup H]
[IsTopologicalAddGroup G] [IsTopologicalAddGroup H] [Module 𝕜 G] [Module 𝕜 H] (μ : Measure G)
[IsAddHaarMeasure μ] [BorelSpace G] [BorelSpace H]
[CompleteSpace 𝕜] [T2Space G] [FiniteDimensional 𝕜 G] [ContinuousSMul 𝕜 G]
[ContinuousSMul 𝕜 H] [T2Space H]
instance MapLinearEquiv.isAddHaarMeasure (e : G ≃ₗ[𝕜] H) : IsAddHaarMeasure (μ.map e) :=
e.toContinuousLinearEquiv.isAddHaarMeasure_map _
end LinearEquiv
section SeminormedGroup
variable {G H : Type*} [MeasurableSpace G] [Group G] [TopologicalSpace G]
[IsTopologicalGroup G] [BorelSpace G] [LocallyCompactSpace G]
[MeasurableSpace H] [SeminormedGroup H] [OpensMeasurableSpace H]
-- TODO: This could be streamlined by proving that inner regular measures always exist
open Metric Bornology in
@[to_additive]
lemma _root_.MonoidHom.exists_nhds_isBounded (f : G →* H) (hf : Measurable f) (x : G) :
∃ s ∈ 𝓝 x, IsBounded (f '' s) := by
let K : PositiveCompacts G := Classical.arbitrary _
obtain ⟨n, hn⟩ : ∃ n : ℕ, 0 < haar (interior K ∩ f ⁻¹' ball 1 n) := by
by_contra!
simp_rw [nonpos_iff_eq_zero, ← measure_iUnion_null_iff, ← inter_iUnion, ← preimage_iUnion,
iUnion_ball_nat, preimage_univ, inter_univ] at this
exact this.not_gt <| isOpen_interior.measure_pos _ K.interior_nonempty
rw [← one_mul x, ← op_smul_eq_mul]
refine ⟨_, smul_mem_nhds_smul _ <| div_mem_nhds_one_of_haar_pos_ne_top haar _
(isOpen_interior.measurableSet.inter <| hf measurableSet_ball) hn <|
mt (measure_mono_top <| inter_subset_left.trans interior_subset) K.isCompact.measure_ne_top,
?_⟩
have : Bornology.IsBounded (f '' (interior K ∩ f ⁻¹' ball 1 n)) :=
isBounded_ball.subset <| (image_mono inter_subset_right).trans <| image_preimage_subset _ _
rw [image_op_smul_distrib, image_div]
exact (this.div this).smul _
end SeminormedGroup
/-- A Borel-measurable group hom from a locally compact normed group to a real normed space is
continuous. -/
lemma AddMonoidHom.continuous_of_measurable {G H : Type*}
[SeminormedAddCommGroup G] [MeasurableSpace G] [BorelSpace G] [LocallyCompactSpace G]
[SeminormedAddCommGroup H] [MeasurableSpace H] [OpensMeasurableSpace H] [NormedSpace ℝ H]
(f : G →+ H) (hf : Measurable f) : Continuous f :=
let ⟨_s, hs, hbdd⟩ := f.exists_nhds_isBounded hf 0; f.continuous_of_isBounded_nhds_zero hs hbdd
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E]
[FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
/-- The integral of `f (R • x)` with respect to an additive Haar measure is a multiple of the
integral of `f`. The formula we give works even when `f` is not integrable or `R = 0`
thanks to the convention that a non-integrable function has integral zero. -/
theorem integral_comp_smul (f : E → F) (R : ℝ) :
∫ x, f (R • x) ∂μ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by
by_cases hF : CompleteSpace F; swap
· simp [integral, hF]
rcases eq_or_ne R 0 with (rfl | hR)
· simp only [zero_smul, integral_const]
rcases Nat.eq_zero_or_pos (finrank ℝ E) with (hE | hE)
· have : Subsingleton E := finrank_zero_iff.1 hE
have : f = fun _ => f 0 := by ext x; rw [Subsingleton.elim x 0]
conv_rhs => rw [this]
simp only [hE, pow_zero, inv_one, abs_one, one_smul, integral_const]
· have : Nontrivial E := finrank_pos_iff.1 hE
simp [zero_pow hE.ne', measure_univ_of_isAddLeftInvariant, measureReal_def]
· calc
(∫ x, f (R • x) ∂μ) = ∫ y, f y ∂Measure.map (fun x => R • x) μ :=
(integral_map_equiv (Homeomorph.smul (isUnit_iff_ne_zero.2 hR).unit).toMeasurableEquiv
f).symm
_ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by
simp only [map_addHaar_smul μ hR, integral_smul_measure, ENNReal.toReal_ofReal, abs_nonneg]
/-- The integral of `f (R • x)` with respect to an additive Haar measure is a multiple of the
integral of `f`. The formula we give works even when `f` is not integrable or `R = 0`
thanks to the convention that a non-integrable function has integral zero. -/
theorem integral_comp_smul_of_nonneg (f : E → F) (R : ℝ) {hR : 0 ≤ R} :
∫ x, f (R • x) ∂μ = (R ^ finrank ℝ E)⁻¹ • ∫ x, f x ∂μ := by
rw [integral_comp_smul μ f R, abs_of_nonneg (inv_nonneg.2 (pow_nonneg hR _))]
/-- The integral of `f (R⁻¹ • x)` with respect to an additive Haar measure is a multiple of the
integral of `f`. The formula we give works even when `f` is not integrable or `R = 0`
thanks to the convention that a non-integrable function has integral zero. -/
theorem integral_comp_inv_smul (f : E → F) (R : ℝ) :
∫ x, f (R⁻¹ • x) ∂μ = |R ^ finrank ℝ E| • ∫ x, f x ∂μ := by
rw [integral_comp_smul μ f R⁻¹, inv_pow, inv_inv]
/-- The integral of `f (R⁻¹ • x)` with respect to an additive Haar measure is a multiple of the
integral of `f`. The formula we give works even when `f` is not integrable or `R = 0`
thanks to the convention that a non-integrable function has integral zero. -/
theorem integral_comp_inv_smul_of_nonneg (f : E → F) {R : ℝ} (hR : 0 ≤ R) :
∫ x, f (R⁻¹ • x) ∂μ = R ^ finrank ℝ E • ∫ x, f x ∂μ := by
rw [integral_comp_inv_smul μ f R, abs_of_nonneg (pow_nonneg hR _)]
theorem setIntegral_comp_smul (f : E → F) {R : ℝ} (s : Set E) (hR : R ≠ 0) :
∫ x in s, f (R • x) ∂μ = |(R ^ finrank ℝ E)⁻¹| • ∫ x in R • s, f x ∂μ := by
let e : E ≃ᵐ E := (Homeomorph.smul (Units.mk0 R hR)).toMeasurableEquiv
calc
∫ x in s, f (R • x) ∂μ
= ∫ x in e ⁻¹' (e.symm ⁻¹' s), f (e x) ∂μ := by simp [← preimage_comp]; rfl
_ = ∫ y in e.symm ⁻¹' s, f y ∂map (fun x ↦ R • x) μ := (setIntegral_map_equiv _ _ _).symm
_ = |(R ^ finrank ℝ E)⁻¹| • ∫ y in e.symm ⁻¹' s, f y ∂μ := by
simp [map_addHaar_smul μ hR, integral_smul_measure, ENNReal.toReal_ofReal, abs_nonneg]
_ = |(R ^ finrank ℝ E)⁻¹| • ∫ x in R • s, f x ∂μ := by
congr 3
ext y
rw [mem_smul_set_iff_inv_smul_mem₀ hR]
rfl
theorem setIntegral_comp_smul_of_pos (f : E → F) {R : ℝ} (s : Set E) (hR : 0 < R) :
∫ x in s, f (R • x) ∂μ = (R ^ finrank ℝ E)⁻¹ • ∫ x in R • s, f x ∂μ := by
rw [setIntegral_comp_smul μ f s hR.ne', abs_of_nonneg (inv_nonneg.2 (pow_nonneg hR.le _))]
theorem integral_comp_mul_left (g : ℝ → F) (a : ℝ) :
(∫ x : ℝ, g (a * x)) = |a⁻¹| • ∫ y : ℝ, g y := by
simp_rw [← smul_eq_mul, Measure.integral_comp_smul, Module.finrank_self, pow_one]
theorem integral_comp_inv_mul_left (g : ℝ → F) (a : ℝ) :
(∫ x : ℝ, g (a⁻¹ * x)) = |a| • ∫ y : ℝ, g y := by
simp_rw [← smul_eq_mul, Measure.integral_comp_inv_smul, Module.finrank_self, pow_one]
theorem integral_comp_mul_right (g : ℝ → F) (a : ℝ) :
(∫ x : ℝ, g (x * a)) = |a⁻¹| • ∫ y : ℝ, g y := by
simpa only [mul_comm] using integral_comp_mul_left g a
theorem integral_comp_inv_mul_right (g : ℝ → F) (a : ℝ) :
(∫ x : ℝ, g (x * a⁻¹)) = |a| • ∫ y : ℝ, g y := by
simpa only [mul_comm] using integral_comp_inv_mul_left g a
theorem integral_comp_div (g : ℝ → F) (a : ℝ) : (∫ x : ℝ, g (x / a)) = |a| • ∫ y : ℝ, g y :=
integral_comp_inv_mul_right g a
end Measure
variable {F : Type*} [NormedAddCommGroup F]
theorem integrable_comp_smul_iff {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ]
(f : E → F) {R : ℝ} (hR : R ≠ 0) : Integrable (fun x => f (R • x)) μ ↔ Integrable f μ := by
-- reduce to one-way implication
suffices
∀ {g : E → F} (_ : Integrable g μ) {S : ℝ} (_ : S ≠ 0), Integrable (fun x => g (S • x)) μ by
refine ⟨fun hf => ?_, fun hf => this hf hR⟩
convert this hf (inv_ne_zero hR)
rw [← mul_smul, mul_inv_cancel₀ hR, one_smul]
-- now prove
intro g hg S hS
let t := ((Homeomorph.smul (isUnit_iff_ne_zero.2 hS).unit).toMeasurableEquiv : E ≃ᵐ E)
refine (integrable_map_equiv t g).mp (?_ : Integrable g (map (S • ·) μ))
rwa [map_addHaar_smul μ hS, integrable_smul_measure _ ENNReal.ofReal_ne_top]
simpa only [Ne, ENNReal.ofReal_eq_zero, not_le, abs_pos] using inv_ne_zero (pow_ne_zero _ hS)
theorem Integrable.comp_smul {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] {μ : Measure E} [IsAddHaarMeasure μ]
{f : E → F} (hf : Integrable f μ) {R : ℝ} (hR : R ≠ 0) : Integrable (fun x => f (R • x)) μ :=
(integrable_comp_smul_iff μ f hR).2 hf
theorem integrable_comp_mul_left_iff (g : ℝ → F) {R : ℝ} (hR : R ≠ 0) :
(Integrable fun x => g (R * x)) ↔ Integrable g := by
simpa only [smul_eq_mul] using integrable_comp_smul_iff volume g hR
theorem Integrable.comp_mul_left' {g : ℝ → F} (hg : Integrable g) {R : ℝ} (hR : R ≠ 0) :
Integrable fun x => g (R * x) :=
(integrable_comp_mul_left_iff g hR).2 hg
theorem integrable_comp_mul_right_iff (g : ℝ → F) {R : ℝ} (hR : R ≠ 0) :
(Integrable fun x => g (x * R)) ↔ Integrable g := by
simpa only [mul_comm] using integrable_comp_mul_left_iff g hR
theorem Integrable.comp_mul_right' {g : ℝ → F} (hg : Integrable g) {R : ℝ} (hR : R ≠ 0) :
Integrable fun x => g (x * R) :=
(integrable_comp_mul_right_iff g hR).2 hg
theorem integrable_comp_div_iff (g : ℝ → F) {R : ℝ} (hR : R ≠ 0) :
(Integrable fun x => g (x / R)) ↔ Integrable g :=
integrable_comp_mul_right_iff g (inv_ne_zero hR)
theorem Integrable.comp_div {g : ℝ → F} (hg : Integrable g) {R : ℝ} (hR : R ≠ 0) :
Integrable fun x => g (x / R) :=
(integrable_comp_div_iff g hR).2 hg
section InnerProductSpace
variable {E' F' A : Type*}
variable [NormedAddCommGroup E'] [InnerProductSpace ℝ E'] [FiniteDimensional ℝ E']
[MeasurableSpace E'] [BorelSpace E']
variable [NormedAddCommGroup F'] [InnerProductSpace ℝ F'] [FiniteDimensional ℝ F']
[MeasurableSpace F'] [BorelSpace F']
variable (f : E' ≃ₗᵢ[ℝ] F')
variable [NormedAddCommGroup A]
theorem integrable_comp (g : F' → A) : Integrable (g ∘ f) ↔ Integrable g :=
f.measurePreserving.integrable_comp_emb f.toMeasurableEquiv.measurableEmbedding
theorem integral_comp [NormedSpace ℝ A] (g : F' → A) : ∫ (x : E'), g (f x) = ∫ (y : F'), g y :=
f.measurePreserving.integral_comp' (f := f.toMeasurableEquiv) g
end InnerProductSpace
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Haar/OfBasis.lean | import Mathlib.MeasureTheory.Measure.Haar.Basic
import Mathlib.Analysis.InnerProductSpace.PiL2
/-!
# Additive Haar measure constructed from a basis
Given a basis of a finite-dimensional real vector space, we define the corresponding Lebesgue
measure, which gives measure `1` to the parallelepiped spanned by the basis.
## Main definitions
* `parallelepiped v` is the parallelepiped spanned by a finite family of vectors.
* `Basis.parallelepiped` is the parallelepiped associated to a basis, seen as a compact set with
nonempty interior.
* `Basis.addHaar` is the Lebesgue measure associated to a basis, giving measure `1` to the
corresponding parallelepiped.
In particular, we declare a `MeasureSpace` instance on any finite-dimensional inner product space,
by using the Lebesgue measure associated to some orthonormal basis (which is in fact independent
of the basis).
-/
open Set TopologicalSpace MeasureTheory MeasureTheory.Measure Module
open scoped Pointwise
noncomputable section
variable {ι ι' E F : Type*}
section Fintype
variable [Fintype ι] [Fintype ι']
section AddCommGroup
variable [AddCommGroup E] [Module ℝ E] [AddCommGroup F] [Module ℝ F]
/-- The closed parallelepiped spanned by a finite family of vectors. -/
def parallelepiped (v : ι → E) : Set E :=
(fun t : ι → ℝ => ∑ i, t i • v i) '' Icc 0 1
theorem mem_parallelepiped_iff (v : ι → E) (x : E) :
x ∈ parallelepiped v ↔ ∃ t ∈ Icc (0 : ι → ℝ) 1, x = ∑ i, t i • v i := by
simp [parallelepiped, eq_comm]
theorem parallelepiped_basis_eq (b : Basis ι ℝ E) :
parallelepiped b = {x | ∀ i, b.repr x i ∈ Set.Icc 0 1} := by
classical
ext x
simp_rw [mem_parallelepiped_iff, mem_setOf_eq, b.ext_elem_iff, _root_.map_sum,
map_smul, Finset.sum_apply', Basis.repr_self, Finsupp.smul_single, smul_eq_mul,
mul_one, Finsupp.single_apply, Finset.sum_ite_eq', Finset.mem_univ, ite_true, mem_Icc,
Pi.le_def, Pi.zero_apply, Pi.one_apply, ← forall_and]
aesop
theorem image_parallelepiped (f : E →ₗ[ℝ] F) (v : ι → E) :
f '' parallelepiped v = parallelepiped (f ∘ v) := by
simp only [parallelepiped, ← image_comp]
congr 1 with t
simp only [Function.comp_apply, _root_.map_sum, LinearMap.map_smulₛₗ, RingHom.id_apply]
/-- Reindexing a family of vectors does not change their parallelepiped. -/
@[simp]
theorem parallelepiped_comp_equiv (v : ι → E) (e : ι' ≃ ι) :
parallelepiped (v ∘ e) = parallelepiped v := by
simp only [parallelepiped]
let K : (ι' → ℝ) ≃ (ι → ℝ) := Equiv.piCongrLeft' (fun _a : ι' => ℝ) e
have : Icc (0 : ι → ℝ) 1 = K '' Icc (0 : ι' → ℝ) 1 := by
rw [← Equiv.preimage_eq_iff_eq_image]
ext x
simp only [K, mem_preimage, mem_Icc, Pi.le_def, Pi.zero_apply, Equiv.piCongrLeft'_apply,
Pi.one_apply]
refine
⟨fun h => ⟨fun i => ?_, fun i => ?_⟩, fun h =>
⟨fun i => h.1 (e.symm i), fun i => h.2 (e.symm i)⟩⟩
· simpa only [Equiv.symm_apply_apply] using h.1 (e i)
· simpa only [Equiv.symm_apply_apply] using h.2 (e i)
rw [this, ← image_comp]
ext x
have := fun z : ι' → ℝ => e.symm.sum_comp fun i => z i • v (e i)
simp_rw [Equiv.apply_symm_apply] at this
simp_rw [Function.comp_apply, mem_image, mem_Icc, K, Equiv.piCongrLeft'_apply, this]
-- The parallelepiped associated to an orthonormal basis of `ℝ` is either `[0, 1]` or `[-1, 0]`.
theorem parallelepiped_orthonormalBasis_one_dim (b : OrthonormalBasis ι ℝ ℝ) :
parallelepiped b = Icc 0 1 ∨ parallelepiped b = Icc (-1) 0 := by
have e : ι ≃ Fin 1 := by
apply Fintype.equivFinOfCardEq
simp only [← finrank_eq_card_basis b.toBasis, finrank_self]
have B : parallelepiped (b.reindex e) = parallelepiped b := by
convert parallelepiped_comp_equiv b e.symm
ext i
simp only [OrthonormalBasis.coe_reindex]
rw [← B]
let F : ℝ → Fin 1 → ℝ := fun t => fun _i => t
have A : Icc (0 : Fin 1 → ℝ) 1 = F '' Icc (0 : ℝ) 1 := by
apply Subset.antisymm
· intro x hx
refine ⟨x 0, ⟨hx.1 0, hx.2 0⟩, ?_⟩
ext j
simp only [F, Subsingleton.elim j 0]
· rintro x ⟨y, hy, rfl⟩
exact ⟨fun _j => hy.1, fun _j => hy.2⟩
rcases orthonormalBasis_one_dim (b.reindex e) with (H | H)
· left
simp_rw [parallelepiped, H, A, Algebra.id.smul_eq_mul, mul_one]
simp only [F, Finset.univ_unique, Fin.default_eq_zero, Finset.sum_singleton,
← image_comp, Function.comp_apply, image_id']
· right
simp_rw [H, parallelepiped, Algebra.id.smul_eq_mul, A]
simp only [F, Finset.univ_unique, Fin.default_eq_zero, mul_neg, mul_one, Finset.sum_neg_distrib,
Finset.sum_singleton, ← image_comp, Function.comp, image_neg_eq_neg, neg_Icc, neg_zero]
theorem parallelepiped_eq_sum_segment (v : ι → E) : parallelepiped v = ∑ i, segment ℝ 0 (v i) := by
ext
simp only [mem_parallelepiped_iff, Set.mem_finset_sum, Finset.mem_univ, forall_true_left,
segment_eq_image, smul_zero, zero_add, ← Set.pi_univ_Icc, Set.mem_univ_pi]
constructor
· rintro ⟨t, ht, rfl⟩
exact ⟨t • v, fun {i} => ⟨t i, ht _, by simp⟩, rfl⟩
rintro ⟨g, hg, rfl⟩
choose t ht hg using @hg
refine ⟨@t, @ht, ?_⟩
simp_rw [hg]
theorem convex_parallelepiped (v : ι → E) : Convex ℝ (parallelepiped v) := by
rw [parallelepiped_eq_sum_segment]
exact convex_sum _ fun _i _hi => convex_segment _ _
/-- A `parallelepiped` is the convex hull of its vertices -/
theorem parallelepiped_eq_convexHull (v : ι → E) :
parallelepiped v = convexHull ℝ (∑ i, {(0 : E), v i}) := by
simp_rw [convexHull_sum, convexHull_pair, parallelepiped_eq_sum_segment]
/-- The axis aligned parallelepiped over `ι → ℝ` is a cuboid. -/
theorem parallelepiped_single [DecidableEq ι] (a : ι → ℝ) :
(parallelepiped fun i => Pi.single i (a i)) = Set.uIcc 0 a := by
ext x
simp_rw [Set.uIcc, mem_parallelepiped_iff, Set.mem_Icc, Pi.le_def, ← forall_and, Pi.inf_apply,
Pi.sup_apply, ← Pi.single_smul', Pi.one_apply, Pi.zero_apply, ← Pi.smul_apply',
Finset.univ_sum_single (_ : ι → ℝ)]
constructor
· rintro ⟨t, ht, rfl⟩ i
specialize ht i
simp_rw [smul_eq_mul, Pi.mul_apply]
rcases le_total (a i) 0 with hai | hai
· rw [sup_eq_left.mpr hai, inf_eq_right.mpr hai]
exact ⟨le_mul_of_le_one_left hai ht.2, mul_nonpos_of_nonneg_of_nonpos ht.1 hai⟩
· rw [sup_eq_right.mpr hai, inf_eq_left.mpr hai]
exact ⟨mul_nonneg ht.1 hai, mul_le_of_le_one_left hai ht.2⟩
· intro h
refine ⟨fun i => x i / a i, fun i => ?_, funext fun i => ?_⟩
· specialize h i
rcases le_total (a i) 0 with hai | hai
· rw [sup_eq_left.mpr hai, inf_eq_right.mpr hai] at h
exact ⟨div_nonneg_of_nonpos h.2 hai, div_le_one_of_ge h.1 hai⟩
· rw [sup_eq_right.mpr hai, inf_eq_left.mpr hai] at h
exact ⟨div_nonneg h.1 hai, div_le_one_of_le₀ h.2 hai⟩
· specialize h i
simp only [smul_eq_mul, Pi.mul_apply]
rcases eq_or_ne (a i) 0 with hai | hai
· rw [hai, inf_idem, sup_idem, ← le_antisymm_iff] at h
rw [hai, ← h, zero_div, zero_mul]
· rw [div_mul_cancel₀ _ hai]
end AddCommGroup
section NormedSpace
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedSpace ℝ E] [NormedSpace ℝ F]
namespace Module.Basis
/-- The parallelepiped spanned by a basis, as a compact set with nonempty interior. -/
def parallelepiped (b : Basis ι ℝ E) : PositiveCompacts E where
carrier := _root_.parallelepiped b
isCompact' := IsCompact.image isCompact_Icc
(continuous_finset_sum Finset.univ fun (i : ι) (_H : i ∈ Finset.univ) =>
(continuous_apply i).smul continuous_const)
interior_nonempty' := by
suffices H : Set.Nonempty (interior (b.equivFunL.symm.toHomeomorph '' Icc 0 1)) by
dsimp only [_root_.parallelepiped]
convert H
exact (b.equivFun_symm_apply _).symm
have A : Set.Nonempty (interior (Icc (0 : ι → ℝ) 1)) := by
rw [← pi_univ_Icc, interior_pi_set (@finite_univ ι _)]
simp only [univ_pi_nonempty_iff, Pi.zero_apply, Pi.one_apply, interior_Icc, nonempty_Ioo,
zero_lt_one, imp_true_iff]
rwa [← Homeomorph.image_interior, image_nonempty]
@[simp]
theorem coe_parallelepiped (b : Basis ι ℝ E) :
(b.parallelepiped : Set E) = _root_.parallelepiped b := rfl
@[simp]
theorem parallelepiped_reindex (b : Basis ι ℝ E) (e : ι ≃ ι') :
(b.reindex e).parallelepiped = b.parallelepiped :=
PositiveCompacts.ext <|
(congr_arg _root_.parallelepiped (b.coe_reindex e)).trans (parallelepiped_comp_equiv b e.symm)
theorem parallelepiped_map (b : Basis ι ℝ E) (e : E ≃ₗ[ℝ] F) :
(b.map e).parallelepiped = b.parallelepiped.map e
(haveI := b.finiteDimensional_of_finite
LinearMap.continuous_of_finiteDimensional e.toLinearMap)
(haveI := (b.map e).finiteDimensional_of_finite
LinearMap.isOpenMap_of_finiteDimensional _ e.surjective) :=
PositiveCompacts.ext (image_parallelepiped e.toLinearMap _).symm
theorem prod_parallelepiped (v : Basis ι ℝ E) (w : Basis ι' ℝ F) :
(v.prod w).parallelepiped = v.parallelepiped.prod w.parallelepiped := by
ext x
simp only [Basis.coe_parallelepiped, TopologicalSpace.PositiveCompacts.coe_prod, Set.mem_prod,
mem_parallelepiped_iff]
constructor
· intro h
rcases h with ⟨t, ht1, ht2⟩
constructor
· use t ∘ Sum.inl
constructor
· exact ⟨(ht1.1 <| Sum.inl ·), (ht1.2 <| Sum.inl ·)⟩
simp [ht2, Prod.fst_sum]
· use t ∘ Sum.inr
constructor
· exact ⟨(ht1.1 <| Sum.inr ·), (ht1.2 <| Sum.inr ·)⟩
simp [ht2, Prod.snd_sum]
intro h
rcases h with ⟨⟨t, ht1, ht2⟩, ⟨s, hs1, hs2⟩⟩
use Sum.elim t s
constructor
· constructor
· change ∀ x : ι ⊕ ι', 0 ≤ Sum.elim t s x
aesop
· change ∀ x : ι ⊕ ι', Sum.elim t s x ≤ 1
aesop
ext
· simp [ht2, Prod.fst_sum]
· simp [hs2, Prod.snd_sum]
variable [MeasurableSpace E] [BorelSpace E]
/-- The Lebesgue measure associated to a basis, giving measure `1` to the parallelepiped spanned
by the basis. -/
irreducible_def addHaar (b : Basis ι ℝ E) : Measure E :=
Measure.addHaarMeasure b.parallelepiped
instance _root_.isAddHaarMeasure_basis_addHaar (b : Basis ι ℝ E) : IsAddHaarMeasure b.addHaar := by
rw [Basis.addHaar]; exact Measure.isAddHaarMeasure_addHaarMeasure _
instance (b : Basis ι ℝ E) : SigmaFinite b.addHaar := by
have : FiniteDimensional ℝ E := b.finiteDimensional_of_finite
rw [Basis.addHaar_def]; exact sigmaFinite_addHaarMeasure
/-- Let `μ` be a σ-finite left invariant measure on `E`. Then `μ` is equal to the Haar measure
defined by `b` iff the parallelepiped defined by `b` has measure `1` for `μ`. -/
theorem addHaar_eq_iff [SecondCountableTopology E] (b : Basis ι ℝ E) (μ : Measure E)
[SigmaFinite μ] [IsAddLeftInvariant μ] :
b.addHaar = μ ↔ μ b.parallelepiped = 1 := by
rw [Basis.addHaar_def]
exact addHaarMeasure_eq_iff b.parallelepiped μ
@[simp]
theorem addHaar_reindex (b : Basis ι ℝ E) (e : ι ≃ ι') :
(b.reindex e).addHaar = b.addHaar := by
rw [Basis.addHaar, b.parallelepiped_reindex e, ← Basis.addHaar]
theorem addHaar_self (b : Basis ι ℝ E) : b.addHaar (_root_.parallelepiped b) = 1 := by
rw [Basis.addHaar]; exact addHaarMeasure_self
variable [MeasurableSpace F] [BorelSpace F] [SecondCountableTopologyEither E F]
theorem prod_addHaar (v : Basis ι ℝ E) (w : Basis ι' ℝ F) :
(v.prod w).addHaar = v.addHaar.prod w.addHaar := by
have : FiniteDimensional ℝ E := v.finiteDimensional_of_finite
have : FiniteDimensional ℝ F := w.finiteDimensional_of_finite
simp [(v.prod w).addHaar_eq_iff, Basis.prod_parallelepiped, Basis.addHaar_self]
end Module.Basis
end NormedSpace
end Fintype
/-- A finite-dimensional inner product space has a canonical measure, the Lebesgue measure giving
volume `1` to the parallelepiped spanned by any orthonormal basis. We define the measure using
some arbitrary choice of orthonormal basis. The fact that it works with any orthonormal basis
is proved in `orthonormalBasis.volume_parallelepiped`.
This instance creates:
- a potential non-defeq diamond with the natural instance for `MeasureSpace (ULift E)`,
which does not exist in Mathlib at the moment;
- a diamond with the existing instance `MeasureTheory.Measure.instMeasureSpacePUnit`.
However, we've decided not to refactor until one of these diamonds starts creating issues, see
https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Hausdorff.20measure.20normalisation
-/
instance (priority := 100) measureSpaceOfInnerProductSpace [NormedAddCommGroup E]
[InnerProductSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] :
MeasureSpace E where volume := (stdOrthonormalBasis ℝ E).toBasis.addHaar
instance [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E]
[MeasurableSpace E] [BorelSpace E] : IsAddHaarMeasure (volume : Measure E) :=
isAddHaarMeasure_basis_addHaar _
/- This instance should not be necessary, but Lean has difficulties to find it in product
situations if we do not declare it explicitly. -/
instance Real.measureSpace : MeasureSpace ℝ := by infer_instance |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Haar/DistribChar.lean | import Mathlib.MeasureTheory.Measure.Haar.Unique
/-!
# The distributive character of Haar measures
Given a group `G` acting by additive morphisms on a locally compact additive commutative group `A`,
and an element `g : G`, one can pull back the Haar measure `μ` of `A`
along the map `(g • ·) : A → A` to get another Haar measure `μ'` on `A`.
By unicity of Haar measures, there exists some nonnegative real number `r` such that `μ' = r • μ`.
We can thus define a map `distribHaarChar : G → ℝ≥0` sending `g` to its associated real number `r`.
Furthermore, this number doesn't depend on the Haar measure `μ` we started with,
and `distribHaarChar` is a group homomorphism.
## See also
`MeasureTheory.Measure.modularCharacter` for the analogous definition when the action is
multiplicative instead of distributive.
[Zulip](https://leanprover.zulipchat.com/#narrow/channel/217875-Is-there-code-for-X.3F/topic/canonical.20norm.20coming.20from.20Haar.20measure/near/480050592)
-/
open MeasureTheory.Measure
open scoped NNReal Pointwise ENNReal
namespace MeasureTheory
variable {G A : Type*} [Group G] [AddCommGroup A] [DistribMulAction G A] [TopologicalSpace A]
[IsTopologicalAddGroup A] [LocallyCompactSpace A] [ContinuousConstSMul G A] {g : G}
variable (A) in
/-- The distributive Haar character of a group `G` acting distributively on a group `A` is the
unique positive real number `Δ(g)` such that `μ (g • s) = Δ(g) * μ s` for all Haar
measures `μ : Measure A`, set `s : Set A` and `g : G`. -/
@[simps -isSimp]
noncomputable def distribHaarChar : G →* ℝ≥0 :=
letI := borel A
haveI : BorelSpace A := ⟨rfl⟩
{
toFun g := addHaarScalarFactor (DomMulAct.mk g • addHaar) (addHaar (G := A))
map_one' := by simp
map_mul' g g' := by
simp_rw [DomMulAct.mk_mul]
rw [addHaarScalarFactor_eq_mul _ (DomMulAct.mk g' • addHaar (G := A))]
congr 1
simp_rw [mul_smul]
rw [addHaarScalarFactor_domSMul]
}
lemma distribHaarChar_pos : 0 < distribHaarChar A g :=
pos_iff_ne_zero.mpr ((Group.isUnit g).map (distribHaarChar A)).ne_zero
variable [MeasurableSpace A] [BorelSpace A] {μ : Measure A} [μ.IsAddHaarMeasure]
variable (μ) in
lemma addHaarScalarFactor_smul_eq_distribHaarChar (g : G) :
addHaarScalarFactor (DomMulAct.mk g • μ) μ = distribHaarChar A g := by
borelize A
exact addHaarScalarFactor_smul_congr' ..
variable (μ) in
lemma addHaarScalarFactor_smul_inv_eq_distribHaarChar (g : G) :
addHaarScalarFactor μ ((DomMulAct.mk g)⁻¹ • μ) = distribHaarChar A g := by
rw [← addHaarScalarFactor_domSMul _ _ (DomMulAct.mk g)]
simp_rw [← mul_smul, mul_inv_cancel, one_smul]
exact addHaarScalarFactor_smul_eq_distribHaarChar ..
variable (μ) in
lemma addHaarScalarFactor_smul_eq_distribHaarChar_inv (g : G) :
addHaarScalarFactor μ (DomMulAct.mk g • μ) = (distribHaarChar A g)⁻¹ := by
rw [← map_inv, ← addHaarScalarFactor_smul_inv_eq_distribHaarChar μ, DomMulAct.mk_inv, inv_inv]
variable [Regular μ] {s : Set A}
variable (μ) in
lemma distribHaarChar_mul (g : G) (s : Set A) : distribHaarChar A g * μ s = μ (g • s) := by
have : (DomMulAct.mk g • μ) s = μ (g • s) := by simp [domSMul_apply]
rw [eq_comm, ← nnreal_smul_coe_apply, ← addHaarScalarFactor_smul_eq_distribHaarChar μ,
← this, ← smul_apply, ← isAddLeftInvariant_eq_smul_of_regular]
lemma distribHaarChar_eq_div (hs₀ : μ s ≠ 0) (hs : μ s ≠ ∞) (g : G) :
distribHaarChar A g = μ (g • s) / μ s := by
rw [← distribHaarChar_mul, ENNReal.mul_div_cancel_right] <;> simp [*]
lemma distribHaarChar_eq_of_measure_smul_eq_mul (hs₀ : μ s ≠ 0) (hs : μ s ≠ ∞) {r : ℝ≥0}
(hμgs : μ (g • s) = r * μ s) : distribHaarChar A g = r := by
refine ENNReal.coe_injective ?_
rw [distribHaarChar_eq_div hs₀ hs, hμgs, ENNReal.mul_div_cancel_right] <;> simp [*]
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Haar/Disintegration.lean | import Mathlib.MeasureTheory.Measure.Haar.Basic
import Mathlib.Analysis.Normed.Module.FiniteDimension
import Mathlib.MeasureTheory.Measure.Haar.Unique
/-!
# Pushing a Haar measure by a linear map
We show that the push-forward of an additive Haar measure in a vector space under a surjective
linear map is proportional to the Haar measure on the target space,
in `LinearMap.exists_map_addHaar_eq_smul_addHaar`.
We deduce disintegration properties of the Haar measure: to check that a property is true ae,
it suffices to check that it is true ae along all translates of a given vector subspace.
See `MeasureTheory.ae_mem_of_ae_add_linearMap_mem`.
TODO: this holds more generally in any locally compact group, see
[Fremlin, *Measure Theory* (volume 4, 443Q)][fremlin_vol4]
-/
open MeasureTheory Measure Set
open scoped ENNReal
variable {𝕜 E F : Type*}
[NontriviallyNormedField 𝕜] [CompleteSpace 𝕜]
[NormedAddCommGroup E] [MeasurableSpace E] [BorelSpace E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [MeasurableSpace F] [BorelSpace F] [NormedSpace 𝕜 F] {L : E →ₗ[𝕜] F}
{μ : Measure E} {ν : Measure F}
[IsAddHaarMeasure μ] [IsAddHaarMeasure ν]
variable [LocallyCompactSpace E]
variable (L μ ν)
/-- The image of an additive Haar measure under a surjective linear map is proportional to a given
additive Haar measure. The proportionality factor will be infinite if the linear map has a
nontrivial kernel. -/
theorem LinearMap.exists_map_addHaar_eq_smul_addHaar' (h : Function.Surjective L) :
∃ (c : ℝ≥0∞), 0 < c ∧ c < ∞ ∧ μ.map L = (c * addHaar (univ : Set (LinearMap.ker L))) • ν := by
/- This is true for the second projection in product spaces, as the projection of the Haar
measure `μS.prod μT` is equal to the Haar measure `μT` multiplied by the total mass of `μS`. This
is also true for linear equivalences, as they map Haar measure to Haar measure. The general case
follows from these two and linear algebra, as `L` can be interpreted as the composition of the
projection `P` on a complement `T` to its kernel `S`, together with a linear equivalence. -/
have : FiniteDimensional 𝕜 E := .of_locallyCompactSpace 𝕜
have : ProperSpace F := by
rcases subsingleton_or_nontrivial E with hE|hE
· have : Subsingleton F := Function.Surjective.subsingleton h
infer_instance
· have : ProperSpace 𝕜 := .of_locallyCompact_module 𝕜 E
have : FiniteDimensional 𝕜 F := Module.Finite.of_surjective L h
exact FiniteDimensional.proper 𝕜 F
let S : Submodule 𝕜 E := LinearMap.ker L
obtain ⟨T, hT⟩ : ∃ T : Submodule 𝕜 E, IsCompl S T := Submodule.exists_isCompl S
let M : (S × T) ≃ₗ[𝕜] E := Submodule.prodEquivOfIsCompl S T hT
have M_cont : Continuous M.symm := LinearMap.continuous_of_finiteDimensional _
let P : S × T →ₗ[𝕜] T := LinearMap.snd 𝕜 S T
have P_cont : Continuous P := LinearMap.continuous_of_finiteDimensional _
have I : Function.Bijective (LinearMap.domRestrict L T) :=
⟨LinearMap.injective_domRestrict_iff.2 (IsCompl.inf_eq_bot hT.symm),
(LinearMap.surjective_domRestrict_iff h).2 hT.symm.sup_eq_top⟩
let L' : T ≃ₗ[𝕜] F := LinearEquiv.ofBijective (LinearMap.domRestrict L T) I
have L'_cont : Continuous L' := LinearMap.continuous_of_finiteDimensional _
have A : L = (L' : T →ₗ[𝕜] F).comp (P.comp (M.symm : E →ₗ[𝕜] (S × T))) := by
ext x
obtain ⟨y, z, hyz⟩ : ∃ (y : S) (z : T), M.symm x = (y, z) := ⟨_, _, rfl⟩
have : x = M (y, z) := by
rw [← hyz]; simp only [LinearEquiv.apply_symm_apply]
simp [L', P, M, this]
have I : μ.map L = ((μ.map M.symm).map P).map L' := by
rw [Measure.map_map, Measure.map_map, A]
· rfl
· exact L'_cont.measurable.comp P_cont.measurable
· exact M_cont.measurable
· exact L'_cont.measurable
· exact P_cont.measurable
let μS : Measure S := addHaar
let μT : Measure T := addHaar
obtain ⟨c₀, c₀_pos, c₀_fin, h₀⟩ :
∃ c₀ : ℝ≥0∞, c₀ ≠ 0 ∧ c₀ ≠ ∞ ∧ μ.map M.symm = c₀ • μS.prod μT := by
have : IsAddHaarMeasure (μ.map M.symm) :=
M.toContinuousLinearEquiv.symm.isAddHaarMeasure_map μ
refine ⟨addHaarScalarFactor (μ.map M.symm) (μS.prod μT), ?_, ENNReal.coe_ne_top,
isAddLeftInvariant_eq_smul _ _⟩
simpa only [ne_eq, ENNReal.coe_eq_zero] using
(addHaarScalarFactor_pos_of_isAddHaarMeasure (μ.map M.symm) (μS.prod μT)).ne'
have J : (μS.prod μT).map P = (μS univ) • μT := map_snd_prod
obtain ⟨c₁, c₁_pos, c₁_fin, h₁⟩ : ∃ c₁ : ℝ≥0∞, c₁ ≠ 0 ∧ c₁ ≠ ∞ ∧ μT.map L' = c₁ • ν := by
have : IsAddHaarMeasure (μT.map L') :=
L'.toContinuousLinearEquiv.isAddHaarMeasure_map μT
refine ⟨addHaarScalarFactor (μT.map L') ν, ?_, ENNReal.coe_ne_top,
isAddLeftInvariant_eq_smul _ _⟩
simpa only [ne_eq, ENNReal.coe_eq_zero] using
(addHaarScalarFactor_pos_of_isAddHaarMeasure (μT.map L') ν).ne'
refine ⟨c₀ * c₁, by simp [pos_iff_ne_zero, c₀_pos, c₁_pos],
ENNReal.mul_lt_top c₀_fin.lt_top c₁_fin.lt_top, ?_⟩
simp only [I, h₀, Measure.map_smul, J, smul_smul, h₁]
rw [mul_assoc, mul_comm _ c₁, ← mul_assoc]
/-- The image of an additive Haar measure under a surjective linear map is proportional to a given
additive Haar measure, with a positive (but maybe infinite) factor. -/
theorem LinearMap.exists_map_addHaar_eq_smul_addHaar (h : Function.Surjective L) :
∃ (c : ℝ≥0∞), 0 < c ∧ μ.map L = c • ν := by
rcases L.exists_map_addHaar_eq_smul_addHaar' μ ν h with ⟨c, c_pos, -, hc⟩
exact ⟨_, by simp [c_pos, NeZero.ne addHaar], hc⟩
namespace MeasureTheory
/-- Given a surjective linear map `L`, it is equivalent to require a property almost everywhere
in the source or the target spaces of `L`, with respect to additive Haar measures there. -/
lemma ae_comp_linearMap_mem_iff (h : Function.Surjective L) {s : Set F} (hs : MeasurableSet s) :
(∀ᵐ x ∂μ, L x ∈ s) ↔ ∀ᵐ y ∂ν, y ∈ s := by
have : FiniteDimensional 𝕜 E := .of_locallyCompactSpace 𝕜
have : AEMeasurable L μ := L.continuous_of_finiteDimensional.aemeasurable
apply (ae_map_iff this hs).symm.trans
rcases L.exists_map_addHaar_eq_smul_addHaar μ ν h with ⟨c, c_pos, hc⟩
rw [hc]
exact ae_smul_measure_iff c_pos.ne'
/-- Given a linear map `L : E → F`, a property holds almost everywhere in `F` if and only if,
almost everywhere in `F`, it holds almost everywhere along the subspace spanned by the
image of `L`. This is an instance of a disintegration argument for additive Haar measures. -/
lemma ae_ae_add_linearMap_mem_iff [LocallyCompactSpace F] {s : Set F} (hs : MeasurableSet s) :
(∀ᵐ y ∂ν, ∀ᵐ x ∂μ, y + L x ∈ s) ↔ ∀ᵐ y ∂ν, y ∈ s := by
have : FiniteDimensional 𝕜 E := .of_locallyCompactSpace 𝕜
have : FiniteDimensional 𝕜 F := .of_locallyCompactSpace 𝕜
have : ProperSpace E := .of_locallyCompactSpace 𝕜
have : ProperSpace F := .of_locallyCompactSpace 𝕜
let M : F × E →ₗ[𝕜] F := LinearMap.id.coprod L
have M_cont : Continuous M := M.continuous_of_finiteDimensional
-- Note: https://github.com/leanprover-community/mathlib4/pull/8386 had to change `range_eq_top` into
-- `range_eq_top (f := _)`
have hM : Function.Surjective M := by
simp [M, ← LinearMap.range_eq_top (f := _), LinearMap.range_coprod]
have A : ∀ x, M x ∈ s ↔ x ∈ M ⁻¹' s := fun x ↦ Iff.rfl
simp_rw [← ae_comp_linearMap_mem_iff M (ν.prod μ) ν hM hs, A]
rw [Measure.ae_prod_mem_iff_ae_ae_mem]
· simp only [M, mem_preimage, LinearMap.coprod_apply, LinearMap.id_coe, id_eq]
· exact M_cont.measurable hs
/-- To check that a property holds almost everywhere with respect to an additive Haar measure, it
suffices to check it almost everywhere along all translates of a given vector subspace. This is an
instance of a disintegration argument for additive Haar measures. -/
lemma ae_mem_of_ae_add_linearMap_mem [LocallyCompactSpace F] {s : Set F} (hs : MeasurableSet s)
(h : ∀ y, ∀ᵐ x ∂μ, y + L x ∈ s) : ∀ᵐ y ∂ν, y ∈ s :=
(ae_ae_add_linearMap_mem_iff L μ ν hs).1 (Filter.Eventually.of_forall h)
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Haar/InnerProductSpace.lean | import Mathlib.Analysis.InnerProductSpace.Orientation
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.Analysis.Normed.Lp.MeasurableSpace
/-!
# Volume forms and measures on inner product spaces
A volume form induces a Lebesgue measure on general finite-dimensional real vector spaces. In this
file, we discuss the specific situation of inner product spaces, where an orientation gives
rise to a canonical volume form. We show that the measure coming from this volume form gives
measure `1` to the parallelepiped spanned by any orthonormal basis, and that it coincides with
the canonical `volume` from the `MeasureSpace` instance.
-/
open Module MeasureTheory MeasureTheory.Measure Set WithLp
variable {ι E F : Type*}
variable [NormedAddCommGroup F] [InnerProductSpace ℝ F]
[NormedAddCommGroup E] [InnerProductSpace ℝ E]
[MeasurableSpace E] [BorelSpace E] [MeasurableSpace F] [BorelSpace F]
namespace LinearIsometryEquiv
variable (f : E ≃ₗᵢ[ℝ] F)
/-- Every linear isometry equivalence is a measurable equivalence. -/
def toMeasurableEquiv : E ≃ᵐ F where
toEquiv := f
measurable_toFun := f.continuous.measurable
measurable_invFun := f.symm.continuous.measurable
@[simp] theorem coe_toMeasurableEquiv : (f.toMeasurableEquiv : E → F) = f := rfl
@[simp] theorem toMeasurableEquiv_symm : f.symm.toMeasurableEquiv = f.toMeasurableEquiv.symm := rfl
@[simp] lemma coe_symm_toMeasurableEquiv : ⇑f.toMeasurableEquiv.symm = f.symm := rfl
end LinearIsometryEquiv
variable [Fintype ι]
variable [FiniteDimensional ℝ E] [FiniteDimensional ℝ F]
section
variable {m n : ℕ} [_i : Fact (finrank ℝ F = n)]
/-- The volume form coming from an orientation in an inner product space gives measure `1` to the
parallelepiped associated to any orthonormal basis. This is a rephrasing of
`abs_volumeForm_apply_of_orthonormal` in terms of measures. -/
theorem Orientation.measure_orthonormalBasis (o : Orientation ℝ F (Fin n))
(b : OrthonormalBasis ι ℝ F) : o.volumeForm.measure (parallelepiped b) = 1 := by
have e : ι ≃ Fin n := by
refine Fintype.equivFinOfCardEq ?_
rw [← _i.out, finrank_eq_card_basis b.toBasis]
have A : ⇑b = b.reindex e ∘ e := by
ext x
simp only [OrthonormalBasis.coe_reindex, Function.comp_apply, Equiv.symm_apply_apply]
rw [A, parallelepiped_comp_equiv, AlternatingMap.measure_parallelepiped,
o.abs_volumeForm_apply_of_orthonormal, ENNReal.ofReal_one]
/-- In an oriented inner product space, the measure coming from the canonical volume form
associated to an orientation coincides with the volume. -/
theorem Orientation.measure_eq_volume (o : Orientation ℝ F (Fin n)) :
o.volumeForm.measure = volume := by
have A : o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped = 1 :=
Orientation.measure_orthonormalBasis o (stdOrthonormalBasis ℝ F)
rw [addHaarMeasure_unique o.volumeForm.measure
(stdOrthonormalBasis ℝ F).toBasis.parallelepiped, A, one_smul]
simp only [volume, Basis.addHaar]
end
/-- The volume measure in a finite-dimensional inner product space gives measure `1` to the
parallelepiped spanned by any orthonormal basis. -/
theorem OrthonormalBasis.volume_parallelepiped (b : OrthonormalBasis ι ℝ F) :
volume (parallelepiped b) = 1 := by
haveI : Fact (finrank ℝ F = finrank ℝ F) := ⟨rfl⟩
let o := (stdOrthonormalBasis ℝ F).toBasis.orientation
rw [← o.measure_eq_volume]
exact o.measure_orthonormalBasis b
/-- The Haar measure defined by any orthonormal basis of a finite-dimensional inner product space
is equal to its volume measure. -/
theorem OrthonormalBasis.addHaar_eq_volume {ι F : Type*} [Fintype ι] [NormedAddCommGroup F]
[InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F]
(b : OrthonormalBasis ι ℝ F) :
b.toBasis.addHaar = volume := by
rw [Basis.addHaar_eq_iff]
exact b.volume_parallelepiped
/-- An orthonormal basis of a finite-dimensional inner product space defines a measurable
equivalence between the space and the Euclidean space of the same dimension. -/
noncomputable def OrthonormalBasis.measurableEquiv (b : OrthonormalBasis ι ℝ F) :
F ≃ᵐ EuclideanSpace ℝ ι := b.repr.toHomeomorph.toMeasurableEquiv
/-- The measurable equivalence defined by an orthonormal basis is volume preserving. -/
theorem OrthonormalBasis.measurePreserving_measurableEquiv (b : OrthonormalBasis ι ℝ F) :
MeasurePreserving b.measurableEquiv volume volume := by
convert (b.measurableEquiv.symm.measurable.measurePreserving _).symm
rw [← (EuclideanSpace.basisFun ι ℝ).addHaar_eq_volume]
erw [MeasurableEquiv.coe_toEquiv_symm, Basis.map_addHaar _ b.repr.symm.toContinuousLinearEquiv]
exact b.addHaar_eq_volume.symm
theorem OrthonormalBasis.measurePreserving_repr (b : OrthonormalBasis ι ℝ F) :
MeasurePreserving b.repr volume volume := b.measurePreserving_measurableEquiv
theorem OrthonormalBasis.measurePreserving_repr_symm (b : OrthonormalBasis ι ℝ F) :
MeasurePreserving b.repr.symm volume volume := b.measurePreserving_measurableEquiv.symm
section PiLp
variable (ι : Type*)
/-- `WithLp.equiv` as a `MeasurableEquiv`. -/
@[deprecated MeasurableEquiv.toLp (since := "2025-11-02")]
protected def EuclideanSpace.measurableEquiv : EuclideanSpace ℝ ι ≃ᵐ (ι → ℝ) :=
(MeasurableEquiv.toLp 2 (ι → ℝ)).symm
set_option linter.deprecated false in
@[deprecated MeasurableEquiv.coe_toLp (since := "2025-11-02")]
theorem EuclideanSpace.measurableEquiv_toEquiv :
(EuclideanSpace.measurableEquiv ι).toEquiv = WithLp.equiv 2 (ι → ℝ) := rfl
set_option linter.deprecated false in
@[deprecated MeasurableEquiv.coe_toLp (since := "2025-11-02")]
theorem EuclideanSpace.coe_measurableEquiv :
⇑(EuclideanSpace.measurableEquiv ι) = ofLp := rfl
set_option linter.deprecated false in
@[deprecated MeasurableEquiv.coe_toLp_symm (since := "2025-11-02")]
theorem EuclideanSpace.coe_measurableEquiv_symm :
⇑(EuclideanSpace.measurableEquiv ι).symm = toLp 2 := rfl
variable [Fintype ι]
/-- The measure equivalence between `EuclideanSpace ℝ ι` and `ι → ℝ` is volume preserving. -/
theorem EuclideanSpace.volume_preserving_symm_measurableEquiv_toLp :
MeasurePreserving (MeasurableEquiv.toLp 2 (ι → ℝ)).symm := by
suffices volume = map (MeasurableEquiv.toLp 2 (ι → ℝ)) volume by
convert ((MeasurableEquiv.toLp 2 (ι → ℝ)).measurable.measurePreserving _).symm
rw [← addHaarMeasure_eq_volume_pi, ← Basis.parallelepiped_basisFun, ← Basis.addHaar_def,
MeasurableEquiv.coe_toLp, ← PiLp.continuousLinearEquiv_symm_apply 2 ℝ, Basis.map_addHaar]
exact (EuclideanSpace.basisFun _ _).addHaar_eq_volume.symm
@[deprecated (since := "2025-07-26")] alias EuclideanSpace.volume_preserving_measurableEquiv :=
EuclideanSpace.volume_preserving_symm_measurableEquiv_toLp
/-- A copy of `EuclideanSpace.volume_preserving_symm_measurableEquiv_toLp`
for the canonical spelling of the equivalence. -/
theorem PiLp.volume_preserving_ofLp : MeasurePreserving (@ofLp 2 (ι → ℝ)) :=
EuclideanSpace.volume_preserving_symm_measurableEquiv_toLp ι
/-- The reverse direction of `EuclideanSpace.volume_preserving_symm_measurableEquiv_toLp`, since
`MeasurePreserving.symm` only works for `MeasurableEquiv`s. -/
theorem PiLp.volume_preserving_toLp : MeasurePreserving (@toLp 2 (ι → ℝ)) :=
(EuclideanSpace.volume_preserving_symm_measurableEquiv_toLp ι).symm
lemma volume_euclideanSpace_eq_dirac [IsEmpty ι] :
(volume : Measure (EuclideanSpace ℝ ι)) = Measure.dirac 0 := by
rw [← (PiLp.volume_preserving_toLp ι).map_eq, volume_pi_eq_dirac 0,
map_dirac (measurable_toLp 2 _), toLp_zero]
end PiLp
namespace LinearIsometryEquiv
/-- Every linear isometry on a real finite-dimensional Hilbert space is measure-preserving. -/
theorem measurePreserving (f : E ≃ₗᵢ[ℝ] F) :
MeasurePreserving f := by
refine ⟨f.continuous.measurable, ?_⟩
rcases exists_orthonormalBasis ℝ E with ⟨w, b, _hw⟩
erw [← OrthonormalBasis.addHaar_eq_volume b, ← OrthonormalBasis.addHaar_eq_volume (b.map f),
Basis.map_addHaar _ f.toContinuousLinearEquiv]
congr
end LinearIsometryEquiv |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Lebesgue/Integral.lean | import Mathlib.MeasureTheory.Integral.Bochner.Set
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
import Mathlib.MeasureTheory.Measure.Haar.Unique
/-! # Properties of integration with respect to the Lebesgue measure -/
open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
section regionBetween
variable {α : Type*}
variable [MeasurableSpace α] {μ : Measure α} {f g : α → ℝ} {s : Set α}
theorem volume_regionBetween_eq_integral' [SigmaFinite μ] (f_int : IntegrableOn f s μ)
(g_int : IntegrableOn g s μ) (hs : MeasurableSet s) (hfg : f ≤ᵐ[μ.restrict s] g) :
μ.prod volume (regionBetween f g s) = ENNReal.ofReal (∫ y in s, (g - f) y ∂μ) := by
have h : g - f =ᵐ[μ.restrict s] fun x => Real.toNNReal (g x - f x) :=
hfg.mono fun x hx => (Real.coe_toNNReal _ <| sub_nonneg.2 hx).symm
rw [volume_regionBetween_eq_lintegral f_int.aemeasurable g_int.aemeasurable hs,
integral_congr_ae h, lintegral_congr_ae,
lintegral_coe_eq_integral _ ((integrable_congr h).mp (g_int.sub f_int))]
dsimp only
rfl
/-- If two functions are integrable on a measurable set, and one function is less than
or equal to the other on that set, then the volume of the region
between the two functions can be represented as an integral. -/
theorem volume_regionBetween_eq_integral [SigmaFinite μ] (f_int : IntegrableOn f s μ)
(g_int : IntegrableOn g s μ) (hs : MeasurableSet s) (hfg : ∀ x ∈ s, f x ≤ g x) :
μ.prod volume (regionBetween f g s) = ENNReal.ofReal (∫ y in s, (g - f) y ∂μ) :=
volume_regionBetween_eq_integral' f_int g_int hs
((ae_restrict_iff' hs).mpr (Eventually.of_forall hfg))
end regionBetween
section SummableNormIcc
open ContinuousMap
/- The following lemma is a minor variation on `integrable_of_summable_norm_restrict` in
`Mathlib/MeasureTheory/Integral/SetIntegral.lean`, but it is placed here because it needs to know
that `Icc a b` has volume `b - a`. -/
/-- If the sequence with `n`-th term the sup norm of `fun x ↦ f (x + n)` on the interval `Icc 0 1`,
for `n ∈ ℤ`, is summable, then `f` is integrable on `ℝ`. -/
theorem Real.integrable_of_summable_norm_Icc {E : Type*} [NormedAddCommGroup E] {f : C(ℝ, E)}
(hf : Summable fun n : ℤ => ‖(f.comp <| ContinuousMap.addRight n).restrict (Icc 0 1)‖) :
Integrable f := by
refine integrable_of_summable_norm_restrict (.of_nonneg_of_le
(fun n : ℤ => mul_nonneg (norm_nonneg
(f.restrict (⟨Icc (n : ℝ) ((n : ℝ) + 1), isCompact_Icc⟩ : Compacts ℝ)))
ENNReal.toReal_nonneg) (fun n => ?_) hf) ?_
· simp only [Compacts.coe_mk, le_add_iff_nonneg_right, zero_le_one, volume_real_Icc_of_le,
add_sub_cancel_left, mul_one, norm_le _ (norm_nonneg _), ContinuousMap.restrict_apply]
intro x
have := ((f.comp <| ContinuousMap.addRight n).restrict (Icc 0 1)).norm_coe_le_norm
⟨x - n, ⟨sub_nonneg.mpr x.2.1, sub_le_iff_le_add'.mpr x.2.2⟩⟩
simpa only [ContinuousMap.restrict_apply, comp_apply, coe_addRight, Subtype.coe_mk,
sub_add_cancel] using this
· exact iUnion_Icc_intCast ℝ
end SummableNormIcc
/-!
### Substituting `-x` for `x`
These lemmas are stated in terms of either `Iic` or `Ioi` (neglecting `Iio` and `Ici`) to match
mathlib's conventions for integrals over finite intervals (see `intervalIntegral`). For the case
of finite integrals, see `intervalIntegral.integral_comp_neg`.
-/
@[simp]
theorem integral_comp_neg_Iic {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
(c : ℝ) (f : ℝ → E) : (∫ x in Iic c, f (-x)) = ∫ x in Ioi (-c), f x := by
have A : MeasurableEmbedding fun x : ℝ => -x :=
(Homeomorph.neg ℝ).isClosedEmbedding.measurableEmbedding
have := MeasurableEmbedding.setIntegral_map (μ := volume) A f (Ici (-c))
rw [Measure.map_neg_eq_self (volume : Measure ℝ)] at this
simp_rw [← integral_Ici_eq_integral_Ioi, this, neg_preimage, neg_Ici, neg_neg]
@[simp]
theorem integral_comp_neg_Ioi {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
(c : ℝ) (f : ℝ → E) : (∫ x in Ioi c, f (-x)) = ∫ x in Iic (-c), f x := by
rw [← neg_neg c, ← integral_comp_neg_Iic]
simp only [neg_neg]
theorem integral_comp_abs {f : ℝ → ℝ} :
∫ x, f |x| = 2 * ∫ x in Ioi (0 : ℝ), f x := by
have eq : ∫ (x : ℝ) in Ioi 0, f |x| = ∫ (x : ℝ) in Ioi 0, f x := by
refine setIntegral_congr_fun measurableSet_Ioi (fun _ hx => ?_)
rw [abs_eq_self.mpr (le_of_lt (by exact hx))]
by_cases hf : IntegrableOn (fun x => f |x|) (Ioi 0)
· have int_Iic : IntegrableOn (fun x ↦ f |x|) (Iic 0) := by
rw [← Measure.map_neg_eq_self (volume : Measure ℝ)]
let m : MeasurableEmbedding fun x : ℝ => -x := (Homeomorph.neg ℝ).measurableEmbedding
rw [m.integrableOn_map_iff]
simp_rw [Function.comp_def, abs_neg, neg_preimage, neg_Iic, neg_zero]
exact Iff.mpr integrableOn_Ici_iff_integrableOn_Ioi hf
calc
_ = (∫ x in Iic 0, f |x|) + ∫ x in Ioi 0, f |x| := by
rw [← setIntegral_union (Iic_disjoint_Ioi le_rfl) measurableSet_Ioi int_Iic hf,
Iic_union_Ioi, restrict_univ]
_ = 2 * ∫ x in Ioi 0, f x := by
rw [two_mul, eq]
congr! 1
rw [← neg_zero, ← integral_comp_neg_Iic, neg_zero]
refine setIntegral_congr_fun measurableSet_Iic (fun _ hx => ?_)
rw [abs_eq_neg_self.mpr (by exact hx)]
· have : ¬ Integrable (fun x => f |x|) := by
contrapose! hf
exact hf.integrableOn
rw [← eq, integral_undef hf, integral_undef this, mul_zero] |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Lebesgue/EqHaar.lean | import Mathlib.LinearAlgebra.FiniteDimensional.Lemmas
import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric
import Mathlib.MeasureTheory.Group.Pointwise
import Mathlib.MeasureTheory.Measure.Doubling
import Mathlib.MeasureTheory.Measure.Haar.Basic
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
/-!
# Relationship between the Haar and Lebesgue measures
We prove that the Haar measure and Lebesgue measure are equal on `ℝ` and on `ℝ^ι`, in
`MeasureTheory.addHaarMeasure_eq_volume` and `MeasureTheory.addHaarMeasure_eq_volume_pi`.
We deduce basic properties of any Haar measure on a finite-dimensional real vector space:
* `map_linearMap_addHaar_eq_smul_addHaar`: a linear map rescales the Haar measure by the
absolute value of its determinant.
* `addHaar_preimage_linearMap` : when `f` is a linear map with nonzero determinant, the measure
of `f ⁻¹' s` is the measure of `s` multiplied by the absolute value of the inverse of the
determinant of `f`.
* `addHaar_image_linearMap` : when `f` is a linear map, the measure of `f '' s` is the
measure of `s` multiplied by the absolute value of the determinant of `f`.
* `addHaar_submodule` : a strict submodule has measure `0`.
* `addHaar_smul` : the measure of `r • s` is `|r| ^ dim * μ s`.
* `addHaar_ball`: the measure of `ball x r` is `r ^ dim * μ (ball 0 1)`.
* `addHaar_closedBall`: the measure of `closedBall x r` is `r ^ dim * μ (ball 0 1)`.
* `addHaar_sphere`: spheres have zero measure.
This makes it possible to associate a Lebesgue measure to an `n`-alternating map in dimension `n`.
This measure is called `AlternatingMap.measure`. Its main property is
`ω.measure_parallelepiped v`, stating that the associated measure of the parallelepiped spanned
by vectors `v₁, ..., vₙ` is given by `|ω v|`.
We also show that a Lebesgue density point `x` of a set `s` (with respect to closed balls) has
density one for the rescaled copies `{x} + r • t` of a given set `t` with positive measure, in
`tendsto_addHaar_inter_smul_one_of_density_one`. In particular, `s` intersects `{x} + r • t` for
small `r`, see `eventually_nonempty_inter_smul_of_density_one`.
Statements on integrals of functions with respect to an additive Haar measure can be found in
`MeasureTheory.Measure.Haar.NormedSpace`.
-/
assert_not_exists MeasureTheory.integral
open TopologicalSpace Set Filter Metric Bornology
open scoped ENNReal Pointwise Topology NNReal
/-- The interval `[0,1]` as a compact set with non-empty interior. -/
def TopologicalSpace.PositiveCompacts.Icc01 : PositiveCompacts ℝ where
carrier := Icc 0 1
isCompact' := isCompact_Icc
interior_nonempty' := by simp_rw [interior_Icc, nonempty_Ioo, zero_lt_one]
universe u
/-- The set `[0,1]^ι` as a compact set with non-empty interior. -/
def TopologicalSpace.PositiveCompacts.piIcc01 (ι : Type*) [Finite ι] :
PositiveCompacts (ι → ℝ) where
carrier := pi univ fun _ => Icc 0 1
isCompact' := isCompact_univ_pi fun _ => isCompact_Icc
interior_nonempty' := by
simp only [interior_pi_set, Set.toFinite, interior_Icc, univ_pi_nonempty_iff, nonempty_Ioo,
imp_true_iff, zero_lt_one]
namespace Module.Basis
/-- The parallelepiped formed from the standard basis for `ι → ℝ` is `[0,1]^ι` -/
theorem parallelepiped_basisFun (ι : Type*) [Fintype ι] :
(Pi.basisFun ℝ ι).parallelepiped = TopologicalSpace.PositiveCompacts.piIcc01 ι :=
SetLike.coe_injective <| by
refine Eq.trans ?_ ((uIcc_of_le ?_).trans (Set.pi_univ_Icc _ _).symm)
· classical convert parallelepiped_single (ι := ι) 1
· exact zero_le_one
/-- A parallelepiped can be expressed on the standard basis. -/
theorem parallelepiped_eq_map {ι E : Type*} [Fintype ι] [NormedAddCommGroup E]
[NormedSpace ℝ E] (b : Basis ι ℝ E) :
b.parallelepiped = (PositiveCompacts.piIcc01 ι).map b.equivFun.symm
b.equivFunL.symm.continuous b.equivFunL.symm.isOpenMap := by
classical
rw [← Basis.parallelepiped_basisFun, ← Basis.parallelepiped_map]
congr with x
simp [Pi.single_apply]
open MeasureTheory MeasureTheory.Measure
theorem map_addHaar {ι E F : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedAddCommGroup F]
[NormedSpace ℝ E] [NormedSpace ℝ F] [MeasurableSpace E] [MeasurableSpace F] [BorelSpace E]
[BorelSpace F] [SecondCountableTopology F] [SigmaCompactSpace F]
(b : Basis ι ℝ E) (f : E ≃L[ℝ] F) :
map f b.addHaar = (b.map f.toLinearEquiv).addHaar := by
rw [eq_comm, Basis.addHaar_eq_iff, Measure.map_apply f.continuous.measurable
(PositiveCompacts.isCompact _).measurableSet, Basis.coe_parallelepiped, Basis.coe_map]
erw [← image_parallelepiped, f.toEquiv.preimage_image, addHaar_self]
end Module.Basis
namespace MeasureTheory
open Measure TopologicalSpace.PositiveCompacts Module
/-!
### The Lebesgue measure is a Haar measure on `ℝ` and on `ℝ^ι`.
-/
/-- The Haar measure equals the Lebesgue measure on `ℝ`. -/
theorem addHaarMeasure_eq_volume : addHaarMeasure Icc01 = volume := by
convert (addHaarMeasure_unique volume Icc01).symm; simp [Icc01]
/-- The Haar measure equals the Lebesgue measure on `ℝ^ι`. -/
theorem addHaarMeasure_eq_volume_pi (ι : Type*) [Fintype ι] :
addHaarMeasure (piIcc01 ι) = volume := by
convert (addHaarMeasure_unique volume (piIcc01 ι)).symm
simp only [piIcc01, volume_pi_pi fun _ => Icc (0 : ℝ) 1, PositiveCompacts.coe_mk,
Compacts.coe_mk, Finset.prod_const_one, ENNReal.ofReal_one, Real.volume_Icc, one_smul, sub_zero]
theorem isAddHaarMeasure_volume_pi (ι : Type*) [Fintype ι] :
IsAddHaarMeasure (volume : Measure (ι → ℝ)) :=
inferInstance
namespace Measure
/-!
### Strict subspaces have zero measure
-/
open scoped Function -- required for scoped `on` notation
/-- If a set is disjoint of its translates by infinitely many bounded vectors, then it has measure
zero. This auxiliary lemma proves this assuming additionally that the set is bounded. -/
theorem addHaar_eq_zero_of_disjoint_translates_aux {E : Type*} [NormedAddCommGroup E]
[NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E)
[IsAddHaarMeasure μ] {s : Set E} (u : ℕ → E) (sb : IsBounded s) (hu : IsBounded (range u))
(hs : Pairwise (Disjoint on fun n => {u n} + s)) (h's : MeasurableSet s) : μ s = 0 := by
by_contra h
apply lt_irrefl ∞
calc
∞ = ∑' _ : ℕ, μ s := (ENNReal.tsum_const_eq_top_of_ne_zero h).symm
_ = ∑' n : ℕ, μ ({u n} + s) := by
congr 1; ext1 n; simp only [image_add_left, measure_preimage_add, singleton_add]
_ = μ (⋃ n, {u n} + s) := Eq.symm <| measure_iUnion hs fun n => by
simpa only [image_add_left, singleton_add] using measurable_id.const_add _ h's
_ = μ (range u + s) := by rw [← iUnion_add, iUnion_singleton_eq_range]
_ < ∞ := (hu.add sb).measure_lt_top
/-- If a set is disjoint of its translates by infinitely many bounded vectors, then it has measure
zero. -/
theorem addHaar_eq_zero_of_disjoint_translates {E : Type*} [NormedAddCommGroup E]
[NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E)
[IsAddHaarMeasure μ] {s : Set E} (u : ℕ → E) (hu : IsBounded (range u))
(hs : Pairwise (Disjoint on fun n => {u n} + s)) (h's : MeasurableSet s) : μ s = 0 := by
suffices H : ∀ R, μ (s ∩ closedBall 0 R) = 0 by
apply le_antisymm _ (zero_le _)
calc
μ s ≤ ∑' n : ℕ, μ (s ∩ closedBall 0 n) := by
conv_lhs => rw [← iUnion_inter_closedBall_nat s 0]
exact measure_iUnion_le _
_ = 0 := by simp only [H, tsum_zero]
intro R
apply addHaar_eq_zero_of_disjoint_translates_aux μ u
(isBounded_closedBall.subset inter_subset_right) hu _ (h's.inter measurableSet_closedBall)
refine pairwise_disjoint_mono hs fun n => ?_
exact add_subset_add Subset.rfl inter_subset_left
/-- A strict vector subspace has measure zero. -/
theorem addHaar_submodule {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E]
[BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] (s : Submodule ℝ E)
(hs : s ≠ ⊤) : μ s = 0 := by
obtain ⟨x, hx⟩ : ∃ x, x ∉ s := by
simpa only [Submodule.eq_top_iff', not_exists, Ne, not_forall] using hs
obtain ⟨c, cpos, cone⟩ : ∃ c : ℝ, 0 < c ∧ c < 1 := ⟨1 / 2, by simp, by norm_num⟩
have A : IsBounded (range fun n : ℕ => c ^ n • x) :=
have : Tendsto (fun n : ℕ => c ^ n • x) atTop (𝓝 ((0 : ℝ) • x)) :=
(tendsto_pow_atTop_nhds_zero_of_lt_one cpos.le cone).smul_const x
isBounded_range_of_tendsto _ this
apply addHaar_eq_zero_of_disjoint_translates μ _ A _
(Submodule.closed_of_finiteDimensional s).measurableSet
intro m n hmn
simp only [Function.onFun, image_add_left, singleton_add, disjoint_left, mem_preimage,
SetLike.mem_coe]
intro y hym hyn
have A : (c ^ n - c ^ m) • x ∈ s := by
convert s.sub_mem hym hyn using 1
simp only [sub_smul, neg_sub_neg, add_sub_add_right_eq_sub]
have H : c ^ n - c ^ m ≠ 0 := by
simpa only [sub_eq_zero, Ne] using (pow_right_strictAnti₀ cpos cone).injective.ne hmn.symm
have : x ∈ s := by
convert s.smul_mem (c ^ n - c ^ m)⁻¹ A
rw [smul_smul, inv_mul_cancel₀ H, one_smul]
exact hx this
/-- A strict affine subspace has measure zero. -/
theorem addHaar_affineSubspace {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ]
(s : AffineSubspace ℝ E) (hs : s ≠ ⊤) : μ s = 0 := by
rcases s.eq_bot_or_nonempty with (rfl | hne)
· rw [AffineSubspace.bot_coe, measure_empty]
rw [Ne, ← AffineSubspace.direction_eq_top_iff_of_nonempty hne] at hs
rcases hne with ⟨x, hx : x ∈ s⟩
simpa only [AffineSubspace.coe_direction_eq_vsub_set_right hx, vsub_eq_sub, sub_eq_add_neg,
image_add_right, neg_neg, measure_preimage_add_right] using addHaar_submodule μ s.direction hs
/-!
### Applying a linear map rescales Haar measure by the determinant
We first prove this on `ι → ℝ`, using that this is already known for the product Lebesgue
measure (thanks to matrices computations). Then, we extend this to any finite-dimensional real
vector space by using a linear equiv with a space of the form `ι → ℝ`, and arguing that such a
linear equiv maps Haar measure to Haar measure.
-/
theorem map_linearMap_addHaar_pi_eq_smul_addHaar {ι : Type*} [Finite ι] {f : (ι → ℝ) →ₗ[ℝ] ι → ℝ}
(hf : LinearMap.det f ≠ 0) (μ : Measure (ι → ℝ)) [IsAddHaarMeasure μ] :
Measure.map f μ = ENNReal.ofReal (abs (LinearMap.det f)⁻¹) • μ := by
cases nonempty_fintype ι
/- We have already proved the result for the Lebesgue product measure, using matrices.
We deduce it for any Haar measure by uniqueness (up to scalar multiplication). -/
have := addHaarMeasure_unique μ (piIcc01 ι)
rw [this, addHaarMeasure_eq_volume_pi, Measure.map_smul,
Real.map_linearMap_volume_pi_eq_smul_volume_pi hf, smul_comm]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E]
[FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ]
theorem map_linearMap_addHaar_eq_smul_addHaar {f : E →ₗ[ℝ] E} (hf : LinearMap.det f ≠ 0) :
Measure.map f μ = ENNReal.ofReal |(LinearMap.det f)⁻¹| • μ := by
-- we reduce to the case of `E = ι → ℝ`, for which we have already proved the result using
-- matrices in `map_linearMap_addHaar_pi_eq_smul_addHaar`.
let ι := Fin (finrank ℝ E)
haveI : FiniteDimensional ℝ (ι → ℝ) := by infer_instance
have : finrank ℝ E = finrank ℝ (ι → ℝ) := by simp [ι]
have e : E ≃ₗ[ℝ] ι → ℝ := LinearEquiv.ofFinrankEq E (ι → ℝ) this
-- next line is to avoid `g` getting reduced by `simp`.
obtain ⟨g, hg⟩ : ∃ g, g = (e : E →ₗ[ℝ] ι → ℝ).comp (f.comp (e.symm : (ι → ℝ) →ₗ[ℝ] E)) := ⟨_, rfl⟩
have gdet : LinearMap.det g = LinearMap.det f := by rw [hg]; exact LinearMap.det_conj f e
rw [← gdet] at hf ⊢
have fg : f = (e.symm : (ι → ℝ) →ₗ[ℝ] E).comp (g.comp (e : E →ₗ[ℝ] ι → ℝ)) := by
ext x
simp only [LinearEquiv.coe_coe, Function.comp_apply, LinearMap.coe_comp,
LinearEquiv.symm_apply_apply, hg]
simp only [fg, LinearEquiv.coe_coe, LinearMap.coe_comp]
have Ce : Continuous e := (e : E →ₗ[ℝ] ι → ℝ).continuous_of_finiteDimensional
have Cg : Continuous g := LinearMap.continuous_of_finiteDimensional g
have Cesymm : Continuous e.symm := (e.symm : (ι → ℝ) →ₗ[ℝ] E).continuous_of_finiteDimensional
rw [← map_map Cesymm.measurable (Cg.comp Ce).measurable, ← map_map Cg.measurable Ce.measurable]
haveI : IsAddHaarMeasure (map e μ) := (e : E ≃+ (ι → ℝ)).isAddHaarMeasure_map μ Ce Cesymm
have ecomp : e.symm ∘ e = id := by
ext x; simp only [id, Function.comp_apply, LinearEquiv.symm_apply_apply]
rw [map_linearMap_addHaar_pi_eq_smul_addHaar hf (map e μ), Measure.map_smul,
map_map Cesymm.measurable Ce.measurable, ecomp, Measure.map_id]
/-- The preimage of a set `s` under a linear map `f` with nonzero determinant has measure
equal to `μ s` times the absolute value of the inverse of the determinant of `f`. -/
@[simp]
theorem addHaar_preimage_linearMap {f : E →ₗ[ℝ] E} (hf : LinearMap.det f ≠ 0) (s : Set E) :
μ (f ⁻¹' s) = ENNReal.ofReal |(LinearMap.det f)⁻¹| * μ s :=
calc
μ (f ⁻¹' s) = Measure.map f μ s :=
((f.equivOfDetNeZero hf).toContinuousLinearEquiv.toHomeomorph.toMeasurableEquiv.map_apply
s).symm
_ = ENNReal.ofReal |(LinearMap.det f)⁻¹| * μ s := by
rw [map_linearMap_addHaar_eq_smul_addHaar μ hf]; rfl
/-- The preimage of a set `s` under a continuous linear map `f` with nonzero determinant has measure
equal to `μ s` times the absolute value of the inverse of the determinant of `f`. -/
@[simp]
theorem addHaar_preimage_continuousLinearMap {f : E →L[ℝ] E}
(hf : LinearMap.det (f : E →ₗ[ℝ] E) ≠ 0) (s : Set E) :
μ (f ⁻¹' s) = ENNReal.ofReal (abs (LinearMap.det (f : E →ₗ[ℝ] E))⁻¹) * μ s :=
addHaar_preimage_linearMap μ hf s
/-- The preimage of a set `s` under a linear equiv `f` has measure
equal to `μ s` times the absolute value of the inverse of the determinant of `f`. -/
@[simp]
theorem addHaar_preimage_linearEquiv (f : E ≃ₗ[ℝ] E) (s : Set E) :
μ (f ⁻¹' s) = ENNReal.ofReal |LinearMap.det (f.symm : E →ₗ[ℝ] E)| * μ s := by
have A : LinearMap.det (f : E →ₗ[ℝ] E) ≠ 0 := (LinearEquiv.isUnit_det' f).ne_zero
convert addHaar_preimage_linearMap μ A s
simp only [LinearEquiv.det_coe_symm]
/-- The preimage of a set `s` under a continuous linear equiv `f` has measure
equal to `μ s` times the absolute value of the inverse of the determinant of `f`. -/
@[simp]
theorem addHaar_preimage_continuousLinearEquiv (f : E ≃L[ℝ] E) (s : Set E) :
μ (f ⁻¹' s) = ENNReal.ofReal |LinearMap.det (f.symm : E →ₗ[ℝ] E)| * μ s :=
addHaar_preimage_linearEquiv μ _ s
/-- The image of a set `s` under a linear map `f` has measure
equal to `μ s` times the absolute value of the determinant of `f`. -/
@[simp]
theorem addHaar_image_linearMap (f : E →ₗ[ℝ] E) (s : Set E) :
μ (f '' s) = ENNReal.ofReal |LinearMap.det f| * μ s := by
rcases ne_or_eq (LinearMap.det f) 0 with (hf | hf)
· let g := (f.equivOfDetNeZero hf).toContinuousLinearEquiv
change μ (g '' s) = _
rw [ContinuousLinearEquiv.image_eq_preimage_symm g s, addHaar_preimage_continuousLinearEquiv]
congr
· simp only [hf, zero_mul, ENNReal.ofReal_zero, abs_zero]
have : μ (LinearMap.range f) = 0 :=
addHaar_submodule μ _ (LinearMap.range_lt_top_of_det_eq_zero hf).ne
exact le_antisymm (le_trans (measure_mono (image_subset_range _ _)) this.le) (zero_le _)
/-- The image of a set `s` under a continuous linear map `f` has measure
equal to `μ s` times the absolute value of the determinant of `f`. -/
@[simp]
theorem addHaar_image_continuousLinearMap (f : E →L[ℝ] E) (s : Set E) :
μ (f '' s) = ENNReal.ofReal |LinearMap.det (f : E →ₗ[ℝ] E)| * μ s :=
addHaar_image_linearMap μ _ s
/-- The image of a set `s` under a continuous linear equiv `f` has measure
equal to `μ s` times the absolute value of the determinant of `f`. -/
@[simp]
theorem addHaar_image_continuousLinearEquiv (f : E ≃L[ℝ] E) (s : Set E) :
μ (f '' s) = ENNReal.ofReal |LinearMap.det (f : E →ₗ[ℝ] E)| * μ s :=
μ.addHaar_image_linearMap (f : E →ₗ[ℝ] E) s
theorem LinearMap.quasiMeasurePreserving (f : E →ₗ[ℝ] E) (hf : LinearMap.det f ≠ 0) :
QuasiMeasurePreserving f μ μ := by
refine ⟨f.continuous_of_finiteDimensional.measurable, ?_⟩
rw [map_linearMap_addHaar_eq_smul_addHaar μ hf]
exact smul_absolutelyContinuous
theorem ContinuousLinearMap.quasiMeasurePreserving (f : E →L[ℝ] E) (hf : f.det ≠ 0) :
QuasiMeasurePreserving f μ μ :=
LinearMap.quasiMeasurePreserving μ (f : E →ₗ[ℝ] E) hf
/-!
### Basic properties of Haar measures on real vector spaces
-/
theorem map_addHaar_smul {r : ℝ} (hr : r ≠ 0) :
Measure.map (r • ·) μ = ENNReal.ofReal (abs (r ^ finrank ℝ E)⁻¹) • μ := by
let f : E →ₗ[ℝ] E := r • (1 : E →ₗ[ℝ] E)
change Measure.map f μ = _
have hf : LinearMap.det f ≠ 0 := by
simp only [f, mul_one, LinearMap.det_smul, Ne, MonoidHom.map_one]
exact pow_ne_zero _ hr
simp only [f, map_linearMap_addHaar_eq_smul_addHaar μ hf, mul_one, LinearMap.det_smul, map_one]
theorem quasiMeasurePreserving_smul {r : ℝ} (hr : r ≠ 0) :
QuasiMeasurePreserving (r • ·) μ μ := by
refine ⟨measurable_const_smul r, ?_⟩
rw [map_addHaar_smul μ hr]
exact smul_absolutelyContinuous
@[simp]
theorem addHaar_preimage_smul {r : ℝ} (hr : r ≠ 0) (s : Set E) :
μ ((r • ·) ⁻¹' s) = ENNReal.ofReal (abs (r ^ finrank ℝ E)⁻¹) * μ s :=
calc
μ ((r • ·) ⁻¹' s) = Measure.map (r • ·) μ s :=
((Homeomorph.smul (isUnit_iff_ne_zero.2 hr).unit).toMeasurableEquiv.map_apply s).symm
_ = ENNReal.ofReal (abs (r ^ finrank ℝ E)⁻¹) * μ s := by
rw [map_addHaar_smul μ hr, coe_smul, Pi.smul_apply, smul_eq_mul]
/-- Rescaling a set by a factor `r` multiplies its measure by `abs (r ^ dim)`. -/
@[simp]
theorem addHaar_smul (r : ℝ) (s : Set E) :
μ (r • s) = ENNReal.ofReal (abs (r ^ finrank ℝ E)) * μ s := by
rcases ne_or_eq r 0 with (h | rfl)
· rw [← preimage_smul_inv₀ h, addHaar_preimage_smul μ (inv_ne_zero h), inv_pow, inv_inv]
rcases eq_empty_or_nonempty s with (rfl | hs)
· simp only [measure_empty, mul_zero, smul_set_empty]
rw [zero_smul_set hs, ← singleton_zero]
by_cases h : finrank ℝ E = 0
· haveI : Subsingleton E := finrank_zero_iff.1 h
simp only [h, one_mul, ENNReal.ofReal_one, abs_one, Subsingleton.eq_univ_of_nonempty hs,
pow_zero, Subsingleton.eq_univ_of_nonempty (singleton_nonempty (0 : E))]
· haveI : Nontrivial E := nontrivial_of_finrank_pos (bot_lt_iff_ne_bot.2 h)
simp only [h, zero_mul, ENNReal.ofReal_zero, abs_zero, Ne, not_false_iff,
zero_pow, measure_singleton]
theorem addHaar_smul_of_nonneg {r : ℝ} (hr : 0 ≤ r) (s : Set E) :
μ (r • s) = ENNReal.ofReal (r ^ finrank ℝ E) * μ s := by
rw [addHaar_smul, abs_pow, abs_of_nonneg hr]
variable {μ} {s : Set E}
-- Note: We might want to rename this once we acquire the lemma corresponding to
-- `MeasurableSet.const_smul`
theorem NullMeasurableSet.const_smul (hs : NullMeasurableSet s μ) (r : ℝ) :
NullMeasurableSet (r • s) μ := by
obtain rfl | hs' := s.eq_empty_or_nonempty
· simp
obtain rfl | hr := eq_or_ne r 0
· simpa [zero_smul_set hs'] using nullMeasurableSet_singleton _
obtain ⟨t, ht, hst⟩ := hs
refine ⟨_, ht.const_smul_of_ne_zero hr, ?_⟩
rw [← measure_symmDiff_eq_zero_iff] at hst ⊢
rw [← smul_set_symmDiff₀ hr, addHaar_smul μ, hst, mul_zero]
variable (μ)
@[simp]
theorem addHaar_image_homothety (x : E) (r : ℝ) (s : Set E) :
μ (AffineMap.homothety x r '' s) = ENNReal.ofReal (abs (r ^ finrank ℝ E)) * μ s :=
calc
μ (AffineMap.homothety x r '' s) = μ ((fun y => y + x) '' (r • (fun y => y + -x) '' s)) := by
simp only [← image_smul, image_image, ← sub_eq_add_neg]; rfl
_ = ENNReal.ofReal (abs (r ^ finrank ℝ E)) * μ s := by
simp only [image_add_right, measure_preimage_add_right, addHaar_smul]
/-! We don't need to state `map_addHaar_neg` here, because it has already been proved for
general Haar measures on general commutative groups. -/
/-! ### Measure of balls -/
theorem addHaar_ball_center {E : Type*} [NormedAddCommGroup E] [MeasurableSpace E] [BorelSpace E]
(μ : Measure E) [IsAddHaarMeasure μ] (x : E) (r : ℝ) : μ (ball x r) = μ (ball (0 : E) r) := by
have : ball (0 : E) r = (x + ·) ⁻¹' ball x r := by simp [preimage_add_ball]
rw [this, measure_preimage_add]
theorem addHaar_real_ball_center {E : Type*} [NormedAddCommGroup E] [MeasurableSpace E]
[BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] (x : E) (r : ℝ) :
μ.real (ball x r) = μ.real (ball (0 : E) r) := by
simp [measureReal_def, addHaar_ball_center]
theorem addHaar_closedBall_center {E : Type*} [NormedAddCommGroup E] [MeasurableSpace E]
[BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] (x : E) (r : ℝ) :
μ (closedBall x r) = μ (closedBall (0 : E) r) := by
have : closedBall (0 : E) r = (x + ·) ⁻¹' closedBall x r := by simp [preimage_add_closedBall]
rw [this, measure_preimage_add]
theorem addHaar_real_closedBall_center {E : Type*} [NormedAddCommGroup E] [MeasurableSpace E]
[BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] (x : E) (r : ℝ) :
μ.real (closedBall x r) = μ.real (closedBall (0 : E) r) := by
simp [measureReal_def, addHaar_closedBall_center]
theorem addHaar_ball_mul_of_pos (x : E) {r : ℝ} (hr : 0 < r) (s : ℝ) :
μ (ball x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * μ (ball 0 s) := by
have : ball (0 : E) (r * s) = r • ball (0 : E) s := by
simp only [_root_.smul_ball hr.ne' (0 : E) s, Real.norm_eq_abs, abs_of_nonneg hr.le, smul_zero]
simp only [this, addHaar_smul, abs_of_nonneg hr.le, addHaar_ball_center, abs_pow]
theorem addHaar_ball_of_pos (x : E) {r : ℝ} (hr : 0 < r) :
μ (ball x r) = ENNReal.ofReal (r ^ finrank ℝ E) * μ (ball 0 1) := by
rw [← addHaar_ball_mul_of_pos μ x hr, mul_one]
theorem addHaar_ball_mul [Nontrivial E] (x : E) {r : ℝ} (hr : 0 ≤ r) (s : ℝ) :
μ (ball x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * μ (ball 0 s) := by
rcases hr.eq_or_lt with (rfl | h)
· simp only [zero_pow (finrank_pos (R := ℝ) (M := E)).ne', measure_empty, zero_mul,
ENNReal.ofReal_zero, ball_zero]
· exact addHaar_ball_mul_of_pos μ x h s
theorem addHaar_ball [Nontrivial E] (x : E) {r : ℝ} (hr : 0 ≤ r) :
μ (ball x r) = ENNReal.ofReal (r ^ finrank ℝ E) * μ (ball 0 1) := by
rw [← addHaar_ball_mul μ x hr, mul_one]
theorem addHaar_closedBall_mul_of_pos (x : E) {r : ℝ} (hr : 0 < r) (s : ℝ) :
μ (closedBall x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * μ (closedBall 0 s) := by
have : closedBall (0 : E) (r * s) = r • closedBall (0 : E) s := by
simp [smul_closedBall' hr.ne' (0 : E), abs_of_nonneg hr.le]
simp only [this, addHaar_smul, abs_of_nonneg hr.le, addHaar_closedBall_center, abs_pow]
theorem addHaar_closedBall_mul (x : E) {r : ℝ} (hr : 0 ≤ r) {s : ℝ} (hs : 0 ≤ s) :
μ (closedBall x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * μ (closedBall 0 s) := by
have : closedBall (0 : E) (r * s) = r • closedBall (0 : E) s := by
simp [smul_closedBall r (0 : E) hs, abs_of_nonneg hr]
simp only [this, addHaar_smul, abs_of_nonneg hr, addHaar_closedBall_center, abs_pow]
/-- The measure of a closed ball can be expressed in terms of the measure of the closed unit ball.
Use instead `addHaar_closedBall`, which uses the measure of the open unit ball as a standard
form. -/
theorem addHaar_closedBall' (x : E) {r : ℝ} (hr : 0 ≤ r) :
μ (closedBall x r) = ENNReal.ofReal (r ^ finrank ℝ E) * μ (closedBall 0 1) := by
rw [← addHaar_closedBall_mul μ x hr zero_le_one, mul_one]
theorem addHaar_real_closedBall' (x : E) {r : ℝ} (hr : 0 ≤ r) :
μ.real (closedBall x r) = r ^ finrank ℝ E * μ.real (closedBall 0 1) := by
simp only [measureReal_def, addHaar_closedBall' μ x hr, ENNReal.toReal_mul, mul_eq_mul_right_iff,
ENNReal.toReal_ofReal_eq_iff]
left
positivity
theorem addHaar_unitClosedBall_eq_addHaar_unitBall :
μ (closedBall (0 : E) 1) = μ (ball 0 1) := by
apply le_antisymm _ (measure_mono ball_subset_closedBall)
have A : Tendsto
(fun r : ℝ => ENNReal.ofReal (r ^ finrank ℝ E) * μ (closedBall (0 : E) 1)) (𝓝[<] 1)
(𝓝 (ENNReal.ofReal ((1 : ℝ) ^ finrank ℝ E) * μ (closedBall (0 : E) 1))) := by
refine ENNReal.Tendsto.mul ?_ (by simp) tendsto_const_nhds (by simp)
exact ENNReal.tendsto_ofReal ((tendsto_id'.2 nhdsWithin_le_nhds).pow _)
simp only [one_pow, one_mul, ENNReal.ofReal_one] at A
refine le_of_tendsto A ?_
filter_upwards [Ioo_mem_nhdsLT zero_lt_one] with r hr
rw [← addHaar_closedBall' μ (0 : E) hr.1.le]
exact measure_mono (closedBall_subset_ball hr.2)
theorem addHaar_closedBall (x : E) {r : ℝ} (hr : 0 ≤ r) :
μ (closedBall x r) = ENNReal.ofReal (r ^ finrank ℝ E) * μ (ball 0 1) := by
rw [addHaar_closedBall' μ x hr, addHaar_unitClosedBall_eq_addHaar_unitBall]
theorem addHaar_real_closedBall (x : E) {r : ℝ} (hr : 0 ≤ r) :
μ.real (closedBall x r) = r ^ finrank ℝ E * μ.real (ball 0 1) := by
simp [addHaar_real_closedBall' μ x hr, measureReal_def,
addHaar_unitClosedBall_eq_addHaar_unitBall]
theorem addHaar_closedBall_eq_addHaar_ball [Nontrivial E] (x : E) (r : ℝ) :
μ (closedBall x r) = μ (ball x r) := by
by_cases! h : r < 0
· rw [Metric.closedBall_eq_empty.mpr h, Metric.ball_eq_empty.mpr h.le]
rw [addHaar_closedBall μ x h, addHaar_ball μ x h]
theorem addHaar_real_closedBall_eq_addHaar_real_ball [Nontrivial E] (x : E) (r : ℝ) :
μ.real (closedBall x r) = μ.real (ball x r) := by
simp [measureReal_def, addHaar_closedBall_eq_addHaar_ball μ x r]
theorem addHaar_sphere_of_ne_zero (x : E) {r : ℝ} (hr : r ≠ 0) : μ (sphere x r) = 0 := by
rcases hr.lt_or_gt with (h | h)
· simp only [empty_diff, measure_empty, ← closedBall_diff_ball, closedBall_eq_empty.2 h]
· rw [← closedBall_diff_ball,
measure_diff ball_subset_closedBall measurableSet_ball.nullMeasurableSet
measure_ball_lt_top.ne,
addHaar_ball_of_pos μ _ h, addHaar_closedBall μ _ h.le, tsub_self]
theorem addHaar_sphere [Nontrivial E] (x : E) (r : ℝ) : μ (sphere x r) = 0 := by
rcases eq_or_ne r 0 with (rfl | h)
· rw [sphere_zero, measure_singleton]
· exact addHaar_sphere_of_ne_zero μ x h
theorem addHaar_singleton_add_smul_div_singleton_add_smul {r : ℝ} (hr : r ≠ 0) (x y : E)
(s t : Set E) : μ ({x} + r • s) / μ ({y} + r • t) = μ s / μ t :=
calc
μ ({x} + r • s) / μ ({y} + r • t) = ENNReal.ofReal (|r| ^ finrank ℝ E) * μ s *
(ENNReal.ofReal (|r| ^ finrank ℝ E) * μ t)⁻¹ := by
simp only [div_eq_mul_inv, addHaar_smul, image_add_left, measure_preimage_add, abs_pow,
singleton_add]
_ = ENNReal.ofReal (|r| ^ finrank ℝ E) * (ENNReal.ofReal (|r| ^ finrank ℝ E))⁻¹ *
(μ s * (μ t)⁻¹) := by
rw [ENNReal.mul_inv]
· ring
· simp only [pow_pos (abs_pos.mpr hr), ENNReal.ofReal_eq_zero, not_le, Ne, true_or]
· simp only [ENNReal.ofReal_ne_top, true_or, Ne, not_false_iff]
_ = μ s / μ t := by
rw [ENNReal.mul_inv_cancel, one_mul, div_eq_mul_inv]
· simp only [pow_pos (abs_pos.mpr hr), ENNReal.ofReal_eq_zero, not_le, Ne]
· simp only [ENNReal.ofReal_ne_top, Ne, not_false_iff]
instance (priority := 100) isUnifLocDoublingMeasureOfIsAddHaarMeasure :
IsUnifLocDoublingMeasure μ := by
refine ⟨⟨(2 : ℝ≥0) ^ finrank ℝ E, ?_⟩⟩
filter_upwards [self_mem_nhdsWithin] with r hr x
rw [addHaar_closedBall_mul μ x zero_le_two (le_of_lt hr), addHaar_closedBall_center μ x,
ENNReal.ofReal, Real.toNNReal_pow zero_le_two]
simp only [Real.toNNReal_ofNat, le_refl]
section
/-!
### The Lebesgue measure associated to an alternating map
-/
variable {ι G : Type*} [Fintype ι] [DecidableEq ι] [NormedAddCommGroup G] [NormedSpace ℝ G]
[MeasurableSpace G] [BorelSpace G]
theorem addHaar_parallelepiped (b : Basis ι ℝ G) (v : ι → G) :
b.addHaar (parallelepiped v) = ENNReal.ofReal |b.det v| := by
have : FiniteDimensional ℝ G := b.finiteDimensional_of_finite
have A : parallelepiped v = b.constr ℕ v '' parallelepiped b := by
rw [image_parallelepiped]
exact congr_arg _ <| funext fun i ↦ (b.constr_basis ℕ v i).symm
rw [A, addHaar_image_linearMap, b.addHaar_self, mul_one, ← LinearMap.det_toMatrix b,
← Basis.toMatrix_eq_toMatrix_constr, Basis.det_apply]
variable [FiniteDimensional ℝ G] {n : ℕ} [_i : Fact (finrank ℝ G = n)]
/-- The Lebesgue measure associated to an alternating map. It gives measure `|ω v|` to the
parallelepiped spanned by the vectors `v₁, ..., vₙ`. Note that it is not always a Haar measure,
as it can be zero, but it is always locally finite and translation invariant. -/
noncomputable irreducible_def _root_.AlternatingMap.measure (ω : G [⋀^Fin n]→ₗ[ℝ] ℝ) :
Measure G :=
‖ω (finBasisOfFinrankEq ℝ G _i.out)‖₊ • (finBasisOfFinrankEq ℝ G _i.out).addHaar
theorem _root_.AlternatingMap.measure_parallelepiped (ω : G [⋀^Fin n]→ₗ[ℝ] ℝ)
(v : Fin n → G) : ω.measure (parallelepiped v) = ENNReal.ofReal |ω v| := by
conv_rhs => rw [ω.eq_smul_basis_det (finBasisOfFinrankEq ℝ G _i.out)]
simp only [addHaar_parallelepiped, AlternatingMap.measure, coe_nnreal_smul_apply,
AlternatingMap.smul_apply, Algebra.id.smul_eq_mul, abs_mul, ENNReal.ofReal_mul (abs_nonneg _),
← Real.enorm_eq_ofReal_abs, enorm]
instance (ω : G [⋀^Fin n]→ₗ[ℝ] ℝ) : IsAddLeftInvariant ω.measure := by
rw [AlternatingMap.measure]; infer_instance
instance (ω : G [⋀^Fin n]→ₗ[ℝ] ℝ) : IsLocallyFiniteMeasure ω.measure := by
rw [AlternatingMap.measure]; infer_instance
end
/-!
### Density points
Besicovitch covering theorem ensures that, for any locally finite measure on a finite-dimensional
real vector space, almost every point of a set `s` is a density point, i.e.,
`μ (s ∩ closedBall x r) / μ (closedBall x r)` tends to `1` as `r` tends to `0`
(see `Besicovitch.ae_tendsto_measure_inter_div`).
When `μ` is a Haar measure, one can deduce the same property for any rescaling sequence of sets,
of the form `{x} + r • t` where `t` is a set with positive finite measure, instead of the sequence
of closed balls.
We argue first for the dual property, i.e., if `s` has density `0` at `x`, then
`μ (s ∩ ({x} + r • t)) / μ ({x} + r • t)` tends to `0`. First when `t` is contained in the ball
of radius `1`, in `tendsto_addHaar_inter_smul_zero_of_density_zero_aux1`,
(by arguing by inclusion). Then when `t` is bounded, reducing to the previous one by rescaling, in
`tendsto_addHaar_inter_smul_zero_of_density_zero_aux2`.
Then for a general set `t`, by cutting it into a bounded part and a part with small measure, in
`tendsto_addHaar_inter_smul_zero_of_density_zero`.
Going to the complement, one obtains the desired property at points of density `1`, first when
`s` is measurable in `tendsto_addHaar_inter_smul_one_of_density_one_aux`, and then without this
assumption in `tendsto_addHaar_inter_smul_one_of_density_one` by applying the previous lemma to
the measurable hull `toMeasurable μ s`
-/
theorem tendsto_addHaar_inter_smul_zero_of_density_zero_aux1 (s : Set E) (x : E)
(h : Tendsto (fun r => μ (s ∩ closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 0)) (t : Set E)
(u : Set E) (h'u : μ u ≠ 0) (t_bound : t ⊆ closedBall 0 1) :
Tendsto (fun r : ℝ => μ (s ∩ ({x} + r • t)) / μ ({x} + r • u)) (𝓝[>] 0) (𝓝 0) := by
have A : Tendsto (fun r : ℝ => μ (s ∩ ({x} + r • t)) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 0) := by
apply
tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds h
(Eventually.of_forall fun b => zero_le _)
filter_upwards [self_mem_nhdsWithin]
rintro r (rpos : 0 < r)
grw [t_bound]
rw [← vadd_eq_add, singleton_vadd, affinity_unitClosedBall rpos.le]
have B :
Tendsto (fun r : ℝ => μ (closedBall x r) / μ ({x} + r • u)) (𝓝[>] 0)
(𝓝 (μ (closedBall x 1) / μ ({x} + u))) := by
apply tendsto_const_nhds.congr' _
filter_upwards [self_mem_nhdsWithin]
rintro r (rpos : 0 < r)
have : closedBall x r = {x} + r • closedBall (0 : E) 1 := by
simp only [_root_.smul_closedBall, Real.norm_of_nonneg rpos.le, zero_le_one, add_zero,
mul_one, singleton_add_closedBall, smul_zero]
simp only [this, addHaar_singleton_add_smul_div_singleton_add_smul μ rpos.ne']
simp only [addHaar_closedBall_center, image_add_left, measure_preimage_add, singleton_add]
have C : Tendsto (fun r : ℝ =>
μ (s ∩ ({x} + r • t)) / μ (closedBall x r) * (μ (closedBall x r) / μ ({x} + r • u)))
(𝓝[>] 0) (𝓝 (0 * (μ (closedBall x 1) / μ ({x} + u)))) := by
apply ENNReal.Tendsto.mul A _ B (Or.inr ENNReal.zero_ne_top)
simp [ENNReal.div_eq_top, h'u, measure_closedBall_lt_top.ne]
simp only [zero_mul] at C
apply C.congr' _
filter_upwards [self_mem_nhdsWithin]
rintro r (rpos : 0 < r)
calc
μ (s ∩ ({x} + r • t)) / μ (closedBall x r) * (μ (closedBall x r) / μ ({x} + r • u)) =
μ (closedBall x r) * (μ (closedBall x r))⁻¹ * (μ (s ∩ ({x} + r • t)) / μ ({x} + r • u)) :=
by simp only [div_eq_mul_inv]; ring
_ = μ (s ∩ ({x} + r • t)) / μ ({x} + r • u) := by
rw [ENNReal.mul_inv_cancel (measure_closedBall_pos μ x rpos).ne'
measure_closedBall_lt_top.ne,
one_mul]
theorem tendsto_addHaar_inter_smul_zero_of_density_zero_aux2 (s : Set E) (x : E)
(h : Tendsto (fun r => μ (s ∩ closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 0)) (t : Set E)
(u : Set E) (h'u : μ u ≠ 0) (R : ℝ) (Rpos : 0 < R) (t_bound : t ⊆ closedBall 0 R) :
Tendsto (fun r : ℝ => μ (s ∩ ({x} + r • t)) / μ ({x} + r • u)) (𝓝[>] 0) (𝓝 0) := by
set t' := R⁻¹ • t with ht'
set u' := R⁻¹ • u with hu'
have A : Tendsto (fun r : ℝ => μ (s ∩ ({x} + r • t')) / μ ({x} + r • u')) (𝓝[>] 0) (𝓝 0) := by
apply tendsto_addHaar_inter_smul_zero_of_density_zero_aux1 μ s x h t' u'
· simp only [u', h'u, (pow_pos Rpos _).ne', abs_nonpos_iff, addHaar_smul, not_false_iff,
ENNReal.ofReal_eq_zero, inv_eq_zero, inv_pow, Ne, or_self_iff, mul_eq_zero]
· refine (smul_set_mono t_bound).trans_eq ?_
rw [smul_closedBall _ _ Rpos.le, smul_zero, Real.norm_of_nonneg (inv_nonneg.2 Rpos.le),
inv_mul_cancel₀ Rpos.ne']
have B : Tendsto (fun r : ℝ => R * r) (𝓝[>] 0) (𝓝[>] (R * 0)) := by
apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within
· exact (tendsto_const_nhds.mul tendsto_id).mono_left nhdsWithin_le_nhds
· filter_upwards [self_mem_nhdsWithin]
intro r rpos
rw [mul_zero]
exact mul_pos Rpos rpos
rw [mul_zero] at B
apply (A.comp B).congr' _
filter_upwards [self_mem_nhdsWithin]
rintro r -
have T : (R * r) • t' = r • t := by
rw [mul_comm, ht', smul_smul, mul_assoc, mul_inv_cancel₀ Rpos.ne', mul_one]
have U : (R * r) • u' = r • u := by
rw [mul_comm, hu', smul_smul, mul_assoc, mul_inv_cancel₀ Rpos.ne', mul_one]
dsimp
rw [T, U]
/-- Consider a point `x` at which a set `s` has density zero, with respect to closed balls. Then it
also has density zero with respect to any measurable set `t`: the proportion of points in `s`
belonging to a rescaled copy `{x} + r • t` of `t` tends to zero as `r` tends to zero. -/
theorem tendsto_addHaar_inter_smul_zero_of_density_zero (s : Set E) (x : E)
(h : Tendsto (fun r => μ (s ∩ closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 0)) (t : Set E)
(ht : MeasurableSet t) (h''t : μ t ≠ ∞) :
Tendsto (fun r : ℝ => μ (s ∩ ({x} + r • t)) / μ ({x} + r • t)) (𝓝[>] 0) (𝓝 0) := by
refine tendsto_order.2 ⟨fun a' ha' => (ENNReal.not_lt_zero ha').elim, fun ε (εpos : 0 < ε) => ?_⟩
rcases eq_or_ne (μ t) 0 with (h't | h't)
· filter_upwards with r
suffices H : μ (s ∩ ({x} + r • t)) = 0 by
rw [H]; simpa only [ENNReal.zero_div] using εpos
apply le_antisymm _ (zero_le _)
calc
μ (s ∩ ({x} + r • t)) ≤ μ ({x} + r • t) := measure_mono inter_subset_right
_ = 0 := by
simp only [h't, addHaar_smul, image_add_left, measure_preimage_add, singleton_add,
mul_zero]
obtain ⟨n, npos, hn⟩ : ∃ n : ℕ, 0 < n ∧ μ (t \ closedBall 0 n) < ε / 2 * μ t := by
have A :
Tendsto (fun n : ℕ => μ (t \ closedBall 0 n)) atTop
(𝓝 (μ (⋂ n : ℕ, t \ closedBall 0 n))) := by
have N : ∃ n : ℕ, μ (t \ closedBall 0 n) ≠ ∞ :=
⟨0, ((measure_mono diff_subset).trans_lt h''t.lt_top).ne⟩
refine tendsto_measure_iInter_atTop
(fun n ↦ (ht.diff measurableSet_closedBall).nullMeasurableSet) (fun m n hmn ↦ ?_) N
exact diff_subset_diff Subset.rfl (closedBall_subset_closedBall (Nat.cast_le.2 hmn))
have : ⋂ n : ℕ, t \ closedBall 0 n = ∅ := by
simp_rw [diff_eq, ← inter_iInter, iInter_eq_compl_iUnion_compl, compl_compl,
iUnion_closedBall_nat, compl_univ, inter_empty]
simp only [this, measure_empty] at A
have I : 0 < ε / 2 * μ t := ENNReal.mul_pos (ENNReal.half_pos εpos.ne').ne' h't
exact (Eventually.and (Ioi_mem_atTop 0) ((tendsto_order.1 A).2 _ I)).exists
have L :
Tendsto (fun r : ℝ => μ (s ∩ ({x} + r • (t ∩ closedBall 0 n))) / μ ({x} + r • t)) (𝓝[>] 0)
(𝓝 0) :=
tendsto_addHaar_inter_smul_zero_of_density_zero_aux2 μ s x h _ t h't n (Nat.cast_pos.2 npos)
inter_subset_right
filter_upwards [(tendsto_order.1 L).2 _ (ENNReal.half_pos εpos.ne'), self_mem_nhdsWithin]
rintro r hr (rpos : 0 < r)
have I :
μ (s ∩ ({x} + r • t)) ≤
μ (s ∩ ({x} + r • (t ∩ closedBall 0 n))) + μ ({x} + r • (t \ closedBall 0 n)) :=
calc
μ (s ∩ ({x} + r • t)) =
μ (s ∩ ({x} + r • (t ∩ closedBall 0 n)) ∪ s ∩ ({x} + r • (t \ closedBall 0 n))) := by
rw [← inter_union_distrib_left, ← add_union, ← smul_set_union, inter_union_diff]
_ ≤ μ (s ∩ ({x} + r • (t ∩ closedBall 0 n))) + μ (s ∩ ({x} + r • (t \ closedBall 0 n))) :=
measure_union_le _ _
_ ≤ μ (s ∩ ({x} + r • (t ∩ closedBall 0 n))) + μ ({x} + r • (t \ closedBall 0 n)) := by
gcongr; apply inter_subset_right
calc
μ (s ∩ ({x} + r • t)) / μ ({x} + r • t) ≤
(μ (s ∩ ({x} + r • (t ∩ closedBall 0 n))) + μ ({x} + r • (t \ closedBall 0 n))) /
μ ({x} + r • t) := by gcongr
_ < ε / 2 + ε / 2 := by
rw [ENNReal.add_div]
apply ENNReal.add_lt_add hr _
rwa [addHaar_singleton_add_smul_div_singleton_add_smul μ rpos.ne',
ENNReal.div_lt_iff (Or.inl h't) (Or.inl h''t)]
_ = ε := ENNReal.add_halves _
theorem tendsto_addHaar_inter_smul_one_of_density_one_aux (s : Set E) (hs : MeasurableSet s)
(x : E) (h : Tendsto (fun r => μ (s ∩ closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 1))
(t : Set E) (ht : MeasurableSet t) (h't : μ t ≠ 0) (h''t : μ t ≠ ∞) :
Tendsto (fun r : ℝ => μ (s ∩ ({x} + r • t)) / μ ({x} + r • t)) (𝓝[>] 0) (𝓝 1) := by
have I : ∀ u v, μ u ≠ 0 → μ u ≠ ∞ → MeasurableSet v →
μ u / μ u - μ (vᶜ ∩ u) / μ u = μ (v ∩ u) / μ u := by
intro u v uzero utop vmeas
simp_rw [div_eq_mul_inv]
rw [← ENNReal.sub_mul]; swap
· simp only [uzero, ENNReal.inv_eq_top, imp_true_iff, Ne, not_false_iff]
congr 1
rw [inter_comm _ u, inter_comm _ u, eq_comm]
exact ENNReal.eq_sub_of_add_eq' utop (measure_inter_add_diff u vmeas)
have L : Tendsto (fun r => μ (sᶜ ∩ closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 0) := by
have A : Tendsto (fun r => μ (closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 1) := by
apply tendsto_const_nhds.congr' _
filter_upwards [self_mem_nhdsWithin]
intro r hr
rw [div_eq_mul_inv, ENNReal.mul_inv_cancel]
· exact (measure_closedBall_pos μ _ hr).ne'
· exact measure_closedBall_lt_top.ne
have B := ENNReal.Tendsto.sub A h (Or.inl ENNReal.one_ne_top)
simp only [tsub_self] at B
apply B.congr' _
filter_upwards [self_mem_nhdsWithin]
rintro r (rpos : 0 < r)
convert I (closedBall x r) sᶜ (measure_closedBall_pos μ _ rpos).ne'
measure_closedBall_lt_top.ne hs.compl
rw [compl_compl]
have L' : Tendsto (fun r : ℝ => μ (sᶜ ∩ ({x} + r • t)) / μ ({x} + r • t)) (𝓝[>] 0) (𝓝 0) :=
tendsto_addHaar_inter_smul_zero_of_density_zero μ sᶜ x L t ht h''t
have L'' : Tendsto (fun r : ℝ => μ ({x} + r • t) / μ ({x} + r • t)) (𝓝[>] 0) (𝓝 1) := by
apply tendsto_const_nhds.congr' _
filter_upwards [self_mem_nhdsWithin]
rintro r (rpos : 0 < r)
rw [addHaar_singleton_add_smul_div_singleton_add_smul μ rpos.ne', ENNReal.div_self h't h''t]
have := ENNReal.Tendsto.sub L'' L' (Or.inl ENNReal.one_ne_top)
simp only [tsub_zero] at this
apply this.congr' _
filter_upwards [self_mem_nhdsWithin]
rintro r (rpos : 0 < r)
refine I ({x} + r • t) s ?_ ?_ hs
· simp only [h't, abs_of_nonneg rpos.le, pow_pos rpos, addHaar_smul, image_add_left,
ENNReal.ofReal_eq_zero, not_le, or_false, Ne, measure_preimage_add, abs_pow,
singleton_add, mul_eq_zero]
· simp [h''t, ENNReal.ofReal_ne_top, addHaar_smul, image_add_left, ENNReal.mul_eq_top,
Ne, measure_preimage_add, singleton_add]
/-- Consider a point `x` at which a set `s` has density one, with respect to closed balls (i.e.,
a Lebesgue density point of `s`). Then `s` has also density one at `x` with respect to any
measurable set `t`: the proportion of points in `s` belonging to a rescaled copy `{x} + r • t`
of `t` tends to one as `r` tends to zero. -/
theorem tendsto_addHaar_inter_smul_one_of_density_one (s : Set E) (x : E)
(h : Tendsto (fun r => μ (s ∩ closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 1)) (t : Set E)
(ht : MeasurableSet t) (h't : μ t ≠ 0) (h''t : μ t ≠ ∞) :
Tendsto (fun r : ℝ => μ (s ∩ ({x} + r • t)) / μ ({x} + r • t)) (𝓝[>] 0) (𝓝 1) := by
have : Tendsto (fun r : ℝ => μ (toMeasurable μ s ∩ ({x} + r • t)) / μ ({x} + r • t))
(𝓝[>] 0) (𝓝 1) := by
apply
tendsto_addHaar_inter_smul_one_of_density_one_aux μ _ (measurableSet_toMeasurable _ _) _ _
t ht h't h''t
apply tendsto_of_tendsto_of_tendsto_of_le_of_le' h tendsto_const_nhds
· refine Eventually.of_forall fun r ↦ ?_
gcongr
apply subset_toMeasurable
· filter_upwards [self_mem_nhdsWithin]
rintro r -
apply ENNReal.div_le_of_le_mul
rw [one_mul]
exact measure_mono inter_subset_right
refine this.congr fun r => ?_
congr 1
apply measure_toMeasurable_inter_of_sFinite
simp only [image_add_left, singleton_add]
apply (continuous_add_left (-x)).measurable (ht.const_smul₀ r)
/-- Consider a point `x` at which a set `s` has density one, with respect to closed balls (i.e.,
a Lebesgue density point of `s`). Then `s` intersects the rescaled copies `{x} + r • t` of a given
set `t` with positive measure, for any small enough `r`. -/
theorem eventually_nonempty_inter_smul_of_density_one (s : Set E) (x : E)
(h : Tendsto (fun r => μ (s ∩ closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 1)) (t : Set E)
(ht : MeasurableSet t) (h't : μ t ≠ 0) :
∀ᶠ r in 𝓝[>] (0 : ℝ), (s ∩ ({x} + r • t)).Nonempty := by
obtain ⟨t', t'_meas, t't, t'pos, t'top⟩ : ∃ t', MeasurableSet t' ∧ t' ⊆ t ∧ 0 < μ t' ∧ μ t' < ⊤ :=
exists_subset_measure_lt_top ht h't.bot_lt
filter_upwards [(tendsto_order.1
(tendsto_addHaar_inter_smul_one_of_density_one μ s x h t' t'_meas t'pos.ne' t'top.ne)).1
0 zero_lt_one]
intro r hr
have : μ (s ∩ ({x} + r • t')) ≠ 0 := fun h' => by
simp only [ENNReal.not_lt_zero, ENNReal.zero_div, h'] at hr
have : (s ∩ ({x} + r • t')).Nonempty := nonempty_of_measure_ne_zero this
apply this.mono (inter_subset_inter Subset.rfl _)
exact add_subset_add Subset.rfl (smul_set_mono t't)
end Measure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean | import Mathlib.Dynamics.Ergodic.MeasurePreserving
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.Diagonal
import Mathlib.LinearAlgebra.Matrix.Transvection
import Mathlib.MeasureTheory.Group.LIntegral
import Mathlib.MeasureTheory.Integral.Marginal
import Mathlib.MeasureTheory.Measure.Stieltjes
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
/-!
# Lebesgue measure on the real line and on `ℝⁿ`
We show that the Lebesgue measure on the real line (constructed as a particular case of additive
Haar measure on inner product spaces) coincides with the Stieltjes measure associated
to the function `x ↦ x`. We deduce properties of this measure on `ℝ`, and then of the product
Lebesgue measure on `ℝⁿ`. In particular, we prove that they are translation invariant.
We show that, on `ℝⁿ`, a linear map acts on Lebesgue measure by rescaling it through the absolute
value of its determinant, in `Real.map_linearMap_volume_pi_eq_smul_volume_pi`.
More properties of the Lebesgue measure are deduced from this in
`Mathlib/MeasureTheory/Measure/Lebesgue/EqHaar.lean`, where they are proved more generally for any
additive Haar measure on a finite-dimensional real vector space.
-/
assert_not_exists MeasureTheory.integral
noncomputable section
open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
open ENNReal (ofReal)
open scoped ENNReal NNReal Topology
/-!
### Definition of the Lebesgue measure and lengths of intervals
-/
namespace Real
variable {ι : Type*} [Fintype ι]
/-- The volume on the real line (as a particular case of the volume on a finite-dimensional
inner product space) coincides with the Stieltjes measure coming from the identity function. -/
theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by
haveI : IsAddLeftInvariant StieltjesFunction.id.measure :=
⟨fun a =>
Eq.symm <|
Real.measure_ext_Ioo_rat fun p q => by
simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo,
sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim,
StieltjesFunction.id_apply, id, preimage_const_add_Ioo]⟩
have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by
change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1
rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;>
simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id, tsub_zero,
StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one]
conv_rhs =>
rw [addHaarMeasure_unique StieltjesFunction.id.measure
(stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped, A]
simp only [volume, Module.Basis.addHaar, one_smul]
theorem volume_val (s) : volume s = StieltjesFunction.id.measure s := by
simp [volume_eq_stieltjes_id]
@[simp]
theorem volume_Ico {a b : ℝ} : volume (Ico a b) = ofReal (b - a) := by simp [volume_val]
@[simp]
theorem volume_real_Ico {a b : ℝ} : volume.real (Ico a b) = max (b - a) 0 := by
simp [measureReal_def, ENNReal.toReal_ofReal']
theorem volume_real_Ico_of_le {a b : ℝ} (hab : a ≤ b) : volume.real (Ico a b) = b - a := by
simp [hab]
@[simp]
theorem volume_Icc {a b : ℝ} : volume (Icc a b) = ofReal (b - a) := by simp [volume_val]
@[simp]
theorem volume_real_Icc {a b : ℝ} : volume.real (Icc a b) = max (b - a) 0 := by
simp [measureReal_def, ENNReal.toReal_ofReal']
theorem volume_real_Icc_of_le {a b : ℝ} (hab : a ≤ b) : volume.real (Icc a b) = b - a := by
simp [hab]
@[simp]
theorem volume_Ioo {a b : ℝ} : volume (Ioo a b) = ofReal (b - a) := by simp [volume_val]
@[simp]
theorem volume_real_Ioo {a b : ℝ} : volume.real (Ioo a b) = max (b - a) 0 := by
simp [measureReal_def, ENNReal.toReal_ofReal']
theorem volume_real_Ioo_of_le {a b : ℝ} (hab : a ≤ b) : volume.real (Ioo a b) = b - a := by
simp [hab]
@[simp]
theorem volume_Ioc {a b : ℝ} : volume (Ioc a b) = ofReal (b - a) := by simp [volume_val]
@[simp]
theorem volume_real_Ioc {a b : ℝ} : volume.real (Ioc a b) = max (b - a) 0 := by
simp [measureReal_def, ENNReal.toReal_ofReal']
theorem volume_real_Ioc_of_le {a b : ℝ} (hab : a ≤ b) : volume.real (Ioc a b) = b - a := by
simp [hab]
theorem volume_singleton {a : ℝ} : volume ({a} : Set ℝ) = 0 := by simp
theorem volume_univ : volume (univ : Set ℝ) = ∞ :=
ENNReal.eq_top_of_forall_nnreal_le fun r =>
calc
(r : ℝ≥0∞) = volume (Icc (0 : ℝ) r) := by simp
_ ≤ volume univ := measure_mono (subset_univ _)
@[simp]
theorem volume_ball (a r : ℝ) : volume (Metric.ball a r) = ofReal (2 * r) := by
rw [ball_eq_Ioo, volume_Ioo, ← sub_add, add_sub_cancel_left, two_mul]
@[simp]
theorem volume_real_ball {a r : ℝ} (hr : 0 ≤ r) : volume.real (Metric.ball a r) = 2 * r := by
simp [measureReal_def, hr]
@[simp]
theorem volume_closedBall (a r : ℝ) : volume (Metric.closedBall a r) = ofReal (2 * r) := by
rw [closedBall_eq_Icc, volume_Icc, ← sub_add, add_sub_cancel_left, two_mul]
@[simp]
theorem volume_real_closedBall {a r : ℝ} (hr : 0 ≤ r) :
volume.real (Metric.closedBall a r) = 2 * r := by
simp [measureReal_def, hr]
@[simp]
theorem volume_emetric_ball (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.ball a r) = 2 * r := by
rcases eq_or_ne r ∞ with (rfl | hr)
· rw [Metric.emetric_ball_top, volume_univ, two_mul, _root_.top_add]
· lift r to ℝ≥0 using hr
rw [Metric.emetric_ball_nnreal, volume_ball, two_mul, ← NNReal.coe_add,
ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul]
@[simp]
theorem volume_emetric_closedBall (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.closedBall a r) = 2 * r := by
rcases eq_or_ne r ∞ with (rfl | hr)
· rw [EMetric.closedBall_top, volume_univ, two_mul, _root_.top_add]
· lift r to ℝ≥0 using hr
rw [Metric.emetric_closedBall_nnreal, volume_closedBall, two_mul, ← NNReal.coe_add,
ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul]
instance noAtoms_volume : NoAtoms (volume : Measure ℝ) :=
⟨fun _ => volume_singleton⟩
@[simp]
theorem volume_interval {a b : ℝ} : volume (uIcc a b) = ofReal |b - a| := by
rw [← Icc_min_max, volume_Icc, max_sub_min_eq_abs]
@[simp]
theorem volume_real_interval {a b : ℝ} : volume.real (uIcc a b) = |b - a| := by
simp [measureReal_def]
@[simp]
theorem volume_Ioi {a : ℝ} : volume (Ioi a) = ∞ :=
top_unique <|
le_of_tendsto' ENNReal.tendsto_nat_nhds_top fun n =>
calc
(n : ℝ≥0∞) = volume (Ioo a (a + n)) := by simp
_ ≤ volume (Ioi a) := measure_mono Ioo_subset_Ioi_self
@[simp]
theorem volume_Ici {a : ℝ} : volume (Ici a) = ∞ := by rw [← measure_congr Ioi_ae_eq_Ici]; simp
@[simp]
theorem volume_Iio {a : ℝ} : volume (Iio a) = ∞ :=
top_unique <|
le_of_tendsto' ENNReal.tendsto_nat_nhds_top fun n =>
calc
(n : ℝ≥0∞) = volume (Ioo (a - n) a) := by simp
_ ≤ volume (Iio a) := measure_mono Ioo_subset_Iio_self
@[simp]
theorem volume_Iic {a : ℝ} : volume (Iic a) = ∞ := by rw [← measure_congr Iio_ae_eq_Iic]; simp
instance locallyFinite_volume : IsLocallyFiniteMeasure (volume : Measure ℝ) :=
⟨fun x =>
⟨Ioo (x - 1) (x + 1),
IsOpen.mem_nhds isOpen_Ioo ⟨sub_lt_self _ zero_lt_one, lt_add_of_pos_right _ zero_lt_one⟩, by
simp only [Real.volume_Ioo, ENNReal.ofReal_lt_top]⟩⟩
instance isFiniteMeasure_restrict_Icc (x y : ℝ) : IsFiniteMeasure (volume.restrict (Icc x y)) :=
⟨by simp⟩
instance isFiniteMeasure_restrict_Ico (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ico x y)) :=
⟨by simp⟩
instance isFiniteMeasure_restrict_Ioc (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ioc x y)) :=
⟨by simp⟩
instance isFiniteMeasure_restrict_Ioo (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ioo x y)) :=
⟨by simp⟩
theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s := by
by_cases hs : Bornology.IsBounded s
· rw [Real.ediam_eq hs, ← volume_Icc]
exact volume.mono hs.subset_Icc_sInf_sSup
· rw [Metric.ediam_of_unbounded hs]; exact le_top
theorem _root_.Filter.Eventually.volume_pos_of_nhds_real {p : ℝ → Prop} {a : ℝ}
(h : ∀ᶠ x in 𝓝 a, p x) : (0 : ℝ≥0∞) < volume { x | p x } := by
rcases h.exists_Ioo_subset with ⟨l, u, hx, hs⟩
grw [← hs]
simpa [-mem_Ioo] using hx.1.trans hx.2
/-!
### Volume of a box in `ℝⁿ`
-/
theorem volume_Icc_pi {a b : ι → ℝ} : volume (Icc a b) = ∏ i, ENNReal.ofReal (b i - a i) := by
rw [← pi_univ_Icc, volume_pi_pi]
simp only [Real.volume_Icc]
@[simp]
theorem volume_Icc_pi_toReal {a b : ι → ℝ} (h : a ≤ b) :
(volume (Icc a b)).toReal = ∏ i, (b i - a i) := by
simp only [volume_Icc_pi, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
theorem volume_pi_Ioo {a b : ι → ℝ} :
volume (pi univ fun i => Ioo (a i) (b i)) = ∏ i, ENNReal.ofReal (b i - a i) :=
(measure_congr Measure.univ_pi_Ioo_ae_eq_Icc).trans volume_Icc_pi
@[simp]
theorem volume_pi_Ioo_toReal {a b : ι → ℝ} (h : a ≤ b) :
(volume (pi univ fun i => Ioo (a i) (b i))).toReal = ∏ i, (b i - a i) := by
simp only [volume_pi_Ioo, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
theorem volume_pi_Ioc {a b : ι → ℝ} :
volume (pi univ fun i => Ioc (a i) (b i)) = ∏ i, ENNReal.ofReal (b i - a i) :=
(measure_congr Measure.univ_pi_Ioc_ae_eq_Icc).trans volume_Icc_pi
@[simp]
theorem volume_pi_Ioc_toReal {a b : ι → ℝ} (h : a ≤ b) :
(volume (pi univ fun i => Ioc (a i) (b i))).toReal = ∏ i, (b i - a i) := by
simp only [volume_pi_Ioc, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
theorem volume_pi_Ico {a b : ι → ℝ} :
volume (pi univ fun i => Ico (a i) (b i)) = ∏ i, ENNReal.ofReal (b i - a i) :=
(measure_congr Measure.univ_pi_Ico_ae_eq_Icc).trans volume_Icc_pi
@[simp]
theorem volume_pi_Ico_toReal {a b : ι → ℝ} (h : a ≤ b) :
(volume (pi univ fun i => Ico (a i) (b i))).toReal = ∏ i, (b i - a i) := by
simp only [volume_pi_Ico, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
@[simp]
nonrec theorem volume_pi_ball (a : ι → ℝ) {r : ℝ} (hr : 0 < r) :
volume (Metric.ball a r) = ENNReal.ofReal ((2 * r) ^ Fintype.card ι) := by
simp only [MeasureTheory.volume_pi_ball a hr, volume_ball, Finset.prod_const]
exact (ENNReal.ofReal_pow (mul_nonneg zero_le_two hr.le) _).symm
@[simp]
nonrec theorem volume_pi_closedBall (a : ι → ℝ) {r : ℝ} (hr : 0 ≤ r) :
volume (Metric.closedBall a r) = ENNReal.ofReal ((2 * r) ^ Fintype.card ι) := by
simp only [MeasureTheory.volume_pi_closedBall a hr, volume_closedBall, Finset.prod_const]
exact (ENNReal.ofReal_pow (mul_nonneg zero_le_two hr) _).symm
theorem volume_pi_le_prod_diam (s : Set (ι → ℝ)) :
volume s ≤ ∏ i : ι, EMetric.diam (Function.eval i '' s) :=
calc
volume s ≤ volume (pi univ fun i => closure (Function.eval i '' s)) :=
volume.mono <|
Subset.trans (subset_pi_eval_image univ s) <| pi_mono fun _ _ => subset_closure
_ = ∏ i, volume (closure <| Function.eval i '' s) := volume_pi_pi _
_ ≤ ∏ i : ι, EMetric.diam (Function.eval i '' s) :=
Finset.prod_le_prod' fun _ _ => (volume_le_diam _).trans_eq (EMetric.diam_closure _)
theorem volume_pi_le_diam_pow (s : Set (ι → ℝ)) : volume s ≤ EMetric.diam s ^ Fintype.card ι :=
calc
volume s ≤ ∏ i : ι, EMetric.diam (Function.eval i '' s) := volume_pi_le_prod_diam s
_ ≤ ∏ _i : ι, (1 : ℝ≥0) * EMetric.diam s :=
(Finset.prod_le_prod' fun i _ => (LipschitzWith.eval i).ediam_image_le s)
_ = EMetric.diam s ^ Fintype.card ι := by
simp only [ENNReal.coe_one, one_mul, Finset.prod_const, Fintype.card]
/-!
### Images of the Lebesgue measure under multiplication in ℝ
-/
theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
ENNReal.ofReal |a| • Measure.map (a * ·) volume = volume := by
refine (Real.measure_ext_Ioo_rat fun p q => ?_).symm
rcases lt_or_gt_of_ne h with h | h
· simp only [Real.volume_Ioo, Measure.smul_apply, ← ENNReal.ofReal_mul (le_of_lt <| neg_pos.2 h),
Measure.map_apply (measurable_const_mul a) measurableSet_Ioo, neg_sub_neg, neg_mul,
preimage_const_mul_Ioo_of_neg _ _ h, abs_of_neg h, mul_sub, smul_eq_mul,
mul_div_cancel₀ _ (ne_of_lt h)]
· simp only [Real.volume_Ioo, Measure.smul_apply, ← ENNReal.ofReal_mul (le_of_lt h),
Measure.map_apply (measurable_const_mul a) measurableSet_Ioo, preimage_const_mul_Ioo _ _ h,
abs_of_pos h, mul_sub, mul_div_cancel₀ _ (ne_of_gt h), smul_eq_mul]
theorem map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
Measure.map (a * ·) volume = ENNReal.ofReal |a⁻¹| • volume := by
conv_rhs =>
rw [← Real.smul_map_volume_mul_left h, smul_smul, ← ENNReal.ofReal_mul (abs_nonneg _), ←
abs_mul, inv_mul_cancel₀ h, abs_one, ENNReal.ofReal_one, one_smul]
@[simp]
theorem volume_preimage_mul_left {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
volume ((a * ·) ⁻¹' s) = ENNReal.ofReal (abs a⁻¹) * volume s :=
calc
volume ((a * ·) ⁻¹' s) = Measure.map (a * ·) volume s :=
((Homeomorph.mulLeft₀ a h).toMeasurableEquiv.map_apply s).symm
_ = ENNReal.ofReal (abs a⁻¹) * volume s := by rw [map_volume_mul_left h]; rfl
theorem smul_map_volume_mul_right {a : ℝ} (h : a ≠ 0) :
ENNReal.ofReal |a| • Measure.map (· * a) volume = volume := by
simpa only [mul_comm] using Real.smul_map_volume_mul_left h
theorem map_volume_mul_right {a : ℝ} (h : a ≠ 0) :
Measure.map (· * a) volume = ENNReal.ofReal |a⁻¹| • volume := by
simpa only [mul_comm] using Real.map_volume_mul_left h
@[simp]
theorem volume_preimage_mul_right {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
volume ((· * a) ⁻¹' s) = ENNReal.ofReal (abs a⁻¹) * volume s :=
calc
volume ((· * a) ⁻¹' s) = Measure.map (· * a) volume s :=
((Homeomorph.mulRight₀ a h).toMeasurableEquiv.map_apply s).symm
_ = ENNReal.ofReal (abs a⁻¹) * volume s := by rw [map_volume_mul_right h]; rfl
/-!
### Images of the Lebesgue measure under translation/linear maps in ℝⁿ
-/
open Matrix
/-- A diagonal matrix rescales Lebesgue according to its determinant. This is a special case of
`Real.map_matrix_volume_pi_eq_smul_volume_pi`, that one should use instead (and whose proof
uses this particular case). -/
theorem smul_map_diagonal_volume_pi [DecidableEq ι] {D : ι → ℝ} (h : det (diagonal D) ≠ 0) :
ENNReal.ofReal (abs (det (diagonal D))) • Measure.map (toLin' (diagonal D)) volume =
volume := by
refine (Measure.pi_eq fun s hs => ?_).symm
simp only [det_diagonal, Measure.coe_smul, Algebra.id.smul_eq_mul, Pi.smul_apply]
rw [Measure.map_apply _ (MeasurableSet.univ_pi hs)]
swap; · exact Continuous.measurable (LinearMap.continuous_on_pi _)
have :
(Matrix.toLin' (diagonal D) ⁻¹' Set.pi Set.univ fun i : ι => s i) =
Set.pi Set.univ fun i : ι => (D i * ·) ⁻¹' s i := by
ext f
simp only [LinearMap.coe_proj, Algebra.id.smul_eq_mul, LinearMap.smul_apply, mem_univ_pi,
mem_preimage, LinearMap.pi_apply, diagonal_toLin']
have B : ∀ i, ofReal (abs (D i)) * volume ((D i * ·) ⁻¹' s i) = volume (s i) := by
intro i
have A : D i ≠ 0 := by
simp only [det_diagonal, Ne] at h
exact Finset.prod_ne_zero_iff.1 h i (Finset.mem_univ i)
rw [volume_preimage_mul_left A, ← mul_assoc, ← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul,
mul_inv_cancel₀ A, abs_one, ENNReal.ofReal_one, one_mul]
rw [this, volume_pi_pi, Finset.abs_prod,
ENNReal.ofReal_prod_of_nonneg fun i _ => abs_nonneg (D i), ← Finset.prod_mul_distrib]
simp only [B]
/-- A transvection preserves Lebesgue measure. -/
theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionStruct ι ℝ) :
MeasurePreserving (toLin' t.toMatrix) := by
/- We use `lmarginal` to conveniently use Fubini's theorem.
Along the coordinate where there is a shearing, it acts like a
translation, and therefore preserves Lebesgue. -/
have ht : Measurable (toLin' t.toMatrix) :=
(toLin' t.toMatrix).continuous_of_finiteDimensional.measurable
refine ⟨ht, ?_⟩
refine (pi_eq fun s hs ↦ ?_).symm
have h2s : MeasurableSet (univ.pi s) := .pi countable_univ fun i _ ↦ hs i
simp_rw [← pi_pi, ← lintegral_indicator_one h2s]
rw [lintegral_map (measurable_one.indicator h2s) ht, volume_pi]
refine lintegral_eq_of_lmarginal_eq {t.i} ((measurable_one.indicator h2s).comp ht)
(measurable_one.indicator h2s) ?_
simp_rw [lmarginal_singleton]
ext x
cases t with | mk t_i t_j t_hij t_c =>
simp [transvection, single_mulVec, t_hij.symm, ← Function.update_add,
lintegral_add_right_eq_self fun xᵢ ↦ indicator (univ.pi s) 1 (Function.update x t_i xᵢ)]
/-- Any invertible matrix rescales Lebesgue measure through the absolute value of its
determinant. -/
theorem map_matrix_volume_pi_eq_smul_volume_pi [DecidableEq ι] {M : Matrix ι ι ℝ} (hM : det M ≠ 0) :
Measure.map (toLin' M) volume = ENNReal.ofReal (abs (det M)⁻¹) • volume := by
-- This follows from the cases we have already proved, of diagonal matrices and transvections,
-- as these matrices generate all invertible matrices.
apply diagonal_transvection_induction_of_det_ne_zero _ M hM
· intro D hD
conv_rhs => rw [← smul_map_diagonal_volume_pi hD]
rw [smul_smul, ← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul, inv_mul_cancel₀ hD, abs_one,
ENNReal.ofReal_one, one_smul]
· intro t
simp_rw [Matrix.TransvectionStruct.det, _root_.inv_one, abs_one, ENNReal.ofReal_one, one_smul,
(volume_preserving_transvectionStruct _).map_eq]
· intro A B _ _ IHA IHB
rw [toLin'_mul, det_mul, LinearMap.coe_comp, ← Measure.map_map, IHB, Measure.map_smul, IHA,
smul_smul, ← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul, mul_comm, mul_inv]
· apply Continuous.measurable
apply LinearMap.continuous_on_pi
· apply Continuous.measurable
apply LinearMap.continuous_on_pi
/-- Any invertible linear map rescales Lebesgue measure through the absolute value of its
determinant. -/
theorem map_linearMap_volume_pi_eq_smul_volume_pi {f : (ι → ℝ) →ₗ[ℝ] ι → ℝ}
(hf : LinearMap.det f ≠ 0) : Measure.map f volume =
ENNReal.ofReal (abs (LinearMap.det f)⁻¹) • volume := by
classical
-- this is deduced from the matrix case
let M := LinearMap.toMatrix' f
have A : LinearMap.det f = det M := by simp only [M, LinearMap.det_toMatrix']
have B : f = toLin' M := by simp only [M, toLin'_toMatrix']
rw [A, B]
apply map_matrix_volume_pi_eq_smul_volume_pi
rwa [A] at hf
end Real
section regionBetween
variable {α : Type*}
/-- The region between two real-valued functions on an arbitrary set. -/
def regionBetween (f g : α → ℝ) (s : Set α) : Set (α × ℝ) :=
{ p : α × ℝ | p.1 ∈ s ∧ p.2 ∈ Ioo (f p.1) (g p.1) }
theorem regionBetween_subset (f g : α → ℝ) (s : Set α) : regionBetween f g s ⊆ s ×ˢ univ := by
simpa only [prod_univ, regionBetween, Set.preimage, setOf_subset_setOf] using fun a => And.left
variable [MeasurableSpace α] {μ : Measure α} {f g : α → ℝ} {s : Set α}
/-- The region between two measurable functions on a measurable set is measurable. -/
theorem measurableSet_regionBetween (hf : Measurable f) (hg : Measurable g) (hs : MeasurableSet s) :
MeasurableSet (regionBetween f g s) := by
dsimp only [regionBetween, Ioo, mem_setOf_eq, setOf_and]
refine
MeasurableSet.inter ?_
((measurableSet_lt (hf.comp measurable_fst) measurable_snd).inter
(measurableSet_lt measurable_snd (hg.comp measurable_fst)))
exact measurable_fst hs
/-- The region between two measurable functions on a measurable set is measurable;
a version for the region together with the graph of the upper function. -/
theorem measurableSet_region_between_oc (hf : Measurable f) (hg : Measurable g)
(hs : MeasurableSet s) :
MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ioc (f p.fst) (g p.fst) } := by
dsimp only [regionBetween, Ioc, mem_setOf_eq, setOf_and]
refine
MeasurableSet.inter ?_
((measurableSet_lt (hf.comp measurable_fst) measurable_snd).inter
(measurableSet_le measurable_snd (hg.comp measurable_fst)))
exact measurable_fst hs
/-- The region between two measurable functions on a measurable set is measurable;
a version for the region together with the graph of the lower function. -/
theorem measurableSet_region_between_co (hf : Measurable f) (hg : Measurable g)
(hs : MeasurableSet s) :
MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ico (f p.fst) (g p.fst) } := by
dsimp only [regionBetween, Ico, mem_setOf_eq, setOf_and]
refine
MeasurableSet.inter ?_
((measurableSet_le (hf.comp measurable_fst) measurable_snd).inter
(measurableSet_lt measurable_snd (hg.comp measurable_fst)))
exact measurable_fst hs
/-- The region between two measurable functions on a measurable set is measurable;
a version for the region together with the graphs of both functions. -/
theorem measurableSet_region_between_cc (hf : Measurable f) (hg : Measurable g)
(hs : MeasurableSet s) :
MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Icc (f p.fst) (g p.fst) } := by
dsimp only [regionBetween, Icc, mem_setOf_eq, setOf_and]
refine
MeasurableSet.inter ?_
((measurableSet_le (hf.comp measurable_fst) measurable_snd).inter
(measurableSet_le measurable_snd (hg.comp measurable_fst)))
exact measurable_fst hs
/-- The graph of a measurable function is a measurable set. -/
theorem measurableSet_graph (hf : Measurable f) :
MeasurableSet { p : α × ℝ | p.snd = f p.fst } := by
simpa using measurableSet_region_between_cc hf hf MeasurableSet.univ
theorem volume_regionBetween_eq_lintegral' (hf : Measurable f) (hg : Measurable g)
(hs : MeasurableSet s) :
μ.prod volume (regionBetween f g s) = ∫⁻ y in s, ENNReal.ofReal ((g - f) y) ∂μ := by
classical
rw [Measure.prod_apply]
· have h :
(fun x => volume { a | x ∈ s ∧ a ∈ Ioo (f x) (g x) }) =
s.indicator fun x => ENNReal.ofReal (g x - f x) := by
funext x
rw [indicator_apply]
split_ifs with h
· have hx : { a | x ∈ s ∧ a ∈ Ioo (f x) (g x) } = Ioo (f x) (g x) := by simp [h, Ioo]
simp only [hx, Real.volume_Ioo]
· have hx : { a | x ∈ s ∧ a ∈ Ioo (f x) (g x) } = ∅ := by simp [h]
simp only [hx, measure_empty]
dsimp only [regionBetween, preimage_setOf_eq]
rw [h, lintegral_indicator] <;> simp only [hs, Pi.sub_apply]
· exact measurableSet_regionBetween hf hg hs
/-- The volume of the region between two almost everywhere measurable functions on a measurable set
can be represented as a Lebesgue integral. -/
theorem volume_regionBetween_eq_lintegral [SFinite μ] (hf : AEMeasurable f (μ.restrict s))
(hg : AEMeasurable g (μ.restrict s)) (hs : MeasurableSet s) :
μ.prod volume (regionBetween f g s) = ∫⁻ y in s, ENNReal.ofReal ((g - f) y) ∂μ := by
have h₁ :
(fun y => ENNReal.ofReal ((g - f) y)) =ᵐ[μ.restrict s] fun y =>
ENNReal.ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y) :=
(hg.ae_eq_mk.sub hf.ae_eq_mk).fun_comp ENNReal.ofReal
have h₂ :
(μ.restrict s).prod volume (regionBetween f g s) =
(μ.restrict s).prod volume
(regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s) := by
apply measure_congr
apply EventuallyEq.rfl.inter
exact
((quasiMeasurePreserving_fst.ae_eq_comp hf.ae_eq_mk).comp₂ _ EventuallyEq.rfl).inter
(EventuallyEq.rfl.comp₂ _ <| quasiMeasurePreserving_fst.ae_eq_comp hg.ae_eq_mk)
rw [lintegral_congr_ae h₁, ←
volume_regionBetween_eq_lintegral' hf.measurable_mk hg.measurable_mk hs]
convert h₂ using 1
· rw [Measure.restrict_prod_eq_prod_univ]
exact (Measure.restrict_eq_self _ (regionBetween_subset f g s)).symm
· rw [Measure.restrict_prod_eq_prod_univ]
exact
(Measure.restrict_eq_self _
(regionBetween_subset (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)).symm
/-- The region between two a.e.-measurable functions on a null-measurable set is null-measurable. -/
lemma nullMeasurableSet_regionBetween (μ : Measure α)
{f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ)
{s : Set α} (s_mble : NullMeasurableSet s μ) :
NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Ioo (f p.fst) (g p.fst)} (μ.prod volume) := by
refine NullMeasurableSet.inter
(s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_)
· exact nullMeasurableSet_lt (by fun_prop) measurable_snd.aemeasurable
· exact nullMeasurableSet_lt measurable_snd.aemeasurable (by fun_prop)
/-- The region between two a.e.-measurable functions on a null-measurable set is null-measurable;
a version for the region together with the graph of the upper function. -/
lemma nullMeasurableSet_region_between_oc (μ : Measure α)
{f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ)
{s : Set α} (s_mble : NullMeasurableSet s μ) :
NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Ioc (f p.fst) (g p.fst)} (μ.prod volume) := by
refine NullMeasurableSet.inter
(s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_)
· exact nullMeasurableSet_lt (by fun_prop) measurable_snd.aemeasurable
· change NullMeasurableSet {p : α × ℝ | p.snd ≤ g p.fst} (μ.prod volume)
rw [show {p : α × ℝ | p.snd ≤ g p.fst} = {p : α × ℝ | g p.fst < p.snd}ᶜ by
ext p
simp only [mem_setOf_eq, mem_compl_iff, not_lt]]
exact (nullMeasurableSet_lt (by fun_prop) measurable_snd.aemeasurable).compl
/-- The region between two a.e.-measurable functions on a null-measurable set is null-measurable;
a version for the region together with the graph of the lower function. -/
lemma nullMeasurableSet_region_between_co (μ : Measure α)
{f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ)
{s : Set α} (s_mble : NullMeasurableSet s μ) :
NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Ico (f p.fst) (g p.fst)} (μ.prod volume) := by
refine NullMeasurableSet.inter
(s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_)
· change NullMeasurableSet {p : α × ℝ | f p.fst ≤ p.snd} (μ.prod volume)
rw [show {p : α × ℝ | f p.fst ≤ p.snd} = {p : α × ℝ | p.snd < f p.fst}ᶜ by
ext p
simp only [mem_setOf_eq, mem_compl_iff, not_lt]]
exact (nullMeasurableSet_lt measurable_snd.aemeasurable (by fun_prop)).compl
· exact nullMeasurableSet_lt measurable_snd.aemeasurable (by fun_prop)
/-- The region between two a.e.-measurable functions on a null-measurable set is null-measurable;
a version for the region together with the graphs of both functions. -/
lemma nullMeasurableSet_region_between_cc (μ : Measure α)
{f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ)
{s : Set α} (s_mble : NullMeasurableSet s μ) :
NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Icc (f p.fst) (g p.fst)} (μ.prod volume) := by
refine NullMeasurableSet.inter
(s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_)
· change NullMeasurableSet {p : α × ℝ | f p.fst ≤ p.snd} (μ.prod volume)
rw [show {p : α × ℝ | f p.fst ≤ p.snd} = {p : α × ℝ | p.snd < f p.fst}ᶜ by
ext p
simp only [mem_setOf_eq, mem_compl_iff, not_lt]]
exact (nullMeasurableSet_lt measurable_snd.aemeasurable (by fun_prop)).compl
· change NullMeasurableSet {p : α × ℝ | p.snd ≤ g p.fst} (μ.prod volume)
rw [show {p : α × ℝ | p.snd ≤ g p.fst} = {p : α × ℝ | g p.fst < p.snd}ᶜ by
ext p
simp only [mem_setOf_eq, mem_compl_iff, not_lt]]
exact (nullMeasurableSet_lt (by fun_prop) measurable_snd.aemeasurable).compl
end regionBetween
/-- Consider a real set `s`. If a property is true almost everywhere in `s ∩ (a, b)` for
all `a, b ∈ s`, then it is true almost everywhere in `s`. Formulated with `μ.restrict`.
See also `ae_of_mem_of_ae_of_mem_inter_Ioo`. -/
theorem ae_restrict_of_ae_restrict_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Set ℝ} {p : ℝ → Prop}
(h : ∀ a b, a ∈ s → b ∈ s → a < b → ∀ᵐ x ∂μ.restrict (s ∩ Ioo a b), p x) :
∀ᵐ x ∂μ.restrict s, p x := by
/- By second-countability, we cover `s` by countably many intervals `(a, b)` (except maybe for
two endpoints, which don't matter since `μ` does not have any atom). -/
let T : s × s → Set ℝ := fun p => Ioo p.1 p.2
let u := ⋃ i : ↥s × ↥s, T i
have hfinite : (s \ u).Finite := s.finite_diff_iUnion_Ioo'
obtain ⟨A, A_count, hA⟩ :
∃ A : Set (↥s × ↥s), A.Countable ∧ ⋃ i ∈ A, T i = ⋃ i : ↥s × ↥s, T i :=
isOpen_iUnion_countable _ fun p => isOpen_Ioo
have : s ⊆ s \ u ∪ ⋃ p ∈ A, s ∩ T p := by
intro x hx
by_cases h'x : x ∈ ⋃ i : ↥s × ↥s, T i
· rw [← hA] at h'x
obtain ⟨p, pA, xp⟩ : ∃ p : ↥s × ↥s, p ∈ A ∧ x ∈ T p := by
simpa only [mem_iUnion, exists_prop, SetCoe.exists, exists_and_right] using h'x
right
exact mem_biUnion pA ⟨hx, xp⟩
· exact Or.inl ⟨hx, h'x⟩
apply ae_restrict_of_ae_restrict_of_subset this
rw [ae_restrict_union_iff, ae_restrict_biUnion_iff _ A_count]
constructor
· have : μ.restrict (s \ u) = 0 := by simp only [restrict_eq_zero, hfinite.measure_zero]
simp only [this, ae_zero, eventually_bot]
· rintro ⟨⟨a, as⟩, ⟨b, bs⟩⟩ -
dsimp [T]
rcases le_or_gt b a with (hba | hab)
· simp only [Ioo_eq_empty_of_le hba, inter_empty, restrict_empty, ae_zero, eventually_bot]
· exact h a b as bs hab
/-- Consider a real set `s`. If a property is true almost everywhere in `s ∩ (a, b)` for
all `a, b ∈ s`, then it is true almost everywhere in `s`. Formulated with bare membership.
See also `ae_restrict_of_ae_restrict_inter_Ioo`. -/
theorem ae_of_mem_of_ae_of_mem_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Set ℝ} {p : ℝ → Prop}
(h : ∀ a b, a ∈ s → b ∈ s → a < b → ∀ᵐ x ∂μ, x ∈ s ∩ Ioo a b → p x) :
∀ᵐ x ∂μ, x ∈ s → p x := by
/- By second-countability, we cover `s` by countably many intervals `(a, b)` (except maybe for
two endpoints, which don't matter since `μ` does not have any atom). -/
let T : s × s → Set ℝ := fun p => Ioo p.1 p.2
let u := ⋃ i : ↥s × ↥s, T i
have hfinite : (s \ u).Finite := s.finite_diff_iUnion_Ioo'
obtain ⟨A, A_count, hA⟩ :
∃ A : Set (↥s × ↥s), A.Countable ∧ ⋃ i ∈ A, T i = ⋃ i : ↥s × ↥s, T i :=
isOpen_iUnion_countable _ fun p => isOpen_Ioo
have M : ∀ᵐ x ∂μ, x ∉ s \ u := hfinite.countable.ae_notMem _
have M' : ∀ᵐ x ∂μ, ∀ (i : ↥s × ↥s), i ∈ A → x ∈ s ∩ T i → p x := by
rw [ae_ball_iff A_count]
rintro ⟨⟨a, as⟩, ⟨b, bs⟩⟩ -
change ∀ᵐ x : ℝ ∂μ, x ∈ s ∩ Ioo a b → p x
rcases le_or_gt b a with (hba | hab)
· simp only [Ioo_eq_empty_of_le hba, inter_empty, IsEmpty.forall_iff, eventually_true,
mem_empty_iff_false]
· exact h a b as bs hab
filter_upwards [M, M'] with x hx h'x
intro xs
by_cases Hx : x ∈ ⋃ i : ↥s × ↥s, T i
· rw [← hA] at Hx
obtain ⟨p, pA, xp⟩ : ∃ p : ↥s × ↥s, p ∈ A ∧ x ∈ T p := by
simpa only [mem_iUnion, exists_prop, SetCoe.exists, exists_and_right] using Hx
apply h'x p pA ⟨xs, xp⟩
· exact False.elim (hx ⟨xs, Hx⟩) |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Lebesgue/VolumeOfBalls.lean | import Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral
import Mathlib.LinearAlgebra.Complex.FiniteDimensional
import Mathlib.MeasureTheory.Constructions.HaarToSphere
import Mathlib.MeasureTheory.Integral.Gamma
import Mathlib.MeasureTheory.Integral.Pi
/-!
# Volume of balls
Let `E` be a finite-dimensional normed `ℝ`-vector space equipped with a Haar measure `μ`. We
prove that
`μ (Metric.ball 0 1) = (∫ (x : E), Real.exp (- ‖x‖ ^ p) ∂μ) / Real.Gamma (finrank ℝ E / p + 1)`
for any real number `p` with `0 < p`, see `MeasureTheory.measure_unitBall_eq_integral_div_gamma`. We
also prove the corresponding result to compute `μ {x : E | g x < 1}` where `g : E → ℝ` is a function
defining a norm on `E`, see `MeasureTheory.measure_lt_one_eq_integral_div_gamma`.
Using these formulas, we compute the volume of the unit balls in several cases.
* `MeasureTheory.volume_sum_rpow_lt` / `MeasureTheory.volume_sum_rpow_le`: volume of the open and
closed balls for the norm `Lp` over a real finite-dimensional vector space with `1 ≤ p`. These
are computed as `volume {x : ι → ℝ | (∑ i, |x i| ^ p) ^ (1 / p) < r}` and
`volume {x : ι → ℝ | (∑ i, |x i| ^ p) ^ (1 / p) ≤ r}` since the spaces `PiLp` do not have a
`MeasureSpace` instance.
* `Complex.volume_sum_rpow_lt_one` / `Complex.volume_sum_rpow_lt`: same as above but for complex
finite-dimensional vector space.
* `EuclideanSpace.volume_ball` / `EuclideanSpace.volume_closedBall` : volume of open and closed
balls in a finite-dimensional Euclidean space.
* `InnerProductSpace.volume_ball` / `InnerProductSpace.volume_closedBall`: volume of open and closed
balls in a finite-dimensional real inner product space.
* `Complex.volume_ball` / `Complex.volume_closedBall`: volume of open and closed balls in `ℂ`.
-/
section general_case
open MeasureTheory MeasureTheory.Measure Module ENNReal
theorem MeasureTheory.measure_unitBall_eq_integral_div_gamma {E : Type*} {p : ℝ}
[NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E]
[BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] (hp : 0 < p) :
μ (Metric.ball 0 1) =
.ofReal ((∫ (x : E), Real.exp (-‖x‖ ^ p) ∂μ) / Real.Gamma (finrank ℝ E / p + 1)) := by
obtain hE | hE := subsingleton_or_nontrivial E
· rw [(Metric.nonempty_ball.mpr zero_lt_one).eq_zero, ← setIntegral_univ,
Set.univ_nonempty.eq_zero, integral_singleton, finrank_zero_of_subsingleton, Nat.cast_zero,
zero_div, zero_add, Real.Gamma_one, div_one, norm_zero, Real.zero_rpow hp.ne', neg_zero,
Real.exp_zero, smul_eq_mul, mul_one, measureReal_def, ofReal_toReal (measure_ne_top μ {0})]
· have : (0 : ℝ) < finrank ℝ E := Nat.cast_pos.mpr finrank_pos
have : ((∫ y in Set.Ioi (0 : ℝ), y ^ (finrank ℝ E - 1) • Real.exp (-y ^ p)) /
Real.Gamma ((finrank ℝ E) / p + 1)) * (finrank ℝ E) = 1 := by
simp_rw [← Real.rpow_natCast _ (finrank ℝ E - 1), smul_eq_mul, Nat.cast_sub finrank_pos,
Nat.cast_one]
rw [integral_rpow_mul_exp_neg_rpow hp (by linarith), sub_add_cancel,
Real.Gamma_add_one (ne_of_gt (by positivity))]
field
rw [integral_fun_norm_addHaar μ (fun x => Real.exp (-x ^ p)), nsmul_eq_mul, smul_eq_mul,
mul_div_assoc, mul_div_assoc, mul_comm, mul_assoc, this, mul_one, ofReal_measureReal _]
exact ne_of_lt measure_ball_lt_top
variable {E : Type*} [AddCommGroup E] [Module ℝ E] [FiniteDimensional ℝ E] [mE : MeasurableSpace E]
[tE : TopologicalSpace E] [IsTopologicalAddGroup E] [BorelSpace E] [T2Space E]
[ContinuousSMul ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] {g : E → ℝ} (h1 : g 0 = 0)
(h2 : ∀ x, g (-x) = g x) (h3 : ∀ x y, g (x + y) ≤ g x + g y) (h4 : ∀ {x}, g x = 0 → x = 0)
(h5 : ∀ r x, g (r • x) ≤ |r| * (g x))
include h1 h2 h3 h4 h5
theorem MeasureTheory.measure_lt_one_eq_integral_div_gamma {p : ℝ} (hp : 0 < p) :
μ {x : E | g x < 1} =
.ofReal ((∫ (x : E), Real.exp (-(g x) ^ p) ∂μ) / Real.Gamma (finrank ℝ E / p + 1)) := by
-- We copy `E` to a new type `F` on which we will put the norm defined by `g`
letI F : Type _ := E
letI : NormedAddCommGroup F :=
{ norm := g
dist := fun x y => g (x - y)
dist_self := by simp only [_root_.sub_self, h1, forall_const]
dist_comm := fun _ _ => by rw [← h2, neg_sub]
dist_triangle := fun x y z => by convert h3 (x - y) (y - z) using 1; simp [F]
edist := fun x y => .ofReal (g (x - y))
edist_dist := fun _ _ => rfl
eq_of_dist_eq_zero := by convert fun _ _ h => eq_of_sub_eq_zero (h4 h) }
letI : NormedSpace ℝ F :=
{ norm_smul_le := fun _ _ ↦ h5 _ _ }
-- We put the new topology on F
letI : TopologicalSpace F := UniformSpace.toTopologicalSpace
letI : MeasurableSpace F := borel F
have : BorelSpace F := { measurable_eq := rfl }
-- The map between `E` and `F` as a continuous linear equivalence
let φ := @LinearEquiv.toContinuousLinearEquiv ℝ _ E _ _ tE _ _ F _ _ _ _ _ _ _ _ _
(LinearEquiv.refl ℝ E : E ≃ₗ[ℝ] F)
-- The measure `ν` is the measure on `F` defined by `μ`
-- Since we have two different topologies, it is necessary to specify the topology of E
let ν : Measure F := @Measure.map E F mE _ φ μ
convert (measure_unitBall_eq_integral_div_gamma ν hp) using 1
· rw [@Measure.map_apply E F mE _ μ φ _ _ measurableSet_ball]
· congr!
simp_rw [Metric.ball, dist_zero_right]
rfl
· refine @Continuous.measurable E F tE mE _ _ _ _ φ ?_
exact @ContinuousLinearEquiv.continuous ℝ ℝ _ _ _ _ _ _ E tE _ F _ _ _ _ φ
· -- The map between `E` and `F` as a measurable equivalence
let ψ := @Homeomorph.toMeasurableEquiv E F tE mE _ _ _ _
(@ContinuousLinearEquiv.toHomeomorph ℝ ℝ _ _ _ _ _ _ E tE _ F _ _ _ _ φ)
-- The map `ψ` is measure preserving by construction
have : @MeasurePreserving E F mE _ ψ μ ν :=
@Measurable.measurePreserving E F mE _ ψ (@MeasurableEquiv.measurable E F mE _ ψ) _
rw [← this.integral_comp']
rfl
theorem MeasureTheory.measure_le_eq_lt [Nontrivial E] (r : ℝ) :
μ {x : E | g x ≤ r} = μ {x : E | g x < r} := by
-- We copy `E` to a new type `F` on which we will put the norm defined by `g`
letI F : Type _ := E
letI : NormedAddCommGroup F :=
{ norm := g
dist := fun x y => g (x - y)
dist_self := by simp only [_root_.sub_self, h1, forall_const]
dist_comm := fun _ _ => by rw [← h2, neg_sub]
dist_triangle := fun x y z => by convert h3 (x - y) (y - z) using 1; simp [F]
edist := fun x y => .ofReal (g (x - y))
edist_dist := fun _ _ => rfl
eq_of_dist_eq_zero := by convert fun _ _ h => eq_of_sub_eq_zero (h4 h) }
letI : NormedSpace ℝ F :=
{ norm_smul_le := fun _ _ ↦ h5 _ _ }
-- We put the new topology on F
letI : TopologicalSpace F := UniformSpace.toTopologicalSpace
letI : MeasurableSpace F := borel F
have : BorelSpace F := { measurable_eq := rfl }
-- The map between `E` and `F` as a continuous linear equivalence
let φ := @LinearEquiv.toContinuousLinearEquiv ℝ _ E _ _ tE _ _ F _ _ _ _ _ _ _ _ _
(LinearEquiv.refl ℝ E : E ≃ₗ[ℝ] F)
-- The measure `ν` is the measure on `F` defined by `μ`
-- Since we have two different topologies, it is necessary to specify the topology of E
let ν : Measure F := @Measure.map E F mE _ φ μ
convert addHaar_closedBall_eq_addHaar_ball ν 0 r using 1
· rw [@Measure.map_apply E F mE _ μ φ _ _ measurableSet_closedBall]
· congr!
simp_rw [Metric.closedBall, dist_zero_right]
rfl
· refine @Continuous.measurable E F tE mE _ _ _ _ φ ?_
exact @ContinuousLinearEquiv.continuous ℝ ℝ _ _ _ _ _ _ E tE _ F _ _ _ _ φ
· rw [@Measure.map_apply E F mE _ μ φ _ _ measurableSet_ball]
· congr!
simp_rw [Metric.ball, dist_zero_right]
rfl
· refine @Continuous.measurable E F tE mE _ _ _ _ φ ?_
exact @ContinuousLinearEquiv.continuous ℝ ℝ _ _ _ _ _ _ E tE _ F _ _ _ _ φ
end general_case
section LpSpace
open Real Fintype ENNReal Module MeasureTheory MeasureTheory.Measure WithLp
variable (ι : Type*) [Fintype ι] {p : ℝ}
theorem MeasureTheory.volume_sum_rpow_lt_one (hp : 1 ≤ p) :
volume {x : ι → ℝ | ∑ i, |x i| ^ p < 1} =
.ofReal ((2 * Gamma (1 / p + 1)) ^ card ι / Gamma (card ι / p + 1)) := by
have h₁ : 0 < p := by linarith
have : (ENNReal.ofReal p).toReal = p := toReal_ofReal (le_of_lt h₁)
have h₂ : ∀ x : ι → ℝ, 0 ≤ ∑ i, |x i| ^ p := by
refine fun _ => Finset.sum_nonneg' ?_
exact fun i => (fun _ => rpow_nonneg (abs_nonneg _) _) _
-- We collect facts about `Lp` norms that will be used in `measure_lt_one_eq_integral_div_gamma`
have eq_norm (x : ι → ℝ) : ‖toLp (.ofReal p) x‖ = (∑ i, |x i| ^ p) ^ (1 / p) := by
simp [PiLp.norm_eq_sum (f := toLp (.ofReal p) x) (this.symm ▸ h₁), this]
have : Fact (1 ≤ ENNReal.ofReal p) := fact_iff.mpr (ofReal_one ▸ (ofReal_le_ofReal hp))
have nm_zero : ‖toLp (.ofReal p) (0 : ι → ℝ)‖ = 0 := norm_zero
have eq_zero (x : ι → ℝ) : ‖toLp (.ofReal p) x‖ = 0 ↔ x = 0 :=
norm_eq_zero.trans (toLp_eq_zero _)
have nm_neg := fun x : ι → ℝ => norm_neg (toLp (.ofReal p) x)
have nm_add := fun x y : ι → ℝ => norm_add_le (toLp (.ofReal p) x) (toLp (.ofReal p) y)
have nm_smul := fun (r : ℝ) (x : ι → ℝ) =>
norm_smul_le (β := PiLp (.ofReal p) (fun _ : ι => ℝ)) r (toLp (.ofReal p) x)
simp_rw [← toLp_neg, ← toLp_add, ← toLp_smul, eq_norm,
norm_eq_abs] at eq_zero nm_zero nm_neg nm_add nm_smul
-- We use `measure_lt_one_eq_integral_div_gamma` with `g` equals to the norm `L_p`
convert (measure_lt_one_eq_integral_div_gamma (volume : Measure (ι → ℝ))
(g := fun x => (∑ i, |x i| ^ p) ^ (1 / p)) nm_zero nm_neg nm_add (eq_zero _).mp
(fun r x => nm_smul r x) (by linarith : 0 < p)) using 4
· rw [rpow_lt_one_iff' _ (one_div_pos.mpr h₁)]
exact Finset.sum_nonneg' (fun _ => rpow_nonneg (abs_nonneg _) _)
· simp_rw [← rpow_mul (h₂ _), div_mul_cancel₀ _ (ne_of_gt h₁), Real.rpow_one,
← Finset.sum_neg_distrib, exp_sum]
rw [integral_fintype_prod_volume_eq_pow fun x : ℝ => exp (- |x| ^ p), integral_comp_abs
(f := fun x => exp (- x ^ p)), integral_exp_neg_rpow h₁]
· rw [finrank_fintype_fun_eq_card]
theorem MeasureTheory.volume_sum_rpow_lt [Nonempty ι] {p : ℝ} (hp : 1 ≤ p) (r : ℝ) :
volume {x : ι → ℝ | (∑ i, |x i| ^ p) ^ (1 / p) < r} = (.ofReal r) ^ card ι *
.ofReal ((2 * Gamma (1 / p + 1)) ^ card ι / Gamma (card ι / p + 1)) := by
have h₁ (x : ι → ℝ) : 0 ≤ ∑ i, |x i| ^ p := by positivity
have h₂ : ∀ x : ι → ℝ, 0 ≤ (∑ i, |x i| ^ p) ^ (1 / p) := fun x => rpow_nonneg (h₁ x) _
obtain hr | hr := le_or_gt r 0
· have : {x : ι → ℝ | (∑ i, |x i| ^ p) ^ (1 / p) < r} = ∅ := by
ext x
refine ⟨fun hx => ?_, fun hx => hx.elim⟩
exact not_le.mpr (lt_of_lt_of_le (Set.mem_setOf.mp hx) hr) (h₂ x)
rw [this, measure_empty, ← zero_eq_ofReal.mpr hr, zero_pow Fin.pos'.ne', zero_mul]
· rw [← volume_sum_rpow_lt_one _ hp, ← ofReal_pow (le_of_lt hr), ← finrank_pi ℝ]
convert addHaar_smul_of_nonneg volume (le_of_lt hr) {x : ι → ℝ | ∑ i, |x i| ^ p < 1} using 2
simp_rw [← Set.preimage_smul_inv₀ (ne_of_gt hr), Set.preimage_setOf_eq, Pi.smul_apply,
smul_eq_mul, abs_mul, mul_rpow (abs_nonneg _) (abs_nonneg _), abs_inv,
inv_rpow (abs_nonneg _), ← Finset.mul_sum, abs_eq_self.mpr (le_of_lt hr),
inv_mul_lt_iff₀ (rpow_pos_of_pos hr _), mul_one, ← rpow_lt_rpow_iff
(rpow_nonneg (h₁ _) _) (le_of_lt hr) (by linarith : 0 < p), ← rpow_mul
(h₁ _), div_mul_cancel₀ _ (ne_of_gt (by linarith) : p ≠ 0), Real.rpow_one]
theorem MeasureTheory.volume_sum_rpow_le [Nonempty ι] {p : ℝ} (hp : 1 ≤ p) (r : ℝ) :
volume {x : ι → ℝ | (∑ i, |x i| ^ p) ^ (1 / p) ≤ r} = (.ofReal r) ^ card ι *
.ofReal ((2 * Gamma (1 / p + 1)) ^ card ι / Gamma (card ι / p + 1)) := by
have h₁ : 0 < p := by linarith
have : (ENNReal.ofReal p).toReal = p := toReal_ofReal (le_of_lt h₁)
-- We collect facts about `Lp` norms that will be used in `measure_le_one_eq_lt_one`
have eq_norm (x : ι → ℝ) : ‖toLp (.ofReal p) x‖ = (∑ i, |x i| ^ p) ^ (1 / p) := by
simp [PiLp.norm_eq_sum (f := toLp (.ofReal p) x) (this.symm ▸ h₁), this]
have : Fact (1 ≤ ENNReal.ofReal p) := fact_iff.mpr (ofReal_one ▸ (ofReal_le_ofReal hp))
have nm_zero : ‖toLp (.ofReal p) (0 : ι → ℝ)‖ = 0 := norm_zero
have eq_zero (x : ι → ℝ) : ‖toLp (.ofReal p) x‖ = 0 ↔ x = 0 :=
norm_eq_zero.trans (toLp_eq_zero _)
have nm_neg := fun x : ι → ℝ => norm_neg (toLp (.ofReal p) x)
have nm_add := fun x y : ι → ℝ => norm_add_le (toLp (.ofReal p) x) (toLp (.ofReal p) y)
have nm_smul := fun (r : ℝ) (x : ι → ℝ) =>
norm_smul_le (β := PiLp (.ofReal p) (fun _ : ι => ℝ)) r (toLp (.ofReal p) x)
simp_rw [← toLp_neg, ← toLp_add, ← toLp_smul, eq_norm,
norm_eq_abs] at eq_zero nm_zero nm_neg nm_add nm_smul
rw [measure_le_eq_lt _ nm_zero (fun x ↦ nm_neg x) (fun x y ↦ nm_add x y) (eq_zero _).mp
(fun r x => nm_smul r x), volume_sum_rpow_lt _ hp]
theorem Complex.volume_sum_rpow_lt_one {p : ℝ} (hp : 1 ≤ p) :
volume {x : ι → ℂ | ∑ i, ‖x i‖ ^ p < 1} =
.ofReal ((π * Real.Gamma (2 / p + 1)) ^ card ι / Real.Gamma (2 * card ι / p + 1)) := by
have h₁ : 0 < p := by linarith
have : (ENNReal.ofReal p).toReal = p := toReal_ofReal (le_of_lt h₁)
have h₂ : ∀ x : ι → ℂ, 0 ≤ ∑ i, ‖x i‖ ^ p := by
refine fun _ => Finset.sum_nonneg' ?_
exact fun i => (fun _ => rpow_nonneg (norm_nonneg _) _) _
-- We collect facts about `Lp` norms that will be used in `measure_lt_one_eq_integral_div_gamma`
have eq_norm (x : ι → ℂ) : ‖toLp (.ofReal p) x‖ = (∑ i, ‖x i‖ ^ p) ^ (1 / p) := by
simp [PiLp.norm_eq_sum (f := toLp (.ofReal p) x) (this.symm ▸ h₁), this]
have : Fact (1 ≤ ENNReal.ofReal p) := fact_iff.mpr (ENNReal.ofReal_one ▸ (ofReal_le_ofReal hp))
have nm_zero : ‖toLp (.ofReal p) (0 : ι → ℂ)‖ = 0 := norm_zero
have eq_zero (x : ι → ℂ) : ‖toLp (.ofReal p) x‖ = 0 ↔ x = 0 :=
norm_eq_zero.trans (toLp_eq_zero _)
have nm_neg := fun x : ι → ℂ => norm_neg (toLp (.ofReal p) x)
have nm_add := fun x y : ι → ℂ => norm_add_le (toLp (.ofReal p) x) (toLp (.ofReal p) y)
have nm_smul := fun (r : ℝ) (x : ι → ℂ) =>
norm_smul_le (β := PiLp (.ofReal p) (fun _ : ι => ℂ)) r (toLp (.ofReal p) x)
simp_rw [← toLp_neg, ← toLp_add, ← toLp_smul, eq_norm] at eq_zero nm_zero nm_neg nm_add nm_smul
-- We use `measure_lt_one_eq_integral_div_gamma` with `g` equals to the norm `L_p`
convert measure_lt_one_eq_integral_div_gamma (volume : Measure (ι → ℂ))
(g := fun x => (∑ i, ‖x i‖ ^ p) ^ (1 / p)) nm_zero nm_neg nm_add (eq_zero _).mp
(fun r x => nm_smul r x) (by linarith : 0 < p) using 4
· rw [rpow_lt_one_iff' _ (one_div_pos.mpr h₁)]
exact Finset.sum_nonneg' (fun _ => rpow_nonneg (norm_nonneg _) _)
· simp_rw [← rpow_mul (h₂ _), div_mul_cancel₀ _ (ne_of_gt h₁), Real.rpow_one,
← Finset.sum_neg_distrib, Real.exp_sum]
rw [integral_fintype_prod_volume_eq_pow fun x : ℂ => Real.exp (- ‖x‖ ^ p),
Complex.integral_exp_neg_rpow hp]
· rw [finrank_pi_fintype, Complex.finrank_real_complex, Finset.sum_const, smul_eq_mul,
Nat.cast_mul, Nat.cast_ofNat, Fintype.card, mul_comm]
theorem Complex.volume_sum_rpow_lt [Nonempty ι] {p : ℝ} (hp : 1 ≤ p) (r : ℝ) :
volume {x : ι → ℂ | (∑ i, ‖x i‖ ^ p) ^ (1 / p) < r} = (.ofReal r) ^ (2 * card ι) *
.ofReal ((π * Real.Gamma (2 / p + 1)) ^ card ι / Real.Gamma (2 * card ι / p + 1)) := by
have h₁ (x : ι → ℂ) : 0 ≤ ∑ i, ‖x i‖ ^ p := by positivity
have h₂ : ∀ x : ι → ℂ, 0 ≤ (∑ i, ‖x i‖ ^ p) ^ (1 / p) := fun x => rpow_nonneg (h₁ x) _
obtain hr | hr := le_or_gt r 0
· have : {x : ι → ℂ | (∑ i, ‖x i‖ ^ p) ^ (1 / p) < r} = ∅ := by
ext x
refine ⟨fun hx => ?_, fun hx => hx.elim⟩
exact not_le.mpr (lt_of_lt_of_le (Set.mem_setOf.mp hx) hr) (h₂ x)
rw [this, measure_empty, ← zero_eq_ofReal.mpr hr, zero_pow Fin.pos'.ne', zero_mul]
· rw [← Complex.volume_sum_rpow_lt_one _ hp, ← ENNReal.ofReal_pow (le_of_lt hr)]
convert addHaar_smul_of_nonneg volume (le_of_lt hr) {x : ι → ℂ | ∑ i, ‖x i‖ ^ p < 1} using 2
· simp_rw [← Set.preimage_smul_inv₀ (ne_of_gt hr), Set.preimage_setOf_eq, Pi.smul_apply,
norm_smul, mul_rpow (norm_nonneg _) (norm_nonneg _), Real.norm_eq_abs, abs_inv, inv_rpow
(abs_nonneg _), ← Finset.mul_sum, abs_eq_self.mpr (le_of_lt hr), inv_mul_lt_iff₀
(rpow_pos_of_pos hr _), mul_one, ← rpow_lt_rpow_iff (rpow_nonneg (h₁ _) _)
(le_of_lt hr) (by linarith : 0 < p), ← rpow_mul (h₁ _), div_mul_cancel₀ _
(ne_of_gt (by linarith) : p ≠ 0), Real.rpow_one]
· simp_rw [finrank_pi_fintype ℝ, Complex.finrank_real_complex, Finset.sum_const, smul_eq_mul,
mul_comm, Fintype.card]
theorem Complex.volume_sum_rpow_le [Nonempty ι] {p : ℝ} (hp : 1 ≤ p) (r : ℝ) :
volume {x : ι → ℂ | (∑ i, ‖x i‖ ^ p) ^ (1 / p) ≤ r} = (.ofReal r) ^ (2 * card ι) *
.ofReal ((π * Real.Gamma (2 / p + 1)) ^ card ι / Real.Gamma (2 * card ι / p + 1)) := by
have h₁ : 0 < p := by linarith
have : (ENNReal.ofReal p).toReal = p := toReal_ofReal (le_of_lt h₁)
-- We collect facts about `Lp` norms that will be used in `measure_lt_one_eq_integral_div_gamma`
have eq_norm (x : ι → ℂ) : ‖toLp (.ofReal p) x‖ = (∑ i, ‖x i‖ ^ p) ^ (1 / p) := by
simp [PiLp.norm_eq_sum (f := toLp (.ofReal p) x) (this.symm ▸ h₁), this]
have : Fact (1 ≤ ENNReal.ofReal p) := fact_iff.mpr (ENNReal.ofReal_one ▸ (ofReal_le_ofReal hp))
have nm_zero : ‖toLp (.ofReal p) (0 : ι → ℂ)‖ = 0 := norm_zero
have eq_zero (x : ι → ℂ) : ‖toLp (.ofReal p) x‖ = 0 ↔ x = 0 :=
norm_eq_zero.trans (toLp_eq_zero _)
have nm_neg := fun x : ι → ℂ => norm_neg (toLp (.ofReal p) x)
have nm_add := fun x y : ι → ℂ => norm_add_le (toLp (.ofReal p) x) (toLp (.ofReal p) y)
have nm_smul := fun (r : ℝ) (x : ι → ℂ) =>
norm_smul_le (β := PiLp (.ofReal p) (fun _ : ι => ℂ)) r (toLp (.ofReal p) x)
simp_rw [← toLp_neg, ← toLp_add, ← toLp_smul, eq_norm] at eq_zero nm_zero nm_neg nm_add nm_smul
rw [measure_le_eq_lt _ nm_zero (fun x ↦ nm_neg x) (fun x y ↦ nm_add x y) (eq_zero _).mp
(fun r x => nm_smul r x), Complex.volume_sum_rpow_lt _ hp]
end LpSpace
namespace EuclideanSpace
variable (ι : Type*) [Nonempty ι] [Fintype ι]
open Fintype Real MeasureTheory MeasureTheory.Measure ENNReal
theorem volume_ball (x : EuclideanSpace ℝ ι) (r : ℝ) :
volume (Metric.ball x r) = (.ofReal r) ^ card ι *
.ofReal (√π ^ card ι / Gamma (card ι / 2 + 1)) := by
obtain hr | hr := le_total r 0
· rw [Metric.ball_eq_empty.mpr hr, measure_empty, ← zero_eq_ofReal.mpr hr, zero_pow card_ne_zero,
zero_mul]
· suffices volume (Metric.ball (0 : EuclideanSpace ℝ ι) 1) =
.ofReal (√π ^ card ι / Gamma (card ι / 2 + 1)) by
rw [Measure.addHaar_ball _ _ hr, this, ofReal_pow hr, finrank_euclideanSpace]
rw [← (PiLp.volume_preserving_toLp ι).measure_preimage
measurableSet_ball.nullMeasurableSet]
simp only [Set.preimage, ball_zero_eq _ zero_le_one, one_pow, Set.mem_setOf_eq]
convert volume_sum_rpow_lt_one ι one_le_two using 4
· simp [sq_abs]
· rw [Gamma_add_one (by simp), Gamma_one_half_eq, ← mul_assoc, mul_div_cancel₀ _
two_ne_zero, one_mul]
theorem volume_closedBall (x : EuclideanSpace ℝ ι) (r : ℝ) :
volume (Metric.closedBall x r) = (.ofReal r) ^ card ι *
.ofReal (√π ^ card ι / Gamma (card ι / 2 + 1)) := by
rw [addHaar_closedBall_eq_addHaar_ball, EuclideanSpace.volume_ball]
end EuclideanSpace
namespace InnerProductSpace
open scoped Nat
open MeasureTheory MeasureTheory.Measure ENNReal Real Module Metric
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E]
[MeasurableSpace E] [BorelSpace E]
section Nontrivial
variable [Nontrivial E]
theorem volume_ball (x : E) (r : ℝ) :
volume (Metric.ball x r) = (.ofReal r) ^ finrank ℝ E *
.ofReal (√π ^ finrank ℝ E / Gamma (finrank ℝ E / 2 + 1)) := by
rw [← ((stdOrthonormalBasis ℝ E).measurePreserving_repr_symm).measure_preimage
measurableSet_ball.nullMeasurableSet]
have : Nonempty (Fin (finrank ℝ E)) := Fin.pos_iff_nonempty.mp finrank_pos
have := EuclideanSpace.volume_ball (Fin (finrank ℝ E)) ((stdOrthonormalBasis ℝ E).repr x) r
simp_rw [Fintype.card_fin] at this
convert this
simp only [LinearIsometryEquiv.preimage_ball, LinearIsometryEquiv.symm_symm]
theorem volume_closedBall (x : E) (r : ℝ) :
volume (Metric.closedBall x r) = (.ofReal r) ^ finrank ℝ E *
.ofReal (√π ^ finrank ℝ E / Gamma (finrank ℝ E / 2 + 1)) := by
rw [addHaar_closedBall_eq_addHaar_ball, InnerProductSpace.volume_ball _]
lemma volume_ball_of_dim_even {k : ℕ} (hk : finrank ℝ E = 2 * k) (x : E) (r : ℝ) :
volume (ball x r) = .ofReal r ^ finrank ℝ E * .ofReal (π ^ k / (k : ℕ)!) := by
rw [volume_ball, hk, pow_mul, pow_mul, sq_sqrt pi_nonneg]
congr
simp [Gamma_nat_eq_factorial]
lemma volume_closedBall_of_dim_even {k : ℕ} (hk : finrank ℝ E = 2 * k) (x : E) (r : ℝ) :
volume (closedBall x r) = .ofReal r ^ finrank ℝ E * .ofReal (π ^ k / (k : ℕ)!) := by
rw [addHaar_closedBall_eq_addHaar_ball, volume_ball_of_dim_even hk x]
end Nontrivial
lemma volume_ball_of_dim_odd {k : ℕ} (hk : finrank ℝ E = 2 * k + 1) (x : E) (r : ℝ) :
volume (ball x r) =
.ofReal r ^ finrank ℝ E * .ofReal (π ^ k * 2 ^ (k + 1) / (finrank ℝ E : ℕ)‼) := by
have : Nontrivial E := Module.nontrivial_of_finrank_pos (R := ℝ) (hk ▸ (2 * k).succ_pos)
rw [volume_ball, hk, pow_succ (√π), pow_mul, sq_sqrt pi_nonneg, mul_div_assoc, mul_div_assoc]
congr 3
suffices √π / (↑(2 * k + 1)‼ * √π / 2 ^ (k + 1)) = 2 ^ (k + 1) / ↑(2 * k + 1)‼ by
simpa [add_div, add_right_comm, -one_div, Gamma_nat_add_one_add_half]
field
lemma volume_closedBall_of_dim_odd {k : ℕ} (hk : finrank ℝ E = 2 * k + 1) (x : E) (r : ℝ) :
volume (closedBall x r) =
.ofReal r ^ finrank ℝ E * .ofReal (π ^ k * 2 ^ (k + 1) / (finrank ℝ E : ℕ)‼) := by
have : Nontrivial E := Module.nontrivial_of_finrank_pos (R := ℝ) (hk ▸ (2 * k).succ_pos)
rw [addHaar_closedBall_eq_addHaar_ball, volume_ball_of_dim_odd hk x r]
end InnerProductSpace
namespace EuclideanSpace
open Real MeasureTheory MeasureTheory.Measure ENNReal Metric
@[simp]
lemma volume_ball_fin_two (x : EuclideanSpace ℝ (Fin 2)) (r : ℝ) :
volume (ball x r) = .ofReal r ^ 2 * .ofReal π := by
norm_num [InnerProductSpace.volume_ball_of_dim_even (k := 1) (by simp) x]
@[simp]
lemma volume_closedBall_fin_two (x : EuclideanSpace ℝ (Fin 2)) (r : ℝ) :
volume (closedBall x r) = .ofReal r ^ 2 * .ofReal π := by
rw [addHaar_closedBall_eq_addHaar_ball, volume_ball_fin_two x r]
@[simp]
lemma volume_ball_fin_three (x : EuclideanSpace ℝ (Fin 3)) (r : ℝ) :
volume (ball x r) = .ofReal r ^ 3 * .ofReal (π * 4 / 3) := by
norm_num [InnerProductSpace.volume_ball_of_dim_odd (k := 1) (by simp) x]
@[simp]
lemma volume_closedBall_fin_three (x : EuclideanSpace ℝ (Fin 3)) (r : ℝ) :
volume (closedBall x r) = .ofReal r ^ 3 * .ofReal (π * 4 / 3) := by
rw [addHaar_closedBall_eq_addHaar_ball, volume_ball_fin_three x]
end EuclideanSpace
section Complex
open MeasureTheory MeasureTheory.Measure ENNReal
@[simp]
theorem Complex.volume_ball (a : ℂ) (r : ℝ) :
volume (Metric.ball a r) = .ofReal r ^ 2 * NNReal.pi := by
simp [InnerProductSpace.volume_ball_of_dim_even (k := 1) (by simp) a,
← NNReal.coe_real_pi, ofReal_coe_nnreal]
@[simp]
theorem Complex.volume_closedBall (a : ℂ) (r : ℝ) :
volume (Metric.closedBall a r) = .ofReal r ^ 2 * NNReal.pi := by
rw [addHaar_closedBall_eq_addHaar_ball, Complex.volume_ball]
end Complex |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Lebesgue/Complex.lean | import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace
import Mathlib.MeasureTheory.Constructions.BorelSpace.Complex
/-!
# Lebesgue measure on `ℂ`
In this file, we consider the Lebesgue measure on `ℂ` defined as the push-forward of the volume
on `ℝ²` under the natural isomorphism and prove that it is equal to the measure `volume` of `ℂ`
coming from its `InnerProductSpace` structure over `ℝ`. For that, we consider the two frequently
used ways to represent `ℝ²` in `mathlib`: `ℝ × ℝ` and `Fin 2 → ℝ`, define measurable equivalences
(`MeasurableEquiv`) to both types and prove that both of them are volume preserving (in the sense
of `MeasureTheory.measurePreserving`).
-/
open MeasureTheory Module
noncomputable section
namespace Complex
/-- Measurable equivalence between `ℂ` and `ℝ² = Fin 2 → ℝ`. -/
def measurableEquivPi : ℂ ≃ᵐ (Fin 2 → ℝ) :=
basisOneI.equivFun.toContinuousLinearEquiv.toHomeomorph.toMeasurableEquiv
@[simp]
theorem measurableEquivPi_apply (a : ℂ) :
measurableEquivPi a = ![a.re, a.im] := rfl
@[simp]
theorem measurableEquivPi_symm_apply (p : (Fin 2) → ℝ) :
measurableEquivPi.symm p = (p 0) + (p 1) * I := rfl
/-- Measurable equivalence between `ℂ` and `ℝ × ℝ`. -/
def measurableEquivRealProd : ℂ ≃ᵐ ℝ × ℝ :=
equivRealProdCLM.toHomeomorph.toMeasurableEquiv
@[simp]
theorem measurableEquivRealProd_apply (a : ℂ) : measurableEquivRealProd a = (a.re, a.im) := rfl
@[simp]
theorem measurableEquivRealProd_symm_apply (p : ℝ × ℝ) :
measurableEquivRealProd.symm p = {re := p.1, im := p.2} := rfl
theorem volume_preserving_equiv_pi : MeasurePreserving measurableEquivPi := by
convert (measurableEquivPi.symm.measurable.measurePreserving volume).symm
rw [← addHaarMeasure_eq_volume_pi, ← Basis.parallelepiped_basisFun, ← Basis.addHaar,
measurableEquivPi, Homeomorph.toMeasurableEquiv_symm_coe,
ContinuousLinearEquiv.coe_symm_toHomeomorph, Basis.map_addHaar, eq_comm]
exact (Basis.addHaar_eq_iff _ _).mpr Complex.orthonormalBasisOneI.volume_parallelepiped
theorem volume_preserving_equiv_real_prod : MeasurePreserving measurableEquivRealProd :=
(volume_preserving_finTwoArrow ℝ).comp volume_preserving_equiv_pi
end Complex |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Typeclasses/Finite.lean | import Mathlib.MeasureTheory.Measure.Restrict
/-!
# Classes for finite measures
We introduce the following typeclasses for measures:
* `IsFiniteMeasure μ`: `μ univ < ∞`;
* `IsLocallyFiniteMeasure μ` : `∀ x, ∃ s ∈ 𝓝 x, μ s < ∞`.
-/
open scoped NNReal Topology
open Set MeasureTheory Measure Filter Function MeasurableSpace ENNReal
variable {α β δ ι : Type*}
namespace MeasureTheory
variable {m0 : MeasurableSpace α} [mβ : MeasurableSpace β] {μ ν ν₁ ν₂ : Measure α}
{s t : Set α}
section IsFiniteMeasure
/-- A measure `μ` is called finite if `μ univ < ∞`. -/
@[mk_iff]
class IsFiniteMeasure (μ : Measure α) : Prop where
measure_univ_lt_top : μ univ < ∞
lemma not_isFiniteMeasure_iff : ¬IsFiniteMeasure μ ↔ μ univ = ∞ := by simp [isFiniteMeasure_iff]
lemma isFiniteMeasure_restrict : IsFiniteMeasure (μ.restrict s) ↔ μ s ≠ ∞ := by
simp [isFiniteMeasure_iff, lt_top_iff_ne_top]
instance Restrict.isFiniteMeasure (μ : Measure α) [hs : Fact (μ s < ∞)] :
IsFiniteMeasure (μ.restrict s) :=
⟨by simpa using hs.elim⟩
@[simp]
theorem measure_lt_top (μ : Measure α) [IsFiniteMeasure μ] (s : Set α) : μ s < ∞ :=
(measure_mono (subset_univ s)).trans_lt IsFiniteMeasure.measure_univ_lt_top
instance isFiniteMeasureRestrict (μ : Measure α) (s : Set α) [h : IsFiniteMeasure μ] :
IsFiniteMeasure (μ.restrict s) := ⟨by simp⟩
@[simp, aesop (rule_sets := [finiteness]) safe apply]
theorem measure_ne_top (μ : Measure α) [IsFiniteMeasure μ] (s : Set α) : μ s ≠ ∞ :=
ne_of_lt (measure_lt_top μ s)
theorem measure_compl_le_add_of_le_add [IsFiniteMeasure μ] (hs : MeasurableSet s)
(ht : MeasurableSet t) {ε : ℝ≥0∞} (h : μ s ≤ μ t + ε) : μ tᶜ ≤ μ sᶜ + ε := by
rw [measure_compl ht (by finiteness), measure_compl hs (by finiteness), tsub_le_iff_right]
calc
μ univ = μ univ - μ s + μ s := (tsub_add_cancel_of_le <| measure_mono s.subset_univ).symm
_ ≤ μ univ - μ s + (μ t + ε) := by gcongr
_ = _ := by rw [add_right_comm, add_assoc]
theorem measure_compl_le_add_iff [IsFiniteMeasure μ] (hs : MeasurableSet s) (ht : MeasurableSet t)
{ε : ℝ≥0∞} : μ sᶜ ≤ μ tᶜ + ε ↔ μ t ≤ μ s + ε :=
⟨fun h => compl_compl s ▸ compl_compl t ▸ measure_compl_le_add_of_le_add hs.compl ht.compl h,
measure_compl_le_add_of_le_add ht hs⟩
/-- The measure of the whole space with respect to a finite measure, considered as `ℝ≥0`. -/
def measureUnivNNReal (μ : Measure α) : ℝ≥0 :=
(μ univ).toNNReal
@[simp]
theorem coe_measureUnivNNReal (μ : Measure α) [IsFiniteMeasure μ] :
↑(measureUnivNNReal μ) = μ univ :=
ENNReal.coe_toNNReal (by finiteness)
instance isFiniteMeasureZero : IsFiniteMeasure (0 : Measure α) :=
⟨by simp⟩
instance (priority := 50) isFiniteMeasureOfIsEmpty [IsEmpty α] : IsFiniteMeasure μ := by
rw [eq_zero_of_isEmpty μ]
infer_instance
@[simp]
theorem measureUnivNNReal_zero : measureUnivNNReal (0 : Measure α) = 0 :=
rfl
instance isFiniteMeasureAdd [IsFiniteMeasure μ] [IsFiniteMeasure ν] : IsFiniteMeasure (μ + ν) where
measure_univ_lt_top := by
rw [Measure.coe_add, Pi.add_apply, ENNReal.add_lt_top]
exact ⟨measure_lt_top _ _, measure_lt_top _ _⟩
instance isFiniteMeasureSMulNNReal [IsFiniteMeasure μ] {r : ℝ≥0} : IsFiniteMeasure (r • μ) where
measure_univ_lt_top := ENNReal.mul_lt_top ENNReal.coe_lt_top (measure_lt_top _ _)
instance IsFiniteMeasure.average : IsFiniteMeasure ((μ univ)⁻¹ • μ) where
measure_univ_lt_top := by
rw [smul_apply, smul_eq_mul, ← ENNReal.div_eq_inv_mul]
exact ENNReal.div_self_le_one.trans_lt ENNReal.one_lt_top
instance isFiniteMeasureSMulOfNNRealTower {R} [SMul R ℝ≥0] [SMul R ℝ≥0∞] [IsScalarTower R ℝ≥0 ℝ≥0∞]
[IsScalarTower R ℝ≥0∞ ℝ≥0∞] [IsFiniteMeasure μ] {r : R} : IsFiniteMeasure (r • μ) := by
rw [← smul_one_smul ℝ≥0 r μ]
infer_instance
theorem isFiniteMeasure_of_le (μ : Measure α) [IsFiniteMeasure μ] (h : ν ≤ μ) : IsFiniteMeasure ν :=
{ measure_univ_lt_top := (h Set.univ).trans_lt (measure_lt_top _ _) }
@[instance]
theorem Measure.isFiniteMeasure_map {m : MeasurableSpace α} (μ : Measure α) [IsFiniteMeasure μ]
(f : α → β) : IsFiniteMeasure (μ.map f) := by
by_cases hf : AEMeasurable f μ
· constructor
rw [map_apply_of_aemeasurable hf MeasurableSet.univ]
exact measure_lt_top μ _
· rw [map_of_not_aemeasurable hf]
exact MeasureTheory.isFiniteMeasureZero
theorem Measure.isFiniteMeasure_of_map {μ : Measure α} {f : α → β}
(hf : AEMeasurable f μ) [IsFiniteMeasure (μ.map f)] : IsFiniteMeasure μ where
measure_univ_lt_top := by
rw [← Set.preimage_univ (f := f), ← map_apply_of_aemeasurable hf .univ]
exact IsFiniteMeasure.measure_univ_lt_top
theorem Measure.isFiniteMeasure_map_iff {μ : Measure α} {f : α → β}
(hf : AEMeasurable f μ) : IsFiniteMeasure (μ.map f) ↔ IsFiniteMeasure μ :=
⟨fun _ ↦ isFiniteMeasure_of_map hf, fun _ ↦ isFiniteMeasure_map μ f⟩
instance IsFiniteMeasure_comap (f : β → α) [IsFiniteMeasure μ] : IsFiniteMeasure (μ.comap f) where
measure_univ_lt_top := by
by_cases hf : Injective f ∧ ∀ s, MeasurableSet s → NullMeasurableSet (f '' s) μ
· rw [Measure.comap_apply₀ _ _ hf.1 hf.2 MeasurableSet.univ.nullMeasurableSet]
exact measure_lt_top μ _
· rw [Measure.comap, dif_neg hf]
exact zero_lt_top
@[simp]
theorem measureUnivNNReal_eq_zero [IsFiniteMeasure μ] : measureUnivNNReal μ = 0 ↔ μ = 0 := by
rw [← MeasureTheory.Measure.measure_univ_eq_zero, ← coe_measureUnivNNReal]
norm_cast
theorem measureUnivNNReal_pos [IsFiniteMeasure μ] (hμ : μ ≠ 0) : 0 < measureUnivNNReal μ := by
contrapose! hμ
simpa [measureUnivNNReal_eq_zero, Nat.le_zero] using hμ
/-- `le_of_add_le_add_left` is normally applicable to `OrderedCancelAddCommMonoid`,
but it holds for measures with the additional assumption that μ is finite. -/
theorem Measure.le_of_add_le_add_left [IsFiniteMeasure μ] (A2 : μ + ν₁ ≤ μ + ν₂) : ν₁ ≤ ν₂ :=
fun S => ENNReal.le_of_add_le_add_left (MeasureTheory.measure_ne_top μ S) (A2 S)
lemma Measure.eq_of_le_of_measure_univ_eq [IsFiniteMeasure μ]
(hμν : μ ≤ ν) (h_univ : μ univ = ν univ) : μ = ν := by
refine le_antisymm hμν (le_intro fun s hs _ ↦ ?_)
by_contra! h_lt
have h_disj : Disjoint s sᶜ := disjoint_compl_right_iff_subset.mpr subset_rfl
rw [← union_compl_self s, measure_union h_disj hs.compl, measure_union h_disj hs.compl] at h_univ
exact ENNReal.add_lt_add_of_lt_of_le (by finiteness) h_lt (hμν sᶜ) |>.not_ge h_univ.symm.le
theorem summable_measure_toReal [hμ : IsFiniteMeasure μ] {f : ℕ → Set α}
(hf₁ : ∀ i : ℕ, MeasurableSet (f i)) (hf₂ : Pairwise (Disjoint on f)) :
Summable fun x => μ.real (f x) := by
apply ENNReal.summable_toReal
rw [← MeasureTheory.measure_iUnion hf₂ hf₁]
exact ne_of_lt (measure_lt_top _ _)
theorem ae_eq_univ_iff_measure_eq [IsFiniteMeasure μ] (hs : NullMeasurableSet s μ) :
s =ᵐ[μ] univ ↔ μ s = μ univ :=
⟨measure_congr, fun h ↦ ae_eq_of_subset_of_measure_ge (subset_univ _) h.ge hs (by finiteness)⟩
theorem ae_iff_measure_eq [IsFiniteMeasure μ] {p : α → Prop}
(hp : NullMeasurableSet { a | p a } μ) : (∀ᵐ a ∂μ, p a) ↔ μ { a | p a } = μ univ := by
rw [← ae_eq_univ_iff_measure_eq hp, eventuallyEq_univ, eventually_iff]
theorem ae_mem_iff_measure_eq [IsFiniteMeasure μ] {s : Set α} (hs : NullMeasurableSet s μ) :
(∀ᵐ a ∂μ, a ∈ s) ↔ μ s = μ univ :=
ae_iff_measure_eq hs
lemma tendsto_measure_biUnion_Ici_zero_of_pairwise_disjoint
{X : Type*} [MeasurableSpace X] {μ : Measure X} [IsFiniteMeasure μ]
{Es : ℕ → Set X} (Es_mble : ∀ i, NullMeasurableSet (Es i) μ)
(Es_disj : Pairwise fun n m ↦ Disjoint (Es n) (Es m)) :
Tendsto (μ ∘ fun n ↦ ⋃ i ≥ n, Es i) atTop (𝓝 0) := by
have decr : Antitone fun n ↦ ⋃ i ≥ n, Es i :=
fun n m hnm ↦ biUnion_mono (fun _ hi ↦ le_trans hnm hi) (fun _ _ ↦ subset_rfl)
have nothing : ⋂ n, ⋃ i ≥ n, Es i = ∅ := by
apply subset_antisymm _ (empty_subset _)
intro x hx
simp only [mem_iInter, mem_iUnion, exists_prop] at hx
obtain ⟨j, _, x_in_Es_j⟩ := hx 0
obtain ⟨k, k_gt_j, x_in_Es_k⟩ := hx (j+1)
have oops := (Es_disj (Nat.ne_of_lt k_gt_j)).ne_of_mem x_in_Es_j x_in_Es_k
contradiction
have key := tendsto_measure_iInter_atTop (μ := μ) (fun n ↦ by measurability)
decr ⟨0, measure_ne_top _ _⟩
simp only [nothing, measure_empty] at key
convert key
open scoped symmDiff
theorem abs_measureReal_sub_le_measureReal_symmDiff'
(hs : NullMeasurableSet s μ) (ht : NullMeasurableSet t μ) (hs' : μ s ≠ ∞) (ht' : μ t ≠ ∞) :
|μ.real s - μ.real t| ≤ μ.real (s ∆ t) := by
simp only [Measure.real]
have hst : μ (s \ t) ≠ ∞ := (measure_lt_top_of_subset diff_subset hs').ne
have hts : μ (t \ s) ≠ ∞ := (measure_lt_top_of_subset diff_subset ht').ne
suffices (μ s).toReal - (μ t).toReal = (μ (s \ t)).toReal - (μ (t \ s)).toReal by
rw [this, measure_symmDiff_eq hs ht, ENNReal.toReal_add hst hts]
convert abs_sub (μ (s \ t)).toReal (μ (t \ s)).toReal <;> simp
rw [measure_diff' s ht ht', measure_diff' t hs hs',
ENNReal.toReal_sub_of_le measure_le_measure_union_right (by finiteness),
ENNReal.toReal_sub_of_le measure_le_measure_union_right (by finiteness),
union_comm t s]
abel
theorem abs_measureReal_sub_le_measureReal_symmDiff [IsFiniteMeasure μ]
(hs : NullMeasurableSet s μ) (ht : NullMeasurableSet t μ) :
|μ.real s - μ.real t| ≤ μ.real (s ∆ t) :=
abs_measureReal_sub_le_measureReal_symmDiff' hs ht (by finiteness) (by finiteness)
instance {s : Finset ι} {μ : ι → Measure α} [∀ i, IsFiniteMeasure (μ i)] :
IsFiniteMeasure (∑ i ∈ s, μ i) where measure_univ_lt_top := by simp [measure_lt_top]
instance [Finite ι] {μ : ι → Measure α} [∀ i, IsFiniteMeasure (μ i)] :
IsFiniteMeasure (.sum μ) where
measure_univ_lt_top := by
cases nonempty_fintype ι
simp [measure_lt_top]
end IsFiniteMeasure
theorem ite_ae_eq_of_measure_zero {γ} (f : α → γ) (g : α → γ) (s : Set α) [DecidablePred (· ∈ s)]
(hs_zero : μ s = 0) :
(fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] g := by
have h_ss : sᶜ ⊆ { a : α | ite (a ∈ s) (f a) (g a) = g a } := fun x hx => by
simp [(Set.mem_compl_iff _ _).mp hx]
refine measure_mono_null ?_ hs_zero
conv_rhs => rw [← compl_compl s]
rwa [Set.compl_subset_compl]
theorem ite_ae_eq_of_measure_compl_zero {γ} (f : α → γ) (g : α → γ)
(s : Set α) [DecidablePred (· ∈ s)] (hs_zero : μ sᶜ = 0) :
(fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] f := by
rw [← mem_ae_iff] at hs_zero
filter_upwards [hs_zero]
intros
split_ifs
rfl
namespace Measure
/-- A measure is called finite at filter `f` if it is finite at some set `s ∈ f`.
Equivalently, it is eventually finite at `s` in `f.small_sets`. -/
def FiniteAtFilter {_m0 : MeasurableSpace α} (μ : Measure α) (f : Filter α) : Prop :=
∃ s ∈ f, μ s < ∞
theorem finiteAtFilter_of_finite {_m0 : MeasurableSpace α} (μ : Measure α) [IsFiniteMeasure μ]
(f : Filter α) : μ.FiniteAtFilter f :=
⟨univ, univ_mem, measure_lt_top μ univ⟩
theorem FiniteAtFilter.exists_mem_basis {f : Filter α} (hμ : FiniteAtFilter μ f) {p : ι → Prop}
{s : ι → Set α} (hf : f.HasBasis p s) : ∃ i, p i ∧ μ (s i) < ∞ :=
(hf.exists_iff fun {_s _t} hst ht => (measure_mono hst).trans_lt ht).1 hμ
theorem finiteAtBot {m0 : MeasurableSpace α} (μ : Measure α) : μ.FiniteAtFilter ⊥ :=
⟨∅, mem_bot, by simp only [measure_empty, zero_lt_top]⟩
/-- `μ` has finite spanning sets in `C` if there is a countable sequence of sets in `C` that have
finite measures. This structure is a type, which is useful if we want to record extra properties
about the sets, such as that they are monotone.
`SigmaFinite` is defined in terms of this: `μ` is σ-finite if there exists a sequence of
finite spanning sets in the collection of all measurable sets. -/
structure FiniteSpanningSetsIn {m0 : MeasurableSpace α} (μ : Measure α) (C : Set (Set α)) where
/-- The sequence of sets in `C` with finite measures -/
protected set : ℕ → Set α
protected set_mem : ∀ i, set i ∈ C
protected finite : ∀ i, μ (set i) < ∞
protected spanning : ⋃ i, set i = univ
end Measure
/-- A measure is called locally finite if it is finite in some neighborhood of each point. -/
class IsLocallyFiniteMeasure [TopologicalSpace α] (μ : Measure α) : Prop where
finiteAtNhds : ∀ x, μ.FiniteAtFilter (𝓝 x)
-- see Note [lower instance priority]
instance (priority := 100) IsFiniteMeasure.toIsLocallyFiniteMeasure [TopologicalSpace α]
(μ : Measure α) [IsFiniteMeasure μ] : IsLocallyFiniteMeasure μ :=
⟨fun _ => finiteAtFilter_of_finite _ _⟩
theorem Measure.finiteAt_nhds [TopologicalSpace α] (μ : Measure α) [IsLocallyFiniteMeasure μ]
(x : α) : μ.FiniteAtFilter (𝓝 x) :=
IsLocallyFiniteMeasure.finiteAtNhds x
theorem Measure.smul_finite (μ : Measure α) [IsFiniteMeasure μ] {c : ℝ≥0∞} (hc : c ≠ ∞) :
IsFiniteMeasure (c • μ) := by
lift c to ℝ≥0 using hc
exact MeasureTheory.isFiniteMeasureSMulNNReal
theorem Measure.exists_isOpen_measure_lt_top [TopologicalSpace α] (μ : Measure α)
[IsLocallyFiniteMeasure μ] (x : α) : ∃ s : Set α, x ∈ s ∧ IsOpen s ∧ μ s < ∞ := by
simpa only [and_assoc] using (μ.finiteAt_nhds x).exists_mem_basis (nhds_basis_opens x)
instance isLocallyFiniteMeasureSMulNNReal [TopologicalSpace α] (μ : Measure α)
[IsLocallyFiniteMeasure μ] (c : ℝ≥0) : IsLocallyFiniteMeasure (c • μ) := by
refine ⟨fun x => ?_⟩
rcases μ.exists_isOpen_measure_lt_top x with ⟨o, xo, o_open, μo⟩
refine ⟨o, o_open.mem_nhds xo, ?_⟩
apply ENNReal.mul_lt_top _ μo
simp
protected theorem Measure.isTopologicalBasis_isOpen_lt_top [TopologicalSpace α]
(μ : Measure α) [IsLocallyFiniteMeasure μ] :
TopologicalSpace.IsTopologicalBasis { s | IsOpen s ∧ μ s < ∞ } := by
refine TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds (fun s hs => hs.1) ?_
intro x s xs hs
rcases μ.exists_isOpen_measure_lt_top x with ⟨v, xv, hv, μv⟩
refine ⟨v ∩ s, ⟨hv.inter hs, lt_of_le_of_lt ?_ μv⟩, ⟨xv, xs⟩, inter_subset_right⟩
exact measure_mono inter_subset_left
/-- A measure `μ` is finite on compacts if any compact set `K` satisfies `μ K < ∞`. -/
class IsFiniteMeasureOnCompacts [TopologicalSpace α] (μ : Measure α) : Prop where
protected lt_top_of_isCompact : ∀ ⦃K : Set α⦄, IsCompact K → μ K < ∞
/-- A compact subset has finite measure for a measure which is finite on compacts. -/
theorem _root_.IsCompact.measure_lt_top [TopologicalSpace α] {μ : Measure α}
[IsFiniteMeasureOnCompacts μ] ⦃K : Set α⦄ (hK : IsCompact K) : μ K < ∞ :=
IsFiniteMeasureOnCompacts.lt_top_of_isCompact hK
/-- A compact subset has finite measure for a measure which is finite on compacts. -/
theorem _root_.IsCompact.measure_ne_top [TopologicalSpace α] {μ : Measure α}
[IsFiniteMeasureOnCompacts μ] ⦃K : Set α⦄ (hK : IsCompact K) : μ K ≠ ∞ :=
hK.measure_lt_top.ne
/-- A bounded subset has finite measure for a measure which is finite on compact sets, in a
proper space. -/
theorem _root_.Bornology.IsBounded.measure_lt_top [PseudoMetricSpace α] [ProperSpace α]
{μ : Measure α} [IsFiniteMeasureOnCompacts μ] ⦃s : Set α⦄ (hs : Bornology.IsBounded s) :
μ s < ∞ :=
calc
μ s ≤ μ (closure s) := measure_mono subset_closure
_ < ∞ := (Metric.isCompact_of_isClosed_isBounded isClosed_closure hs.closure).measure_lt_top
theorem measure_closedBall_lt_top [PseudoMetricSpace α] [ProperSpace α] {μ : Measure α}
[IsFiniteMeasureOnCompacts μ] {x : α} {r : ℝ} : μ (Metric.closedBall x r) < ∞ :=
Metric.isBounded_closedBall.measure_lt_top
@[aesop (rule_sets := [finiteness]) safe apply]
theorem measure_ball_ne_top [PseudoMetricSpace α] [ProperSpace α] {μ : Measure α}
[IsFiniteMeasureOnCompacts μ] {x : α} {r : ℝ} : μ (Metric.ball x r) ≠ ∞ :=
Metric.isBounded_ball.measure_lt_top.ne
theorem measure_ball_lt_top [PseudoMetricSpace α] [ProperSpace α] {μ : Measure α}
[IsFiniteMeasureOnCompacts μ] {x : α} {r : ℝ} : μ (Metric.ball x r) < ∞ := by finiteness
protected theorem IsFiniteMeasureOnCompacts.smul [TopologicalSpace α] (μ : Measure α)
[IsFiniteMeasureOnCompacts μ] {c : ℝ≥0∞} (hc : c ≠ ∞) : IsFiniteMeasureOnCompacts (c • μ) :=
⟨fun _K hK => ENNReal.mul_lt_top hc.lt_top hK.measure_lt_top⟩
instance IsFiniteMeasureOnCompacts.smul_nnreal [TopologicalSpace α] (μ : Measure α)
[IsFiniteMeasureOnCompacts μ] (c : ℝ≥0) : IsFiniteMeasureOnCompacts (c • μ) :=
IsFiniteMeasureOnCompacts.smul μ coe_ne_top
instance instIsFiniteMeasureOnCompactsRestrict [TopologicalSpace α] {μ : Measure α}
[IsFiniteMeasureOnCompacts μ] {s : Set α} : IsFiniteMeasureOnCompacts (μ.restrict s) :=
⟨fun _k hk ↦ (restrict_apply_le _ _).trans_lt hk.measure_lt_top⟩
variable {mβ} in
protected theorem IsFiniteMeasureOnCompacts.comap' [TopologicalSpace α] [TopologicalSpace β]
(μ : Measure β) [IsFiniteMeasureOnCompacts μ] {f : α → β} (f_cont : Continuous f)
(f_me : MeasurableEmbedding f) : IsFiniteMeasureOnCompacts (μ.comap f) where
lt_top_of_isCompact K hK := by
rw [f_me.comap_apply]
exact IsFiniteMeasureOnCompacts.lt_top_of_isCompact (hK.image f_cont)
instance (priority := 100) CompactSpace.isFiniteMeasure [TopologicalSpace α] [CompactSpace α]
[IsFiniteMeasureOnCompacts μ] : IsFiniteMeasure μ :=
⟨IsFiniteMeasureOnCompacts.lt_top_of_isCompact isCompact_univ⟩
/-- A measure which is finite on compact sets in a locally compact space is locally finite. -/
instance (priority := 100) isLocallyFiniteMeasure_of_isFiniteMeasureOnCompacts [TopologicalSpace α]
[WeaklyLocallyCompactSpace α] [IsFiniteMeasureOnCompacts μ] : IsLocallyFiniteMeasure μ :=
⟨fun x ↦
let ⟨K, K_compact, K_mem⟩ := exists_compact_mem_nhds x
⟨K, K_mem, K_compact.measure_lt_top⟩⟩
theorem exists_pos_measure_of_cover [Countable ι] {U : ι → Set α} (hU : ⋃ i, U i = univ)
(hμ : μ ≠ 0) : ∃ i, 0 < μ (U i) := by
contrapose! hμ with H
rw [← measure_univ_eq_zero, ← hU]
exact measure_iUnion_null fun i => nonpos_iff_eq_zero.1 (H i)
theorem exists_pos_preimage_ball [PseudoMetricSpace δ] (f : α → δ) (x : δ) (hμ : μ ≠ 0) :
∃ n : ℕ, 0 < μ (f ⁻¹' Metric.ball x n) :=
exists_pos_measure_of_cover (by rw [← preimage_iUnion, Metric.iUnion_ball_nat, preimage_univ]) hμ
theorem exists_pos_ball [PseudoMetricSpace α] (x : α) (hμ : μ ≠ 0) :
∃ n : ℕ, 0 < μ (Metric.ball x n) :=
exists_pos_preimage_ball id x hμ
/-- If a set has zero measure in a neighborhood of each of its points, then it has zero measure
in a second-countable space. -/
theorem exists_ne_forall_mem_nhds_pos_measure_preimage {β} [TopologicalSpace β] [T1Space β]
[SecondCountableTopology β] [Nonempty β] {f : α → β} (h : ∀ b, ∃ᵐ x ∂μ, f x ≠ b) :
∃ a b : β, a ≠ b ∧ (∀ s ∈ 𝓝 a, 0 < μ (f ⁻¹' s)) ∧ ∀ t ∈ 𝓝 b, 0 < μ (f ⁻¹' t) := by
-- We use an `OuterMeasure` so that the proof works without `Measurable f`
set m : OuterMeasure β := OuterMeasure.map f μ.toOuterMeasure
replace h : ∀ b : β, m {b}ᶜ ≠ 0 := fun b => not_eventually.mpr (h b)
inhabit β
have : m univ ≠ 0 := ne_bot_of_le_ne_bot (h default) (measure_mono <| subset_univ _)
rcases exists_mem_forall_mem_nhdsWithin_pos_measure this with ⟨b, -, hb⟩
simp only [nhdsWithin_univ] at hb
rcases exists_mem_forall_mem_nhdsWithin_pos_measure (h b) with ⟨a, hab : a ≠ b, ha⟩
simp only [isOpen_compl_singleton.nhdsWithin_eq hab] at ha
exact ⟨a, b, hab, ha, hb⟩
/-- If two finite measures give the same mass to the whole space and coincide on a π-system made
of measurable sets, then they coincide on all sets in the σ-algebra generated by the π-system. -/
theorem ext_on_measurableSpace_of_generate_finite {α} (m₀ : MeasurableSpace α) {μ ν : Measure α}
[IsFiniteMeasure μ] (C : Set (Set α)) (hμν : ∀ s ∈ C, μ s = ν s) {m : MeasurableSpace α}
(h : m ≤ m₀) (hA : m = MeasurableSpace.generateFrom C) (hC : IsPiSystem C)
(h_univ : μ Set.univ = ν Set.univ) {s : Set α} (hs : MeasurableSet[m] s) : μ s = ν s := by
haveI : IsFiniteMeasure ν := by
constructor
rw [← h_univ]
apply IsFiniteMeasure.measure_univ_lt_top
induction s, hs using induction_on_inter hA hC with
| empty => simp
| basic t ht => exact hμν t ht
| compl t htm iht =>
rw [measure_compl (h t htm) (by finiteness), measure_compl (h t htm) (by finiteness), iht,
h_univ]
| iUnion f hfd hfm ihf =>
simp [measure_iUnion, hfd, h _ (hfm _), ihf]
/-- Two finite measures are equal if they are equal on the π-system generating the σ-algebra
(and `univ`). -/
theorem ext_of_generate_finite (C : Set (Set α)) (hA : m0 = generateFrom C) (hC : IsPiSystem C)
[IsFiniteMeasure μ] (hμν : ∀ s ∈ C, μ s = ν s) (h_univ : μ univ = ν univ) : μ = ν :=
Measure.ext fun _s hs =>
ext_on_measurableSpace_of_generate_finite m0 C hμν le_rfl hA hC h_univ hs
namespace Measure
namespace FiniteAtFilter
variable {f g : Filter α}
theorem filter_mono (h : f ≤ g) : μ.FiniteAtFilter g → μ.FiniteAtFilter f := fun ⟨s, hs, hμ⟩ =>
⟨s, h hs, hμ⟩
theorem inf_of_left (h : μ.FiniteAtFilter f) : μ.FiniteAtFilter (f ⊓ g) :=
h.filter_mono inf_le_left
theorem inf_of_right (h : μ.FiniteAtFilter g) : μ.FiniteAtFilter (f ⊓ g) :=
h.filter_mono inf_le_right
@[simp]
theorem inf_ae_iff : μ.FiniteAtFilter (f ⊓ ae μ) ↔ μ.FiniteAtFilter f := by
refine ⟨?_, fun h => h.filter_mono inf_le_left⟩
rintro ⟨s, ⟨t, ht, u, hu, rfl⟩, hμ⟩
suffices μ t ≤ μ (t ∩ u) from ⟨t, ht, this.trans_lt hμ⟩
exact measure_mono_ae (mem_of_superset hu fun x hu ht => ⟨ht, hu⟩)
alias ⟨of_inf_ae, _⟩ := inf_ae_iff
theorem filter_mono_ae (h : f ⊓ (ae μ) ≤ g) (hg : μ.FiniteAtFilter g) : μ.FiniteAtFilter f :=
inf_ae_iff.1 (hg.filter_mono h)
protected theorem measure_mono (h : μ ≤ ν) : ν.FiniteAtFilter f → μ.FiniteAtFilter f :=
fun ⟨s, hs, hν⟩ => ⟨s, hs, (Measure.le_iff'.1 h s).trans_lt hν⟩
@[mono]
protected theorem mono (hf : f ≤ g) (hμ : μ ≤ ν) : ν.FiniteAtFilter g → μ.FiniteAtFilter f :=
fun h => (h.filter_mono hf).measure_mono hμ
protected theorem eventually (h : μ.FiniteAtFilter f) : ∀ᶠ s in f.smallSets, μ s < ∞ :=
(eventually_smallSets' fun _s _t hst ht => (measure_mono hst).trans_lt ht).2 h
theorem filterSup : μ.FiniteAtFilter f → μ.FiniteAtFilter g → μ.FiniteAtFilter (f ⊔ g) :=
fun ⟨s, hsf, hsμ⟩ ⟨t, htg, htμ⟩ =>
⟨s ∪ t, union_mem_sup hsf htg, (measure_union_le s t).trans_lt (ENNReal.add_lt_top.2 ⟨hsμ, htμ⟩)⟩
end FiniteAtFilter
theorem finiteAt_nhdsWithin [TopologicalSpace α] {_m0 : MeasurableSpace α} (μ : Measure α)
[IsLocallyFiniteMeasure μ] (x : α) (s : Set α) : μ.FiniteAtFilter (𝓝[s] x) :=
(finiteAt_nhds μ x).inf_of_left
@[simp]
theorem finiteAt_principal : μ.FiniteAtFilter (𝓟 s) ↔ μ s < ∞ :=
⟨fun ⟨_t, ht, hμ⟩ => (measure_mono ht).trans_lt hμ, fun h => ⟨s, mem_principal_self s, h⟩⟩
theorem isLocallyFiniteMeasure_of_le [TopologicalSpace α] {_m : MeasurableSpace α} {μ ν : Measure α}
[H : IsLocallyFiniteMeasure μ] (h : ν ≤ μ) : IsLocallyFiniteMeasure ν :=
let F := H.finiteAtNhds
⟨fun x => (F x).measure_mono h⟩
end Measure
end MeasureTheory
namespace IsCompact
variable [TopologicalSpace α] [MeasurableSpace α] {μ : Measure α} {s : Set α}
/-- If `s` is a compact set and `μ` is finite at `𝓝 x` for every `x ∈ s`, then `s` admits an open
superset of finite measure. -/
theorem exists_open_superset_measure_lt_top' (h : IsCompact s)
(hμ : ∀ x ∈ s, μ.FiniteAtFilter (𝓝 x)) : ∃ U ⊇ s, IsOpen U ∧ μ U < ∞ := by
refine IsCompact.induction_on h ?_ ?_ ?_ ?_
· use ∅
simp [Superset]
· rintro s t hst ⟨U, htU, hUo, hU⟩
exact ⟨U, hst.trans htU, hUo, hU⟩
· rintro s t ⟨U, hsU, hUo, hU⟩ ⟨V, htV, hVo, hV⟩
refine
⟨U ∪ V, union_subset_union hsU htV, hUo.union hVo,
(measure_union_le _ _).trans_lt <| ENNReal.add_lt_top.2 ⟨hU, hV⟩⟩
· intro x hx
rcases (hμ x hx).exists_mem_basis (nhds_basis_opens _) with ⟨U, ⟨hx, hUo⟩, hU⟩
exact ⟨U, nhdsWithin_le_nhds (hUo.mem_nhds hx), U, Subset.rfl, hUo, hU⟩
/-- If `s` is a compact set and `μ` is a locally finite measure, then `s` admits an open superset of
finite measure. -/
theorem exists_open_superset_measure_lt_top (h : IsCompact s) (μ : Measure α)
[IsLocallyFiniteMeasure μ] : ∃ U ⊇ s, IsOpen U ∧ μ U < ∞ :=
h.exists_open_superset_measure_lt_top' fun x _ => μ.finiteAt_nhds x
theorem measure_lt_top_of_nhdsWithin (h : IsCompact s) (hμ : ∀ x ∈ s, μ.FiniteAtFilter (𝓝[s] x)) :
μ s < ∞ :=
IsCompact.induction_on h (by simp) (fun _ _ hst ht => (measure_mono hst).trans_lt ht)
(fun s t hs ht => (measure_union_le s t).trans_lt (ENNReal.add_lt_top.2 ⟨hs, ht⟩)) hμ
theorem measure_zero_of_nhdsWithin (hs : IsCompact s) :
(∀ a ∈ s, ∃ t ∈ 𝓝[s] a, μ t = 0) → μ s = 0 := by
simpa only [← compl_mem_ae_iff] using hs.compl_mem_sets_of_nhdsWithin
end IsCompact
-- see Note [lower instance priority]
instance (priority := 100) isFiniteMeasureOnCompacts_of_isLocallyFiniteMeasure [TopologicalSpace α]
{_ : MeasurableSpace α} {μ : Measure α} [IsLocallyFiniteMeasure μ] :
IsFiniteMeasureOnCompacts μ :=
⟨fun _s hs => hs.measure_lt_top_of_nhdsWithin fun _ _ => μ.finiteAt_nhdsWithin _ _⟩
theorem isFiniteMeasure_iff_isFiniteMeasureOnCompacts_of_compactSpace [TopologicalSpace α]
[MeasurableSpace α] {μ : Measure α} [CompactSpace α] :
IsFiniteMeasure μ ↔ IsFiniteMeasureOnCompacts μ := by
constructor <;> intros
· infer_instance
· exact CompactSpace.isFiniteMeasure
/-- Compact covering of a `σ`-compact topological space as
`MeasureTheory.Measure.FiniteSpanningSetsIn`. -/
def MeasureTheory.Measure.finiteSpanningSetsInCompact [TopologicalSpace α] [SigmaCompactSpace α]
{_ : MeasurableSpace α} (μ : Measure α) [IsLocallyFiniteMeasure μ] :
μ.FiniteSpanningSetsIn { K | IsCompact K } where
set := compactCovering α
set_mem := isCompact_compactCovering α
finite n := (isCompact_compactCovering α n).measure_lt_top
spanning := iUnion_compactCovering α
/-- A locally finite measure on a `σ`-compact topological space admits a finite spanning sequence
of open sets. -/
def MeasureTheory.Measure.finiteSpanningSetsInOpen [TopologicalSpace α] [SigmaCompactSpace α]
{_ : MeasurableSpace α} (μ : Measure α) [IsLocallyFiniteMeasure μ] :
μ.FiniteSpanningSetsIn { K | IsOpen K } where
set n := ((isCompact_compactCovering α n).exists_open_superset_measure_lt_top μ).choose
set_mem n :=
((isCompact_compactCovering α n).exists_open_superset_measure_lt_top μ).choose_spec.2.1
finite n :=
((isCompact_compactCovering α n).exists_open_superset_measure_lt_top μ).choose_spec.2.2
spanning :=
eq_univ_of_subset
(iUnion_mono fun n =>
((isCompact_compactCovering α n).exists_open_superset_measure_lt_top μ).choose_spec.1)
(iUnion_compactCovering α)
open TopologicalSpace
/-- A locally finite measure on a second countable topological space admits a finite spanning
sequence of open sets. -/
noncomputable irreducible_def MeasureTheory.Measure.finiteSpanningSetsInOpen' [TopologicalSpace α]
[SecondCountableTopology α] {m : MeasurableSpace α} (μ : Measure α) [IsLocallyFiniteMeasure μ] :
μ.FiniteSpanningSetsIn { K | IsOpen K } := by
suffices H : Nonempty (μ.FiniteSpanningSetsIn { K | IsOpen K }) from H.some
cases isEmpty_or_nonempty α
· exact
⟨{ set := fun _ => ∅
set_mem := fun _ => by simp
finite := fun _ => by simp
spanning := by simp [eq_iff_true_of_subsingleton] }⟩
inhabit α
let S : Set (Set α) := { s | IsOpen s ∧ μ s < ∞ }
obtain ⟨T, T_count, TS, hT⟩ : ∃ T : Set (Set α), T.Countable ∧ T ⊆ S ∧ ⋃₀ T = ⋃₀ S :=
isOpen_sUnion_countable S fun s hs => hs.1
rw [μ.isTopologicalBasis_isOpen_lt_top.sUnion_eq] at hT
have T_ne : T.Nonempty := by
by_contra h'T
rw [not_nonempty_iff_eq_empty.1 h'T, sUnion_empty] at hT
simpa only [← hT] using mem_univ (default : α)
obtain ⟨f, hf⟩ : ∃ f : ℕ → Set α, T = range f := T_count.exists_eq_range T_ne
have fS : ∀ n, f n ∈ S := by
intro n
apply TS
rw [hf]
exact mem_range_self n
refine
⟨{ set := f
set_mem := fun n => (fS n).1
finite := fun n => (fS n).2
spanning := ?_ }⟩
refine eq_univ_of_forall fun x => ?_
obtain ⟨t, tT, xt⟩ : ∃ t : Set α, t ∈ range f ∧ x ∈ t := by
have : x ∈ ⋃₀ T := by simp only [hT, mem_univ]
simpa only [mem_sUnion, exists_prop, ← hf]
obtain ⟨n, rfl⟩ : ∃ n : ℕ, f n = t := by simpa only using tT
exact mem_iUnion_of_mem _ xt
section MeasureIxx
variable [Preorder α] [TopologicalSpace α] [CompactIccSpace α] {m : MeasurableSpace α}
{μ : Measure α} [IsLocallyFiniteMeasure μ] {a b : α}
theorem measure_Icc_lt_top : μ (Icc a b) < ∞ :=
isCompact_Icc.measure_lt_top
theorem measure_Ico_lt_top : μ (Ico a b) < ∞ :=
(measure_mono Ico_subset_Icc_self).trans_lt measure_Icc_lt_top
theorem measure_Ioc_lt_top : μ (Ioc a b) < ∞ :=
(measure_mono Ioc_subset_Icc_self).trans_lt measure_Icc_lt_top
theorem measure_Ioo_lt_top : μ (Ioo a b) < ∞ :=
(measure_mono Ioo_subset_Icc_self).trans_lt measure_Icc_lt_top
end MeasureIxx |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Typeclasses/NoAtoms.lean | import Mathlib.MeasureTheory.Measure.Restrict
/-!
# Measures having no atoms
A measure `μ` has no atoms if the measure of each singleton is zero.
## TODO
Should `NoAtoms` be redefined as `∀ s, 0 < μ s → ∃ t ⊆ s, 0 < μ t ∧ μ t < μ s`?
-/
namespace MeasureTheory
open Set Measure
variable {α : Type*} {m0 : MeasurableSpace α} {μ : Measure α} {s : Set α}
/-- Measure `μ` *has no atoms* if the measure of each singleton is zero.
NB: Wikipedia assumes that for any measurable set `s` with positive `μ`-measure,
there exists a measurable `t ⊆ s` such that `0 < μ t < μ s`. While this implies `μ {x} = 0`,
the converse is not true. -/
class NoAtoms {m0 : MeasurableSpace α} (μ : Measure α) : Prop where
measure_singleton : ∀ x, μ {x} = 0
export MeasureTheory.NoAtoms (measure_singleton)
attribute [simp] measure_singleton
variable [NoAtoms μ]
theorem _root_.Set.Subsingleton.measure_zero (hs : s.Subsingleton) (μ : Measure α) [NoAtoms μ] :
μ s = 0 :=
hs.induction_on (p := fun s => μ s = 0) measure_empty measure_singleton
theorem Measure.restrict_singleton' {a : α} : μ.restrict {a} = 0 := by
simp only [measure_singleton, Measure.restrict_eq_zero]
instance Measure.restrict.instNoAtoms (s : Set α) : NoAtoms (μ.restrict s) := by
refine ⟨fun x => ?_⟩
obtain ⟨t, hxt, ht1, ht2⟩ := exists_measurable_superset_of_null (measure_singleton x : μ {x} = 0)
apply measure_mono_null hxt
rw [Measure.restrict_apply ht1]
apply measure_mono_null inter_subset_left ht2
theorem _root_.Set.Countable.measure_zero (h : s.Countable) (μ : Measure α) [NoAtoms μ] :
μ s = 0 := by
rw [← biUnion_of_singleton s, measure_biUnion_null_iff h]
simp
theorem _root_.Set.Countable.ae_notMem (h : s.Countable) (μ : Measure α) [NoAtoms μ] :
∀ᵐ x ∂μ, x ∉ s := by
simpa only [ae_iff, Classical.not_not] using h.measure_zero μ
@[deprecated (since := "2025-05-23")]
alias _root_.Set.Countable.ae_not_mem := _root_.Set.Countable.ae_notMem
lemma _root_.Set.Countable.measure_restrict_compl (h : s.Countable) (μ : Measure α) [NoAtoms μ] :
μ.restrict sᶜ = μ :=
restrict_eq_self_of_ae_mem <| h.ae_notMem μ
@[simp]
lemma restrict_compl_singleton (a : α) : μ.restrict ({a}ᶜ) = μ :=
(countable_singleton _).measure_restrict_compl μ
theorem _root_.Set.Finite.measure_zero (h : s.Finite) (μ : Measure α) [NoAtoms μ] : μ s = 0 :=
h.countable.measure_zero μ
theorem _root_.Finset.measure_zero (s : Finset α) (μ : Measure α) [NoAtoms μ] : μ s = 0 :=
s.finite_toSet.measure_zero μ
theorem insert_ae_eq_self (a : α) (s : Set α) : (insert a s : Set α) =ᵐ[μ] s :=
union_ae_eq_right.2 <| measure_mono_null diff_subset (measure_singleton _)
section
variable [PartialOrder α] {a b : α}
theorem Iio_ae_eq_Iic : Iio a =ᵐ[μ] Iic a :=
Iio_ae_eq_Iic' (measure_singleton a)
theorem Ioi_ae_eq_Ici : Ioi a =ᵐ[μ] Ici a :=
Ioi_ae_eq_Ici' (measure_singleton a)
theorem Ioo_ae_eq_Ioc : Ioo a b =ᵐ[μ] Ioc a b :=
Ioo_ae_eq_Ioc' (measure_singleton b)
theorem Ioc_ae_eq_Icc : Ioc a b =ᵐ[μ] Icc a b :=
Ioc_ae_eq_Icc' (measure_singleton a)
theorem Ioo_ae_eq_Ico : Ioo a b =ᵐ[μ] Ico a b :=
Ioo_ae_eq_Ico' (measure_singleton a)
theorem Ioo_ae_eq_Icc : Ioo a b =ᵐ[μ] Icc a b :=
Ioo_ae_eq_Icc' (measure_singleton a) (measure_singleton b)
theorem Ico_ae_eq_Icc : Ico a b =ᵐ[μ] Icc a b :=
Ico_ae_eq_Icc' (measure_singleton b)
theorem Ico_ae_eq_Ioc : Ico a b =ᵐ[μ] Ioc a b :=
Ico_ae_eq_Ioc' (measure_singleton a) (measure_singleton b)
theorem restrict_Iio_eq_restrict_Iic : μ.restrict (Iio a) = μ.restrict (Iic a) :=
restrict_congr_set Iio_ae_eq_Iic
theorem restrict_Ioi_eq_restrict_Ici : μ.restrict (Ioi a) = μ.restrict (Ici a) :=
restrict_congr_set Ioi_ae_eq_Ici
theorem restrict_Ioo_eq_restrict_Ioc : μ.restrict (Ioo a b) = μ.restrict (Ioc a b) :=
restrict_congr_set Ioo_ae_eq_Ioc
theorem restrict_Ioc_eq_restrict_Icc : μ.restrict (Ioc a b) = μ.restrict (Icc a b) :=
restrict_congr_set Ioc_ae_eq_Icc
theorem restrict_Ioo_eq_restrict_Ico : μ.restrict (Ioo a b) = μ.restrict (Ico a b) :=
restrict_congr_set Ioo_ae_eq_Ico
theorem restrict_Ioo_eq_restrict_Icc : μ.restrict (Ioo a b) = μ.restrict (Icc a b) :=
restrict_congr_set Ioo_ae_eq_Icc
theorem restrict_Ico_eq_restrict_Icc : μ.restrict (Ico a b) = μ.restrict (Icc a b) :=
restrict_congr_set Ico_ae_eq_Icc
theorem restrict_Ico_eq_restrict_Ioc : μ.restrict (Ico a b) = μ.restrict (Ioc a b) :=
restrict_congr_set Ico_ae_eq_Ioc
end
open Interval
open scoped Interval in
theorem uIoc_ae_eq_interval [LinearOrder α] {a b : α} : Ι a b =ᵐ[μ] [[a, b]] :=
Ioc_ae_eq_Icc
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Typeclasses/Probability.lean | import Mathlib.MeasureTheory.Measure.Typeclasses.Finite
import Mathlib.Topology.UnitInterval
/-!
# Classes for probability measures
We introduce the following typeclasses for measures:
* `IsZeroOrProbabilityMeasure μ`: `μ univ = 0 ∨ μ univ = 1`;
* `IsProbabilityMeasure μ`: `μ univ = 1`.
-/
namespace MeasureTheory
open Set Measure Filter Function ENNReal
variable {α β : Type*} {m0 : MeasurableSpace α} [MeasurableSpace β] {μ : Measure α} {s : Set α}
section IsZeroOrProbabilityMeasure
/-- A measure `μ` is zero or a probability measure if `μ univ = 0` or `μ univ = 1`. This class
of measures appears naturally when conditioning on events, and many results which are true for
probability measures hold more generally over this class. -/
class IsZeroOrProbabilityMeasure (μ : Measure α) : Prop where
measure_univ : μ univ = 0 ∨ μ univ = 1
lemma isZeroOrProbabilityMeasure_iff : IsZeroOrProbabilityMeasure μ ↔ μ univ = 0 ∨ μ univ = 1 :=
⟨fun _ ↦ IsZeroOrProbabilityMeasure.measure_univ, IsZeroOrProbabilityMeasure.mk⟩
lemma prob_le_one {μ : Measure α} [IsZeroOrProbabilityMeasure μ] {s : Set α} : μ s ≤ 1 := by
apply (measure_mono (subset_univ _)).trans
rcases IsZeroOrProbabilityMeasure.measure_univ (μ := μ) with h | h <;> simp [h]
lemma measureReal_le_one {μ : Measure α} [IsZeroOrProbabilityMeasure μ] {s : Set α} :
μ.real s ≤ 1 :=
ENNReal.toReal_le_of_le_ofReal zero_le_one (ENNReal.ofReal_one.symm ▸ prob_le_one)
@[simp]
theorem one_le_prob_iff {μ : Measure α} [IsZeroOrProbabilityMeasure μ] : 1 ≤ μ s ↔ μ s = 1 :=
⟨fun h => le_antisymm prob_le_one h, fun h => h ▸ le_refl _⟩
instance (priority := 100) IsZeroOrProbabilityMeasure.toIsFiniteMeasure (μ : Measure α)
[IsZeroOrProbabilityMeasure μ] : IsFiniteMeasure μ :=
⟨prob_le_one.trans_lt one_lt_top⟩
instance : IsZeroOrProbabilityMeasure (0 : Measure α) :=
⟨Or.inl rfl⟩
end IsZeroOrProbabilityMeasure
section IsProbabilityMeasure
/-- A measure `μ` is called a probability measure if `μ univ = 1`. -/
class IsProbabilityMeasure (μ : Measure α) : Prop where
measure_univ : μ univ = 1
export MeasureTheory.IsProbabilityMeasure (measure_univ)
attribute [simp] IsProbabilityMeasure.measure_univ
lemma isProbabilityMeasure_iff : IsProbabilityMeasure μ ↔ μ univ = 1 :=
⟨fun _ ↦ measure_univ, IsProbabilityMeasure.mk⟩
instance (priority := 100) (μ : Measure α) [IsProbabilityMeasure μ] :
IsZeroOrProbabilityMeasure μ :=
⟨Or.inr measure_univ⟩
theorem IsProbabilityMeasure.ne_zero (μ : Measure α) [IsProbabilityMeasure μ] : μ ≠ 0 :=
mt measure_univ_eq_zero.2 <| by simp [measure_univ]
instance (priority := 100) IsProbabilityMeasure.neZero (μ : Measure α) [IsProbabilityMeasure μ] :
NeZero μ := ⟨IsProbabilityMeasure.ne_zero μ⟩
theorem IsProbabilityMeasure.ae_neBot [IsProbabilityMeasure μ] : NeBot (ae μ) := inferInstance
theorem prob_add_prob_compl [IsProbabilityMeasure μ] (h : MeasurableSet s) : μ s + μ sᶜ = 1 :=
(measure_add_measure_compl h).trans measure_univ
instance isProbabilityMeasureSMul [IsFiniteMeasure μ] [NeZero μ] :
IsProbabilityMeasure ((μ univ)⁻¹ • μ) :=
⟨ENNReal.inv_mul_cancel (NeZero.ne (μ univ)) (measure_ne_top _ _)⟩
instance isProbabilityMeasure_dite {p : Prop} [Decidable p] {μ : p → Measure α}
{ν : ¬ p → Measure α} [∀ h, IsProbabilityMeasure (μ h)] [∀ h, IsProbabilityMeasure (ν h)] :
IsProbabilityMeasure (dite p μ ν) := by split <;> infer_instance
instance isProbabilityMeasure_ite {p : Prop} [Decidable p] {μ ν : Measure α}
[IsProbabilityMeasure μ] [IsProbabilityMeasure ν] :
IsProbabilityMeasure (ite p μ ν) := by split <;> infer_instance
open unitInterval in
instance {μ ν : Measure α} [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] {p : I} :
IsProbabilityMeasure (toNNReal p • μ + toNNReal (σ p) • ν) where
measure_univ := by simp [← add_smul]
variable [IsProbabilityMeasure μ] {p : α → Prop} {f : β → α}
theorem Measure.isProbabilityMeasure_map {f : α → β} (hf : AEMeasurable f μ) :
IsProbabilityMeasure (map f μ) :=
⟨by simp [map_apply_of_aemeasurable, hf]⟩
theorem Measure.isProbabilityMeasure_of_map {μ : Measure α} {f : α → β}
(hf : AEMeasurable f μ) [IsProbabilityMeasure (μ.map f)] : IsProbabilityMeasure μ where
measure_univ := by
rw [← Set.preimage_univ (f := f), ← map_apply_of_aemeasurable hf .univ]
exact IsProbabilityMeasure.measure_univ
theorem Measure.isProbabilityMeasure_map_iff {μ : Measure α} {f : α → β}
(hf : AEMeasurable f μ) : IsProbabilityMeasure (μ.map f) ↔ IsProbabilityMeasure μ :=
⟨fun _ ↦ isProbabilityMeasure_of_map hf, fun _ ↦ isProbabilityMeasure_map hf⟩
instance IsProbabilityMeasure_comap_equiv (f : β ≃ᵐ α) : IsProbabilityMeasure (μ.comap f) := by
rw [← MeasurableEquiv.map_symm]; exact isProbabilityMeasure_map f.symm.measurable.aemeasurable
/-- Note that this is not quite as useful as it looks because the measure takes values in `ℝ≥0∞`.
Thus the subtraction appearing is the truncated subtraction of `ℝ≥0∞`, rather than the
better-behaved subtraction of `ℝ`. -/
lemma prob_compl_eq_one_sub₀ (h : NullMeasurableSet s μ) : μ sᶜ = 1 - μ s := by
rw [measure_compl₀ h (measure_ne_top _ _), measure_univ]
/-- Note that this is not quite as useful as it looks because the measure takes values in `ℝ≥0∞`.
Thus the subtraction appearing is the truncated subtraction of `ℝ≥0∞`, rather than the
better-behaved subtraction of `ℝ`. -/
theorem prob_compl_eq_one_sub (hs : MeasurableSet s) : μ sᶜ = 1 - μ s :=
prob_compl_eq_one_sub₀ hs.nullMeasurableSet
@[simp] lemma prob_compl_eq_zero_iff₀ (hs : NullMeasurableSet s μ) : μ sᶜ = 0 ↔ μ s = 1 := by
rw [prob_compl_eq_one_sub₀ hs, tsub_eq_zero_iff_le, one_le_prob_iff]
lemma prob_compl_eq_zero_iff (hs : MeasurableSet s) : μ sᶜ = 0 ↔ μ s = 1 := by
simp [hs]
@[simp] lemma prob_compl_eq_one_iff₀ (hs : NullMeasurableSet s μ) : μ sᶜ = 1 ↔ μ s = 0 := by
rw [← prob_compl_eq_zero_iff₀ hs.compl, compl_compl]
lemma prob_compl_eq_one_iff (hs : MeasurableSet s) : μ sᶜ = 1 ↔ μ s = 0 := by
simp [hs]
lemma mem_ae_iff_prob_eq_one₀ (hs : NullMeasurableSet s μ) : s ∈ ae μ ↔ μ s = 1 :=
mem_ae_iff.trans <| prob_compl_eq_zero_iff₀ hs
lemma mem_ae_iff_prob_eq_one (hs : MeasurableSet s) : s ∈ ae μ ↔ μ s = 1 :=
mem_ae_iff.trans <| prob_compl_eq_zero_iff hs
lemma ae_iff_prob_eq_one (hp : Measurable p) : (∀ᵐ a ∂μ, p a) ↔ μ {a | p a} = 1 :=
mem_ae_iff_prob_eq_one hp.setOf
lemma isProbabilityMeasure_comap (hf : Injective f) (hf' : ∀ᵐ a ∂μ, a ∈ range f)
(hf'' : ∀ s, MeasurableSet s → MeasurableSet (f '' s)) :
IsProbabilityMeasure (μ.comap f) where
measure_univ := by
rw [comap_apply _ hf hf'' _ MeasurableSet.univ,
← mem_ae_iff_prob_eq_one (hf'' _ MeasurableSet.univ)]
simpa
protected lemma _root_.MeasurableEmbedding.isProbabilityMeasure_comap (hf : MeasurableEmbedding f)
(hf' : ∀ᵐ a ∂μ, a ∈ range f) : IsProbabilityMeasure (μ.comap f) :=
isProbabilityMeasure_comap hf.injective hf' hf.measurableSet_image'
instance isProbabilityMeasure_map_up :
IsProbabilityMeasure (μ.map ULift.up) := isProbabilityMeasure_map measurable_up.aemeasurable
instance isProbabilityMeasure_comap_down : IsProbabilityMeasure (μ.comap ULift.down) :=
MeasurableEquiv.ulift.measurableEmbedding.isProbabilityMeasure_comap <| ae_of_all _ <| by
simp [Function.Surjective.range_eq <| EquivLike.surjective _]
lemma Measure.eq_of_le_of_isProbabilityMeasure {μ ν : Measure α}
[IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (hμν : μ ≤ ν) : μ = ν :=
eq_of_le_of_measure_univ_eq hμν (by simp)
end IsProbabilityMeasure
section IsZeroOrProbabilityMeasure
instance isZeroOrProbabilityMeasureSMul :
IsZeroOrProbabilityMeasure ((μ univ)⁻¹ • μ) := by
rcases eq_zero_or_neZero μ with rfl | h
· simp; infer_instance
rcases eq_top_or_lt_top (μ univ) with h | h
· simp [h]; infer_instance
have : IsFiniteMeasure μ := ⟨h⟩
infer_instance
variable [IsZeroOrProbabilityMeasure μ] {p : α → Prop} {f : β → α}
variable (μ) in
lemma eq_zero_or_isProbabilityMeasure : μ = 0 ∨ IsProbabilityMeasure μ := by
rcases IsZeroOrProbabilityMeasure.measure_univ (μ := μ) with h | h
· apply Or.inl (measure_univ_eq_zero.mp h)
· exact Or.inr ⟨h⟩
instance {f : α → β} : IsZeroOrProbabilityMeasure (map f μ) := by
by_cases hf : AEMeasurable f μ
· simpa [isZeroOrProbabilityMeasure_iff, hf] using IsZeroOrProbabilityMeasure.measure_univ
· simp [isZeroOrProbabilityMeasure_iff, hf]
lemma prob_compl_lt_one_sub_of_lt_prob {p : ℝ≥0∞} (hμs : p < μ s) (s_mble : MeasurableSet s) :
μ sᶜ < 1 - p := by
rcases eq_zero_or_isProbabilityMeasure μ with rfl | h
· simp at hμs
· rw [prob_compl_eq_one_sub s_mble]
apply ENNReal.sub_lt_of_sub_lt prob_le_one (Or.inl one_ne_top)
convert hμs
exact ENNReal.sub_sub_cancel one_ne_top (lt_of_lt_of_le hμs prob_le_one).le
lemma prob_compl_le_one_sub_of_le_prob {p : ℝ≥0∞} (hμs : p ≤ μ s) (s_mble : MeasurableSet s) :
μ sᶜ ≤ 1 - p := by
rcases eq_zero_or_isProbabilityMeasure μ with rfl | h
· simp
· simpa [prob_compl_eq_one_sub s_mble] using tsub_le_tsub_left hμs 1
@[simp]
lemma inv_measure_univ_smul_eq_self : (μ univ)⁻¹ • μ = μ := by
rcases eq_zero_or_isProbabilityMeasure μ with h | h <;> simp [h]
end IsZeroOrProbabilityMeasure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Typeclasses/SFinite.lean | import Mathlib.MeasureTheory.Measure.Typeclasses.Finite
/-!
# Classes for s-finite measures
We introduce the following typeclasses for measures:
* `SFinite μ`: the measure `μ` can be written as a countable sum of finite measures;
* `SigmaFinite μ`: there exists a countable collection of sets that cover `univ`
where `μ` is finite.
-/
namespace MeasureTheory
open Set Filter Function Measure MeasurableSpace NNReal ENNReal
variable {α β ι : Type*} {m0 : MeasurableSpace α} [MeasurableSpace β] {μ ν : Measure α}
{s t : Set α} {a : α}
section SFinite
/-- A measure is called s-finite if it is a countable sum of finite measures. -/
class SFinite (μ : Measure α) : Prop where
out' : ∃ m : ℕ → Measure α, (∀ n, IsFiniteMeasure (m n)) ∧ μ = Measure.sum m
/-- A sequence of finite measures such that `μ = sum (sfiniteSeq μ)` (see `sum_sfiniteSeq`). -/
noncomputable def sfiniteSeq (μ : Measure α) [h : SFinite μ] : ℕ → Measure α := h.1.choose
instance isFiniteMeasure_sfiniteSeq [h : SFinite μ] (n : ℕ) : IsFiniteMeasure (sfiniteSeq μ n) :=
h.1.choose_spec.1 n
lemma sum_sfiniteSeq (μ : Measure α) [h : SFinite μ] : sum (sfiniteSeq μ) = μ :=
h.1.choose_spec.2.symm
lemma sfiniteSeq_le (μ : Measure α) [SFinite μ] (n : ℕ) : sfiniteSeq μ n ≤ μ :=
(le_sum _ n).trans (sum_sfiniteSeq μ).le
instance : SFinite (0 : Measure α) := ⟨fun _ ↦ 0, inferInstance, by rw [Measure.sum_zero]⟩
@[simp]
lemma sfiniteSeq_zero (n : ℕ) : sfiniteSeq (0 : Measure α) n = 0 :=
bot_unique <| sfiniteSeq_le _ _
/-- A countable sum of finite measures is s-finite.
This lemma is superseded by the instance below. -/
lemma sfinite_sum_of_countable [Countable ι]
(m : ι → Measure α) [∀ n, IsFiniteMeasure (m n)] : SFinite (Measure.sum m) := by
classical
obtain ⟨f, hf⟩ : ∃ f : ι → ℕ, Function.Injective f := Countable.exists_injective_nat ι
refine ⟨_, fun n ↦ ?_, (sum_extend_zero hf m).symm⟩
rcases em (n ∈ range f) with ⟨i, rfl⟩ | hn
· rw [hf.extend_apply]
infer_instance
· rw [Function.extend_apply' _ _ _ hn, Pi.zero_apply]
infer_instance
instance [Countable ι] (m : ι → Measure α) [∀ n, SFinite (m n)] : SFinite (Measure.sum m) := by
change SFinite (Measure.sum (fun i ↦ m i))
simp_rw [← sum_sfiniteSeq (m _), Measure.sum_sum]
apply sfinite_sum_of_countable
instance [SFinite μ] [SFinite ν] : SFinite (μ + ν) := by
have : ∀ b : Bool, SFinite (cond b μ ν) := by simp [*]
simpa using inferInstanceAs (SFinite (.sum (cond · μ ν)))
instance [SFinite μ] (s : Set α) : SFinite (μ.restrict s) :=
⟨fun n ↦ (sfiniteSeq μ n).restrict s, fun n ↦ inferInstance,
by rw [← restrict_sum_of_countable, sum_sfiniteSeq]⟩
variable (μ) in
/-- For an s-finite measure `μ`, there exists a finite measure `ν`
such that each of `μ` and `ν` is absolutely continuous with respect to the other.
-/
theorem exists_isFiniteMeasure_absolutelyContinuous [SFinite μ] :
∃ ν : Measure α, IsFiniteMeasure ν ∧ μ ≪ ν ∧ ν ≪ μ := by
rcases ENNReal.exists_pos_tsum_mul_lt_of_countable top_ne_zero (sfiniteSeq μ · univ)
fun _ ↦ measure_ne_top _ _ with ⟨c, hc₀, hc⟩
have {s : Set α} : sum (fun n ↦ c n • sfiniteSeq μ n) s = 0 ↔ μ s = 0 := by
conv_rhs => rw [← sum_sfiniteSeq μ, sum_apply_of_countable]
simp [(hc₀ _).ne']
refine ⟨.sum fun n ↦ c n • sfiniteSeq μ n, ⟨?_⟩, fun _ ↦ this.1, fun _ ↦ this.2⟩
simpa [mul_comm] using hc
end SFinite
/-- A measure `μ` is called σ-finite if there is a countable collection of sets
`{ A i | i ∈ ℕ }` such that `μ (A i) < ∞` and `⋃ i, A i = s`. -/
class SigmaFinite {m0 : MeasurableSpace α} (μ : Measure α) : Prop where
out' : Nonempty (μ.FiniteSpanningSetsIn univ)
theorem sigmaFinite_iff : SigmaFinite μ ↔ Nonempty (μ.FiniteSpanningSetsIn univ) :=
⟨fun h => h.1, fun h => ⟨h⟩⟩
theorem SigmaFinite.out (h : SigmaFinite μ) : Nonempty (μ.FiniteSpanningSetsIn univ) :=
h.1
/-- If `μ` is σ-finite it has finite spanning sets in the collection of all measurable sets. -/
def Measure.toFiniteSpanningSetsIn (μ : Measure α) [h : SigmaFinite μ] :
μ.FiniteSpanningSetsIn { s | MeasurableSet s } where
set n := toMeasurable μ (h.out.some.set n)
set_mem _ := measurableSet_toMeasurable _ _
finite n := by
rw [measure_toMeasurable]
exact h.out.some.finite n
spanning := eq_univ_of_subset (iUnion_mono fun _ => subset_toMeasurable _ _) h.out.some.spanning
/-- A noncomputable way to get a monotone collection of sets that span `univ` and have finite
measure using `Classical.choose`. This definition satisfies monotonicity in addition to all other
properties in `SigmaFinite`. -/
def spanningSets (μ : Measure α) [SigmaFinite μ] (i : ℕ) : Set α :=
Accumulate μ.toFiniteSpanningSetsIn.set i
theorem monotone_spanningSets (μ : Measure α) [SigmaFinite μ] : Monotone (spanningSets μ) :=
monotone_accumulate
@[gcongr]
lemma spanningSets_mono [SigmaFinite μ] {m n : ℕ} (hmn : m ≤ n) :
spanningSets μ m ⊆ spanningSets μ n := monotone_spanningSets _ hmn
theorem measurableSet_spanningSets (μ : Measure α) [SigmaFinite μ] (i : ℕ) :
MeasurableSet (spanningSets μ i) :=
MeasurableSet.iUnion fun j => MeasurableSet.iUnion fun _ => μ.toFiniteSpanningSetsIn.set_mem j
theorem measure_spanningSets_lt_top (μ : Measure α) [SigmaFinite μ] (i : ℕ) :
μ (spanningSets μ i) < ∞ :=
measure_biUnion_lt_top (finite_le_nat i) fun j _ => μ.toFiniteSpanningSetsIn.finite j
@[simp]
theorem iUnion_spanningSets (μ : Measure α) [SigmaFinite μ] : ⋃ i : ℕ, spanningSets μ i = univ := by
simp_rw [spanningSets, iUnion_accumulate, μ.toFiniteSpanningSetsIn.spanning]
theorem isCountablySpanning_spanningSets (μ : Measure α) [SigmaFinite μ] :
IsCountablySpanning (range (spanningSets μ)) :=
⟨spanningSets μ, mem_range_self, iUnion_spanningSets μ⟩
open scoped Classical in
/-- `spanningSetsIndex μ x` is the least `n : ℕ` such that `x ∈ spanningSets μ n`. -/
noncomputable def spanningSetsIndex (μ : Measure α) [SigmaFinite μ] (x : α) : ℕ :=
Nat.find <| iUnion_eq_univ_iff.1 (iUnion_spanningSets μ) x
open scoped Classical in
theorem measurableSet_spanningSetsIndex (μ : Measure α) [SigmaFinite μ] :
Measurable (spanningSetsIndex μ) :=
measurable_find _ <| measurableSet_spanningSets μ
open scoped Classical in
theorem preimage_spanningSetsIndex_singleton (μ : Measure α) [SigmaFinite μ] (n : ℕ) :
spanningSetsIndex μ ⁻¹' {n} = disjointed (spanningSets μ) n :=
preimage_find_eq_disjointed _ _ _
theorem spanningSetsIndex_eq_iff (μ : Measure α) [SigmaFinite μ] {x : α} {n : ℕ} :
spanningSetsIndex μ x = n ↔ x ∈ disjointed (spanningSets μ) n := by
convert Set.ext_iff.1 (preimage_spanningSetsIndex_singleton μ n) x
theorem mem_disjointed_spanningSetsIndex (μ : Measure α) [SigmaFinite μ] (x : α) :
x ∈ disjointed (spanningSets μ) (spanningSetsIndex μ x) :=
(spanningSetsIndex_eq_iff μ).1 rfl
theorem mem_spanningSetsIndex (μ : Measure α) [SigmaFinite μ] (x : α) :
x ∈ spanningSets μ (spanningSetsIndex μ x) :=
disjointed_subset _ _ (mem_disjointed_spanningSetsIndex μ x)
theorem mem_spanningSets_of_index_le (μ : Measure α) [SigmaFinite μ] (x : α) {n : ℕ}
(hn : spanningSetsIndex μ x ≤ n) : x ∈ spanningSets μ n :=
monotone_spanningSets μ hn (mem_spanningSetsIndex μ x)
theorem eventually_mem_spanningSets (μ : Measure α) [SigmaFinite μ] (x : α) :
∀ᶠ n in atTop, x ∈ spanningSets μ n :=
eventually_atTop.2 ⟨spanningSetsIndex μ x, fun _ => mem_spanningSets_of_index_le μ x⟩
lemma measure_singleton_lt_top [SigmaFinite μ] : μ {a} < ∞ :=
measure_lt_top_mono (singleton_subset_iff.2 <| mem_spanningSetsIndex ..)
(measure_spanningSets_lt_top _ _)
theorem sum_restrict_disjointed_spanningSets (μ ν : Measure α) [SigmaFinite ν] :
sum (fun n ↦ μ.restrict (disjointed (spanningSets ν) n)) = μ := by
rw [← restrict_iUnion (disjoint_disjointed _)
(MeasurableSet.disjointed (measurableSet_spanningSets _)),
iUnion_disjointed, iUnion_spanningSets, restrict_univ]
instance (priority := 100) [SigmaFinite μ] : SFinite μ := by
have : ∀ n, Fact (μ (disjointed (spanningSets μ) n) < ∞) :=
fun n ↦ ⟨(measure_mono (disjointed_subset _ _)).trans_lt (measure_spanningSets_lt_top μ n)⟩
exact ⟨⟨fun n ↦ μ.restrict (disjointed (spanningSets μ) n), fun n ↦ by infer_instance,
(sum_restrict_disjointed_spanningSets μ μ).symm⟩⟩
namespace Measure
/-- A set in a σ-finite space has zero measure if and only if its intersection with
all members of the countable family of finite measure spanning sets has zero measure. -/
theorem forall_measure_inter_spanningSets_eq_zero [MeasurableSpace α] {μ : Measure α}
[SigmaFinite μ] (s : Set α) : (∀ n, μ (s ∩ spanningSets μ n) = 0) ↔ μ s = 0 := by
nth_rw 2 [show s = ⋃ n, s ∩ spanningSets μ n by
rw [← inter_iUnion, iUnion_spanningSets, inter_univ] ]
rw [measure_iUnion_null_iff]
/-- A set in a σ-finite space has positive measure if and only if its intersection with
some member of the countable family of finite measure spanning sets has positive measure. -/
theorem exists_measure_inter_spanningSets_pos [MeasurableSpace α] {μ : Measure α} [SigmaFinite μ]
(s : Set α) : (∃ n, 0 < μ (s ∩ spanningSets μ n)) ↔ 0 < μ s := by
rw [← not_iff_not]
simp only [not_exists, not_lt, nonpos_iff_eq_zero]
exact forall_measure_inter_spanningSets_eq_zero s
/-- If the union of a.e.-disjoint null-measurable sets has finite measure, then there are only
finitely many members of the union whose measure exceeds any given positive number. -/
theorem finite_const_le_meas_of_disjoint_iUnion₀ {ι : Type*} [MeasurableSpace α] (μ : Measure α)
{ε : ℝ≥0∞} (ε_pos : 0 < ε) {As : ι → Set α} (As_mble : ∀ i : ι, NullMeasurableSet (As i) μ)
(As_disj : Pairwise (AEDisjoint μ on As)) (Union_As_finite : μ (⋃ i, As i) ≠ ∞) :
Set.Finite { i : ι | ε ≤ μ (As i) } :=
ENNReal.finite_const_le_of_tsum_ne_top
(ne_top_of_le_ne_top Union_As_finite (tsum_meas_le_meas_iUnion_of_disjoint₀ μ As_mble As_disj))
ε_pos.ne'
/-- If the union of disjoint measurable sets has finite measure, then there are only
finitely many members of the union whose measure exceeds any given positive number. -/
theorem finite_const_le_meas_of_disjoint_iUnion {ι : Type*} [MeasurableSpace α] (μ : Measure α)
{ε : ℝ≥0∞} (ε_pos : 0 < ε) {As : ι → Set α} (As_mble : ∀ i : ι, MeasurableSet (As i))
(As_disj : Pairwise (Disjoint on As)) (Union_As_finite : μ (⋃ i, As i) ≠ ∞) :
Set.Finite { i : ι | ε ≤ μ (As i) } :=
finite_const_le_meas_of_disjoint_iUnion₀ μ ε_pos (fun i ↦ (As_mble i).nullMeasurableSet)
(fun _ _ h ↦ Disjoint.aedisjoint (As_disj h)) Union_As_finite
/-- If all elements of an infinite set have measure uniformly separated from zero,
then the set has infinite measure. -/
theorem _root_.Set.Infinite.meas_eq_top [MeasurableSingletonClass α]
{s : Set α} (hs : s.Infinite) (h' : ∃ ε, ε ≠ 0 ∧ ∀ x ∈ s, ε ≤ μ {x}) : μ s = ∞ := top_unique <|
let ⟨ε, hne, hε⟩ := h'; have := hs.to_subtype
calc
∞ = ∑' _ : s, ε := (ENNReal.tsum_const_eq_top_of_ne_zero hne).symm
_ ≤ ∑' x : s, μ {x.1} := ENNReal.tsum_le_tsum fun x ↦ hε x x.2
_ ≤ μ (⋃ x : s, {x.1}) := tsum_meas_le_meas_iUnion_of_disjoint _
(fun _ ↦ MeasurableSet.singleton _) fun x y hne ↦ by simpa [Subtype.val_inj]
_ = μ s := by simp
/-- If the union of a.e.-disjoint null-measurable sets has finite measure, then there are only
countably many members of the union whose measure is positive. -/
theorem countable_meas_pos_of_disjoint_of_meas_iUnion_ne_top₀ {ι : Type*} {_ : MeasurableSpace α}
(μ : Measure α) {As : ι → Set α} (As_mble : ∀ i : ι, NullMeasurableSet (As i) μ)
(As_disj : Pairwise (AEDisjoint μ on As)) (Union_As_finite : μ (⋃ i, As i) ≠ ∞) :
Set.Countable { i : ι | 0 < μ (As i) } := by
set posmeas := { i : ι | 0 < μ (As i) } with posmeas_def
rcases exists_seq_strictAnti_tendsto' (zero_lt_one : (0 : ℝ≥0∞) < 1) with
⟨as, _, as_mem, as_lim⟩
set fairmeas := fun n : ℕ => { i : ι | as n ≤ μ (As i) }
have countable_union : posmeas = ⋃ n, fairmeas n := by
have fairmeas_eq : ∀ n, fairmeas n = (fun i => μ (As i)) ⁻¹' Ici (as n) := fun n => by
simp only [fairmeas]
rfl
simpa only [fairmeas_eq, posmeas_def, ← preimage_iUnion,
iUnion_Ici_eq_Ioi_of_lt_of_tendsto (fun n => (as_mem n).1) as_lim]
rw [countable_union]
refine countable_iUnion fun n => Finite.countable ?_
exact finite_const_le_meas_of_disjoint_iUnion₀ μ (as_mem n).1 As_mble As_disj Union_As_finite
/-- If the union of disjoint measurable sets has finite measure, then there are only
countably many members of the union whose measure is positive. -/
theorem countable_meas_pos_of_disjoint_of_meas_iUnion_ne_top {ι : Type*} {_ : MeasurableSpace α}
(μ : Measure α) {As : ι → Set α} (As_mble : ∀ i : ι, MeasurableSet (As i))
(As_disj : Pairwise (Disjoint on As)) (Union_As_finite : μ (⋃ i, As i) ≠ ∞) :
Set.Countable { i : ι | 0 < μ (As i) } :=
countable_meas_pos_of_disjoint_of_meas_iUnion_ne_top₀ μ (fun i ↦ (As_mble i).nullMeasurableSet)
((fun _ _ h ↦ Disjoint.aedisjoint (As_disj h))) Union_As_finite
/-- In an s-finite space, among disjoint null-measurable sets, only countably many can have positive
measure. -/
theorem countable_meas_pos_of_disjoint_iUnion₀ {ι : Type*} {_ : MeasurableSpace α} {μ : Measure α}
[SFinite μ] {As : ι → Set α} (As_mble : ∀ i : ι, NullMeasurableSet (As i) μ)
(As_disj : Pairwise (AEDisjoint μ on As)) :
Set.Countable { i : ι | 0 < μ (As i) } := by
rw [← sum_sfiniteSeq μ] at As_disj As_mble ⊢
have obs : { i : ι | 0 < sum (sfiniteSeq μ) (As i) }
⊆ ⋃ n, { i : ι | 0 < sfiniteSeq μ n (As i) } := by
intro i hi
by_contra con
simp only [mem_iUnion, mem_setOf_eq, not_exists, not_lt, nonpos_iff_eq_zero] at *
rw [sum_apply₀] at hi
· simp_rw [con] at hi
simp at hi
· exact As_mble i
apply Countable.mono obs
refine countable_iUnion fun n ↦ ?_
apply countable_meas_pos_of_disjoint_of_meas_iUnion_ne_top₀
· exact fun i ↦ (As_mble i).mono (le_sum _ _)
· exact fun i j hij ↦ AEDisjoint.of_le (As_disj hij) (le_sum _ _)
· exact measure_ne_top _ (⋃ i, As i)
/-- In an s-finite space, among disjoint measurable sets, only countably many can have positive
measure. -/
theorem countable_meas_pos_of_disjoint_iUnion {ι : Type*} {_ : MeasurableSpace α} {μ : Measure α}
[SFinite μ] {As : ι → Set α} (As_mble : ∀ i : ι, MeasurableSet (As i))
(As_disj : Pairwise (Disjoint on As)) : Set.Countable { i : ι | 0 < μ (As i) } :=
countable_meas_pos_of_disjoint_iUnion₀ (fun i ↦ (As_mble i).nullMeasurableSet)
((fun _ _ h ↦ Disjoint.aedisjoint (As_disj h)))
theorem countable_meas_level_set_pos₀ {α β : Type*} {_ : MeasurableSpace α} {μ : Measure α}
[SFinite μ] [MeasurableSpace β] [MeasurableSingletonClass β] {g : α → β}
(g_mble : NullMeasurable g μ) : Set.Countable { t : β | 0 < μ { a : α | g a = t } } := by
have level_sets_disjoint : Pairwise (Disjoint on fun t : β => { a : α | g a = t }) :=
fun s t hst => Disjoint.preimage g (disjoint_singleton.mpr hst)
exact Measure.countable_meas_pos_of_disjoint_iUnion₀
(fun b => g_mble (‹MeasurableSingletonClass β›.measurableSet_singleton b))
((fun _ _ h ↦ Disjoint.aedisjoint (level_sets_disjoint h)))
theorem countable_meas_level_set_pos {α β : Type*} {_ : MeasurableSpace α} {μ : Measure α}
[SFinite μ] [MeasurableSpace β] [MeasurableSingletonClass β] {g : α → β}
(g_mble : Measurable g) : Set.Countable { t : β | 0 < μ { a : α | g a = t } } :=
countable_meas_level_set_pos₀ g_mble.nullMeasurable
/-- If a measure `μ` is the sum of a countable family `mₙ`, and a set `t` has finite measure for
each `mₙ`, then its measurable superset `toMeasurable μ t` (which has the same measure as `t`)
satisfies, for any measurable set `s`, the equality `μ (toMeasurable μ t ∩ s) = μ (t ∩ s)`. -/
theorem measure_toMeasurable_inter_of_sum {s : Set α} (hs : MeasurableSet s) {t : Set α}
{m : ℕ → Measure α} (hv : ∀ n, m n t ≠ ∞) (hμ : μ = sum m) :
μ (toMeasurable μ t ∩ s) = μ (t ∩ s) := by
-- we show that there is a measurable superset of `t` satisfying the conclusion for any
-- measurable set `s`. It is built for each measure `mₙ` using `toMeasurable`
-- (which is well behaved for finite measure sets thanks to `measure_toMeasurable_inter`), and
-- then taking the intersection over `n`.
have A : ∃ t', t' ⊇ t ∧ MeasurableSet t' ∧ ∀ u, MeasurableSet u → μ (t' ∩ u) = μ (t ∩ u) := by
let w n := toMeasurable (m n) t
have T : t ⊆ ⋂ n, w n := subset_iInter (fun i ↦ subset_toMeasurable (m i) t)
have M : MeasurableSet (⋂ n, w n) :=
MeasurableSet.iInter (fun i ↦ measurableSet_toMeasurable (m i) t)
refine ⟨⋂ n, w n, T, M, fun u hu ↦ ?_⟩
refine le_antisymm ?_ (by gcongr)
rw [hμ, sum_apply _ (M.inter hu)]
apply le_trans _ (le_sum_apply _ _)
apply ENNReal.tsum_le_tsum (fun i ↦ ?_)
calc
m i ((⋂ n, w n) ∩ u) ≤ m i (w i ∩ u) := by gcongr; apply iInter_subset
_ = m i (t ∩ u) := measure_toMeasurable_inter hu (hv i)
-- thanks to the definition of `toMeasurable`, the previous property will also be shared
-- by `toMeasurable μ t`, which is enough to conclude the proof.
rw [toMeasurable]
split_ifs with ht
· apply measure_congr
exact ae_eq_set_inter ht.choose_spec.2.2 (ae_eq_refl _)
· exact A.choose_spec.2.2 s hs
/-- If a set `t` is covered by a countable family of finite measure sets, then its measurable
superset `toMeasurable μ t` (which has the same measure as `t`) satisfies,
for any measurable set `s`, the equality `μ (toMeasurable μ t ∩ s) = μ (t ∩ s)`. -/
theorem measure_toMeasurable_inter_of_cover {s : Set α} (hs : MeasurableSet s) {t : Set α}
{v : ℕ → Set α} (hv : t ⊆ ⋃ n, v n) (h'v : ∀ n, μ (t ∩ v n) ≠ ∞) :
μ (toMeasurable μ t ∩ s) = μ (t ∩ s) := by
-- we show that there is a measurable superset of `t` satisfying the conclusion for any
-- measurable set `s`. It is built on each member of a spanning family using `toMeasurable`
-- (which is well behaved for finite measure sets thanks to `measure_toMeasurable_inter`), and
-- the desired property passes to the union.
have A : ∃ t', t' ⊇ t ∧ MeasurableSet t' ∧ ∀ u, MeasurableSet u → μ (t' ∩ u) = μ (t ∩ u) := by
let w n := toMeasurable μ (t ∩ v n)
have hw : ∀ n, μ (w n) < ∞ := by
intro n
simp_rw [w, measure_toMeasurable]
exact (h'v n).lt_top
set t' := ⋃ n, toMeasurable μ (t ∩ disjointed w n) with ht'
have tt' : t ⊆ t' :=
calc
t ⊆ ⋃ n, t ∩ disjointed w n := by
rw [← inter_iUnion, iUnion_disjointed, inter_iUnion]
intro x hx
rcases mem_iUnion.1 (hv hx) with ⟨n, hn⟩
refine mem_iUnion.2 ⟨n, ?_⟩
have : x ∈ t ∩ v n := ⟨hx, hn⟩
exact ⟨hx, subset_toMeasurable μ _ this⟩
_ ⊆ ⋃ n, toMeasurable μ (t ∩ disjointed w n) :=
iUnion_mono fun n => subset_toMeasurable _ _
refine ⟨t', tt', MeasurableSet.iUnion fun n => measurableSet_toMeasurable μ _, fun u hu => ?_⟩
apply le_antisymm _ (by gcongr)
calc
μ (t' ∩ u) ≤ ∑' n, μ (toMeasurable μ (t ∩ disjointed w n) ∩ u) := by
rw [ht', iUnion_inter]
exact measure_iUnion_le _
_ = ∑' n, μ (t ∩ disjointed w n ∩ u) := by
congr 1
ext1 n
apply measure_toMeasurable_inter hu
apply ne_of_lt
calc
μ (t ∩ disjointed w n) ≤ μ (t ∩ w n) := by
gcongr
exact disjointed_le w n
_ ≤ μ (w n) := measure_mono inter_subset_right
_ < ∞ := hw n
_ = ∑' n, μ.restrict (t ∩ u) (disjointed w n) := by
congr 1
ext1 n
rw [restrict_apply, inter_comm t _, inter_assoc]
refine MeasurableSet.disjointed (fun n => ?_) n
exact measurableSet_toMeasurable _ _
_ = μ.restrict (t ∩ u) (⋃ n, disjointed w n) := by
rw [measure_iUnion]
· exact disjoint_disjointed _
· intro i
refine MeasurableSet.disjointed (fun n => ?_) i
exact measurableSet_toMeasurable _ _
_ ≤ μ.restrict (t ∩ u) univ := measure_mono (subset_univ _)
_ = μ (t ∩ u) := by rw [restrict_apply MeasurableSet.univ, univ_inter]
-- thanks to the definition of `toMeasurable`, the previous property will also be shared
-- by `toMeasurable μ t`, which is enough to conclude the proof.
rw [toMeasurable]
split_ifs with ht
· apply measure_congr
exact ae_eq_set_inter ht.choose_spec.2.2 (ae_eq_refl _)
· exact A.choose_spec.2.2 s hs
theorem restrict_toMeasurable_of_cover {s : Set α} {v : ℕ → Set α} (hv : s ⊆ ⋃ n, v n)
(h'v : ∀ n, μ (s ∩ v n) ≠ ∞) : μ.restrict (toMeasurable μ s) = μ.restrict s :=
ext fun t ht => by
simp only [restrict_apply ht, inter_comm t, measure_toMeasurable_inter_of_cover ht hv h'v]
/-- The measurable superset `toMeasurable μ t` of `t` (which has the same measure as `t`)
satisfies, for any measurable set `s`, the equality `μ (toMeasurable μ t ∩ s) = μ (t ∩ s)`.
This only holds when `μ` is s-finite -- for example for σ-finite measures. For a version without
this assumption (but requiring that `t` has finite measure), see `measure_toMeasurable_inter`. -/
theorem measure_toMeasurable_inter_of_sFinite [SFinite μ] {s : Set α} (hs : MeasurableSet s)
(t : Set α) : μ (toMeasurable μ t ∩ s) = μ (t ∩ s) :=
measure_toMeasurable_inter_of_sum hs (fun _ ↦ measure_ne_top _ t) (sum_sfiniteSeq μ).symm
@[simp]
theorem restrict_toMeasurable_of_sFinite [SFinite μ] (s : Set α) :
μ.restrict (toMeasurable μ s) = μ.restrict s :=
ext fun t ht => by
rw [restrict_apply ht, inter_comm t, measure_toMeasurable_inter_of_sFinite ht,
restrict_apply ht, inter_comm t]
/-- Auxiliary lemma for `iSup_restrict_spanningSets`. -/
theorem iSup_restrict_spanningSets_of_measurableSet [SigmaFinite μ] (hs : MeasurableSet s) :
⨆ i, μ.restrict (spanningSets μ i) s = μ s :=
calc
⨆ i, μ.restrict (spanningSets μ i) s = μ.restrict (⋃ i, spanningSets μ i) s :=
(restrict_iUnion_apply_eq_iSup (monotone_spanningSets μ).directed_le hs).symm
_ = μ s := by rw [iUnion_spanningSets, restrict_univ]
theorem iSup_restrict_spanningSets [SigmaFinite μ] (s : Set α) :
⨆ i, μ.restrict (spanningSets μ i) s = μ s := by
rw [← measure_toMeasurable s,
← iSup_restrict_spanningSets_of_measurableSet (measurableSet_toMeasurable _ _)]
simp_rw [restrict_apply' (measurableSet_spanningSets μ _), Set.inter_comm s,
← restrict_apply (measurableSet_spanningSets μ _), ← restrict_toMeasurable_of_sFinite s,
restrict_apply (measurableSet_spanningSets μ _), Set.inter_comm _ (toMeasurable μ s)]
/-- In a σ-finite space, any measurable set of measure `> r` contains a measurable subset of
finite measure `> r`. -/
theorem exists_subset_measure_lt_top [SigmaFinite μ] {r : ℝ≥0∞} (hs : MeasurableSet s)
(h's : r < μ s) : ∃ t, MeasurableSet t ∧ t ⊆ s ∧ r < μ t ∧ μ t < ∞ := by
rw [← iSup_restrict_spanningSets,
@lt_iSup_iff _ _ _ r fun i : ℕ => μ.restrict (spanningSets μ i) s] at h's
rcases h's with ⟨n, hn⟩
simp only [restrict_apply hs] at hn
refine
⟨s ∩ spanningSets μ n, hs.inter (measurableSet_spanningSets _ _), inter_subset_left, hn, ?_⟩
exact (measure_mono inter_subset_right).trans_lt (measure_spanningSets_lt_top _ _)
namespace FiniteSpanningSetsIn
variable {C D : Set (Set α)}
/-- If `μ` has finite spanning sets in `C` and `C ∩ {s | μ s < ∞} ⊆ D` then `μ` has finite spanning
sets in `D`. -/
protected def mono' (h : μ.FiniteSpanningSetsIn C) (hC : C ∩ { s | μ s < ∞ } ⊆ D) :
μ.FiniteSpanningSetsIn D :=
⟨h.set, fun i => hC ⟨h.set_mem i, h.finite i⟩, h.finite, h.spanning⟩
/-- If `μ` has finite spanning sets in `C` and `C ⊆ D` then `μ` has finite spanning sets in `D`. -/
protected def mono (h : μ.FiniteSpanningSetsIn C) (hC : C ⊆ D) : μ.FiniteSpanningSetsIn D :=
h.mono' fun _s hs => hC hs.1
/-- If `μ` has finite spanning sets in the collection of measurable sets `C`, then `μ` is σ-finite.
-/
protected theorem sigmaFinite (h : μ.FiniteSpanningSetsIn C) : SigmaFinite μ :=
⟨⟨h.mono <| subset_univ C⟩⟩
/-- An extensionality for measures. It is `ext_of_generateFrom_of_iUnion` formulated in terms of
`FiniteSpanningSetsIn`. -/
protected theorem ext {ν : Measure α} {C : Set (Set α)} (hA : ‹_› = generateFrom C)
(hC : IsPiSystem C) (h : μ.FiniteSpanningSetsIn C) (h_eq : ∀ s ∈ C, μ s = ν s) : μ = ν :=
ext_of_generateFrom_of_iUnion C _ hA hC h.spanning h.set_mem (fun i => (h.finite i).ne) h_eq
protected theorem isCountablySpanning (h : μ.FiniteSpanningSetsIn C) : IsCountablySpanning C :=
⟨h.set, h.set_mem, h.spanning⟩
end FiniteSpanningSetsIn
theorem sigmaFinite_of_countable {S : Set (Set α)} (hc : S.Countable) (hμ : ∀ s ∈ S, μ s < ∞)
(hU : ⋃₀ S = univ) : SigmaFinite μ := by
obtain ⟨s, hμ, hs⟩ : ∃ s : ℕ → Set α, (∀ n, μ (s n) < ∞) ∧ ⋃ n, s n = univ :=
(@exists_seq_cover_iff_countable _ (fun x => μ x < ∞) ⟨∅, by simp⟩).2 ⟨S, hc, hμ, hU⟩
exact ⟨⟨⟨fun n => s n, fun _ => trivial, hμ, hs⟩⟩⟩
/-- Given measures `μ`, `ν` where `ν ≤ μ`, `FiniteSpanningSetsIn.ofLe` provides the induced
`FiniteSpanningSet` with respect to `ν` from a `FiniteSpanningSet` with respect to `μ`. -/
def FiniteSpanningSetsIn.ofLE (h : ν ≤ μ) {C : Set (Set α)} (S : μ.FiniteSpanningSetsIn C) :
ν.FiniteSpanningSetsIn C where
set := S.set
set_mem := S.set_mem
finite n := lt_of_le_of_lt (le_iff'.1 h _) (S.finite n)
spanning := S.spanning
theorem sigmaFinite_of_le (μ : Measure α) [hs : SigmaFinite μ] (h : ν ≤ μ) : SigmaFinite ν :=
⟨hs.out.map <| FiniteSpanningSetsIn.ofLE h⟩
@[simp] lemma add_right_inj (μ ν₁ ν₂ : Measure α) [SigmaFinite μ] :
μ + ν₁ = μ + ν₂ ↔ ν₁ = ν₂ := by
refine ⟨fun h ↦ ?_, fun h ↦ by rw [h]⟩
rw [ext_iff_of_iUnion_eq_univ (iUnion_spanningSets μ)]
intro i
ext s hs
rw [← ENNReal.add_right_inj (measure_mono s.inter_subset_right |>.trans_lt <|
measure_spanningSets_lt_top μ i).ne]
simp only [ext_iff', coe_add, Pi.add_apply] at h
simp [hs, h]
@[simp] lemma add_left_inj (μ ν₁ ν₂ : Measure α) [SigmaFinite μ] :
ν₁ + μ = ν₂ + μ ↔ ν₁ = ν₂ := by rw [add_comm _ μ, add_comm _ μ, μ.add_right_inj]
end Measure
/-- Every finite measure is σ-finite. -/
instance (priority := 100) IsFiniteMeasure.toSigmaFinite {_m0 : MeasurableSpace α} (μ : Measure α)
[IsFiniteMeasure μ] : SigmaFinite μ :=
⟨⟨⟨fun _ => univ, fun _ => trivial, fun _ => measure_lt_top μ _, iUnion_const _⟩⟩⟩
/-- A measure on a countable space is sigma-finite iff it gives finite mass to every singleton.
See `measure_singleton_lt_top` for the forward direction without the countability assumption. -/
lemma Measure.sigmaFinite_iff_measure_singleton_lt_top [Countable α] :
SigmaFinite μ ↔ ∀ a, μ {a} < ∞ where
mp _ a := measure_singleton_lt_top
mpr hμ := by
cases isEmpty_or_nonempty α
· rw [Subsingleton.elim μ 0]
infer_instance
· obtain ⟨f, hf⟩ := exists_surjective_nat α
exact ⟨⟨⟨fun n ↦ {f n}, by simp, by simpa [hf.forall] using hμ, by simp [hf.range_eq]⟩⟩⟩
theorem sigmaFinite_bot_iff (μ : @Measure α ⊥) : SigmaFinite μ ↔ IsFiniteMeasure μ := by
refine ⟨fun h => ⟨?_⟩, fun h => by infer_instance⟩
haveI : SigmaFinite μ := h
let s := spanningSets μ
have hs_univ : ⋃ i, s i = Set.univ := iUnion_spanningSets μ
have hs_meas : ∀ i, MeasurableSet[⊥] (s i) := measurableSet_spanningSets μ
simp_rw [MeasurableSpace.measurableSet_bot_iff] at hs_meas
by_cases h_univ_empty : (Set.univ : Set α) = ∅
· rw [h_univ_empty, measure_empty]
exact ENNReal.zero_ne_top.lt_top
obtain ⟨i, hsi⟩ : ∃ i, s i = Set.univ := by
by_contra! h_not_univ
have h_empty : ∀ i, s i = ∅ := by simpa [h_not_univ] using hs_meas
simp only [h_empty, iUnion_empty] at hs_univ
exact h_univ_empty hs_univ.symm
rw [← hsi]
exact measure_spanningSets_lt_top μ i
instance Restrict.sigmaFinite (μ : Measure α) [SigmaFinite μ] (s : Set α) :
SigmaFinite (μ.restrict s) := by
refine ⟨⟨⟨spanningSets μ, fun _ => trivial, fun i => ?_, iUnion_spanningSets μ⟩⟩⟩
rw [Measure.restrict_apply (measurableSet_spanningSets μ i)]
exact (measure_mono inter_subset_left).trans_lt (measure_spanningSets_lt_top μ i)
instance sum.sigmaFinite {ι} [Finite ι] (μ : ι → Measure α) [∀ i, SigmaFinite (μ i)] :
SigmaFinite (sum μ) := by
cases nonempty_fintype ι
have : ∀ n, MeasurableSet (⋂ i : ι, spanningSets (μ i) n) := fun n =>
MeasurableSet.iInter fun i => measurableSet_spanningSets (μ i) n
refine ⟨⟨⟨fun n => ⋂ i, spanningSets (μ i) n, fun _ => trivial, fun n => ?_, ?_⟩⟩⟩
· rw [sum_apply _ (this n), tsum_fintype, ENNReal.sum_lt_top]
rintro i -
exact (measure_mono <| iInter_subset _ i).trans_lt (measure_spanningSets_lt_top (μ i) n)
· rw [iUnion_iInter_of_monotone]
· simp_rw [iUnion_spanningSets, iInter_univ]
exact fun i => monotone_spanningSets (μ i)
instance Add.sigmaFinite (μ ν : Measure α) [SigmaFinite μ] [SigmaFinite ν] :
SigmaFinite (μ + ν) := by
rw [← sum_cond]
refine @sum.sigmaFinite _ _ _ _ _ (Bool.rec ?_ ?_) <;> simpa
instance SMul.sigmaFinite {μ : Measure α} [SigmaFinite μ] (c : ℝ≥0) :
MeasureTheory.SigmaFinite (c • μ) where
out' :=
⟨{ set := spanningSets μ
set_mem := fun _ ↦ trivial
finite := by
intro i
simp only [Measure.coe_smul, Pi.smul_apply, nnreal_smul_coe_apply]
exact ENNReal.mul_lt_top ENNReal.coe_lt_top (measure_spanningSets_lt_top μ i)
spanning := iUnion_spanningSets μ }⟩
instance [SigmaFinite (μ.restrict s)] [SigmaFinite (μ.restrict t)] :
SigmaFinite (μ.restrict (s ∪ t)) := sigmaFinite_of_le _ (restrict_union_le _ _)
instance [SigmaFinite (μ.restrict s)] : SigmaFinite (μ.restrict (s ∩ t)) :=
sigmaFinite_of_le (μ.restrict s) (restrict_mono_ae (ae_of_all _ Set.inter_subset_left))
instance [SigmaFinite (μ.restrict t)] : SigmaFinite (μ.restrict (s ∩ t)) :=
sigmaFinite_of_le (μ.restrict t) (restrict_mono_ae (ae_of_all _ Set.inter_subset_right))
theorem SigmaFinite.of_map (μ : Measure α) {f : α → β} (hf : AEMeasurable f μ)
(h : SigmaFinite (μ.map f)) : SigmaFinite μ :=
⟨⟨⟨fun n => f ⁻¹' spanningSets (μ.map f) n, fun _ => trivial, fun n => by
simp only [← map_apply_of_aemeasurable hf, measurableSet_spanningSets,
measure_spanningSets_lt_top],
by rw [← preimage_iUnion, iUnion_spanningSets, preimage_univ]⟩⟩⟩
lemma _root_.MeasurableEmbedding.sigmaFinite_map {f : α → β} (hf : MeasurableEmbedding f)
[SigmaFinite μ] :
SigmaFinite (μ.map f) := by
refine ⟨fun n ↦ f '' (spanningSets μ n) ∪ (Set.range f)ᶜ, by simp, fun n ↦ ?_, ?_⟩
· rw [hf.map_apply, Set.preimage_union]
simp only [Set.preimage_compl, Set.preimage_range, Set.compl_univ, Set.union_empty,
Set.preimage_image_eq _ hf.injective]
exact measure_spanningSets_lt_top μ n
· rw [← Set.iUnion_union, ← Set.image_iUnion, iUnion_spanningSets,
Set.image_univ, Set.union_compl_self]
theorem _root_.MeasurableEquiv.sigmaFinite_map (f : α ≃ᵐ β) [SigmaFinite μ] :
SigmaFinite (μ.map f) := f.measurableEmbedding.sigmaFinite_map
/-- Similar to `ae_of_forall_measure_lt_top_ae_restrict`, but where you additionally get the
hypothesis that another σ-finite measure has finite values on `s`. -/
theorem ae_of_forall_measure_lt_top_ae_restrict' {μ : Measure α} (ν : Measure α) [SigmaFinite μ]
[SigmaFinite ν] (P : α → Prop)
(h : ∀ s, MeasurableSet s → μ s < ∞ → ν s < ∞ → ∀ᵐ x ∂μ.restrict s, P x) : ∀ᵐ x ∂μ, P x := by
have : ∀ n, ∀ᵐ x ∂μ, x ∈ spanningSets (μ + ν) n → P x := by
intro n
have := h
(spanningSets (μ + ν) n) (measurableSet_spanningSets _ _)
((self_le_add_right _ _).trans_lt (measure_spanningSets_lt_top (μ + ν) _))
((self_le_add_left _ _).trans_lt (measure_spanningSets_lt_top (μ + ν) _))
exact (ae_restrict_iff' (measurableSet_spanningSets _ _)).mp this
filter_upwards [ae_all_iff.2 this] with _ hx using hx _ (mem_spanningSetsIndex _ _)
/-- To prove something for almost all `x` w.r.t. a σ-finite measure, it is sufficient to show that
this holds almost everywhere in sets where the measure has finite value. -/
theorem ae_of_forall_measure_lt_top_ae_restrict {μ : Measure α} [SigmaFinite μ] (P : α → Prop)
(h : ∀ s, MeasurableSet s → μ s < ∞ → ∀ᵐ x ∂μ.restrict s, P x) : ∀ᵐ x ∂μ, P x :=
ae_of_forall_measure_lt_top_ae_restrict' μ P fun s hs h2s _ => h s hs h2s
instance (priority := 100) SigmaFinite.of_isFiniteMeasureOnCompacts [TopologicalSpace α]
[SigmaCompactSpace α] (μ : Measure α) [IsFiniteMeasureOnCompacts μ] : SigmaFinite μ :=
⟨⟨{ set := compactCovering α
set_mem := fun _ => trivial
finite := fun n => (isCompact_compactCovering α n).measure_lt_top
spanning := iUnion_compactCovering α }⟩⟩
-- see Note [lower instance priority]
instance (priority := 100) sigmaFinite_of_locallyFinite [TopologicalSpace α]
[SecondCountableTopology α] [IsLocallyFiniteMeasure μ] : SigmaFinite μ := by
choose s hsx hsμ using μ.finiteAt_nhds
rcases TopologicalSpace.countable_cover_nhds hsx with ⟨t, htc, htU⟩
refine Measure.sigmaFinite_of_countable (htc.image s) (forall_mem_image.2 fun x _ => hsμ x) ?_
rwa [sUnion_image]
namespace Measure
section disjointed
/-- Given `S : μ.FiniteSpanningSetsIn {s | MeasurableSet s}`,
`FiniteSpanningSetsIn.disjointed` provides a `FiniteSpanningSetsIn {s | MeasurableSet s}`
such that its underlying sets are pairwise disjoint. -/
protected def FiniteSpanningSetsIn.disjointed {μ : Measure α}
(S : μ.FiniteSpanningSetsIn { s | MeasurableSet s }) :
μ.FiniteSpanningSetsIn { s | MeasurableSet s } :=
⟨disjointed S.set, MeasurableSet.disjointed S.set_mem, fun n =>
lt_of_le_of_lt (measure_mono (disjointed_subset S.set n)) (S.finite _),
S.spanning ▸ iUnion_disjointed⟩
theorem FiniteSpanningSetsIn.disjointed_set_eq {μ : Measure α}
(S : μ.FiniteSpanningSetsIn { s | MeasurableSet s }) : S.disjointed.set = disjointed S.set :=
rfl
theorem exists_eq_disjoint_finiteSpanningSetsIn (μ ν : Measure α) [SigmaFinite μ] [SigmaFinite ν] :
∃ (S : μ.FiniteSpanningSetsIn { s | MeasurableSet s })
(T : ν.FiniteSpanningSetsIn { s | MeasurableSet s }),
S.set = T.set ∧ Pairwise (Disjoint on S.set) :=
let S := (μ + ν).toFiniteSpanningSetsIn.disjointed
⟨S.ofLE (Measure.le_add_right le_rfl), S.ofLE (Measure.le_add_left le_rfl), rfl,
disjoint_disjointed _⟩
end disjointed
end Measure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Decomposition/Hahn.lean | import Mathlib.MeasureTheory.Measure.Typeclasses.Finite
/-!
# Unsigned Hahn decomposition theorem
This file proves the unsigned version of the Hahn decomposition theorem.
## Main definitions
* `MeasureTheory.IsHahnDecomposition`: characterizes a set where `μ ≤ ν` (and the
reverse inequality on the complement),
## Main statements
* `hahn_decomposition` : Given two finite measures `μ` and `ν`, there exists a measurable set `s`
such that any measurable set `t` included in `s` satisfies `ν t ≤ μ t`, and any
measurable set `u` included in the complement of `s` satisfies `μ u ≤ ν u`.
* `exists_isHahnDecomposition` : reformulation of `hahn_decomposition` using the
`IsHahnDecomposition` structure which relies on the measure restriction.
## Tags
Hahn decomposition
-/
assert_not_exists MeasureTheory.Measure.rnDeriv
assert_not_exists MeasureTheory.VectorMeasure
open Set Filter Topology ENNReal
namespace MeasureTheory
variable {α : Type*} {mα : MeasurableSpace α}
/-- **Hahn decomposition theorem** -/
theorem hahn_decomposition (μ ν : Measure α) [IsFiniteMeasure μ] [IsFiniteMeasure ν] :
∃ s, MeasurableSet s ∧ (∀ t, MeasurableSet t → t ⊆ s → ν t ≤ μ t) ∧
∀ t, MeasurableSet t → t ⊆ sᶜ → μ t ≤ ν t := by
let d : Set α → ℝ := fun s => ((μ s).toNNReal : ℝ) - (ν s).toNNReal
let c : Set ℝ := d '' { s | MeasurableSet s }
let γ : ℝ := sSup c
have hμ : ∀ s, μ s ≠ ∞ := measure_ne_top μ
have hν : ∀ s, ν s ≠ ∞ := measure_ne_top ν
have to_nnreal_μ : ∀ s, ((μ s).toNNReal : ℝ≥0∞) = μ s := fun s => ENNReal.coe_toNNReal <| hμ _
have to_nnreal_ν : ∀ s, ((ν s).toNNReal : ℝ≥0∞) = ν s := fun s => ENNReal.coe_toNNReal <| hν _
have d_split s t (ht : MeasurableSet t) : d s = d (s \ t) + d (s ∩ t) := by
dsimp only [d]
rw [← measure_inter_add_diff s ht, ← measure_inter_add_diff s ht,
ENNReal.toNNReal_add (hμ _) (hμ _), ENNReal.toNNReal_add (hν _) (hν _), NNReal.coe_add,
NNReal.coe_add]
simp only [sub_eq_add_neg, neg_add]
abel
have d_Union (s : ℕ → Set α) (hm : Monotone s) :
Tendsto (fun n => d (s n)) atTop (𝓝 (d (⋃ n, s n))) := by
refine Tendsto.sub ?_ ?_ <;>
refine NNReal.tendsto_coe.2 <| (ENNReal.tendsto_toNNReal ?_).comp <|
tendsto_measure_iUnion_atTop hm
· exact hμ _
· exact hν _
have d_Inter (s : ℕ → Set α) (hs : ∀ n, MeasurableSet (s n)) (hm : ∀ n m, n ≤ m → s m ⊆ s n) :
Tendsto (fun n => d (s n)) atTop (𝓝 (d (⋂ n, s n))) := by
refine Tendsto.sub ?_ ?_ <;>
refine NNReal.tendsto_coe.2 <| (ENNReal.tendsto_toNNReal <| ?_).comp <|
tendsto_measure_iInter_atTop (fun n ↦ (hs n).nullMeasurableSet) hm ?_
exacts [hμ _, ⟨0, hμ _⟩, hν _, ⟨0, hν _⟩]
have bdd_c : BddAbove c := by
use (μ univ).toNNReal
rintro r ⟨s, _hs, rfl⟩
refine le_trans (sub_le_self _ <| NNReal.coe_nonneg _) ?_
rw [NNReal.coe_le_coe, ← ENNReal.coe_le_coe, to_nnreal_μ, to_nnreal_μ]
exact measure_mono (subset_univ _)
have c_nonempty : c.Nonempty := Nonempty.image _ ⟨_, MeasurableSet.empty⟩
have d_le_γ : ∀ s, MeasurableSet s → d s ≤ γ := fun s hs => le_csSup bdd_c ⟨s, hs, rfl⟩
have (n : ℕ) : ∃ s : Set α, MeasurableSet s ∧ γ - (1 / 2) ^ n < d s := by
have : γ - (1 / 2) ^ n < γ := sub_lt_self γ (pow_pos (half_pos zero_lt_one) n)
rcases exists_lt_of_lt_csSup c_nonempty this with ⟨r, ⟨s, hs, rfl⟩, hlt⟩
exact ⟨s, hs, hlt⟩
rcases Classical.axiom_of_choice this with ⟨e, he⟩
change ℕ → Set α at e
have he₁ : ∀ n, MeasurableSet (e n) := fun n => (he n).1
have he₂ : ∀ n, γ - (1 / 2) ^ n < d (e n) := fun n => (he n).2
let f : ℕ → ℕ → Set α := fun n m => (Finset.Ico n (m + 1)).inf e
have hf n m : MeasurableSet (f n m) := by
simp only [f, Finset.inf_eq_iInf]
exact MeasurableSet.biInter (to_countable _) fun i _ => he₁ _
have f_subset_f {a b c d} (hab : a ≤ b) (hcd : c ≤ d) : f a d ⊆ f b c := by
simp_rw [f, Finset.inf_eq_iInf]
exact biInter_subset_biInter_left (Finset.Ico_subset_Ico hab <| Nat.succ_le_succ hcd)
have f_succ n m (hnm : n ≤ m) : f n (m + 1) = f n m ∩ e (m + 1) := by
have : n ≤ m + 1 := le_of_lt (Nat.succ_le_succ hnm)
simp_rw [f, ← Finset.insert_Ico_right_eq_Ico_add_one this, Finset.inf_insert,
Set.inter_comm]
rfl
have le_d_f n m (h : m ≤ n) : γ - 2 * (1 / 2) ^ m + (1 / 2) ^ n ≤ d (f m n) := by
refine Nat.le_induction ?_ ?_ n h
· have := he₂ m
simp_rw [f, Nat.Ico_succ_singleton, Finset.inf_singleton]
linarith
· intro n (hmn : m ≤ n) ih
refine le_of_add_le_add_left (a := γ) ?_
calc
γ + (γ - 2 * (1 / 2) ^ m + (1 / 2) ^ (n + 1)) =
γ + (γ - 2 * (1 / 2) ^ m + ((1 / 2) ^ n - (1 / 2) ^ (n + 1))) := by
rw [pow_succ, mul_one_div, _root_.sub_half]
_ = γ - (1 / 2) ^ (n + 1) + (γ - 2 * (1 / 2) ^ m + (1 / 2) ^ n) := by
simp only [sub_eq_add_neg]; abel
_ ≤ d (e (n + 1)) + d (f m n) := add_le_add (le_of_lt <| he₂ _) ih
_ ≤ d (e (n + 1)) + d (f m n \ e (n + 1)) + d (f m (n + 1)) := by
rw [f_succ _ _ hmn, d_split (f m n) (e (n + 1)) (he₁ _), add_assoc]
_ = d (e (n + 1) ∪ f m n) + d (f m (n + 1)) := by
rw [d_split (e (n + 1) ∪ f m n) (e (n + 1)), union_diff_left, union_inter_cancel_left]
· abel
· exact he₁ _
_ ≤ γ + d (f m (n + 1)) := by grw [d_le_γ _ <| (he₁ _).union (hf _ _)]
let s := ⋃ m, ⋂ n, f m n
have γ_le_d_s : γ ≤ d s := by
have hγ : Tendsto (fun m : ℕ => γ - 2 * (1 / 2) ^ m) atTop (𝓝 γ) := by
suffices Tendsto (fun m : ℕ => γ - 2 * (1 / 2) ^ m) atTop (𝓝 (γ - 2 * 0)) by
simpa only [mul_zero, tsub_zero]
exact
tendsto_const_nhds.sub <|
tendsto_const_nhds.mul <|
tendsto_pow_atTop_nhds_zero_of_lt_one (le_of_lt <| half_pos <| zero_lt_one)
(half_lt_self zero_lt_one)
have hd : Tendsto (fun m => d (⋂ n, f m n)) atTop (𝓝 (d (⋃ m, ⋂ n, f m n))) := by
refine d_Union _ ?_
exact fun n m hnm =>
subset_iInter fun i => Subset.trans (iInter_subset (f n) i) <| f_subset_f hnm <| le_rfl
refine le_of_tendsto_of_tendsto' hγ hd fun m => ?_
have : Tendsto (fun n => d (f m n)) atTop (𝓝 (d (⋂ n, f m n))) := by
refine d_Inter _ ?_ ?_
· intro n
exact hf _ _
· intro n m hnm
exact f_subset_f le_rfl hnm
refine ge_of_tendsto this (eventually_atTop.2 ⟨m, fun n hmn => ?_⟩)
change γ - 2 * (1 / 2) ^ m ≤ d (f m n)
refine le_trans ?_ (le_d_f _ _ hmn)
exact le_add_of_le_of_nonneg le_rfl (pow_nonneg (le_of_lt <| half_pos <| zero_lt_one) _)
have hs : MeasurableSet s := MeasurableSet.iUnion fun n => MeasurableSet.iInter fun m => hf _ _
refine ⟨s, hs, ?_, ?_⟩
· intro t ht hts
have : 0 ≤ d t :=
(add_le_add_iff_left γ).1 <|
calc
γ + 0 ≤ d s := by rw [add_zero]; exact γ_le_d_s
_ = d (s \ t) + d t := by rw [d_split s _ ht, inter_eq_self_of_subset_right hts]
_ ≤ γ + d t := add_le_add (d_le_γ _ (hs.diff ht)) le_rfl
rw [← to_nnreal_μ, ← to_nnreal_ν, ENNReal.coe_le_coe, ← NNReal.coe_le_coe]
simpa only [d, le_sub_iff_add_le, zero_add] using this
· intro t ht hts
have : d t ≤ 0 :=
(add_le_add_iff_left γ).1 <|
calc
γ + d t ≤ d s + d t := by gcongr
_ = d (s ∪ t) := by
rw [d_split (s ∪ t) _ ht, union_diff_right, union_inter_cancel_right,
(subset_compl_iff_disjoint_left.1 hts).sdiff_eq_left]
_ ≤ γ + 0 := by rw [add_zero]; exact d_le_γ _ (hs.union ht)
rw [← to_nnreal_μ, ← to_nnreal_ν, ENNReal.coe_le_coe, ← NNReal.coe_le_coe]
simpa only [d, sub_le_iff_le_add, zero_add] using this
/-- A set where `μ ≤ ν` (and the reverse inequality on the complement),
defined via measurable set and measure restriction comparisons. -/
structure IsHahnDecomposition (μ ν : Measure α) (s : Set α) : Prop where
measurableSet : MeasurableSet s
le_on : μ.restrict s ≤ ν.restrict s
ge_on_compl : ν.restrict sᶜ ≤ μ.restrict sᶜ
lemma IsHahnDecomposition.compl {μ ν : Measure α} {s : Set α}
(h : IsHahnDecomposition μ ν s) : IsHahnDecomposition ν μ sᶜ where
measurableSet := h.measurableSet.compl
le_on := h.ge_on_compl
ge_on_compl := by simpa using h.le_on
lemma exists_isHahnDecomposition (μ ν : Measure α) [IsFiniteMeasure μ] [IsFiniteMeasure ν] :
∃ s : Set α, IsHahnDecomposition μ ν s := by
obtain ⟨s, hs, h₁, h₂⟩ := hahn_decomposition ν μ
refine ⟨s, hs, ?_, ?_⟩
all_goals
rw [Measure.le_iff]
intros
simp [*]
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Decomposition/RadonNikodym.lean | import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap
import Mathlib.MeasureTheory.Measure.Decomposition.Lebesgue
/-!
# Radon-Nikodym theorem
This file proves the Radon-Nikodym theorem. The Radon-Nikodym theorem states that, given measures
`μ, ν`, if `HaveLebesgueDecomposition μ ν`, then `μ` is absolutely continuous with respect to
`ν` if and only if there exists a measurable function `f : α → ℝ≥0∞` such that `μ = fν`.
In particular, we have `f = rnDeriv μ ν`.
The Radon-Nikodym theorem will allow us to define many important concepts in probability theory,
most notably probability cumulative functions. It could also be used to define the conditional
expectation of a real function, but we take a different approach (see the file
`MeasureTheory/Function/ConditionalExpectation`).
## Main results
* `MeasureTheory.Measure.absolutelyContinuous_iff_withDensity_rnDeriv_eq` :
the Radon-Nikodym theorem
* `MeasureTheory.SignedMeasure.absolutelyContinuous_iff_withDensityᵥ_rnDeriv_eq` :
the Radon-Nikodym theorem for signed measures
The file also contains properties of `rnDeriv` that use the Radon-Nikodym theorem, notably
* `MeasureTheory.Measure.rnDeriv_withDensity_left`: the Radon-Nikodym derivative of
`μ.withDensity f` with respect to `ν` is `f * μ.rnDeriv ν`.
* `MeasureTheory.Measure.rnDeriv_withDensity_right`: the Radon-Nikodym derivative of
`μ` with respect to `ν.withDensity f` is `f⁻¹ * μ.rnDeriv ν`.
* `MeasureTheory.Measure.inv_rnDeriv`: `(μ.rnDeriv ν)⁻¹ =ᵐ[μ] ν.rnDeriv μ`.
* `MeasureTheory.Measure.setLIntegral_rnDeriv`: `∫⁻ x in s, μ.rnDeriv ν x ∂ν = μ s` if `μ ≪ ν`.
There is also a version of this result for the Bochner integral.
## Tags
Radon-Nikodym theorem
-/
assert_not_exists InnerProductSpace
assert_not_exists MeasureTheory.VectorMeasure
noncomputable section
open scoped MeasureTheory NNReal ENNReal
variable {α β : Type*} {m : MeasurableSpace α}
namespace MeasureTheory
namespace Measure
theorem withDensity_rnDeriv_eq (μ ν : Measure α) [HaveLebesgueDecomposition μ ν] (h : μ ≪ ν) :
ν.withDensity (rnDeriv μ ν) = μ := by
suffices μ.singularPart ν = 0 by
conv_rhs => rw [haveLebesgueDecomposition_add μ ν, this, zero_add]
exact (singularPart_eq_zero μ ν).mpr h
variable {μ ν : Measure α}
/-- **The Radon-Nikodym theorem**: Given two measures `μ` and `ν`, if
`HaveLebesgueDecomposition μ ν`, then `μ` is absolutely continuous to `ν` if and only if
`ν.withDensity (rnDeriv μ ν) = μ`. -/
theorem absolutelyContinuous_iff_withDensity_rnDeriv_eq
[HaveLebesgueDecomposition μ ν] : μ ≪ ν ↔ ν.withDensity (rnDeriv μ ν) = μ :=
⟨withDensity_rnDeriv_eq μ ν, fun h => h ▸ withDensity_absolutelyContinuous _ _⟩
lemma rnDeriv_pos [HaveLebesgueDecomposition μ ν] (hμν : μ ≪ ν) :
∀ᵐ x ∂μ, 0 < μ.rnDeriv ν x := by
rw [← Measure.withDensity_rnDeriv_eq _ _ hμν,
ae_withDensity_iff (Measure.measurable_rnDeriv _ _), Measure.withDensity_rnDeriv_eq _ _ hμν]
exact ae_of_all _ (fun x hx ↦ lt_of_le_of_ne (zero_le _) hx.symm)
lemma rnDeriv_pos' [HaveLebesgueDecomposition ν μ] [SigmaFinite μ] (hμν : μ ≪ ν) :
∀ᵐ x ∂μ, 0 < ν.rnDeriv μ x := by
refine (absolutelyContinuous_withDensity_rnDeriv hμν).ae_le ?_
filter_upwards [Measure.rnDeriv_pos (withDensity_absolutelyContinuous μ (ν.rnDeriv μ)),
(withDensity_absolutelyContinuous μ (ν.rnDeriv μ)).ae_le
(Measure.rnDeriv_withDensity μ (Measure.measurable_rnDeriv ν μ))] with x hx hx2
rwa [← hx2]
section rnDeriv_withDensity_leftRight
variable {f : α → ℝ≥0∞}
/-- Auxiliary lemma for `rnDeriv_withDensity_left`. -/
lemma rnDeriv_withDensity_withDensity_rnDeriv_left (μ ν : Measure α) [SigmaFinite μ] [SigmaFinite ν]
(hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
((ν.withDensity (μ.rnDeriv ν)).withDensity f).rnDeriv ν =ᵐ[ν] (μ.withDensity f).rnDeriv ν := by
conv_rhs => rw [μ.haveLebesgueDecomposition_add ν, add_comm, withDensity_add_measure]
have : SigmaFinite ((μ.singularPart ν).withDensity f) :=
SigmaFinite.withDensity_of_ne_top (ae_mono (Measure.singularPart_le _ _) hf_ne_top)
have : SigmaFinite ((ν.withDensity (μ.rnDeriv ν)).withDensity f) :=
SigmaFinite.withDensity_of_ne_top (ae_mono (Measure.withDensity_rnDeriv_le _ _) hf_ne_top)
exact (rnDeriv_add_of_mutuallySingular _ _ _ (mutuallySingular_singularPart μ ν).withDensity).symm
/-- Auxiliary lemma for `rnDeriv_withDensity_right`. -/
lemma rnDeriv_withDensity_withDensity_rnDeriv_right (μ ν : Measure α) [SigmaFinite μ]
[SigmaFinite ν] (hf : AEMeasurable f ν) (hf_ne_zero : ∀ᵐ x ∂ν, f x ≠ 0)
(hf_ne_top : ∀ᵐ x ∂ν, f x ≠ ∞) :
(ν.withDensity (μ.rnDeriv ν)).rnDeriv (ν.withDensity f) =ᵐ[ν] μ.rnDeriv (ν.withDensity f) := by
conv_rhs => rw [μ.haveLebesgueDecomposition_add ν, add_comm]
have hν_ac : ν ≪ ν.withDensity f := withDensity_absolutelyContinuous' hf hf_ne_zero
refine hν_ac.ae_eq ?_
have : SigmaFinite (ν.withDensity f) := SigmaFinite.withDensity_of_ne_top hf_ne_top
refine (rnDeriv_add_of_mutuallySingular _ _ _ ?_).symm
exact ((mutuallySingular_singularPart μ ν).symm.withDensity).symm
lemma rnDeriv_withDensity_left_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
[SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν) :
(μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
refine (Measure.eq_rnDeriv₀ ?_ Measure.MutuallySingular.zero_left ?_).symm
· exact hf.mul (Measure.measurable_rnDeriv _ _).aemeasurable
· ext1 s hs
rw [zero_add, withDensity_apply _ hs, withDensity_apply _ hs]
conv_lhs => rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
rw [setLIntegral_withDensity_eq_setLIntegral_mul_non_measurable₀ _ _ _ hs]
· congr with x
rw [mul_comm]
simp only [Pi.mul_apply]
· refine ae_restrict_of_ae ?_
exact Measure.rnDeriv_lt_top _ _
· exact (Measure.measurable_rnDeriv _ _).aemeasurable
lemma rnDeriv_withDensity_left {μ ν : Measure α} [SigmaFinite μ] [SigmaFinite ν]
(hfν : AEMeasurable f ν) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
(μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
let μ' := ν.withDensity (μ.rnDeriv ν)
have hμ'ν : μ' ≪ ν := withDensity_absolutelyContinuous _ _
have h := rnDeriv_withDensity_left_of_absolutelyContinuous hμ'ν hfν
have h1 : μ'.rnDeriv ν =ᵐ[ν] μ.rnDeriv ν :=
Measure.rnDeriv_withDensity _ (Measure.measurable_rnDeriv _ _)
have h2 : (μ'.withDensity f).rnDeriv ν =ᵐ[ν] (μ.withDensity f).rnDeriv ν := by
exact rnDeriv_withDensity_withDensity_rnDeriv_left μ ν hf_ne_top
filter_upwards [h, h1, h2] with x hx hx1 hx2
rw [← hx2, hx, hx1]
/-- Auxiliary lemma for `rnDeriv_withDensity_right`. -/
lemma rnDeriv_withDensity_right_of_absolutelyContinuous {ν : Measure α}
[HaveLebesgueDecomposition μ ν] [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν)
(hf_ne_zero : ∀ᵐ x ∂ν, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂ν, f x ≠ ∞) :
μ.rnDeriv (ν.withDensity f) =ᵐ[ν] fun x ↦ (f x)⁻¹ * μ.rnDeriv ν x := by
have : SigmaFinite (ν.withDensity f) := SigmaFinite.withDensity_of_ne_top hf_ne_top
refine (withDensity_absolutelyContinuous' hf hf_ne_zero).ae_eq ?_
refine (Measure.eq_rnDeriv₀ (ν := ν.withDensity f) ?_ Measure.MutuallySingular.zero_left ?_).symm
· exact (hf.inv.mono_ac (withDensity_absolutelyContinuous _ _)).mul
(Measure.measurable_rnDeriv _ _).aemeasurable
· ext1 s hs
conv_lhs => rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
rw [zero_add, withDensity_apply _ hs, withDensity_apply _ hs]
rw [setLIntegral_withDensity_eq_setLIntegral_mul_non_measurable₀ _ _ _ hs]
· simp only [Pi.mul_apply]
have : (fun a ↦ f a * ((f a)⁻¹ * μ.rnDeriv ν a)) =ᵐ[ν] μ.rnDeriv ν := by
filter_upwards [hf_ne_zero, hf_ne_top] with x hx1 hx2
simp [← mul_assoc, ENNReal.mul_inv_cancel, hx1, hx2]
rw [lintegral_congr_ae (ae_restrict_of_ae this)]
· refine ae_restrict_of_ae ?_
filter_upwards [hf_ne_top] with x hx using hx.lt_top
· exact hf.restrict
lemma rnDeriv_withDensity_right (μ ν : Measure α) [SigmaFinite μ] [SigmaFinite ν]
(hf : AEMeasurable f ν) (hf_ne_zero : ∀ᵐ x ∂ν, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂ν, f x ≠ ∞) :
μ.rnDeriv (ν.withDensity f) =ᵐ[ν] fun x ↦ (f x)⁻¹ * μ.rnDeriv ν x := by
let μ' := ν.withDensity (μ.rnDeriv ν)
have h₁ : μ'.rnDeriv (ν.withDensity f) =ᵐ[ν] μ.rnDeriv (ν.withDensity f) :=
rnDeriv_withDensity_withDensity_rnDeriv_right μ ν hf hf_ne_zero hf_ne_top
have h₂ : μ.rnDeriv ν =ᵐ[ν] μ'.rnDeriv ν :=
(Measure.rnDeriv_withDensity _ (Measure.measurable_rnDeriv _ _)).symm
have hμ' := rnDeriv_withDensity_right_of_absolutelyContinuous
(withDensity_absolutelyContinuous ν (μ.rnDeriv ν)) hf hf_ne_zero hf_ne_top
filter_upwards [h₁, h₂, hμ'] with x hx₁ hx₂ hx_eq
rw [← hx₁, hx₂, hx_eq]
end rnDeriv_withDensity_leftRight
lemma rnDeriv_eq_zero_of_mutuallySingular {ν' : Measure α} [HaveLebesgueDecomposition μ ν']
[SigmaFinite ν'] (h : μ ⟂ₘ ν) (hνν' : ν ≪ ν') :
μ.rnDeriv ν' =ᵐ[ν] 0 := by
let t := h.nullSet
have ht : MeasurableSet t := h.measurableSet_nullSet
refine ae_of_ae_restrict_of_ae_restrict_compl t ?_ (by simp [t])
change μ.rnDeriv ν' =ᵐ[ν.restrict t] 0
have : μ.rnDeriv ν' =ᵐ[ν.restrict t] (μ.restrict t).rnDeriv ν' := by
have h : (μ.restrict t).rnDeriv ν' =ᵐ[ν] t.indicator (μ.rnDeriv ν') :=
hνν'.ae_le (rnDeriv_restrict μ ν' ht)
rw [Filter.EventuallyEq, ae_restrict_iff' ht]
filter_upwards [h] with x hx hxt
rw [hx, Set.indicator_of_mem hxt]
refine this.trans ?_
simp only [t, MutuallySingular.restrict_nullSet]
suffices (0 : Measure α).rnDeriv ν' =ᵐ[ν'] 0 by
have h_ac' : ν.restrict t ≪ ν' := restrict_le_self.absolutelyContinuous.trans hνν'
exact h_ac'.ae_le this
exact rnDeriv_zero _
/-- Auxiliary lemma for `rnDeriv_add_right_of_mutuallySingular`. -/
lemma rnDeriv_add_right_of_absolutelyContinuous_of_mutuallySingular {ν' : Measure α}
[HaveLebesgueDecomposition μ ν] [HaveLebesgueDecomposition μ (ν + ν')] [SigmaFinite ν]
(hμν : μ ≪ ν) (hνν' : ν ⟂ₘ ν') :
μ.rnDeriv (ν + ν') =ᵐ[ν] μ.rnDeriv ν := by
let t := hνν'.nullSet
have ht : MeasurableSet t := hνν'.measurableSet_nullSet
refine ae_of_ae_restrict_of_ae_restrict_compl t (by simp [t]) ?_
change μ.rnDeriv (ν + ν') =ᵐ[ν.restrict tᶜ] μ.rnDeriv ν
rw [← withDensity_eq_iff_of_sigmaFinite (μ := ν.restrict tᶜ)
(Measure.measurable_rnDeriv _ _).aemeasurable (Measure.measurable_rnDeriv _ _).aemeasurable]
have : (ν.restrict tᶜ).withDensity (μ.rnDeriv (ν + ν'))
= ((ν + ν').restrict tᶜ).withDensity (μ.rnDeriv (ν + ν')) := by simp [t]
rw [this, ← restrict_withDensity ht.compl, ← restrict_withDensity ht.compl,
Measure.withDensity_rnDeriv_eq _ _ (hμν.add_right ν'), Measure.withDensity_rnDeriv_eq _ _ hμν]
/-- Auxiliary lemma for `rnDeriv_add_right_of_mutuallySingular`. -/
lemma rnDeriv_add_right_of_mutuallySingular' {ν' : Measure α}
[SigmaFinite μ] [SigmaFinite ν] [SigmaFinite ν']
(hμν' : μ ⟂ₘ ν') (hνν' : ν ⟂ₘ ν') :
μ.rnDeriv (ν + ν') =ᵐ[ν] μ.rnDeriv ν := by
have h_ac : ν ≪ ν + ν' := Measure.AbsolutelyContinuous.rfl.add_right _
rw [haveLebesgueDecomposition_add μ ν]
have h₁ := rnDeriv_add' (μ.singularPart ν) (ν.withDensity (μ.rnDeriv ν)) (ν + ν')
have h₂ := rnDeriv_add' (μ.singularPart ν) (ν.withDensity (μ.rnDeriv ν)) ν
refine (Filter.EventuallyEq.trans (h_ac.ae_le h₁) ?_).trans h₂.symm
have h₃ := rnDeriv_add_right_of_absolutelyContinuous_of_mutuallySingular
(withDensity_absolutelyContinuous ν (μ.rnDeriv ν)) hνν'
have h₄ : (μ.singularPart ν).rnDeriv (ν + ν') =ᵐ[ν] 0 := by
refine h_ac.ae_eq ?_
simp only [rnDeriv_eq_zero, MutuallySingular.add_right_iff]
exact ⟨mutuallySingular_singularPart μ ν, hμν'.singularPart ν⟩
have h₅ : (μ.singularPart ν).rnDeriv ν =ᵐ[ν] 0 := rnDeriv_singularPart μ ν
filter_upwards [h₃, h₄, h₅] with x hx₃ hx₄ hx₅
simp only [Pi.add_apply]
rw [hx₃, hx₄, hx₅]
lemma rnDeriv_add_right_of_mutuallySingular {ν' : Measure α}
[SigmaFinite μ] [SigmaFinite ν] [SigmaFinite ν'] (hνν' : ν ⟂ₘ ν') :
μ.rnDeriv (ν + ν') =ᵐ[ν] μ.rnDeriv ν := by
have h_ac : ν ≪ ν + ν' := Measure.AbsolutelyContinuous.rfl.add_right _
rw [haveLebesgueDecomposition_add μ ν']
have h₁ := rnDeriv_add' (μ.singularPart ν') (ν'.withDensity (μ.rnDeriv ν')) (ν + ν')
have h₂ := rnDeriv_add' (μ.singularPart ν') (ν'.withDensity (μ.rnDeriv ν')) ν
refine (Filter.EventuallyEq.trans (h_ac.ae_le h₁) ?_).trans h₂.symm
have h₃ := rnDeriv_add_right_of_mutuallySingular' (?_ : μ.singularPart ν' ⟂ₘ ν') hνν'
· have h₄ : (ν'.withDensity (rnDeriv μ ν')).rnDeriv (ν + ν') =ᵐ[ν] 0 := by
refine rnDeriv_eq_zero_of_mutuallySingular ?_ h_ac
exact hνν'.symm.withDensity
have h₅ : (ν'.withDensity (rnDeriv μ ν')).rnDeriv ν =ᵐ[ν] 0 := by
rw [rnDeriv_eq_zero]
exact hνν'.symm.withDensity
filter_upwards [h₃, h₄, h₅] with x hx₃ hx₄ hx₅
rw [Pi.add_apply, Pi.add_apply, hx₃, hx₄, hx₅]
exact mutuallySingular_singularPart μ ν'
lemma rnDeriv_withDensity_rnDeriv [SigmaFinite μ] [SigmaFinite ν] (hμν : μ ≪ ν) :
μ.rnDeriv (μ.withDensity (ν.rnDeriv μ)) =ᵐ[μ] μ.rnDeriv ν := by
conv_rhs => rw [ν.haveLebesgueDecomposition_add μ, add_comm]
refine (absolutelyContinuous_withDensity_rnDeriv hμν).ae_eq ?_
exact (rnDeriv_add_right_of_mutuallySingular
(Measure.mutuallySingular_singularPart ν μ).symm.withDensity).symm
/-- Auxiliary lemma for `inv_rnDeriv`. -/
lemma inv_rnDeriv_aux [HaveLebesgueDecomposition μ ν] [HaveLebesgueDecomposition ν μ]
[SigmaFinite μ] (hμν : μ ≪ ν) (hνμ : ν ≪ μ) :
(μ.rnDeriv ν)⁻¹ =ᵐ[μ] ν.rnDeriv μ := by
suffices μ.withDensity (μ.rnDeriv ν)⁻¹ = μ.withDensity (ν.rnDeriv μ) by
calc (μ.rnDeriv ν)⁻¹ =ᵐ[μ] (μ.withDensity (μ.rnDeriv ν)⁻¹).rnDeriv μ :=
(rnDeriv_withDensity _ (measurable_rnDeriv _ _).inv).symm
_ = (μ.withDensity (ν.rnDeriv μ)).rnDeriv μ := by rw [this]
_ =ᵐ[μ] ν.rnDeriv μ := rnDeriv_withDensity _ (measurable_rnDeriv _ _)
rw [withDensity_rnDeriv_eq _ _ hνμ, ← withDensity_rnDeriv_eq _ _ hμν]
conv in ((ν.withDensity (μ.rnDeriv ν)).rnDeriv ν)⁻¹ => rw [withDensity_rnDeriv_eq _ _ hμν]
change (ν.withDensity (μ.rnDeriv ν)).withDensity (fun x ↦ (μ.rnDeriv ν x)⁻¹) = ν
rw [withDensity_inv_same (measurable_rnDeriv _ _)
(by filter_upwards [hνμ.ae_le (rnDeriv_pos hμν)] with x hx using hx.ne')
(rnDeriv_ne_top _ _)]
lemma inv_rnDeriv [SigmaFinite μ] [SigmaFinite ν] (hμν : μ ≪ ν) :
(μ.rnDeriv ν)⁻¹ =ᵐ[μ] ν.rnDeriv μ := by
suffices (μ.rnDeriv ν)⁻¹ =ᵐ[μ] (μ.rnDeriv (μ.withDensity (ν.rnDeriv μ)))⁻¹
∧ ν.rnDeriv μ =ᵐ[μ] (μ.withDensity (ν.rnDeriv μ)).rnDeriv μ by
refine (this.1.trans (Filter.EventuallyEq.trans ?_ this.2.symm))
exact Measure.inv_rnDeriv_aux (absolutelyContinuous_withDensity_rnDeriv hμν)
(withDensity_absolutelyContinuous _ _)
constructor
· filter_upwards [rnDeriv_withDensity_rnDeriv hμν] with x hx
simp only [Pi.inv_apply, inv_inj]
exact hx.symm
· exact (Measure.rnDeriv_withDensity μ (Measure.measurable_rnDeriv ν μ)).symm
lemma inv_rnDeriv' [SigmaFinite μ] [SigmaFinite ν] (hμν : μ ≪ ν) :
(ν.rnDeriv μ)⁻¹ =ᵐ[μ] μ.rnDeriv ν := by
filter_upwards [inv_rnDeriv hμν] with x hx; simp only [Pi.inv_apply, ← hx, inv_inv]
section integral
lemma setLIntegral_rnDeriv_le (s : Set α) :
∫⁻ x in s, μ.rnDeriv ν x ∂ν ≤ μ s :=
(withDensity_apply_le _ _).trans (Measure.le_iff'.1 (withDensity_rnDeriv_le μ ν) s)
lemma lintegral_rnDeriv_le : ∫⁻ x, μ.rnDeriv ν x ∂ν ≤ μ Set.univ :=
(setLIntegral_univ _).symm ▸ Measure.setLIntegral_rnDeriv_le Set.univ
lemma setLIntegral_rnDeriv' [HaveLebesgueDecomposition μ ν] (hμν : μ ≪ ν) {s : Set α}
(hs : MeasurableSet s) :
∫⁻ x in s, μ.rnDeriv ν x ∂ν = μ s := by
rw [← withDensity_apply _ hs, Measure.withDensity_rnDeriv_eq _ _ hμν]
lemma setLIntegral_rnDeriv [HaveLebesgueDecomposition μ ν] [SFinite ν]
(hμν : μ ≪ ν) (s : Set α) :
∫⁻ x in s, μ.rnDeriv ν x ∂ν = μ s := by
rw [← withDensity_apply' _ s, Measure.withDensity_rnDeriv_eq _ _ hμν]
lemma lintegral_rnDeriv [HaveLebesgueDecomposition μ ν] (hμν : μ ≪ ν) :
∫⁻ x, μ.rnDeriv ν x ∂ν = μ Set.univ := by
rw [← setLIntegral_univ, setLIntegral_rnDeriv' hμν MeasurableSet.univ]
lemma integrableOn_toReal_rnDeriv {s : Set α} (hμs : μ s ≠ ∞) :
IntegrableOn (fun x ↦ (μ.rnDeriv ν x).toReal) s ν := by
refine integrable_toReal_of_lintegral_ne_top (Measure.measurable_rnDeriv _ _).aemeasurable ?_
exact ((setLIntegral_rnDeriv_le _).trans_lt hμs.lt_top).ne
lemma setIntegral_toReal_rnDeriv_eq_withDensity' [SigmaFinite μ]
{s : Set α} (hs : MeasurableSet s) :
∫ x in s, (μ.rnDeriv ν x).toReal ∂ν = (ν.withDensity (μ.rnDeriv ν)).real s := by
rw [integral_toReal (Measure.measurable_rnDeriv _ _).aemeasurable, measureReal_def]
· rw [ENNReal.toReal_eq_toReal_iff, ← withDensity_apply _ hs]
simp
· exact ae_restrict_of_ae (Measure.rnDeriv_lt_top _ _)
lemma setIntegral_toReal_rnDeriv_eq_withDensity [SigmaFinite μ] [SFinite ν] (s : Set α) :
∫ x in s, (μ.rnDeriv ν x).toReal ∂ν = (ν.withDensity (μ.rnDeriv ν)).real s := by
rw [integral_toReal (Measure.measurable_rnDeriv _ _).aemeasurable, measureReal_def]
· rw [ENNReal.toReal_eq_toReal_iff, ← withDensity_apply' _ s]
simp
· exact ae_restrict_of_ae (Measure.rnDeriv_lt_top _ _)
lemma setIntegral_toReal_rnDeriv_le [SigmaFinite μ] {s : Set α} (hμs : μ s ≠ ∞) :
∫ x in s, (μ.rnDeriv ν x).toReal ∂ν ≤ μ.real s := by
set t := toMeasurable μ s with ht
have ht_m : MeasurableSet t := measurableSet_toMeasurable μ s
have hμt : μ t ≠ ∞ := by rwa [ht, measure_toMeasurable s]
calc ∫ x in s, (μ.rnDeriv ν x).toReal ∂ν
≤ ∫ x in t, (μ.rnDeriv ν x).toReal ∂ν := by
refine setIntegral_mono_set ?_ ?_ (HasSubset.Subset.eventuallyLE (subset_toMeasurable _ _))
· exact integrableOn_toReal_rnDeriv hμt
· exact ae_of_all _ (by simp)
_ = (withDensity ν (rnDeriv μ ν)).real t := setIntegral_toReal_rnDeriv_eq_withDensity' ht_m
_ ≤ μ.real t := by
simp only [measureReal_def]
gcongr
· exact hμt
· apply withDensity_rnDeriv_le
_ = μ.real s := by rw [measureReal_def, measureReal_def, measure_toMeasurable s]
lemma setIntegral_toReal_rnDeriv' [SigmaFinite μ] [HaveLebesgueDecomposition μ ν]
(hμν : μ ≪ ν) {s : Set α} (hs : MeasurableSet s) :
∫ x in s, (μ.rnDeriv ν x).toReal ∂ν = μ.real s := by
rw [setIntegral_toReal_rnDeriv_eq_withDensity' hs, Measure.withDensity_rnDeriv_eq _ _ hμν,
measureReal_def]
lemma setIntegral_toReal_rnDeriv [SigmaFinite μ] [SigmaFinite ν] (hμν : μ ≪ ν) (s : Set α) :
∫ x in s, (μ.rnDeriv ν x).toReal ∂ν = μ.real s := by
rw [setIntegral_toReal_rnDeriv_eq_withDensity s, Measure.withDensity_rnDeriv_eq _ _ hμν]
lemma integral_toReal_rnDeriv [SigmaFinite μ] [SigmaFinite ν] (hμν : μ ≪ ν) :
∫ x, (μ.rnDeriv ν x).toReal ∂ν = μ.real Set.univ := by
rw [← setIntegral_univ, setIntegral_toReal_rnDeriv hμν Set.univ]
lemma integral_toReal_rnDeriv' [IsFiniteMeasure μ] [SigmaFinite ν] :
∫ x, (μ.rnDeriv ν x).toReal ∂ν = μ.real Set.univ - (μ.singularPart ν).real Set.univ := by
rw [measureReal_def, measureReal_def,
← ENNReal.toReal_sub_of_le (μ.singularPart_le ν Set.univ) (measure_ne_top _ _),
← Measure.sub_apply .univ (Measure.singularPart_le μ ν), Measure.measure_sub_singularPart,
← measureReal_def, ← Measure.setIntegral_toReal_rnDeriv_eq_withDensity, setIntegral_univ]
end integral
lemma rnDeriv_mul_rnDeriv {κ : Measure α} [SigmaFinite μ] [SigmaFinite ν] [SigmaFinite κ]
(hμν : μ ≪ ν) :
μ.rnDeriv ν * ν.rnDeriv κ =ᵐ[κ] μ.rnDeriv κ := by
refine (rnDeriv_withDensity_left ?_ ?_).symm.trans ?_
· exact (Measure.measurable_rnDeriv _ _).aemeasurable
· exact rnDeriv_ne_top _ _
· rw [Measure.withDensity_rnDeriv_eq _ _ hμν]
lemma rnDeriv_mul_rnDeriv' {κ : Measure α} [SigmaFinite μ] [SigmaFinite ν] [SigmaFinite κ]
(hνκ : ν ≪ κ) :
μ.rnDeriv ν * ν.rnDeriv κ =ᵐ[ν] μ.rnDeriv κ := by
obtain ⟨h_meas, h_sing, hμν⟩ := Measure.haveLebesgueDecomposition_spec μ ν
filter_upwards [hνκ <| Measure.rnDeriv_add' (μ.singularPart ν) (ν.withDensity (μ.rnDeriv ν)) κ,
hνκ <| Measure.rnDeriv_withDensity_left_of_absolutelyContinuous hνκ h_meas.aemeasurable,
Measure.rnDeriv_eq_zero_of_mutuallySingular h_sing hνκ] with x hx1 hx2 hx3
nth_rw 2 [hμν]
rw [hx1, Pi.add_apply, hx2, Pi.mul_apply, hx3, Pi.zero_apply, zero_add]
lemma rnDeriv_le_one_of_le (hμν : μ ≤ ν) [SigmaFinite ν] : μ.rnDeriv ν ≤ᵐ[ν] 1 := by
refine ae_le_of_forall_setLIntegral_le_of_sigmaFinite (μ.measurable_rnDeriv ν) fun s _ _ ↦ ?_
simp only [Pi.one_apply, MeasureTheory.setLIntegral_one]
exact (Measure.setLIntegral_rnDeriv_le s).trans (hμν s)
lemma rnDeriv_le_one_iff_le [HaveLebesgueDecomposition μ ν] [SigmaFinite ν] (hμν : μ ≪ ν) :
μ.rnDeriv ν ≤ᵐ[ν] 1 ↔ μ ≤ ν := by
refine ⟨fun h s ↦ ?_, fun h ↦ rnDeriv_le_one_of_le h⟩
rw [← withDensity_rnDeriv_eq _ _ hμν, withDensity_apply', ← setLIntegral_one]
exact setLIntegral_mono_ae aemeasurable_const (h.mono fun _ hh _ ↦ hh)
lemma rnDeriv_eq_one_iff_eq [HaveLebesgueDecomposition μ ν] [SigmaFinite ν] (hμν : μ ≪ ν) :
μ.rnDeriv ν =ᵐ[ν] 1 ↔ μ = ν := by
refine ⟨fun h ↦ ?_, fun h ↦ h ▸ ν.rnDeriv_self⟩
rw [← withDensity_rnDeriv_eq _ _ hμν, withDensity_congr_ae h, withDensity_one]
section MeasurableEmbedding
variable {mβ : MeasurableSpace β} {f : α → β}
lemma _root_.MeasurableEmbedding.rnDeriv_map_aux (hf : MeasurableEmbedding f)
(hμν : μ ≪ ν) [SigmaFinite μ] [SigmaFinite ν] :
(fun x ↦ (μ.map f).rnDeriv (ν.map f) (f x)) =ᵐ[ν] μ.rnDeriv ν := by
refine ae_eq_of_forall_setLIntegral_eq_of_sigmaFinite ?_ ?_ (fun s _ _ ↦ ?_)
· exact (Measure.measurable_rnDeriv _ _).comp hf.measurable
· exact Measure.measurable_rnDeriv _ _
rw [← hf.lintegral_map, Measure.setLIntegral_rnDeriv hμν]
have hs_eq : s = f ⁻¹' (f '' s) := by rw [hf.injective.preimage_image]
have : SigmaFinite (ν.map f) := hf.sigmaFinite_map
rw [hs_eq, ← hf.restrict_map, Measure.setLIntegral_rnDeriv (hf.absolutelyContinuous_map hμν),
hf.map_apply]
lemma _root_.MeasurableEmbedding.rnDeriv_map (hf : MeasurableEmbedding f)
(μ ν : Measure α) [SigmaFinite μ] [SigmaFinite ν] :
(fun x ↦ (μ.map f).rnDeriv (ν.map f) (f x)) =ᵐ[ν] μ.rnDeriv ν := by
rw [μ.haveLebesgueDecomposition_add ν, Measure.map_add _ _ hf.measurable]
have : SigmaFinite (map f ν) := hf.sigmaFinite_map
have : SigmaFinite (map f (μ.singularPart ν)) := hf.sigmaFinite_map
have : SigmaFinite (map f (ν.withDensity (μ.rnDeriv ν))) := hf.sigmaFinite_map
have h_add := Measure.rnDeriv_add' ((μ.singularPart ν).map f)
((ν.withDensity (μ.rnDeriv ν)).map f) (ν.map f)
rw [Filter.EventuallyEq, hf.ae_map_iff, ← Filter.EventuallyEq] at h_add
refine h_add.trans ((Measure.rnDeriv_add' _ _ _).trans ?_).symm
refine Filter.EventuallyEq.add ?_ ?_
· refine (Measure.rnDeriv_singularPart μ ν).trans ?_
symm
suffices (fun x ↦ ((μ.singularPart ν).map f).rnDeriv (ν.map f) x) =ᵐ[ν.map f] 0 by
rw [Filter.EventuallyEq, hf.ae_map_iff] at this
exact this
refine Measure.rnDeriv_eq_zero_of_mutuallySingular ?_ Measure.AbsolutelyContinuous.rfl
exact hf.mutuallySingular_map (μ.mutuallySingular_singularPart ν)
· exact (hf.rnDeriv_map_aux (withDensity_absolutelyContinuous _ _)).symm
lemma _root_.MeasurableEmbedding.map_withDensity_rnDeriv (hf : MeasurableEmbedding f)
(μ ν : Measure α) [SigmaFinite μ] [SigmaFinite ν] :
(ν.withDensity (μ.rnDeriv ν)).map f = (ν.map f).withDensity ((μ.map f).rnDeriv (ν.map f)) := by
ext s hs
rw [hf.map_apply, withDensity_apply _ (hf.measurable hs), withDensity_apply _ hs,
setLIntegral_map hs (Measure.measurable_rnDeriv _ _) hf.measurable]
refine setLIntegral_congr_fun_ae (hf.measurable hs) ?_
filter_upwards [hf.rnDeriv_map μ ν] with a ha _ using ha.symm
lemma _root_.MeasurableEmbedding.singularPart_map (hf : MeasurableEmbedding f)
(μ ν : Measure α) [SigmaFinite μ] [SigmaFinite ν] :
(μ.map f).singularPart (ν.map f) = (μ.singularPart ν).map f := by
have h_add : μ.map f = (μ.singularPart ν).map f
+ (ν.map f).withDensity ((μ.map f).rnDeriv (ν.map f)) := by
conv_lhs => rw [μ.haveLebesgueDecomposition_add ν]
rw [Measure.map_add _ _ hf.measurable, ← hf.map_withDensity_rnDeriv μ ν]
refine (Measure.eq_singularPart (Measure.measurable_rnDeriv _ _) ?_ h_add).symm
exact hf.mutuallySingular_map (μ.mutuallySingular_singularPart ν)
end MeasurableEmbedding
end Measure
section IntegralRNDerivMul
open Measure
variable {α : Type*} {m : MeasurableSpace α} {μ ν : Measure α}
theorem lintegral_rnDeriv_mul [HaveLebesgueDecomposition μ ν] (hμν : μ ≪ ν) {f : α → ℝ≥0∞}
(hf : AEMeasurable f ν) : ∫⁻ x, μ.rnDeriv ν x * f x ∂ν = ∫⁻ x, f x ∂μ := by
nth_rw 2 [← withDensity_rnDeriv_eq μ ν hμν]
rw [lintegral_withDensity_eq_lintegral_mul₀ (measurable_rnDeriv μ ν).aemeasurable hf]
simp only [Pi.mul_apply]
lemma setLIntegral_rnDeriv_mul [HaveLebesgueDecomposition μ ν] (hμν : μ ≪ ν) {f : α → ℝ≥0∞}
(hf : AEMeasurable f ν) {s : Set α} (hs : MeasurableSet s) :
∫⁻ x in s, μ.rnDeriv ν x * f x ∂ν = ∫⁻ x in s, f x ∂μ := by
nth_rw 2 [← Measure.withDensity_rnDeriv_eq μ ν hμν]
rw [setLIntegral_withDensity_eq_lintegral_mul₀ (measurable_rnDeriv μ ν).aemeasurable hf hs]
simp only [Pi.mul_apply]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [HaveLebesgueDecomposition μ ν]
[SigmaFinite μ] {f : α → E}
theorem integrable_rnDeriv_smul_iff (hμν : μ ≪ ν) :
Integrable (fun x ↦ (μ.rnDeriv ν x).toReal • f x) ν ↔ Integrable f μ := by
nth_rw 2 [← withDensity_rnDeriv_eq μ ν hμν]
rw [← integrable_withDensity_iff_integrable_smul' (E := E)
(measurable_rnDeriv μ ν) (rnDeriv_lt_top μ ν)]
theorem integral_rnDeriv_smul (hμν : μ ≪ ν) :
∫ x, (μ.rnDeriv ν x).toReal • f x ∂ν = ∫ x, f x ∂μ := by
rw [← integral_withDensity_eq_integral_toReal_smul (measurable_rnDeriv _ _) (rnDeriv_lt_top _ _),
withDensity_rnDeriv_eq _ _ hμν]
/-- See also `setIntegral_rnDeriv_smul'` for a version that requires both measures to be σ-finite,
but doesn't require `s` to be a measurable set. -/
lemma setIntegral_rnDeriv_smul (hμν : μ ≪ ν) {s : Set α} (hs : MeasurableSet s) :
∫ x in s, (μ.rnDeriv ν x).toReal • f x ∂ν = ∫ x in s, f x ∂μ := by
rw [← setIntegral_withDensity_eq_setIntegral_toReal_smul, withDensity_rnDeriv_eq _ _ hμν]
exacts [measurable_rnDeriv _ _, ae_restrict_of_ae (rnDeriv_lt_top _ _), hs]
omit [HaveLebesgueDecomposition μ ν] in
/-- A version of `setIntegral_rnDeriv_smul` that requires both measures to be σ-finite,
but doesn't require `s` to be a measurable set. -/
lemma setIntegral_rnDeriv_smul' [SigmaFinite ν] (hμν : μ ≪ ν) (s : Set α) :
∫ x in s, (μ.rnDeriv ν x).toReal • f x ∂ν = ∫ x in s, f x ∂μ := by
rw [← setIntegral_withDensity_eq_setIntegral_toReal_smul', withDensity_rnDeriv_eq _ _ hμν]
exacts [measurable_rnDeriv _ _, ae_restrict_of_ae (rnDeriv_lt_top _ _)]
end IntegralRNDerivMul
section Conv
open Measure
variable {G : Type*} [Group G] {mG : MeasurableSpace G} [MeasurableMul₂ G] [MeasurableInv G]
{μ : Measure G} [IsMulLeftInvariant μ]
@[to_additive]
theorem mconv_eq_withDensity_mlconvolution_rnDeriv [SFinite μ] {ν₁ ν₂ : Measure G}
[ν₁.HaveLebesgueDecomposition μ] [ν₂.HaveLebesgueDecomposition μ]
(hν₁ : ν₁ ≪ μ) (hν₂ : ν₂ ≪ μ) :
ν₁ ∗ₘ ν₂ = μ.withDensity (ν₁.rnDeriv μ ⋆ₘₗ[μ] ν₂.rnDeriv μ) := by
rw [← mconv_withDensity_eq_mlconvolution (by fun_prop) (by fun_prop),
withDensity_rnDeriv_eq _ _ hν₁, withDensity_rnDeriv_eq _ _ hν₂]
@[to_additive]
theorem HaveLebesgueDecomposition.mconv [SFinite μ] {ν₁ ν₂ : Measure G}
[ν₁.HaveLebesgueDecomposition μ] [ν₂.HaveLebesgueDecomposition μ]
(hν₁ : ν₁ ≪ μ) (hν₂ : ν₂ ≪ μ) : (ν₁ ∗ₘ ν₂).HaveLebesgueDecomposition μ :=
⟨⟨0, (ν₁.rnDeriv μ) ⋆ₘₗ[μ] (ν₂.rnDeriv μ)⟩, by fun_prop, by simp,
by simpa using mconv_eq_withDensity_mlconvolution_rnDeriv hν₁ hν₂⟩
@[to_additive]
theorem rnDeriv_mconv [SFinite μ] {ν₁ ν₂ : Measure G} [IsFiniteMeasure ν₁] [IsFiniteMeasure ν₂]
[ν₁.HaveLebesgueDecomposition μ] [ν₂.HaveLebesgueDecomposition μ]
(hν₁ : ν₁ ≪ μ) (hν₂ : ν₂ ≪ μ) :
(ν₁ ∗ₘ ν₂).rnDeriv μ =ᵐ[μ] (ν₁.rnDeriv μ) ⋆ₘₗ[μ] (ν₂.rnDeriv μ) := by
have := HaveLebesgueDecomposition.mconv hν₁ hν₂
rw [← withDensity_eq_iff (by fun_prop) (by fun_prop),
withDensity_rnDeriv_eq _ _ (mconv_absolutelyContinuous hν₂),
mconv_eq_withDensity_mlconvolution_rnDeriv hν₁ hν₂]
exact (lintegral_rnDeriv_lt_top (ν₁ ∗ₘ ν₂) μ).ne
@[to_additive]
theorem rnDeriv_mconv' [SigmaFinite μ] {ν₁ ν₂ : Measure G} [SigmaFinite ν₁] [SigmaFinite ν₂]
(hν₁ : ν₁ ≪ μ) (hν₂ : ν₂ ≪ μ) :
(ν₁ ∗ₘ ν₂).rnDeriv μ =ᵐ[μ] (ν₁.rnDeriv μ) ⋆ₘₗ[μ] (ν₂.rnDeriv μ) := by
rw [← withDensity_eq_iff_of_sigmaFinite (by fun_prop) (by fun_prop),
← mconv_eq_withDensity_mlconvolution_rnDeriv hν₁ hν₂,
withDensity_rnDeriv_eq _ _ (mconv_absolutelyContinuous hν₂)]
end Conv
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Decomposition/Exhaustion.lean | import Mathlib.MeasureTheory.Measure.Typeclasses.SFinite
/-!
# Method of exhaustion
If `μ, ν` are two measures with `ν` s-finite, then there exists a set `s` such that
`μ` is sigma-finite on `s`, and for all sets `t ⊆ sᶜ`, either `ν t = 0` or `μ t = ∞`.
## Main definitions
* `MeasureTheory.Measure.sigmaFiniteSetWRT`: if such a set exists, `μ.sigmaFiniteSetWRT ν` is
a measurable set such that `μ.restrict (μ.sigmaFiniteSetWRT ν)` is sigma-finite and
for all sets `t ⊆ (μ.sigmaFiniteSetWRT ν)ᶜ`, either `ν t = 0` or `μ t = ∞`.
If no such set exists (which is only possible if `ν` is not s-finite), we define
`μ.sigmaFiniteSetWRT ν = ∅`.
* `MeasureTheory.Measure.sigmaFiniteSet`: for an s-finite measure `μ`, a measurable set such that
`μ.restrict μ.sigmaFiniteSet` is sigma-finite, and for all sets `s ⊆ μ.sigmaFiniteSetᶜ`,
either `μ s = 0` or `μ s = ∞`.
Defined as `μ.sigmaFiniteSetWRT μ`.
## Main statements
* `measure_eq_top_of_subset_compl_sigmaFiniteSetWRT`: for s-finite `ν`, for all sets `s`
in `(sigmaFiniteSetWRT μ ν)ᶜ`, if `ν s ≠ 0` then `μ s = ∞`.
* An instance showing that `μ.restrict (sigmaFiniteSetWRT μ ν)` is sigma-finite.
* `restrict_compl_sigmaFiniteSetWRT`: if `μ ≪ ν` and `ν` is s-finite, then
`μ.restrict (μ.sigmaFiniteSetWRT ν)ᶜ = ∞ • ν.restrict (μ.sigmaFiniteSetWRT ν)ᶜ`. As a consequence,
that restriction is s-finite.
* An instance showing that `μ.restrict μ.sigmaFiniteSet` is sigma-finite.
* `restrict_compl_sigmaFiniteSet_eq_zero_or_top`: the measure `μ.restrict μ.sigmaFiniteSetᶜ` takes
only two values: 0 and ∞ .
* `measure_compl_sigmaFiniteSet_eq_zero_iff_sigmaFinite`: a measure `μ` is sigma-finite
iff `μ μ.sigmaFiniteSetᶜ = 0`.
## References
* [P. R. Halmos, *Measure theory*, 17.3 and 30.11][halmos1950measure]
-/
assert_not_exists MeasureTheory.Measure.rnDeriv
assert_not_exists MeasureTheory.VectorMeasure
open scoped ENNReal Topology
open Filter
namespace MeasureTheory
variable {α : Type*} {mα : MeasurableSpace α} {μ ν : Measure α} {s t : Set α}
open Classical in
/-- A measurable set such that `μ.restrict (μ.sigmaFiniteSetWRT ν)` is sigma-finite and for all
measurable sets `t ⊆ sᶜ`, either `ν t = 0` or `μ t = ∞`. -/
def Measure.sigmaFiniteSetWRT (μ ν : Measure α) : Set α :=
if h : ∃ s : Set α, MeasurableSet s ∧ SigmaFinite (μ.restrict s)
∧ (∀ t, t ⊆ sᶜ → ν t ≠ 0 → μ t = ∞)
then h.choose
else ∅
@[measurability]
lemma measurableSet_sigmaFiniteSetWRT :
MeasurableSet (μ.sigmaFiniteSetWRT ν) := by
rw [Measure.sigmaFiniteSetWRT]
split_ifs with h
· exact h.choose_spec.1
· exact MeasurableSet.empty
instance : SigmaFinite (μ.restrict (μ.sigmaFiniteSetWRT ν)) := by
rw [Measure.sigmaFiniteSetWRT]
split_ifs with h
· exact h.choose_spec.2.1
· rw [Measure.restrict_empty]
infer_instance
section IsFiniteMeasure
/-! We prove that the condition in the definition of `sigmaFiniteSetWRT` is true for finite
measures. Since every s-finite measure is absolutely continuous with respect to a finite measure,
the condition will then also be true for s-finite measures. -/
/-- Let `C` be the supremum of `ν s` over all measurable sets `s` such that `μ.restrict s` is
sigma-finite. `C` is finite since `ν` is a finite measure. Then there exists a measurable set `t`
with `μ.restrict t` sigma-finite such that `ν t ≥ C - 1/n`. -/
lemma exists_isSigmaFiniteSet_measure_ge (μ ν : Measure α) [IsFiniteMeasure ν] (n : ℕ) :
∃ t, MeasurableSet t ∧ SigmaFinite (μ.restrict t)
∧ (⨆ (s) (_ : MeasurableSet s) (_ : SigmaFinite (μ.restrict s)), ν s) - 1/n ≤ ν t := by
by_cases! hC_lt : 1/n < ⨆ (s) (_ : MeasurableSet s) (_ : SigmaFinite (μ.restrict s)), ν s
· have h_lt_top : ⨆ (s) (_ : MeasurableSet s) (_ : SigmaFinite (μ.restrict s)), ν s < ∞ := by
refine (?_ : ⨆ (s) (_ : MeasurableSet s)
(_ : SigmaFinite (μ.restrict s)), ν s ≤ ν Set.univ).trans_lt (measure_lt_top _ _)
refine iSup_le (fun s ↦ ?_)
exact iSup_le (fun _ ↦ iSup_le (fun _ ↦ measure_mono (Set.subset_univ s)))
obtain ⟨t, ht⟩ := exists_lt_of_lt_ciSup
(ENNReal.sub_lt_self h_lt_top.ne (ne_zero_of_lt hC_lt) (by simp) :
(⨆ (s) (_ : MeasurableSet s) (_ : SigmaFinite (μ.restrict s)), ν s) - 1/n
< ⨆ (s) (_ : MeasurableSet s) (_ : SigmaFinite (μ.restrict s)), ν s)
have ht_meas : MeasurableSet t := by
by_contra h_notMem
simp only [h_notMem] at ht
simp at ht
have ht_mem : SigmaFinite (μ.restrict t) := by
by_contra h_notMem
simp only [h_notMem] at ht
simp at ht
refine ⟨t, ht_meas, ht_mem, ?_⟩
simp only [ht_meas, ht_mem, iSup_true] at ht
exact ht.le
· refine ⟨∅, MeasurableSet.empty, by rw [Measure.restrict_empty]; infer_instance, ?_⟩
rw [tsub_eq_zero_of_le hC_lt]
exact zero_le'
/-- A measurable set such that `μ.restrict (μ.sigmaFiniteSetGE ν n)` is sigma-finite and
for `C` the supremum of `ν s` over all measurable sets `s` with `μ.restrict s` sigma-finite,
`ν (μ.sigmaFiniteSetGE ν n) ≥ C - 1/n`. -/
def Measure.sigmaFiniteSetGE (μ ν : Measure α) [IsFiniteMeasure ν] (n : ℕ) : Set α :=
(exists_isSigmaFiniteSet_measure_ge μ ν n).choose
lemma measurableSet_sigmaFiniteSetGE [IsFiniteMeasure ν] (n : ℕ) :
MeasurableSet (μ.sigmaFiniteSetGE ν n) :=
(exists_isSigmaFiniteSet_measure_ge μ ν n).choose_spec.1
lemma sigmaFinite_restrict_sigmaFiniteSetGE (μ ν : Measure α) [IsFiniteMeasure ν] (n : ℕ) :
SigmaFinite (μ.restrict (μ.sigmaFiniteSetGE ν n)) :=
(exists_isSigmaFiniteSet_measure_ge μ ν n).choose_spec.2.1
lemma measure_sigmaFiniteSetGE_le (μ ν : Measure α) [IsFiniteMeasure ν] (n : ℕ) :
ν (μ.sigmaFiniteSetGE ν n)
≤ ⨆ (s) (_ : MeasurableSet s) (_ : SigmaFinite (μ.restrict s)), ν s := by
refine (le_iSup (f := fun s ↦ _)
(sigmaFinite_restrict_sigmaFiniteSetGE μ ν n)).trans ?_
exact le_iSup₂ (f := fun s _ ↦ ⨆ (_ : SigmaFinite (μ.restrict s)), ν s) (μ.sigmaFiniteSetGE ν n)
(measurableSet_sigmaFiniteSetGE n)
lemma measure_sigmaFiniteSetGE_ge (μ ν : Measure α) [IsFiniteMeasure ν] (n : ℕ) :
(⨆ (s) (_ : MeasurableSet s) (_ : SigmaFinite (μ.restrict s)), ν s) - 1/n
≤ ν (μ.sigmaFiniteSetGE ν n) :=
(exists_isSigmaFiniteSet_measure_ge μ ν n).choose_spec.2.2
lemma tendsto_measure_sigmaFiniteSetGE (μ ν : Measure α) [IsFiniteMeasure ν] :
Tendsto (fun n ↦ ν (μ.sigmaFiniteSetGE ν n)) atTop
(𝓝 (⨆ (s) (_ : MeasurableSet s) (_ : SigmaFinite (μ.restrict s)), ν s)) := by
refine tendsto_of_tendsto_of_tendsto_of_le_of_le ?_
tendsto_const_nhds (measure_sigmaFiniteSetGE_ge μ ν) (measure_sigmaFiniteSetGE_le μ ν)
nth_rewrite 2 [← tsub_zero (⨆ (s) (_ : MeasurableSet s) (_ : SigmaFinite (μ.restrict s)), ν s)]
refine ENNReal.Tendsto.sub tendsto_const_nhds ?_ (Or.inr ENNReal.zero_ne_top)
simp only [one_div]
exact ENNReal.tendsto_inv_nat_nhds_zero
/-- A measurable set such that `μ.restrict (μ.sigmaFiniteSetWRT' ν)` is sigma-finite and
`ν (μ.sigmaFiniteSetWRT' ν)` has maximal measure among such sets. -/
def Measure.sigmaFiniteSetWRT' (μ ν : Measure α) [IsFiniteMeasure ν] : Set α :=
⋃ n, μ.sigmaFiniteSetGE ν n
lemma measurableSet_sigmaFiniteSetWRT' [IsFiniteMeasure ν] :
MeasurableSet (μ.sigmaFiniteSetWRT' ν) :=
MeasurableSet.iUnion measurableSet_sigmaFiniteSetGE
lemma sigmaFinite_restrict_sigmaFiniteSetWRT' (μ ν : Measure α) [IsFiniteMeasure ν] :
SigmaFinite (μ.restrict (μ.sigmaFiniteSetWRT' ν)) := by
have := sigmaFinite_restrict_sigmaFiniteSetGE μ ν
let f : ℕ × ℕ → Set α := fun p : ℕ × ℕ ↦ (μ.sigmaFiniteSetWRT' ν)ᶜ
∪ (spanningSets (μ.restrict (μ.sigmaFiniteSetGE ν p.1)) p.2 ∩ (μ.sigmaFiniteSetGE ν p.1))
suffices (μ.restrict (μ.sigmaFiniteSetWRT' ν)).FiniteSpanningSetsIn (Set.range f) from
this.sigmaFinite
let e : ℕ ≃ ℕ × ℕ := Nat.pairEquiv.symm
refine ⟨fun n ↦ f (e n), fun _ ↦ by simp, fun n ↦ ?_, ?_⟩
· simp only [Nat.pairEquiv_symm_apply, measure_union_lt_top_iff, f, e]
rw [Measure.restrict_apply' measurableSet_sigmaFiniteSetWRT', Set.compl_inter_self,
Measure.restrict_apply' measurableSet_sigmaFiniteSetWRT']
simp only [measure_empty, ENNReal.zero_lt_top, true_and]
refine (measure_mono Set.inter_subset_left).trans_lt ?_
rw [← Measure.restrict_apply' (measurableSet_sigmaFiniteSetGE _)]
exact measure_spanningSets_lt_top _ _
· simp only [Nat.pairEquiv_symm_apply, f, e]
rw [← Set.union_iUnion]
suffices ⋃ n, (spanningSets (μ.restrict (μ.sigmaFiniteSetGE ν (Nat.unpair n).1)) n.unpair.2
∩ μ.sigmaFiniteSetGE ν n.unpair.1) = μ.sigmaFiniteSetWRT' ν by
rw [this, Set.compl_union_self]
calc ⋃ n, (spanningSets (μ.restrict (μ.sigmaFiniteSetGE ν (Nat.unpair n).1)) n.unpair.2
∩ μ.sigmaFiniteSetGE ν n.unpair.1)
= ⋃ n, ⋃ m, (spanningSets (μ.restrict (μ.sigmaFiniteSetGE ν n)) m
∩ μ.sigmaFiniteSetGE ν n) :=
Set.iUnion_unpair (fun n m ↦ spanningSets (μ.restrict (μ.sigmaFiniteSetGE ν n)) m
∩ μ.sigmaFiniteSetGE ν n)
_ = ⋃ n, μ.sigmaFiniteSetGE ν n := by
refine Set.iUnion_congr (fun n ↦ ?_)
rw [← Set.iUnion_inter, iUnion_spanningSets, Set.univ_inter]
_ = μ.sigmaFiniteSetWRT' ν := rfl
/-- `μ.sigmaFiniteSetWRT' ν` has maximal `ν`-measure among all measurable sets `s` with sigma-finite
`μ.restrict s`. -/
lemma measure_sigmaFiniteSetWRT' (μ ν : Measure α) [IsFiniteMeasure ν] :
ν (μ.sigmaFiniteSetWRT' ν)
= ⨆ (s) (_ : MeasurableSet s) (_ : SigmaFinite (μ.restrict s)), ν s := by
apply le_antisymm
· refine (le_iSup (f := fun _ ↦ _)
(sigmaFinite_restrict_sigmaFiniteSetWRT' μ ν)).trans ?_
exact le_iSup₂ (f := fun s _ ↦ ⨆ (_ : SigmaFinite (μ.restrict s)), ν s) (μ.sigmaFiniteSetWRT' ν)
measurableSet_sigmaFiniteSetWRT'
· exact le_of_tendsto' (tendsto_measure_sigmaFiniteSetGE μ ν)
(fun _ ↦ measure_mono (Set.subset_iUnion _ _))
/-- Auxiliary lemma for `measure_eq_top_of_subset_compl_sigmaFiniteSetWRT'`. -/
lemma measure_eq_top_of_subset_compl_sigmaFiniteSetWRT'_of_measurableSet [IsFiniteMeasure ν]
(hs : MeasurableSet s) (hs_subset : s ⊆ (μ.sigmaFiniteSetWRT' ν)ᶜ) (hνs : ν s ≠ 0) :
μ s = ∞ := by
suffices ¬ SigmaFinite (μ.restrict s) by
by_contra h
have h_lt_top : Fact (μ s < ∞) := ⟨Ne.lt_top h⟩
exact this inferInstance
intro hsσ
have h_lt : ν (μ.sigmaFiniteSetWRT' ν) < ν (μ.sigmaFiniteSetWRT' ν ∪ s) := by
rw [measure_union _ hs]
· exact ENNReal.lt_add_right (measure_ne_top _ _) hνs
· exact disjoint_compl_right.mono_right hs_subset
have h_le : ν (μ.sigmaFiniteSetWRT' ν ∪ s) ≤ ν (μ.sigmaFiniteSetWRT' ν) := by
conv_rhs => rw [measure_sigmaFiniteSetWRT']
refine (le_iSup
(f := fun (_ : SigmaFinite (μ.restrict (μ.sigmaFiniteSetWRT' ν ∪ s))) ↦ _) ?_).trans ?_
· have := sigmaFinite_restrict_sigmaFiniteSetWRT' μ ν
infer_instance
· exact le_iSup₂ (f := fun s _ ↦ ⨆ (_ : SigmaFinite (μ.restrict _)), ν s)
(μ.sigmaFiniteSetWRT' ν ∪ s) (measurableSet_sigmaFiniteSetWRT'.union hs)
exact h_lt.not_ge h_le
/-- For all sets `s` in `(μ.sigmaFiniteSetWRT ν)ᶜ`, if `ν s ≠ 0` then `μ s = ∞`. -/
lemma measure_eq_top_of_subset_compl_sigmaFiniteSetWRT' [IsFiniteMeasure ν]
(hs_subset : s ⊆ (μ.sigmaFiniteSetWRT' ν)ᶜ) (hνs : ν s ≠ 0) :
μ s = ∞ := by
rw [measure_eq_iInf]
simp_rw [iInf_eq_top]
suffices ∀ t, t ⊆ (μ.sigmaFiniteSetWRT' ν)ᶜ → s ⊆ t → MeasurableSet t → μ t = ∞ by
intro t hts ht
suffices μ (t ∩ (μ.sigmaFiniteSetWRT' ν)ᶜ) = ∞ from
measure_mono_top Set.inter_subset_left this
have hs_subset_t : s ⊆ t ∩ (μ.sigmaFiniteSetWRT' ν)ᶜ := Set.subset_inter hts hs_subset
exact this (t ∩ (μ.sigmaFiniteSetWRT' ν)ᶜ) Set.inter_subset_right hs_subset_t
(ht.inter measurableSet_sigmaFiniteSetWRT'.compl)
intro t ht_subset hst ht
refine measure_eq_top_of_subset_compl_sigmaFiniteSetWRT'_of_measurableSet ht ht_subset ?_
exact fun hνt ↦ hνs (measure_mono_null hst hνt)
end IsFiniteMeasure
section SFinite
/-- For all sets `s` in `(μ.sigmaFiniteSetWRT ν)ᶜ`, if `ν s ≠ 0` then `μ s = ∞`. -/
lemma measure_eq_top_of_subset_compl_sigmaFiniteSetWRT [SFinite ν]
(hs_subset : s ⊆ (μ.sigmaFiniteSetWRT ν)ᶜ) (hνs : ν s ≠ 0) :
μ s = ∞ := by
have ⟨ν', hν', hνν', _⟩ := exists_isFiniteMeasure_absolutelyContinuous ν
have h : ∃ s : Set α, MeasurableSet s ∧ SigmaFinite (μ.restrict s)
∧ (∀ t ⊆ sᶜ, ν t ≠ 0 → μ t = ∞) := by
refine ⟨μ.sigmaFiniteSetWRT' ν', measurableSet_sigmaFiniteSetWRT',
sigmaFinite_restrict_sigmaFiniteSetWRT' _ _,
fun t ht_subset hνt ↦ measure_eq_top_of_subset_compl_sigmaFiniteSetWRT' ht_subset ?_⟩
exact fun hν't ↦ hνt (hνν' hν't)
rw [Measure.sigmaFiniteSetWRT, dif_pos h] at hs_subset
exact h.choose_spec.2.2 s hs_subset hνs
lemma restrict_compl_sigmaFiniteSetWRT [SFinite ν] (hμν : μ ≪ ν) :
μ.restrict (μ.sigmaFiniteSetWRT ν)ᶜ = ∞ • ν.restrict (μ.sigmaFiniteSetWRT ν)ᶜ := by
ext s
rw [Measure.restrict_apply' measurableSet_sigmaFiniteSetWRT.compl,
Measure.smul_apply, smul_eq_mul,
Measure.restrict_apply' measurableSet_sigmaFiniteSetWRT.compl]
by_cases hνs : ν (s ∩ (μ.sigmaFiniteSetWRT ν)ᶜ) = 0
· rw [hνs, mul_zero]
exact hμν hνs
· rw [ENNReal.top_mul hνs, measure_eq_top_of_subset_compl_sigmaFiniteSetWRT
Set.inter_subset_right hνs]
end SFinite
@[simp]
lemma measure_compl_sigmaFiniteSetWRT (hμν : μ ≪ ν) [SigmaFinite μ] [SFinite ν] :
ν (μ.sigmaFiniteSetWRT ν)ᶜ = 0 := by
have h : ν (μ.sigmaFiniteSetWRT ν)ᶜ ≠ 0 → μ (μ.sigmaFiniteSetWRT ν)ᶜ = ∞ :=
measure_eq_top_of_subset_compl_sigmaFiniteSetWRT subset_rfl
by_contra h0
refine ENNReal.top_ne_zero ?_
rw [← h h0, ← Measure.iSup_restrict_spanningSets]
simp_rw [Measure.restrict_apply' (measurableSet_spanningSets μ _), ENNReal.iSup_eq_zero]
intro i
by_contra h_ne_zero
have h_zero_top := measure_eq_top_of_subset_compl_sigmaFiniteSetWRT
(Set.inter_subset_left : (μ.sigmaFiniteSetWRT ν)ᶜ ∩ spanningSets μ i ⊆ _) ?_
swap; · exact fun h ↦ h_ne_zero (hμν h)
refine absurd h_zero_top (ne_of_lt ?_)
exact (measure_mono Set.inter_subset_right).trans_lt (measure_spanningSets_lt_top μ i)
section SigmaFiniteSet
/-- A measurable set such that `μ.restrict μ.sigmaFiniteSet` is sigma-finite,
and for all measurable sets `s ⊆ μ.sigmaFiniteSetᶜ`, either `μ s = 0` or `μ s = ∞`. -/
def Measure.sigmaFiniteSet (μ : Measure α) : Set α := μ.sigmaFiniteSetWRT μ
@[measurability]
lemma measurableSet_sigmaFiniteSet : MeasurableSet μ.sigmaFiniteSet :=
measurableSet_sigmaFiniteSetWRT
lemma measure_eq_zero_or_top_of_subset_compl_sigmaFiniteSet [SFinite μ]
(ht_subset : t ⊆ μ.sigmaFiniteSetᶜ) :
μ t = 0 ∨ μ t = ∞ := by
rw [or_iff_not_imp_left]
exact measure_eq_top_of_subset_compl_sigmaFiniteSetWRT ht_subset
/-- The measure `μ.restrict μ.sigmaFiniteSetᶜ` takes only two values: 0 and ∞ . -/
lemma restrict_compl_sigmaFiniteSet_eq_zero_or_top (μ : Measure α) [SFinite μ] (s : Set α) :
μ.restrict μ.sigmaFiniteSetᶜ s = 0 ∨ μ.restrict μ.sigmaFiniteSetᶜ s = ∞ := by
rw [Measure.restrict_apply' measurableSet_sigmaFiniteSet.compl]
exact measure_eq_zero_or_top_of_subset_compl_sigmaFiniteSet Set.inter_subset_right
/-- The restriction of an s-finite measure `μ` to `μ.sigmaFiniteSet` is sigma-finite. -/
instance : SigmaFinite (μ.restrict μ.sigmaFiniteSet) := by
rw [Measure.sigmaFiniteSet]
infer_instance
lemma sigmaFinite_of_measure_compl_sigmaFiniteSet_eq_zero (h : μ μ.sigmaFiniteSetᶜ = 0) :
SigmaFinite μ := by
rw [← Measure.restrict_add_restrict_compl (μ := μ) (measurableSet_sigmaFiniteSet (μ := μ)),
Measure.restrict_eq_zero.mpr h, add_zero]
infer_instance
@[simp]
lemma measure_compl_sigmaFiniteSet (μ : Measure α) [SigmaFinite μ] : μ μ.sigmaFiniteSetᶜ = 0 :=
measure_compl_sigmaFiniteSetWRT Measure.AbsolutelyContinuous.rfl
/-- An s-finite measure `μ` is sigma-finite iff `μ μ.sigmaFiniteSetᶜ = 0`. -/
lemma measure_compl_sigmaFiniteSet_eq_zero_iff_sigmaFinite (μ : Measure α) :
μ μ.sigmaFiniteSetᶜ = 0 ↔ SigmaFinite μ :=
⟨sigmaFinite_of_measure_compl_sigmaFiniteSet_eq_zero, fun _ ↦ measure_compl_sigmaFiniteSet μ⟩
end SigmaFiniteSet
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Decomposition/IntegralRNDeriv.lean | import Mathlib.Analysis.Convex.Continuous
import Mathlib.Analysis.Convex.Integral
import Mathlib.MeasureTheory.Measure.Decomposition.RadonNikodym
/-!
# Integrals of functions of Radon-Nikodym derivatives
## Main statements
* `mul_le_integral_rnDeriv_of_ac`: for a convex continuous function `f` on `[0, ∞)`, if `μ`
is absolutely continuous with respect to `ν`, then
`ν.real univ * f (μ.real univ / ν.real univ) ≤ ∫ x, f (μ.rnDeriv ν x).toReal ∂ν`.
-/
open Set
namespace MeasureTheory
variable {α : Type*} {mα : MeasurableSpace α} {μ ν : Measure α} {f : ℝ → ℝ}
@[fun_prop]
lemma Measure.integrable_toReal_rnDeriv [IsFiniteMeasure μ] :
Integrable (fun x ↦ (μ.rnDeriv ν x).toReal) ν :=
integrable_toReal_of_lintegral_ne_top (Measure.measurable_rnDeriv _ _).aemeasurable
(Measure.lintegral_rnDeriv_lt_top _ _).ne
/-- For a convex continuous function `f` on `[0, ∞)`, if `μ` is absolutely continuous
with respect to a probability measure `ν`, then
`f μ.real univ ≤ ∫ x, f (μ.rnDeriv ν x).toReal ∂ν`. -/
lemma le_integral_rnDeriv_of_ac [IsFiniteMeasure μ] [IsProbabilityMeasure ν]
(hf_cvx : ConvexOn ℝ (Ici 0) f) (hf_cont : ContinuousWithinAt f (Ici 0) 0)
(hf_int : Integrable (fun x ↦ f (μ.rnDeriv ν x).toReal) ν) (hμν : μ ≪ ν) :
f (μ.real univ) ≤ ∫ x, f (μ.rnDeriv ν x).toReal ∂ν := by
have hf_cont' : ContinuousOn f (Ici 0) := by
intro x hx
rcases eq_or_lt_of_le (α := ℝ) (hx : 0 ≤ x) with rfl | hx_pos
· exact hf_cont
· have h := hf_cvx.continuousOn_interior x
simp only [nonempty_Iio, interior_Ici', mem_Ioi] at h
rw [continuousWithinAt_iff_continuousAt (Ioi_mem_nhds hx_pos)] at h
exact (h hx_pos).continuousWithinAt
calc f (μ.real univ)
= f (∫ x, (μ.rnDeriv ν x).toReal ∂ν) := by rw [Measure.integral_toReal_rnDeriv hμν]
_ ≤ ∫ x, f (μ.rnDeriv ν x).toReal ∂ν := by
rw [← average_eq_integral, ← average_eq_integral]
exact ConvexOn.map_average_le hf_cvx hf_cont' isClosed_Ici (by simp)
Measure.integrable_toReal_rnDeriv hf_int
/-- For a convex continuous function `f` on `[0, ∞)`, if `μ` is absolutely continuous
with respect to `ν`, then
`ν.real univ * f (μ.real univ / ν.real univ) ≤ ∫ x, f (μ.rnDeriv ν x).toReal ∂ν`. -/
lemma mul_le_integral_rnDeriv_of_ac [IsFiniteMeasure μ] [IsFiniteMeasure ν]
(hf_cvx : ConvexOn ℝ (Ici 0) f) (hf_cont : ContinuousWithinAt f (Ici 0) 0)
(hf_int : Integrable (fun x ↦ f (μ.rnDeriv ν x).toReal) ν) (hμν : μ ≪ ν) :
ν.real univ * f (μ.real univ / ν.real univ)
≤ ∫ x, f (μ.rnDeriv ν x).toReal ∂ν := by
by_cases hν : ν = 0
· simp [hν]
have : NeZero ν := ⟨hν⟩
let μ' := (ν univ)⁻¹ • μ
let ν' := (ν univ)⁻¹ • ν
have : IsFiniteMeasure μ' := μ.smul_finite (by simp [hν])
have hμν' : μ' ≪ ν' := hμν.smul _
have h_rnDeriv_eq : μ'.rnDeriv ν' =ᵐ[ν] μ.rnDeriv ν := by
have h1' : μ'.rnDeriv ν' =ᵐ[ν'] (ν univ)⁻¹ • μ.rnDeriv ν' :=
Measure.rnDeriv_smul_left_of_ne_top' (μ := ν') (ν := μ) (by simp [hν])
have h1 : μ'.rnDeriv ν' =ᵐ[ν] (ν univ)⁻¹ • μ.rnDeriv ν' := by
rwa [Measure.ae_smul_measure_eq] at h1'
simp
have h2 : μ.rnDeriv ν' =ᵐ[ν] (ν univ)⁻¹⁻¹ • μ.rnDeriv ν :=
Measure.rnDeriv_smul_right_of_ne_top' (μ := ν) (ν := μ) (by simp) (by simp [hν])
filter_upwards [h1, h2] with x h1 h2
rw [h1, Pi.smul_apply, smul_eq_mul, h2]
simp only [inv_inv, Pi.smul_apply, smul_eq_mul]
rw [← mul_assoc, ENNReal.inv_mul_cancel, one_mul]
· simp [hν]
· simp
have h_eq : ∫ x, f (μ'.rnDeriv ν' x).toReal ∂ν'
= (ν.real univ)⁻¹ * ∫ x, f ((μ.rnDeriv ν x).toReal) ∂ν := by
rw [integral_smul_measure, smul_eq_mul, ENNReal.toReal_inv]
congr 1
refine integral_congr_ae ?_
filter_upwards [h_rnDeriv_eq] with x hx
rw [hx]
have h : f (μ'.real univ) ≤ ∫ x, f (μ'.rnDeriv ν' x).toReal ∂ν' :=
le_integral_rnDeriv_of_ac hf_cvx hf_cont ?_ hμν'
swap
· refine Integrable.smul_measure ?_ (by simp [hν])
refine (integrable_congr ?_).mpr hf_int
filter_upwards [h_rnDeriv_eq] with x hx
rw [hx]
rw [h_eq, mul_comm, ← div_le_iff₀, div_eq_inv_mul, inv_inv] at h
· convert h
· simp only [div_eq_inv_mul, Measure.smul_apply, smul_eq_mul, ENNReal.toReal_mul,
ENNReal.toReal_inv, μ', measureReal_def]
· simp [ENNReal.toReal_pos_iff, hν, measureReal_def]
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Measure/Decomposition/Lebesgue.lean | import Mathlib.MeasureTheory.Measure.Decomposition.Hahn
import Mathlib.MeasureTheory.Function.AEEqOfLIntegral
import Mathlib.MeasureTheory.Measure.Sub
/-!
# Lebesgue decomposition
This file proves the Lebesgue decomposition theorem. The Lebesgue decomposition theorem states that,
given two σ-finite measures `μ` and `ν`, there exists a σ-finite measure `ξ` and a measurable
function `f` such that `μ = ξ + fν` and `ξ` is mutually singular with respect to `ν`.
The Lebesgue decomposition provides the Radon-Nikodym theorem readily.
## Main definitions
* `MeasureTheory.Measure.HaveLebesgueDecomposition` : A pair of measures `μ` and `ν` is said
to `HaveLebesgueDecomposition` if there exist a measure `ξ` and a measurable function `f`,
such that `ξ` is mutually singular with respect to `ν` and `μ = ξ + ν.withDensity f`
* `MeasureTheory.Measure.singularPart` : If a pair of measures `HaveLebesgueDecomposition`,
then `singularPart` chooses the measure from `HaveLebesgueDecomposition`, otherwise it
returns the zero measure.
* `MeasureTheory.Measure.rnDeriv`: If a pair of measures
`HaveLebesgueDecomposition`, then `rnDeriv` chooses the measurable function from
`HaveLebesgueDecomposition`, otherwise it returns the zero function.
## Main results
* `MeasureTheory.Measure.haveLebesgueDecomposition_of_sigmaFinite` :
the Lebesgue decomposition theorem.
* `MeasureTheory.Measure.eq_singularPart` : Given measures `μ` and `ν`, if `s` is a measure
mutually singular to `ν` and `f` is a measurable function such that `μ = s + fν`, then
`s = μ.singularPart ν`.
* `MeasureTheory.Measure.eq_rnDeriv` : Given measures `μ` and `ν`, if `s` is a
measure mutually singular to `ν` and `f` is a measurable function such that `μ = s + fν`,
then `f = μ.rnDeriv ν`.
## Tags
Lebesgue decomposition theorem
-/
assert_not_exists MeasureTheory.VectorMeasure
open scoped MeasureTheory NNReal ENNReal
open Set
namespace MeasureTheory
namespace Measure
variable {α : Type*} {m : MeasurableSpace α} {μ ν : Measure α}
/-- A pair of measures `μ` and `ν` is said to `HaveLebesgueDecomposition` if there exists a
measure `ξ` and a measurable function `f`, such that `ξ` is mutually singular with respect to
`ν` and `μ = ξ + ν.withDensity f`. -/
class HaveLebesgueDecomposition (μ ν : Measure α) : Prop where
lebesgue_decomposition :
∃ p : Measure α × (α → ℝ≥0∞), Measurable p.2 ∧ p.1 ⟂ₘ ν ∧ μ = p.1 + ν.withDensity p.2
open Classical in
/-- If a pair of measures `HaveLebesgueDecomposition`, then `singularPart` chooses the
measure from `HaveLebesgueDecomposition`, otherwise it returns the zero measure. For sigma-finite
measures, `μ = μ.singularPart ν + ν.withDensity (μ.rnDeriv ν)`. -/
noncomputable irreducible_def singularPart (μ ν : Measure α) : Measure α :=
if h : HaveLebesgueDecomposition μ ν then (Classical.choose h.lebesgue_decomposition).1 else 0
open Classical in
/-- If a pair of measures `HaveLebesgueDecomposition`, then `rnDeriv` chooses the
measurable function from `HaveLebesgueDecomposition`, otherwise it returns the zero function.
For sigma-finite measures, `μ = μ.singularPart ν + ν.withDensity (μ.rnDeriv ν)`. -/
noncomputable irreducible_def rnDeriv (μ ν : Measure α) : α → ℝ≥0∞ :=
if h : HaveLebesgueDecomposition μ ν then (Classical.choose h.lebesgue_decomposition).2 else 0
section ByDefinition
theorem haveLebesgueDecomposition_spec (μ ν : Measure α) [h : HaveLebesgueDecomposition μ ν] :
Measurable (μ.rnDeriv ν) ∧
μ.singularPart ν ⟂ₘ ν ∧ μ = μ.singularPart ν + ν.withDensity (μ.rnDeriv ν) := by
rw [singularPart, rnDeriv, dif_pos h, dif_pos h]
exact Classical.choose_spec h.lebesgue_decomposition
lemma rnDeriv_of_not_haveLebesgueDecomposition (h : ¬ HaveLebesgueDecomposition μ ν) :
μ.rnDeriv ν = 0 := by
rw [rnDeriv, dif_neg h]
lemma singularPart_of_not_haveLebesgueDecomposition (h : ¬ HaveLebesgueDecomposition μ ν) :
μ.singularPart ν = 0 := by
rw [singularPart, dif_neg h]
@[measurability, fun_prop]
theorem measurable_rnDeriv (μ ν : Measure α) : Measurable <| μ.rnDeriv ν := by
by_cases h : HaveLebesgueDecomposition μ ν
· exact (haveLebesgueDecomposition_spec μ ν).1
· rw [rnDeriv_of_not_haveLebesgueDecomposition h]
exact measurable_zero
theorem mutuallySingular_singularPart (μ ν : Measure α) : μ.singularPart ν ⟂ₘ ν := by
by_cases h : HaveLebesgueDecomposition μ ν
· exact (haveLebesgueDecomposition_spec μ ν).2.1
· rw [singularPart_of_not_haveLebesgueDecomposition h]
exact MutuallySingular.zero_left
theorem MutuallySingular.haveLebesgueDecomposition (h : μ ⟂ₘ ν) : HaveLebesgueDecomposition μ ν :=
⟨⟨(μ, 0), measurable_zero, h, by simp⟩⟩
theorem haveLebesgueDecomposition_add (μ ν : Measure α) [HaveLebesgueDecomposition μ ν] :
μ = μ.singularPart ν + ν.withDensity (μ.rnDeriv ν) :=
(haveLebesgueDecomposition_spec μ ν).2.2
/-- For the versions of this lemma where `ν.withDensity (μ.rnDeriv ν)` or `μ.singularPart ν` are
isolated, see `MeasureTheory.Measure.measure_sub_singularPart` and
`MeasureTheory.Measure.measure_sub_rnDeriv`. -/
lemma singularPart_add_rnDeriv (μ ν : Measure α) [HaveLebesgueDecomposition μ ν] :
μ.singularPart ν + ν.withDensity (μ.rnDeriv ν) = μ := (haveLebesgueDecomposition_add μ ν).symm
/-- For the versions of this lemma where `μ.singularPart ν` or `ν.withDensity (μ.rnDeriv ν)` are
isolated, see `MeasureTheory.Measure.measure_sub_singularPart` and
`MeasureTheory.Measure.measure_sub_rnDeriv`. -/
lemma rnDeriv_add_singularPart (μ ν : Measure α) [HaveLebesgueDecomposition μ ν] :
ν.withDensity (μ.rnDeriv ν) + μ.singularPart ν = μ := by rw [add_comm, singularPart_add_rnDeriv]
end ByDefinition
section HaveLebesgueDecomposition
instance instHaveLebesgueDecompositionZeroLeft : HaveLebesgueDecomposition 0 ν :=
MutuallySingular.zero_left.haveLebesgueDecomposition
instance instHaveLebesgueDecompositionZeroRight : HaveLebesgueDecomposition μ 0 :=
MutuallySingular.zero_right.haveLebesgueDecomposition
instance instHaveLebesgueDecompositionSelf : HaveLebesgueDecomposition μ μ where
lebesgue_decomposition := ⟨⟨0, 1⟩, measurable_const, MutuallySingular.zero_left, by simp⟩
instance HaveLebesgueDecomposition.sum_left {ι : Type*} [Countable ι] (μ : ι → Measure α)
[∀ i, HaveLebesgueDecomposition (μ i) ν] : HaveLebesgueDecomposition (.sum μ) ν :=
⟨(.sum fun i ↦ (μ i).singularPart ν, ∑' i, rnDeriv (μ i) ν),
by dsimp only; fun_prop, by simp [mutuallySingular_singularPart], by
simp [withDensity_tsum, measurable_rnDeriv, Measure.sum_add_sum, singularPart_add_rnDeriv]⟩
instance HaveLebesgueDecomposition.add_left {μ' : Measure α} [HaveLebesgueDecomposition μ ν]
[HaveLebesgueDecomposition μ' ν] : HaveLebesgueDecomposition (μ + μ') ν := by
have : ∀ b, HaveLebesgueDecomposition (cond b μ μ') ν := by simp [*]
simpa using sum_left (cond · μ μ')
instance haveLebesgueDecompositionSMul' (μ ν : Measure α) [HaveLebesgueDecomposition μ ν]
(r : ℝ≥0∞) : (r • μ).HaveLebesgueDecomposition ν where
lebesgue_decomposition := by
obtain ⟨hmeas, hsing, hadd⟩ := haveLebesgueDecomposition_spec μ ν
refine ⟨⟨r • μ.singularPart ν, r • μ.rnDeriv ν⟩, hmeas.const_smul _, hsing.smul _, ?_⟩
simp only
rw [withDensity_smul _ hmeas, ← smul_add, ← hadd]
instance haveLebesgueDecompositionSMul (μ ν : Measure α) [HaveLebesgueDecomposition μ ν]
(r : ℝ≥0) : (r • μ).HaveLebesgueDecomposition ν := by
rw [ENNReal.smul_def]; infer_instance
instance haveLebesgueDecompositionSMulRight (μ ν : Measure α) [HaveLebesgueDecomposition μ ν]
(r : ℝ≥0) :
μ.HaveLebesgueDecomposition (r • ν) where
lebesgue_decomposition := by
obtain ⟨hmeas, hsing, hadd⟩ := haveLebesgueDecomposition_spec μ ν
by_cases hr : r = 0
· exact ⟨⟨μ, 0⟩, measurable_const, by simp [hr], by simp⟩
refine ⟨⟨μ.singularPart ν, r⁻¹ • μ.rnDeriv ν⟩, hmeas.const_smul _,
hsing.mono_ac AbsolutelyContinuous.rfl smul_absolutelyContinuous, ?_⟩
have : r⁻¹ • rnDeriv μ ν = ((r⁻¹ : ℝ≥0) : ℝ≥0∞) • rnDeriv μ ν := by simp [ENNReal.smul_def]
rw [this, withDensity_smul _ hmeas, ENNReal.smul_def r, withDensity_smul_measure,
← smul_assoc, smul_eq_mul, ENNReal.coe_inv hr, ENNReal.inv_mul_cancel, one_smul]
· exact hadd
· simp [hr]
· exact ENNReal.coe_ne_top
theorem haveLebesgueDecomposition_withDensity (μ : Measure α) {f : α → ℝ≥0∞} (hf : Measurable f) :
(μ.withDensity f).HaveLebesgueDecomposition μ := ⟨⟨⟨0, f⟩, hf, .zero_left, (zero_add _).symm⟩⟩
instance haveLebesgueDecompositionRnDeriv (μ ν : Measure α) :
HaveLebesgueDecomposition (ν.withDensity (μ.rnDeriv ν)) ν :=
haveLebesgueDecomposition_withDensity ν (measurable_rnDeriv _ _)
instance instHaveLebesgueDecompositionSingularPart :
HaveLebesgueDecomposition (μ.singularPart ν) ν :=
⟨⟨μ.singularPart ν, 0⟩, measurable_zero, mutuallySingular_singularPart μ ν, by simp⟩
end HaveLebesgueDecomposition
theorem singularPart_le (μ ν : Measure α) : μ.singularPart ν ≤ μ := by
by_cases hl : HaveLebesgueDecomposition μ ν
· conv_rhs => rw [haveLebesgueDecomposition_add μ ν]
exact Measure.le_add_right le_rfl
· rw [singularPart, dif_neg hl]
exact Measure.zero_le μ
theorem withDensity_rnDeriv_le (μ ν : Measure α) : ν.withDensity (μ.rnDeriv ν) ≤ μ := by
by_cases hl : HaveLebesgueDecomposition μ ν
· conv_rhs => rw [haveLebesgueDecomposition_add μ ν]
exact Measure.le_add_left le_rfl
· rw [rnDeriv, dif_neg hl, withDensity_zero]
exact Measure.zero_le μ
lemma _root_.AEMeasurable.singularPart {β : Type*} {_ : MeasurableSpace β} {f : α → β}
(hf : AEMeasurable f μ) (ν : Measure α) :
AEMeasurable f (μ.singularPart ν) :=
AEMeasurable.mono_measure hf (Measure.singularPart_le _ _)
lemma _root_.AEMeasurable.withDensity_rnDeriv {β : Type*} {_ : MeasurableSpace β} {f : α → β}
(hf : AEMeasurable f μ) (ν : Measure α) :
AEMeasurable f (ν.withDensity (μ.rnDeriv ν)) :=
AEMeasurable.mono_measure hf (Measure.withDensity_rnDeriv_le _ _)
protected lemma MutuallySingular.singularPart (h : μ ⟂ₘ ν) (ν' : Measure α) :
μ.singularPart ν' ⟂ₘ ν :=
h.mono (singularPart_le μ ν') le_rfl
lemma absolutelyContinuous_withDensity_rnDeriv [HaveLebesgueDecomposition ν μ] (hμν : μ ≪ ν) :
μ ≪ μ.withDensity (ν.rnDeriv μ) := by
rw [haveLebesgueDecomposition_add ν μ] at hμν
refine AbsolutelyContinuous.mk (fun s _ hνs ↦ ?_)
obtain ⟨t, _, ht1, ht2⟩ := mutuallySingular_singularPart ν μ
rw [← inter_union_compl s]
refine le_antisymm ((measure_union_le (s ∩ t) (s ∩ tᶜ)).trans ?_) (zero_le _)
simp only [nonpos_iff_eq_zero, add_eq_zero]
constructor
· refine hμν ?_
simp only [coe_add, Pi.add_apply, add_eq_zero]
constructor
· exact measure_mono_null Set.inter_subset_right ht1
· exact measure_mono_null Set.inter_subset_left hνs
· exact measure_mono_null Set.inter_subset_right ht2
lemma AbsolutelyContinuous.withDensity_rnDeriv {ξ : Measure α} [μ.HaveLebesgueDecomposition ν]
(hξμ : ξ ≪ μ) (hξν : ξ ≪ ν) :
ξ ≪ ν.withDensity (μ.rnDeriv ν) := by
conv_rhs at hξμ => rw [μ.haveLebesgueDecomposition_add ν, add_comm]
refine absolutelyContinuous_of_add_of_mutuallySingular hξμ ?_
exact MutuallySingular.mono_ac (mutuallySingular_singularPart μ ν).symm hξν .rfl
lemma absolutelyContinuous_withDensity_rnDeriv_swap [ν.HaveLebesgueDecomposition μ] :
ν.withDensity (μ.rnDeriv ν) ≪ μ.withDensity (ν.rnDeriv μ) :=
(withDensity_absolutelyContinuous ν (μ.rnDeriv ν)).withDensity_rnDeriv
(absolutelyContinuous_of_le (withDensity_rnDeriv_le _ _))
lemma singularPart_eq_zero_of_ac (h : μ ≪ ν) : μ.singularPart ν = 0 := by
rw [← MutuallySingular.self_iff]
exact MutuallySingular.mono_ac (mutuallySingular_singularPart _ _)
AbsolutelyContinuous.rfl ((absolutelyContinuous_of_le (singularPart_le _ _)).trans h)
@[simp]
theorem singularPart_zero (ν : Measure α) : (0 : Measure α).singularPart ν = 0 :=
singularPart_eq_zero_of_ac (AbsolutelyContinuous.zero _)
@[simp]
lemma singularPart_zero_right (μ : Measure α) : μ.singularPart 0 = μ := by
conv_rhs => rw [haveLebesgueDecomposition_add μ 0]
simp
lemma singularPart_eq_zero (μ ν : Measure α) [μ.HaveLebesgueDecomposition ν] :
μ.singularPart ν = 0 ↔ μ ≪ ν := by
have h_dec := haveLebesgueDecomposition_add μ ν
refine ⟨fun h ↦ ?_, singularPart_eq_zero_of_ac⟩
rw [h, zero_add] at h_dec
rw [h_dec]
exact withDensity_absolutelyContinuous ν _
@[simp]
lemma withDensity_rnDeriv_eq_zero (μ ν : Measure α) [μ.HaveLebesgueDecomposition ν] :
ν.withDensity (μ.rnDeriv ν) = 0 ↔ μ ⟂ₘ ν := by
have h_dec := haveLebesgueDecomposition_add μ ν
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· rw [h, add_zero] at h_dec
rw [h_dec]
exact mutuallySingular_singularPart μ ν
· rw [← MutuallySingular.self_iff]
rw [h_dec, MutuallySingular.add_left_iff] at h
refine MutuallySingular.mono_ac h.2 AbsolutelyContinuous.rfl ?_
exact withDensity_absolutelyContinuous _ _
@[simp]
lemma rnDeriv_eq_zero (μ ν : Measure α) [μ.HaveLebesgueDecomposition ν] :
μ.rnDeriv ν =ᵐ[ν] 0 ↔ μ ⟂ₘ ν := by
rw [← withDensity_rnDeriv_eq_zero, withDensity_eq_zero_iff (measurable_rnDeriv _ _).aemeasurable]
lemma rnDeriv_zero (ν : Measure α) : (0 : Measure α).rnDeriv ν =ᵐ[ν] 0 := by
rw [rnDeriv_eq_zero]
exact MutuallySingular.zero_left
lemma MutuallySingular.rnDeriv_ae_eq_zero (hμν : μ ⟂ₘ ν) :
μ.rnDeriv ν =ᵐ[ν] 0 := by
by_cases h : μ.HaveLebesgueDecomposition ν
· rw [rnDeriv_eq_zero]
exact hμν
· rw [rnDeriv_of_not_haveLebesgueDecomposition h]
@[simp]
theorem singularPart_withDensity (ν : Measure α) (f : α → ℝ≥0∞) :
(ν.withDensity f).singularPart ν = 0 :=
singularPart_eq_zero_of_ac (withDensity_absolutelyContinuous _ _)
lemma rnDeriv_singularPart (μ ν : Measure α) :
(μ.singularPart ν).rnDeriv ν =ᵐ[ν] 0 := by
rw [rnDeriv_eq_zero]
exact mutuallySingular_singularPart μ ν
@[simp]
lemma singularPart_self (μ : Measure α) : μ.singularPart μ = 0 :=
singularPart_eq_zero_of_ac Measure.AbsolutelyContinuous.rfl
lemma rnDeriv_self (μ : Measure α) [SigmaFinite μ] : μ.rnDeriv μ =ᵐ[μ] fun _ ↦ 1 := by
have h := rnDeriv_add_singularPart μ μ
rw [singularPart_self, add_zero] at h
have h_one : μ = μ.withDensity 1 := by simp
conv_rhs at h => rw [h_one]
rwa [withDensity_eq_iff_of_sigmaFinite (measurable_rnDeriv _ _).aemeasurable] at h
exact aemeasurable_const
lemma singularPart_eq_self : μ.singularPart ν = μ ↔ μ ⟂ₘ ν := by
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· rw [← h]
exact mutuallySingular_singularPart _ _
· have := h.haveLebesgueDecomposition
conv_rhs => rw [← singularPart_add_rnDeriv μ ν]
rw [(withDensity_rnDeriv_eq_zero _ _).mpr h, add_zero]
@[simp]
lemma singularPart_singularPart (μ ν : Measure α) :
(μ.singularPart ν).singularPart ν = μ.singularPart ν := by
rw [Measure.singularPart_eq_self]
exact Measure.mutuallySingular_singularPart _ _
instance singularPart.instIsFiniteMeasure [IsFiniteMeasure μ] :
IsFiniteMeasure (μ.singularPart ν) :=
isFiniteMeasure_of_le μ <| singularPart_le μ ν
instance singularPart.instSigmaFinite [SigmaFinite μ] : SigmaFinite (μ.singularPart ν) :=
sigmaFinite_of_le μ <| singularPart_le μ ν
instance singularPart.instIsLocallyFiniteMeasure [TopologicalSpace α] [IsLocallyFiniteMeasure μ] :
IsLocallyFiniteMeasure (μ.singularPart ν) :=
isLocallyFiniteMeasure_of_le <| singularPart_le μ ν
instance withDensity.instIsFiniteMeasure [IsFiniteMeasure μ] :
IsFiniteMeasure (ν.withDensity <| μ.rnDeriv ν) :=
isFiniteMeasure_of_le μ <| withDensity_rnDeriv_le μ ν
instance withDensity.instSigmaFinite [SigmaFinite μ] :
SigmaFinite (ν.withDensity <| μ.rnDeriv ν) :=
sigmaFinite_of_le μ <| withDensity_rnDeriv_le μ ν
instance withDensity.instIsLocallyFiniteMeasure [TopologicalSpace α] [IsLocallyFiniteMeasure μ] :
IsLocallyFiniteMeasure (ν.withDensity <| μ.rnDeriv ν) :=
isLocallyFiniteMeasure_of_le <| withDensity_rnDeriv_le μ ν
section RNDerivFinite
theorem lintegral_rnDeriv_lt_top_of_measure_ne_top (ν : Measure α) {s : Set α} (hs : μ s ≠ ∞) :
∫⁻ x in s, μ.rnDeriv ν x ∂ν < ∞ := by
by_cases hl : HaveLebesgueDecomposition μ ν
· suffices (∫⁻ x in toMeasurable μ s, μ.rnDeriv ν x ∂ν) < ∞ from
lt_of_le_of_lt (lintegral_mono_set (subset_toMeasurable _ _)) this
rw [← withDensity_apply _ (measurableSet_toMeasurable _ _)]
calc
_ ≤ (singularPart μ ν) (toMeasurable μ s) + _ := le_add_self
_ = μ s := by rw [← Measure.add_apply, ← haveLebesgueDecomposition_add, measure_toMeasurable]
_ < ⊤ := hs.lt_top
· simp only [Measure.rnDeriv, dif_neg hl, Pi.zero_apply, lintegral_zero, ENNReal.zero_lt_top]
theorem lintegral_rnDeriv_lt_top (μ ν : Measure α) [IsFiniteMeasure μ] :
∫⁻ x, μ.rnDeriv ν x ∂ν < ∞ := by
rw [← setLIntegral_univ]
exact lintegral_rnDeriv_lt_top_of_measure_ne_top _ (measure_lt_top _ _).ne
/-- The Radon-Nikodym derivative of a sigma-finite measure `μ` with respect to another
measure `ν` is `ν`-almost everywhere finite. -/
theorem rnDeriv_lt_top (μ ν : Measure α) [SigmaFinite μ] : ∀ᵐ x ∂ν, μ.rnDeriv ν x < ∞ := by
suffices ∀ n, ∀ᵐ x ∂ν, x ∈ spanningSets μ n → μ.rnDeriv ν x < ∞ by
filter_upwards [ae_all_iff.2 this] with _ hx using hx _ (mem_spanningSetsIndex _ _)
intro n
rw [← ae_restrict_iff' (measurableSet_spanningSets _ _)]
apply ae_lt_top (measurable_rnDeriv _ _)
refine (lintegral_rnDeriv_lt_top_of_measure_ne_top _ ?_).ne
exact (measure_spanningSets_lt_top _ _).ne
lemma rnDeriv_ne_top (μ ν : Measure α) [SigmaFinite μ] : ∀ᵐ x ∂ν, μ.rnDeriv ν x ≠ ∞ := by
filter_upwards [Measure.rnDeriv_lt_top μ ν] with x hx using hx.ne
end RNDerivFinite
/-- Given measures `μ` and `ν`, if `s` is a measure mutually singular to `ν` and `f` is a
measurable function such that `μ = s + fν`, then `s = μ.singularPart μ`.
This theorem provides the uniqueness of the `singularPart` in the Lebesgue decomposition theorem,
while `MeasureTheory.Measure.eq_rnDeriv` provides the uniqueness of the
`rnDeriv`. -/
theorem eq_singularPart {s : Measure α} {f : α → ℝ≥0∞} (hf : Measurable f) (hs : s ⟂ₘ ν)
(hadd : μ = s + ν.withDensity f) : s = μ.singularPart ν := by
have : HaveLebesgueDecomposition μ ν := ⟨⟨⟨s, f⟩, hf, hs, hadd⟩⟩
obtain ⟨hmeas, hsing, hadd'⟩ := haveLebesgueDecomposition_spec μ ν
obtain ⟨⟨S, hS₁, hS₂, hS₃⟩, ⟨T, hT₁, hT₂, hT₃⟩⟩ := hs, hsing
rw [hadd'] at hadd
have hνinter : ν (S ∩ T)ᶜ = 0 := by
rw [compl_inter]
refine nonpos_iff_eq_zero.1 (le_trans (measure_union_le _ _) ?_)
rw [hT₃, hS₃, add_zero]
have heq : s.restrict (S ∩ T)ᶜ = (μ.singularPart ν).restrict (S ∩ T)ᶜ := by
ext1 A hA
have hf : ν.withDensity f (A ∩ (S ∩ T)ᶜ) = 0 := by
refine withDensity_absolutelyContinuous ν _ ?_
rw [← nonpos_iff_eq_zero]
exact hνinter ▸ measure_mono inter_subset_right
have hrn : ν.withDensity (μ.rnDeriv ν) (A ∩ (S ∩ T)ᶜ) = 0 := by
refine withDensity_absolutelyContinuous ν _ ?_
rw [← nonpos_iff_eq_zero]
exact hνinter ▸ measure_mono inter_subset_right
rw [restrict_apply hA, restrict_apply hA, ← add_zero (s (A ∩ (S ∩ T)ᶜ)), ← hf, ← add_apply, ←
hadd, add_apply, hrn, add_zero]
have heq' : ∀ A : Set α, MeasurableSet A → s A = s.restrict (S ∩ T)ᶜ A := by
intro A hA
have hsinter : s (A ∩ (S ∩ T)) = 0 := by
rw [← nonpos_iff_eq_zero]
exact hS₂ ▸ measure_mono (inter_subset_right.trans inter_subset_left)
rw [restrict_apply hA, ← diff_eq, AEDisjoint.measure_diff_left hsinter]
ext1 A hA
have hμinter : μ.singularPart ν (A ∩ (S ∩ T)) = 0 := by
rw [← nonpos_iff_eq_zero]
exact hT₂ ▸ measure_mono (inter_subset_right.trans inter_subset_right)
rw [heq' A hA, heq, restrict_apply hA, ← diff_eq, AEDisjoint.measure_diff_left hμinter]
theorem singularPart_smul (μ ν : Measure α) (r : ℝ≥0) :
(r • μ).singularPart ν = r • μ.singularPart ν := by
by_cases hr : r = 0
· rw [hr, zero_smul, zero_smul, singularPart_zero]
by_cases hl : HaveLebesgueDecomposition μ ν
· refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul (r : ℝ≥0∞))
(MutuallySingular.smul r (mutuallySingular_singularPart _ _)) ?_).symm
rw [withDensity_smul _ (measurable_rnDeriv _ _), ← smul_add,
← haveLebesgueDecomposition_add μ ν, ENNReal.smul_def]
· rw [singularPart, singularPart, dif_neg hl, dif_neg, smul_zero]
refine fun hl' ↦ hl ?_
rw [← inv_smul_smul₀ hr μ]
infer_instance
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
μ.singularPart (r • ν) = μ.singularPart ν := by
by_cases hl : HaveLebesgueDecomposition μ ν
· refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
· exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
smul_absolutelyContinuous
· rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
swap; · exact (measurable_rnDeriv _ _).const_smul _
convert haveLebesgueDecomposition_add μ ν
ext x
simp only [Pi.smul_apply]
rw [← ENNReal.smul_def, smul_inv_smul₀ hr]
· rw [singularPart, singularPart, dif_neg hl, dif_neg]
refine fun hl' ↦ hl ?_
rw [← inv_smul_smul₀ hr ν]
infer_instance
theorem singularPart_add (μ₁ μ₂ ν : Measure α) [HaveLebesgueDecomposition μ₁ ν]
[HaveLebesgueDecomposition μ₂ ν] :
(μ₁ + μ₂).singularPart ν = μ₁.singularPart ν + μ₂.singularPart ν := by
refine (eq_singularPart ((measurable_rnDeriv μ₁ ν).add (measurable_rnDeriv μ₂ ν))
((mutuallySingular_singularPart _ _).add_left (mutuallySingular_singularPart _ _)) ?_).symm
rw [← Pi.add_def, withDensity_add_left (measurable_rnDeriv μ₁ ν)]
conv_rhs => rw [add_assoc, add_comm (μ₂.singularPart ν), ← add_assoc, ← add_assoc]
rw [← haveLebesgueDecomposition_add μ₁ ν, add_assoc, add_comm (ν.withDensity (μ₂.rnDeriv ν)),
← haveLebesgueDecomposition_add μ₂ ν]
lemma singularPart_restrict (μ ν : Measure α) [HaveLebesgueDecomposition μ ν]
{s : Set α} (hs : MeasurableSet s) :
(μ.restrict s).singularPart ν = (μ.singularPart ν).restrict s := by
refine (Measure.eq_singularPart (f := s.indicator (μ.rnDeriv ν)) ?_ ?_ ?_).symm
· exact (μ.measurable_rnDeriv ν).indicator hs
· exact (Measure.mutuallySingular_singularPart μ ν).restrict s
· ext t
rw [withDensity_indicator hs, ← restrict_withDensity hs, ← Measure.restrict_add,
← μ.haveLebesgueDecomposition_add ν]
/-- If a set `s` separates the absolutely continuous part of `μ` with respect to `ν`
from the singular part, then the singular part equals the restriction of `μ` to `s`. -/
theorem singularPart_eq_restrict' {s : Set α} [μ.HaveLebesgueDecomposition ν]
(hμs : μ.singularPart ν sᶜ = 0) (hνs : ν.withDensity (μ.rnDeriv ν) s = 0) :
μ.singularPart ν = μ.restrict s := by
conv_rhs => rw [← singularPart_add_rnDeriv μ ν]
rwa [restrict_add, restrict_eq_self_of_ae_mem, restrict_eq_zero.2 hνs, add_zero]
/-- If a set `s` separates `ν` from the singular part of `μ` with respect to `ν`,
then the singular part equals the restriction of `μ` to `s`. -/
theorem singularPart_eq_restrict {s : Set α} [μ.HaveLebesgueDecomposition ν]
(hμs : μ.singularPart ν sᶜ = 0) (hνs : ν s = 0) :
μ.singularPart ν = μ.restrict s :=
singularPart_eq_restrict' hμs <| withDensity_absolutelyContinuous _ _ hνs
lemma measure_sub_singularPart (μ ν : Measure α) [HaveLebesgueDecomposition μ ν]
[IsFiniteMeasure μ] :
μ - μ.singularPart ν = ν.withDensity (μ.rnDeriv ν) := by
nth_rw 1 [← rnDeriv_add_singularPart μ ν]
exact Measure.add_sub_cancel
lemma measure_sub_rnDeriv (μ ν : Measure α) [HaveLebesgueDecomposition μ ν] [IsFiniteMeasure μ] :
μ - ν.withDensity (μ.rnDeriv ν) = μ.singularPart ν := by
nth_rw 1 [← singularPart_add_rnDeriv μ ν]
exact Measure.add_sub_cancel
/-- Given measures `μ` and `ν`, if `s` is a measure mutually singular to `ν` and `f` is a
measurable function such that `μ = s + fν`, then `f = μ.rnDeriv ν`.
This theorem provides the uniqueness of the `rnDeriv` in the Lebesgue decomposition
theorem, while `MeasureTheory.Measure.eq_singularPart` provides the uniqueness of the
`singularPart`. Here, the uniqueness is given in terms of the measures, while the uniqueness in
terms of the functions is given in `eq_rnDeriv`. -/
theorem eq_withDensity_rnDeriv {s : Measure α} {f : α → ℝ≥0∞} (hf : Measurable f) (hs : s ⟂ₘ ν)
(hadd : μ = s + ν.withDensity f) : ν.withDensity f = ν.withDensity (μ.rnDeriv ν) := by
have : HaveLebesgueDecomposition μ ν := ⟨⟨⟨s, f⟩, hf, hs, hadd⟩⟩
obtain ⟨hmeas, hsing, hadd'⟩ := haveLebesgueDecomposition_spec μ ν
obtain ⟨⟨S, hS₁, hS₂, hS₃⟩, ⟨T, hT₁, hT₂, hT₃⟩⟩ := hs, hsing
rw [hadd'] at hadd
have hνinter : ν (S ∩ T)ᶜ = 0 := by
rw [compl_inter]
refine nonpos_iff_eq_zero.1 (le_trans (measure_union_le _ _) ?_)
rw [hT₃, hS₃, add_zero]
have heq :
(ν.withDensity f).restrict (S ∩ T) = (ν.withDensity (μ.rnDeriv ν)).restrict (S ∩ T) := by
ext1 A hA
have hs : s (A ∩ (S ∩ T)) = 0 := by
rw [← nonpos_iff_eq_zero]
exact hS₂ ▸ measure_mono (inter_subset_right.trans inter_subset_left)
have hsing : μ.singularPart ν (A ∩ (S ∩ T)) = 0 := by
rw [← nonpos_iff_eq_zero]
exact hT₂ ▸ measure_mono (inter_subset_right.trans inter_subset_right)
rw [restrict_apply hA, restrict_apply hA, ← add_zero (ν.withDensity f (A ∩ (S ∩ T))), ← hs, ←
add_apply, add_comm, ← hadd, add_apply, hsing, zero_add]
have heq' :
∀ A : Set α, MeasurableSet A → ν.withDensity f A = (ν.withDensity f).restrict (S ∩ T) A := by
intro A hA
have hνfinter : ν.withDensity f (A ∩ (S ∩ T)ᶜ) = 0 := by
rw [← nonpos_iff_eq_zero]
exact withDensity_absolutelyContinuous ν f hνinter ▸ measure_mono inter_subset_right
rw [restrict_apply hA, ← add_zero (ν.withDensity f (A ∩ (S ∩ T))), ← hνfinter, ← diff_eq,
measure_inter_add_diff _ (hS₁.inter hT₁)]
ext1 A hA
have hνrn : ν.withDensity (μ.rnDeriv ν) (A ∩ (S ∩ T)ᶜ) = 0 := by
rw [← nonpos_iff_eq_zero]
exact
withDensity_absolutelyContinuous ν (μ.rnDeriv ν) hνinter ▸
measure_mono inter_subset_right
rw [heq' A hA, heq, ← add_zero ((ν.withDensity (μ.rnDeriv ν)).restrict (S ∩ T) A), ← hνrn,
restrict_apply hA, ← diff_eq, measure_inter_add_diff _ (hS₁.inter hT₁)]
theorem eq_withDensity_rnDeriv₀ {s : Measure α} {f : α → ℝ≥0∞}
(hf : AEMeasurable f ν) (hs : s ⟂ₘ ν) (hadd : μ = s + ν.withDensity f) :
ν.withDensity f = ν.withDensity (μ.rnDeriv ν) := by
rw [withDensity_congr_ae hf.ae_eq_mk] at hadd ⊢
exact eq_withDensity_rnDeriv hf.measurable_mk hs hadd
theorem eq_rnDeriv₀ [SigmaFinite ν] {s : Measure α} {f : α → ℝ≥0∞}
(hf : AEMeasurable f ν) (hs : s ⟂ₘ ν) (hadd : μ = s + ν.withDensity f) :
f =ᵐ[ν] μ.rnDeriv ν :=
(withDensity_eq_iff_of_sigmaFinite hf (measurable_rnDeriv _ _).aemeasurable).mp
(eq_withDensity_rnDeriv₀ hf hs hadd)
/-- Given measures `μ` and `ν`, if `s` is a measure mutually singular to `ν` and `f` is a
measurable function such that `μ = s + fν`, then `f = μ.rnDeriv ν`.
This theorem provides the uniqueness of the `rnDeriv` in the Lebesgue decomposition
theorem, while `MeasureTheory.Measure.eq_singularPart` provides the uniqueness of the
`singularPart`. Here, the uniqueness is given in terms of the functions, while the uniqueness in
terms of the functions is given in `eq_withDensity_rnDeriv`. -/
theorem eq_rnDeriv [SigmaFinite ν] {s : Measure α} {f : α → ℝ≥0∞} (hf : Measurable f) (hs : s ⟂ₘ ν)
(hadd : μ = s + ν.withDensity f) : f =ᵐ[ν] μ.rnDeriv ν :=
eq_rnDeriv₀ hf.aemeasurable hs hadd
/-- The Radon-Nikodym derivative of `f ν` with respect to `ν` is `f`. -/
theorem rnDeriv_withDensity₀ (ν : Measure α) [SigmaFinite ν] {f : α → ℝ≥0∞}
(hf : AEMeasurable f ν) :
(ν.withDensity f).rnDeriv ν =ᵐ[ν] f :=
have : ν.withDensity f = 0 + ν.withDensity f := by rw [zero_add]
(eq_rnDeriv₀ hf MutuallySingular.zero_left this).symm
/-- The Radon-Nikodym derivative of `f ν` with respect to `ν` is `f`. -/
theorem rnDeriv_withDensity (ν : Measure α) [SigmaFinite ν] {f : α → ℝ≥0∞} (hf : Measurable f) :
(ν.withDensity f).rnDeriv ν =ᵐ[ν] f :=
rnDeriv_withDensity₀ ν hf.aemeasurable
lemma rnDeriv_restrict (μ ν : Measure α) [HaveLebesgueDecomposition μ ν] [SigmaFinite ν]
{s : Set α} (hs : MeasurableSet s) :
(μ.restrict s).rnDeriv ν =ᵐ[ν] s.indicator (μ.rnDeriv ν) := by
refine (eq_rnDeriv (s := (μ.restrict s).singularPart ν)
((measurable_rnDeriv _ _).indicator hs) (mutuallySingular_singularPart _ _) ?_).symm
rw [singularPart_restrict _ _ hs, withDensity_indicator hs, ← restrict_withDensity hs,
← Measure.restrict_add, ← μ.haveLebesgueDecomposition_add ν]
/-- The Radon-Nikodym derivative of the restriction of a measure to a measurable set is the
indicator function of this set. -/
theorem rnDeriv_restrict_self (ν : Measure α) [SigmaFinite ν] {s : Set α} (hs : MeasurableSet s) :
(ν.restrict s).rnDeriv ν =ᵐ[ν] s.indicator 1 := by
rw [← withDensity_indicator_one hs]
exact rnDeriv_withDensity _ (measurable_one.indicator hs)
/-- Radon-Nikodym derivative of the scalar multiple of a measure.
See also `rnDeriv_smul_left'`, which requires sigma-finite `ν` and `μ`. -/
theorem rnDeriv_smul_left (ν μ : Measure α) [IsFiniteMeasure ν]
[ν.HaveLebesgueDecomposition μ] (r : ℝ≥0) :
(r • ν).rnDeriv μ =ᵐ[μ] r • ν.rnDeriv μ := by
rw [← withDensity_eq_iff]
· simp_rw [ENNReal.smul_def]
rw [withDensity_smul _ (measurable_rnDeriv _ _)]
suffices (r • ν).singularPart μ + withDensity μ (rnDeriv (r • ν) μ)
= (r • ν).singularPart μ + r • withDensity μ (rnDeriv ν μ) by
rwa [Measure.add_right_inj] at this
rw [← (r • ν).haveLebesgueDecomposition_add μ, singularPart_smul, ← smul_add,
← ν.haveLebesgueDecomposition_add μ]
· exact (measurable_rnDeriv _ _).aemeasurable
· exact (measurable_rnDeriv _ _).aemeasurable.const_smul _
· exact (lintegral_rnDeriv_lt_top (r • ν) μ).ne
/-- Radon-Nikodym derivative of the scalar multiple of a measure.
See also `rnDeriv_smul_left_of_ne_top'`, which requires sigma-finite `ν` and `μ`. -/
theorem rnDeriv_smul_left_of_ne_top (ν μ : Measure α) [IsFiniteMeasure ν]
[ν.HaveLebesgueDecomposition μ] {r : ℝ≥0∞} (hr : r ≠ ∞) :
(r • ν).rnDeriv μ =ᵐ[μ] r • ν.rnDeriv μ := by
have h : (r.toNNReal • ν).rnDeriv μ =ᵐ[μ] r.toNNReal • ν.rnDeriv μ :=
rnDeriv_smul_left ν μ r.toNNReal
simpa [ENNReal.smul_def, ENNReal.coe_toNNReal hr] using h
/-- Radon-Nikodym derivative with respect to the scalar multiple of a measure.
See also `rnDeriv_smul_right'`, which requires sigma-finite `ν` and `μ`. -/
theorem rnDeriv_smul_right (ν μ : Measure α) [IsFiniteMeasure ν]
[ν.HaveLebesgueDecomposition μ] {r : ℝ≥0} (hr : r ≠ 0) :
ν.rnDeriv (r • μ) =ᵐ[μ] r⁻¹ • ν.rnDeriv μ := by
refine (absolutelyContinuous_smul <| ENNReal.coe_ne_zero.2 hr).ae_le
(?_ : ν.rnDeriv (r • μ) =ᵐ[r • μ] r⁻¹ • ν.rnDeriv μ)
rw [← withDensity_eq_iff]
rotate_left
· exact (measurable_rnDeriv _ _).aemeasurable
· exact (measurable_rnDeriv _ _).aemeasurable.const_smul _
· exact (lintegral_rnDeriv_lt_top ν _).ne
· simp_rw [ENNReal.smul_def]
rw [withDensity_smul _ (measurable_rnDeriv _ _)]
suffices ν.singularPart (r • μ) + withDensity (r • μ) (rnDeriv ν (r • μ))
= ν.singularPart (r • μ) + r⁻¹ • withDensity (r • μ) (rnDeriv ν μ) by
rwa [add_right_inj] at this
rw [← ν.haveLebesgueDecomposition_add (r • μ), singularPart_smul_right _ _ _ hr,
ENNReal.smul_def r, withDensity_smul_measure, ← ENNReal.smul_def, ← smul_assoc,
smul_eq_mul, inv_mul_cancel₀ hr, one_smul]
exact ν.haveLebesgueDecomposition_add μ
/-- Radon-Nikodym derivative with respect to the scalar multiple of a measure.
See also `rnDeriv_smul_right_of_ne_top'`, which requires sigma-finite `ν` and `μ`. -/
theorem rnDeriv_smul_right_of_ne_top (ν μ : Measure α) [IsFiniteMeasure ν]
[ν.HaveLebesgueDecomposition μ] {r : ℝ≥0∞} (hr : r ≠ 0) (hr_ne_top : r ≠ ∞) :
ν.rnDeriv (r • μ) =ᵐ[μ] r⁻¹ • ν.rnDeriv μ := by
have h : ν.rnDeriv (r.toNNReal • μ) =ᵐ[μ] r.toNNReal⁻¹ • ν.rnDeriv μ := by
refine rnDeriv_smul_right ν μ ?_
rw [ne_eq, ENNReal.toNNReal_eq_zero_iff]
simp [hr, hr_ne_top]
have : (r.toNNReal)⁻¹ • rnDeriv ν μ = r⁻¹ • rnDeriv ν μ := by
ext x
simp only [Pi.smul_apply, ENNReal.smul_def, smul_eq_mul]
rw [ENNReal.coe_inv, ENNReal.coe_toNNReal hr_ne_top]
rw [ne_eq, ENNReal.toNNReal_eq_zero_iff]
simp [hr, hr_ne_top]
simp_rw [this, ENNReal.smul_def, ENNReal.coe_toNNReal hr_ne_top] at h
exact h
/-- Radon-Nikodym derivative of a sum of two measures.
See also `rnDeriv_add'`, which requires sigma-finite `ν₁`, `ν₂` and `μ`. -/
lemma rnDeriv_add (ν₁ ν₂ μ : Measure α) [IsFiniteMeasure ν₁] [IsFiniteMeasure ν₂]
[ν₁.HaveLebesgueDecomposition μ] [ν₂.HaveLebesgueDecomposition μ]
[(ν₁ + ν₂).HaveLebesgueDecomposition μ] :
(ν₁ + ν₂).rnDeriv μ =ᵐ[μ] ν₁.rnDeriv μ + ν₂.rnDeriv μ := by
rw [← withDensity_eq_iff]
· suffices (ν₁ + ν₂).singularPart μ + μ.withDensity ((ν₁ + ν₂).rnDeriv μ)
= (ν₁ + ν₂).singularPart μ + μ.withDensity (ν₁.rnDeriv μ + ν₂.rnDeriv μ) by
rwa [add_right_inj] at this
rw [← (ν₁ + ν₂).haveLebesgueDecomposition_add μ, singularPart_add,
withDensity_add_left (measurable_rnDeriv _ _), add_assoc,
add_comm (ν₂.singularPart μ), add_assoc, add_comm _ (ν₂.singularPart μ),
← ν₂.haveLebesgueDecomposition_add μ, ← add_assoc, ← ν₁.haveLebesgueDecomposition_add μ]
· exact (measurable_rnDeriv _ _).aemeasurable
· exact ((measurable_rnDeriv _ _).add (measurable_rnDeriv _ _)).aemeasurable
· exact (lintegral_rnDeriv_lt_top (ν₁ + ν₂) μ).ne
/-- If two finite measures `μ` and `ν` are not mutually singular, there exists some `ε > 0` and
a measurable set `E`, such that `ν(E) > 0` and `E` is positive with respect to `μ - εν`.
This lemma is useful for the Lebesgue decomposition theorem. -/
theorem exists_positive_of_not_mutuallySingular (μ ν : Measure α) [IsFiniteMeasure μ]
[IsFiniteMeasure ν] (h : ¬ μ ⟂ₘ ν) :
∃ ε : ℝ≥0, 0 < ε ∧
∃ E : Set α, MeasurableSet E ∧ 0 < ν E
∧ ∀ A, MeasurableSet A → ε * ν (A ∩ E) ≤ μ (A ∩ E) := by
-- for all `n : ℕ`, obtain the Hahn decomposition for `μ - (1 / n) ν`
have h_decomp (n : ℕ) : ∃ s : Set α, MeasurableSet s
∧ (∀ t, MeasurableSet t → ((1 / (n + 1) : ℝ≥0) • ν) (t ∩ s) ≤ μ (t ∩ s))
∧ (∀ t, MeasurableSet t → μ (t ∩ sᶜ) ≤ ((1 / (n + 1) : ℝ≥0) • ν) (t ∩ sᶜ)) := by
obtain ⟨s, hs, hs_le, hs_ge⟩ := hahn_decomposition μ ((1 / (n + 1) : ℝ≥0) • ν)
refine ⟨s, hs, fun t ht ↦ ?_, fun t ht ↦ ?_⟩
· exact hs_le (t ∩ s) (ht.inter hs) inter_subset_right
· exact hs_ge (t ∩ sᶜ) (ht.inter hs.compl) inter_subset_right
choose f hf₁ hf₂ hf₃ using h_decomp
-- set `A` to be the intersection of all the negative parts of obtained Hahn decompositions
-- and we show that `μ A = 0`
let A := ⋂ n, (f n)ᶜ
have hAmeas : MeasurableSet A := MeasurableSet.iInter fun n ↦ (hf₁ n).compl
have hA₂ (n : ℕ) (t : Set α) (ht : MeasurableSet t) :
μ (t ∩ A) ≤ ((1 / (n + 1) : ℝ≥0) • ν) (t ∩ A) := by
specialize hf₃ n (t ∩ A) (ht.inter hAmeas)
have : A ∩ (f n)ᶜ = A := inter_eq_left.mpr (iInter_subset _ n)
rwa [inter_assoc, this] at hf₃
have hA₃ (n : ℕ) : μ A ≤ (1 / (n + 1) : ℝ≥0) * ν A := by simpa using hA₂ n univ .univ
have hμ : μ A = 0 := by
lift μ A to ℝ≥0 using measure_ne_top _ _ with μA
lift ν A to ℝ≥0 using measure_ne_top _ _ with νA
rw [ENNReal.coe_eq_zero]
by_cases! hb : 0 < νA
· suffices ∀ b, 0 < b → μA ≤ b by
by_contra h
have h' := this (μA / 2) (half_pos (zero_lt_iff.2 h))
rw [← @Classical.not_not (μA ≤ μA / 2)] at h'
exact h' (not_le.2 (NNReal.half_lt_self h))
intro c hc
have : ∃ n : ℕ, 1 / (n + 1 : ℝ) < c * (νA : ℝ)⁻¹ := by
refine exists_nat_one_div_lt ?_
positivity
rcases this with ⟨n, hn⟩
have hb₁ : (0 : ℝ) < (νA : ℝ)⁻¹ := by rw [_root_.inv_pos]; exact hb
have h' : 1 / (↑n + 1) * νA < c := by
rw [← NNReal.coe_lt_coe, ← mul_lt_mul_iff_left₀ hb₁, NNReal.coe_mul, mul_assoc, ←
NNReal.coe_inv, ← NNReal.coe_mul, mul_inv_cancel₀, ← NNReal.coe_mul, mul_one,
NNReal.coe_inv]
· exact hn
· exact hb.ne'
refine le_trans ?_ h'.le
rw [← ENNReal.coe_le_coe, ENNReal.coe_mul]
exact hA₃ n
· rw [le_zero_iff] at hb
simpa [hb] using hA₃ 0
-- since `μ` and `ν` are not mutually singular, `μ A = 0` implies `ν Aᶜ > 0`
rw [MutuallySingular] at h; push_neg at h
have := h _ hAmeas hμ
simp_rw [A, compl_iInter, compl_compl] at this
-- as `Aᶜ = ⋃ n, f n`, `ν Aᶜ > 0` implies there exists some `n` such that `ν (f n) > 0`
obtain ⟨n, hn⟩ := exists_measure_pos_of_not_measure_iUnion_null this
-- thus, choosing `f n` as the set `E` suffices
exact ⟨1 / (n + 1), by simp, f n, hf₁ n, hn, hf₂ n⟩
namespace LebesgueDecomposition
/-- Given two measures `μ` and `ν`, `measurableLE μ ν` is the set of measurable
functions `f`, such that, for all measurable sets `A`, `∫⁻ x in A, f x ∂μ ≤ ν A`.
This is useful for the Lebesgue decomposition theorem. -/
def measurableLE (μ ν : Measure α) : Set (α → ℝ≥0∞) :=
{f | Measurable f ∧ ∀ (A : Set α), MeasurableSet A → (∫⁻ x in A, f x ∂μ) ≤ ν A}
theorem zero_mem_measurableLE : (0 : α → ℝ≥0∞) ∈ measurableLE μ ν :=
⟨measurable_zero, fun A _ ↦ by simp⟩
theorem sup_mem_measurableLE {f g : α → ℝ≥0∞} (hf : f ∈ measurableLE μ ν)
(hg : g ∈ measurableLE μ ν) : (fun a ↦ f a ⊔ g a) ∈ measurableLE μ ν := by
refine ⟨Measurable.max hf.1 hg.1, fun A hA ↦ ?_⟩
have h₁ := hA.inter (measurableSet_le hf.1 hg.1)
have h₂ := hA.inter (measurableSet_lt hg.1 hf.1)
rw [setLIntegral_max hf.1 hg.1]
refine (add_le_add (hg.2 _ h₁) (hf.2 _ h₂)).trans_eq ?_
simp only [← not_le, ← compl_setOf, ← diff_eq]
exact measure_inter_add_diff _ (measurableSet_le hf.1 hg.1)
theorem iSup_succ_eq_sup {α} (f : ℕ → α → ℝ≥0∞) (m : ℕ) (a : α) :
⨆ (k : ℕ) (_ : k ≤ m + 1), f k a = f m.succ a ⊔ ⨆ (k : ℕ) (_ : k ≤ m), f k a := by
set c := ⨆ (k : ℕ) (_ : k ≤ m + 1), f k a with hc
set d := f m.succ a ⊔ ⨆ (k : ℕ) (_ : k ≤ m), f k a with hd
rw [le_antisymm_iff, hc, hd]
constructor
· refine iSup₂_le fun n hn ↦ ?_
rcases Nat.of_le_succ hn with (h | h)
· exact le_sup_of_le_right (le_iSup₂ (f := fun k (_ : k ≤ m) ↦ f k a) n h)
· exact h ▸ le_sup_left
· refine sup_le ?_ (biSup_mono fun n hn ↦ hn.trans m.le_succ)
exact @le_iSup₂ ℝ≥0∞ ℕ (fun i ↦ i ≤ m + 1) _ _ (m + 1) le_rfl
theorem iSup_mem_measurableLE (f : ℕ → α → ℝ≥0∞) (hf : ∀ n, f n ∈ measurableLE μ ν) (n : ℕ) :
(fun x ↦ ⨆ (k) (_ : k ≤ n), f k x) ∈ measurableLE μ ν := by
induction n with
| zero =>
constructor
· simp [(hf 0).1]
· intro A hA; simp [(hf 0).2 A hA]
| succ m hm =>
have :
(fun a : α ↦ ⨆ (k : ℕ) (_ : k ≤ m + 1), f k a) = fun a ↦
f m.succ a ⊔ ⨆ (k : ℕ) (_ : k ≤ m), f k a :=
funext fun _ ↦ iSup_succ_eq_sup _ _ _
refine ⟨.iSup fun n ↦ Measurable.iSup_Prop _ (hf n).1, fun A hA ↦ ?_⟩
rw [this]; exact (sup_mem_measurableLE (hf m.succ) hm).2 A hA
theorem iSup_mem_measurableLE' (f : ℕ → α → ℝ≥0∞) (hf : ∀ n, f n ∈ measurableLE μ ν) (n : ℕ) :
(⨆ (k) (_ : k ≤ n), f k) ∈ measurableLE μ ν := by
convert iSup_mem_measurableLE f hf n
simp
section SuprLemmas
--TODO: these statements should be moved elsewhere
theorem iSup_monotone {α : Type*} (f : ℕ → α → ℝ≥0∞) :
Monotone fun n x ↦ ⨆ (k) (_ : k ≤ n), f k x :=
fun _ _ hnm _ ↦ biSup_mono fun _ ↦ ge_trans hnm
theorem iSup_monotone' {α : Type*} (f : ℕ → α → ℝ≥0∞) (x : α) :
Monotone fun n ↦ ⨆ (k) (_ : k ≤ n), f k x := fun _ _ hnm ↦ iSup_monotone f hnm x
theorem iSup_le_le {α : Type*} (f : ℕ → α → ℝ≥0∞) (n k : ℕ) (hk : k ≤ n) :
f k ≤ fun x ↦ ⨆ (k) (_ : k ≤ n), f k x :=
fun x ↦ le_iSup₂ (f := fun k (_ : k ≤ n) ↦ f k x) k hk
end SuprLemmas
/-- `measurableLEEval μ ν` is the set of `∫⁻ x, f x ∂μ` for all `f ∈ measurableLE μ ν`. -/
def measurableLEEval (μ ν : Measure α) : Set ℝ≥0∞ :=
(fun f : α → ℝ≥0∞ ↦ ∫⁻ x, f x ∂μ) '' measurableLE μ ν
end LebesgueDecomposition
open LebesgueDecomposition
/-- Any pair of finite measures `μ` and `ν`, `HaveLebesgueDecomposition`. That is to say,
there exist a measure `ξ` and a measurable function `f`, such that `ξ` is mutually singular
with respect to `ν` and `μ = ξ + ν.withDensity f`.
This is not an instance since this is also shown for the more general σ-finite measures with
`MeasureTheory.Measure.haveLebesgueDecomposition_of_sigmaFinite`. -/
theorem haveLebesgueDecomposition_of_finiteMeasure [IsFiniteMeasure μ] [IsFiniteMeasure ν] :
HaveLebesgueDecomposition μ ν where
lebesgue_decomposition := by
have h := @exists_seq_tendsto_sSup _ _ _ _ _ (measurableLEEval ν μ)
⟨0, 0, zero_mem_measurableLE, by simp⟩ (OrderTop.bddAbove _)
choose g _ hg₂ f hf₁ hf₂ using h
-- we set `ξ` to be the supremum of an increasing sequence of functions obtained from above
set ξ := ⨆ (n) (k) (_ : k ≤ n), f k with hξ
-- we see that `ξ` has the largest integral among all functions in `measurableLE`
have hξ₁ : sSup (measurableLEEval ν μ) = ∫⁻ a, ξ a ∂ν := by
have := @lintegral_tendsto_of_tendsto_of_monotone _ _ ν (fun n ↦ ⨆ (k) (_ : k ≤ n), f k)
(⨆ (n) (k) (_ : k ≤ n), f k) ?_ ?_ ?_
· refine tendsto_nhds_unique ?_ this
refine tendsto_of_tendsto_of_tendsto_of_le_of_le hg₂ tendsto_const_nhds (fun n ↦ ?_)
fun n ↦ ?_
· rw [← hf₂ n]
apply lintegral_mono
convert iSup_le_le f n n le_rfl
simp only [iSup_apply]
· exact le_sSup ⟨⨆ (k : ℕ) (_ : k ≤ n), f k, iSup_mem_measurableLE' _ hf₁ _, rfl⟩
· intro n
refine Measurable.aemeasurable ?_
convert (iSup_mem_measurableLE _ hf₁ n).1
simp
· refine Filter.Eventually.of_forall fun a ↦ ?_
simp [iSup_monotone' f _]
· refine Filter.Eventually.of_forall fun a ↦ ?_
simp [tendsto_atTop_iSup (iSup_monotone' f a)]
have hξm : Measurable ξ := by
convert Measurable.iSup fun n ↦ (iSup_mem_measurableLE _ hf₁ n).1
simp [hξ]
-- we see that `ξ` has the largest integral among all functions in `measurableLE`
have hξle A (hA : MeasurableSet A) : ∫⁻ a in A, ξ a ∂ν ≤ μ A := by
rw [hξ]
simp_rw [iSup_apply]
rw [lintegral_iSup (fun n ↦ (iSup_mem_measurableLE _ hf₁ n).1) (iSup_monotone _)]
exact iSup_le fun n ↦ (iSup_mem_measurableLE _ hf₁ n).2 A hA
have hle : ν.withDensity ξ ≤ μ := by
refine le_intro fun B hB _ ↦ ?_
rw [withDensity_apply _ hB]
exact hξle B hB
have : IsFiniteMeasure (ν.withDensity ξ) := by
refine isFiniteMeasure_withDensity ?_
have hle' := hle univ
rw [withDensity_apply _ MeasurableSet.univ, Measure.restrict_univ] at hle'
exact ne_top_of_le_ne_top (measure_ne_top _ _) hle'
-- `ξ` is the `f` in the theorem statement and we set `μ₁` to be `μ - ν.withDensity ξ`
-- since we need `μ₁ + ν.withDensity ξ = μ`
set μ₁ := μ - ν.withDensity ξ with hμ₁
refine ⟨⟨μ₁, ξ⟩, hξm, ?_, ?_⟩
· by_contra h
-- if they are not mutually singular, then from `exists_positive_of_not_mutuallySingular`,
-- there exists some `ε > 0` and a measurable set `E`, such that `μ(E) > 0` and `E` is
-- positive with respect to `ν - εμ`
obtain ⟨ε, hε₁, E, hE₁, hE₂, hE₃⟩ := exists_positive_of_not_mutuallySingular μ₁ ν h
simp_rw [hμ₁] at hE₃
-- since `E` is positive, we have `∫⁻ a in A ∩ E, ε + ξ a ∂ν ≤ μ (A ∩ E)` for all `A`
have hε₂ (A : Set α) (hA : MeasurableSet A) : ∫⁻ a in A ∩ E, ε + ξ a ∂ν ≤ μ (A ∩ E) := by
specialize hE₃ A hA
rw [lintegral_add_left measurable_const, lintegral_const, restrict_apply_univ]
rw [Measure.sub_apply (hA.inter hE₁) hle, withDensity_apply _ (hA.inter hE₁)] at hE₃
refine add_le_of_le_tsub_right_of_le (hξle _ (hA.inter hE₁)) hE₃
-- from this, we can show `ξ + ε * E.indicator` is a function in `measurableLE` with
-- integral greater than `ξ`
have hξε : (ξ + E.indicator fun _ ↦ (ε : ℝ≥0∞)) ∈ measurableLE ν μ := by
refine ⟨hξm.add (measurable_const.indicator hE₁), fun A hA ↦ ?_⟩
have : ∫⁻ a in A, (ξ + E.indicator fun _ ↦ (ε : ℝ≥0∞)) a ∂ν =
∫⁻ a in A ∩ E, ε + ξ a ∂ν + ∫⁻ a in A \ E, ξ a ∂ν := by
simp only [lintegral_add_left measurable_const, lintegral_add_left hξm,
setLIntegral_const, add_assoc, lintegral_inter_add_diff _ _ hE₁, Pi.add_apply,
lintegral_indicator hE₁, restrict_apply hE₁]
rw [inter_comm, add_comm]
rw [this, ← measure_inter_add_diff A hE₁]
exact add_le_add (hε₂ A hA) (hξle (A \ E) (hA.diff hE₁))
have : (∫⁻ a, ξ a + E.indicator (fun _ ↦ (ε : ℝ≥0∞)) a ∂ν) ≤ sSup (measurableLEEval ν μ) :=
le_sSup ⟨ξ + E.indicator fun _ ↦ (ε : ℝ≥0∞), hξε, rfl⟩
-- but this contradicts the maximality of `∫⁻ x, ξ x ∂ν`
refine not_lt.2 this ?_
rw [hξ₁, lintegral_add_left hξm, lintegral_indicator hE₁, setLIntegral_const]
refine ENNReal.lt_add_right ?_ (ENNReal.mul_pos_iff.2 ⟨ENNReal.coe_pos.2 hε₁, hE₂⟩).ne'
have := measure_ne_top (ν.withDensity ξ) univ
rwa [withDensity_apply _ MeasurableSet.univ, Measure.restrict_univ] at this
-- since `ν.withDensity ξ ≤ μ`, it is clear that `μ = μ₁ + ν.withDensity ξ`
· rw [hμ₁]
ext1 A hA
rw [Measure.coe_add, Pi.add_apply, Measure.sub_apply hA hle, add_comm,
add_tsub_cancel_of_le (hle A)]
/-- If any finite measure has a Lebesgue decomposition with respect to `ν`,
then the same is true for any s-finite measure. -/
theorem HaveLebesgueDecomposition.sfinite_of_isFiniteMeasure [SFinite μ]
(_h : ∀ (μ : Measure α) [IsFiniteMeasure μ], HaveLebesgueDecomposition μ ν) :
HaveLebesgueDecomposition μ ν :=
sum_sfiniteSeq μ ▸ sum_left _
attribute [local instance] haveLebesgueDecomposition_of_finiteMeasure
-- see Note [lower instance priority]
variable (μ ν) in
/-- **The Lebesgue decomposition theorem**:
Any s-finite measure `μ` has Lebesgue decomposition with respect to any σ-finite measure `ν`.
That is to say, there exist a measure `ξ` and a measurable function `f`,
such that `ξ` is mutually singular with respect to `ν` and `μ = ξ + ν.withDensity f` -/
nonrec instance (priority := 100) haveLebesgueDecomposition_of_sigmaFinite
[SFinite μ] [SigmaFinite ν] : HaveLebesgueDecomposition μ ν := by
wlog hμ : IsFiniteMeasure μ generalizing μ
· exact .sfinite_of_isFiniteMeasure fun μ _ ↦ this μ ‹_›
-- Take a disjoint cover that consists of sets of finite measure `ν`.
set s : ℕ → Set α := disjointed (spanningSets ν)
have hsm : ∀ n, MeasurableSet (s n) := .disjointed <| measurableSet_spanningSets _
have hs : ∀ n, Fact (ν (s n) < ⊤) := fun n ↦
⟨lt_of_le_of_lt (measure_mono <| disjointed_le ..) (measure_spanningSets_lt_top ν n)⟩
-- Note that the restrictions of `μ` and `ν` to `s n` are finite measures.
-- Therefore, as we proved above, these restrictions have a Lebesgue decomposition.
-- Let `ξ n` and `f n` be the singular part and the Radon-Nikodym derivative
-- of these restrictions.
set ξ : ℕ → Measure α := fun n : ℕ ↦ singularPart (.restrict μ (s n)) (.restrict ν (s n))
set f : ℕ → α → ℝ≥0∞ := fun n ↦ (s n).indicator (rnDeriv (.restrict μ (s n)) (.restrict ν (s n)))
have hfm (n : ℕ) : Measurable (f n) := by measurability
-- Each `ξ n` is supported on `s n` and is mutually singular with the restriction of `ν` to `s n`.
-- Therefore, `ξ n` is mutually singular with `ν`, hence their sum is mutually singular with `ν`.
have hξ : .sum ξ ⟂ₘ ν := by
refine MutuallySingular.sum_left.2 fun n ↦ ?_
rw [← ν.restrict_add_restrict_compl (hsm n)]
refine (mutuallySingular_singularPart ..).add_right (.singularPart ?_ _)
refine ⟨(s n)ᶜ, (hsm n).compl, ?_⟩
simp [hsm]
-- Finally, the sum of all `ξ n` and measure `ν` with the density `∑' n, f n`
-- is equal to `μ`, thus `(Measure.sum ξ, ∑' n, f n)` is a Lebesgue decomposition for `μ` and `ν`.
have hadd : .sum ξ + ν.withDensity (∑' n, f n) = μ := calc
.sum ξ + ν.withDensity (∑' n, f n) = .sum fun n ↦ ξ n + ν.withDensity (f n) := by
rw [withDensity_tsum hfm, Measure.sum_add_sum]
_ = .sum fun n ↦ .restrict μ (s n) := by
simp_rw [ξ, f, withDensity_indicator (hsm _), singularPart_add_rnDeriv]
_ = μ := sum_restrict_disjointed_spanningSets ..
exact ⟨⟨(.sum ξ, ∑' n, f n), by fun_prop, hξ, hadd.symm⟩⟩
section rnDeriv
/-- Radon-Nikodym derivative of the scalar multiple of a measure.
See also `rnDeriv_smul_left`, which has no hypothesis on `μ` but requires finite `ν`. -/
theorem rnDeriv_smul_left' (ν μ : Measure α) [SigmaFinite ν] [SigmaFinite μ] (r : ℝ≥0) :
(r • ν).rnDeriv μ =ᵐ[μ] r • ν.rnDeriv μ := by
rw [← withDensity_eq_iff_of_sigmaFinite]
· simp_rw [ENNReal.smul_def]
rw [withDensity_smul _ (measurable_rnDeriv _ _)]
suffices (r • ν).singularPart μ + withDensity μ (rnDeriv (r • ν) μ)
= (r • ν).singularPart μ + r • withDensity μ (rnDeriv ν μ) by
rwa [Measure.add_right_inj] at this
rw [← (r • ν).haveLebesgueDecomposition_add μ, singularPart_smul, ← smul_add,
← ν.haveLebesgueDecomposition_add μ]
· exact (measurable_rnDeriv _ _).aemeasurable
· exact (measurable_rnDeriv _ _).aemeasurable.const_smul _
/-- Radon-Nikodym derivative of the scalar multiple of a measure.
See also `rnDeriv_smul_left_of_ne_top`, which has no hypothesis on `μ` but requires finite `ν`. -/
theorem rnDeriv_smul_left_of_ne_top' (ν μ : Measure α) [SigmaFinite ν] [SigmaFinite μ]
{r : ℝ≥0∞} (hr : r ≠ ∞) :
(r • ν).rnDeriv μ =ᵐ[μ] r • ν.rnDeriv μ := by
have h : (r.toNNReal • ν).rnDeriv μ =ᵐ[μ] r.toNNReal • ν.rnDeriv μ :=
rnDeriv_smul_left' ν μ r.toNNReal
simpa [ENNReal.smul_def, ENNReal.coe_toNNReal hr] using h
/-- Radon-Nikodym derivative with respect to the scalar multiple of a measure.
See also `rnDeriv_smul_right`, which has no hypothesis on `μ` but requires finite `ν`. -/
theorem rnDeriv_smul_right' (ν μ : Measure α) [SigmaFinite ν] [SigmaFinite μ]
{r : ℝ≥0} (hr : r ≠ 0) :
ν.rnDeriv (r • μ) =ᵐ[μ] r⁻¹ • ν.rnDeriv μ := by
refine (absolutelyContinuous_smul <| ENNReal.coe_ne_zero.2 hr).ae_le
(?_ : ν.rnDeriv (r • μ) =ᵐ[r • μ] r⁻¹ • ν.rnDeriv μ)
rw [← withDensity_eq_iff_of_sigmaFinite]
· simp_rw [ENNReal.smul_def]
rw [withDensity_smul _ (measurable_rnDeriv _ _)]
suffices ν.singularPart (r • μ) + withDensity (r • μ) (rnDeriv ν (r • μ))
= ν.singularPart (r • μ) + r⁻¹ • withDensity (r • μ) (rnDeriv ν μ) by
rwa [add_right_inj] at this
rw [← ν.haveLebesgueDecomposition_add (r • μ), singularPart_smul_right _ _ _ hr,
ENNReal.smul_def r, withDensity_smul_measure, ← ENNReal.smul_def, ← smul_assoc,
smul_eq_mul, inv_mul_cancel₀ hr, one_smul]
exact ν.haveLebesgueDecomposition_add μ
· exact (measurable_rnDeriv _ _).aemeasurable
· exact (measurable_rnDeriv _ _).aemeasurable.const_smul _
/-- Radon-Nikodym derivative with respect to the scalar multiple of a measure.
See also `rnDeriv_smul_right_of_ne_top`, which has no hypothesis on `μ` but requires finite `ν`. -/
theorem rnDeriv_smul_right_of_ne_top' (ν μ : Measure α) [SigmaFinite ν] [SigmaFinite μ]
{r : ℝ≥0∞} (hr : r ≠ 0) (hr_ne_top : r ≠ ∞) :
ν.rnDeriv (r • μ) =ᵐ[μ] r⁻¹ • ν.rnDeriv μ := by
have h : ν.rnDeriv (r.toNNReal • μ) =ᵐ[μ] r.toNNReal⁻¹ • ν.rnDeriv μ := by
refine rnDeriv_smul_right' ν μ ?_
rw [ne_eq, ENNReal.toNNReal_eq_zero_iff]
simp [hr, hr_ne_top]
rwa [ENNReal.smul_def, ENNReal.coe_toNNReal hr_ne_top,
← ENNReal.toNNReal_inv, ENNReal.smul_def, ENNReal.coe_toNNReal (ENNReal.inv_ne_top.mpr hr)] at h
/-- Radon-Nikodym derivative of a sum of two measures.
See also `rnDeriv_add`, which has no hypothesis on `μ` but requires finite `ν₁` and `ν₂`. -/
lemma rnDeriv_add' (ν₁ ν₂ μ : Measure α) [SigmaFinite ν₁] [SigmaFinite ν₂] [SigmaFinite μ] :
(ν₁ + ν₂).rnDeriv μ =ᵐ[μ] ν₁.rnDeriv μ + ν₂.rnDeriv μ := by
rw [← withDensity_eq_iff_of_sigmaFinite]
· suffices (ν₁ + ν₂).singularPart μ + μ.withDensity ((ν₁ + ν₂).rnDeriv μ)
= (ν₁ + ν₂).singularPart μ + μ.withDensity (ν₁.rnDeriv μ + ν₂.rnDeriv μ) by
rwa [add_right_inj] at this
rw [← (ν₁ + ν₂).haveLebesgueDecomposition_add μ, singularPart_add,
withDensity_add_left (measurable_rnDeriv _ _), add_assoc,
add_comm (ν₂.singularPart μ), add_assoc, add_comm _ (ν₂.singularPart μ),
← ν₂.haveLebesgueDecomposition_add μ, ← add_assoc, ← ν₁.haveLebesgueDecomposition_add μ]
· exact (measurable_rnDeriv _ _).aemeasurable
· exact ((measurable_rnDeriv _ _).add (measurable_rnDeriv _ _)).aemeasurable
lemma rnDeriv_add_of_mutuallySingular (ν₁ ν₂ μ : Measure α)
[SigmaFinite ν₁] [SigmaFinite ν₂] [SigmaFinite μ] (h : ν₂ ⟂ₘ μ) :
(ν₁ + ν₂).rnDeriv μ =ᵐ[μ] ν₁.rnDeriv μ := by
filter_upwards [rnDeriv_add' ν₁ ν₂ μ, (rnDeriv_eq_zero ν₂ μ).mpr h] with x hx_add hx_zero
simp [hx_add, hx_zero]
end rnDeriv
end Measure
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Covering/Besicovitch.lean | import Mathlib.MeasureTheory.Covering.Differentiation
/-!
# Besicovitch covering theorems
The topological Besicovitch covering theorem ensures that, in a nice metric space, there exists a
number `N` such that, from any family of balls with bounded radii, one can extract `N` families,
each made of disjoint balls, covering together all the centers of the initial family.
By "nice metric space", we mean a technical property stated as follows: there exists no satellite
configuration of `N + 1` points (with a given parameter `τ > 1`). Such a configuration is a family
of `N + 1` balls, where the first `N` balls all intersect the last one, but none of them contains
the center of another one and their radii are controlled. This property is for instance
satisfied by finite-dimensional real vector spaces.
In this file, we prove the topological Besicovitch covering theorem,
in `Besicovitch.exist_disjoint_covering_families`.
The measurable Besicovitch theorem ensures that, in the same class of metric spaces, if at every
point one considers a class of balls of arbitrarily small radii, called admissible balls, then
one can cover almost all the space by a family of disjoint admissible balls.
It is deduced from the topological Besicovitch theorem, and proved
in `Besicovitch.exists_disjoint_closedBall_covering_ae`.
This implies that balls of small radius form a Vitali family in such spaces. Therefore, theorems
on differentiation of measures hold as a consequence of general results. We restate them in this
context to make them more easily usable.
## Main definitions and results
* `SatelliteConfig α N τ` is the type of all satellite configurations of `N + 1` points
in the metric space `α`, with parameter `τ`.
* `HasBesicovitchCovering` is a class recording that there exist `N` and `τ > 1` such that
there is no satellite configuration of `N + 1` points with parameter `τ`.
* `exist_disjoint_covering_families` is the topological Besicovitch covering theorem: from any
family of balls one can extract finitely many disjoint subfamilies covering the same set.
* `exists_disjoint_closedBall_covering` is the measurable Besicovitch covering theorem: from any
family of balls with arbitrarily small radii at every point, one can extract countably many
disjoint balls covering almost all the space. While the value of `N` is relevant for the precise
statement of the topological Besicovitch theorem, it becomes irrelevant for the measurable one.
Therefore, this statement is expressed using the `Prop`-valued
typeclass `HasBesicovitchCovering`.
We also restate the following specialized versions of general theorems on differentiation of
measures:
* `Besicovitch.ae_tendsto_rnDeriv` ensures that `ρ (closedBall x r) / μ (closedBall x r)` tends
almost surely to the Radon-Nikodym derivative of `ρ` with respect to `μ` at `x`.
* `Besicovitch.ae_tendsto_measure_inter_div` states that almost every point in an arbitrary set `s`
is a Lebesgue density point, i.e., `μ (s ∩ closedBall x r) / μ (closedBall x r)` tends to `1` as
`r` tends to `0`. A stronger version for measurable sets is given in
`Besicovitch.ae_tendsto_measure_inter_div_of_measurableSet`.
## Implementation
#### Sketch of proof of the topological Besicovitch theorem:
We choose balls in a greedy way. First choose a ball with maximal radius (or rather, since there
is no guarantee the maximal radius is realized, a ball with radius within a factor `τ` of the
supremum). Then, remove all balls whose center is covered by the first ball, and choose among the
remaining ones a ball with radius close to maximum. Go on forever until there is no available
center (this is a transfinite induction in general).
Then define inductively a coloring of the balls. A ball will be of color `i` if it intersects
already chosen balls of color `0`, ..., `i - 1`, but none of color `i`. In this way, balls of the
same color form a disjoint family, and the space is covered by the families of the different colors.
The nontrivial part is to show that at most `N` colors are used. If one needs `N + 1` colors,
consider the first time this happens. Then the corresponding ball intersects `N` balls of the
different colors. Moreover, the inductive construction ensures that the radii of all the balls are
controlled: they form a satellite configuration with `N + 1` balls (essentially by definition of
satellite configurations). Since we assume that there are no such configurations, this is a
contradiction.
#### Sketch of proof of the measurable Besicovitch theorem:
From the topological Besicovitch theorem, one can find a disjoint countable family of balls
covering a proportion `> 1 / (N + 1)` of the space. Taking a large enough finite subset of these
balls, one gets the same property for finitely many balls. Their union is closed. Therefore, any
point in the complement has around it an admissible ball not intersecting these finitely many balls.
Applying again the topological Besicovitch theorem, one extracts from these a disjoint countable
subfamily covering a proportion `> 1 / (N + 1)` of the remaining points, and then even a disjoint
finite subfamily. Then one goes on again and again, covering at each step a positive proportion of
the remaining points, while remaining disjoint from the already chosen balls. The union of all these
balls is the desired almost everywhere covering.
-/
noncomputable section
universe u
open Metric Set Filter Fin MeasureTheory TopologicalSpace
open scoped Topology ENNReal MeasureTheory NNReal
/-!
### Satellite configurations
-/
/-- A satellite configuration is a configuration of `N+1` points that shows up in the inductive
construction for the Besicovitch covering theorem. It depends on some parameter `τ ≥ 1`.
This is a family of balls (indexed by `i : Fin N.succ`, with center `c i` and radius `r i`) such
that the last ball intersects all the other balls (condition `inter`),
and given any two balls there is an order between them, ensuring that the first ball does not
contain the center of the other one, and the radius of the second ball cannot be larger than
the radius of the first ball (up to a factor `τ`). This order corresponds to the order of choice
in the inductive construction: otherwise, the second ball would have been chosen before.
This is the condition `h`.
Finally, the last ball is chosen after all the other ones, meaning that `h` can be strengthened
by keeping only one side of the alternative in `hlast`.
-/
structure Besicovitch.SatelliteConfig (α : Type*) [MetricSpace α] (N : ℕ) (τ : ℝ) where
/-- Centers of the balls -/
c : Fin N.succ → α
/-- Radii of the balls -/
r : Fin N.succ → ℝ
rpos : ∀ i, 0 < r i
h : Pairwise fun i j =>
r i ≤ dist (c i) (c j) ∧ r j ≤ τ * r i ∨ r j ≤ dist (c j) (c i) ∧ r i ≤ τ * r j
hlast : ∀ i < last N, r i ≤ dist (c i) (c (last N)) ∧ r (last N) ≤ τ * r i
inter : ∀ i < last N, dist (c i) (c (last N)) ≤ r i + r (last N)
namespace Mathlib.Meta.Positivity
open Lean Meta Qq
/-- Extension for the `positivity` tactic: `Besicovitch.SatelliteConfig.r`. -/
@[positivity Besicovitch.SatelliteConfig.r _ _]
def evalBesicovitchSatelliteConfigR : PositivityExt where eval {u α} _zα _pα e := do
match u, α, e with
| 0, ~q(ℝ), ~q(@Besicovitch.SatelliteConfig.r $β $inst $N $τ $self $i) =>
assertInstancesCommute
return .positive q(Besicovitch.SatelliteConfig.rpos $self $i)
| _, _, _ => throwError "not Besicovitch.SatelliteConfig.r"
end Mathlib.Meta.Positivity
/-- A metric space has the Besicovitch covering property if there exist `N` and `τ > 1` such that
there are no satellite configuration of parameter `τ` with `N+1` points. This is the condition that
guarantees that the measurable Besicovitch covering theorem holds. It is satisfied by
finite-dimensional real vector spaces. -/
class HasBesicovitchCovering (α : Type*) [MetricSpace α] : Prop where
no_satelliteConfig : ∃ (N : ℕ) (τ : ℝ), 1 < τ ∧ IsEmpty (Besicovitch.SatelliteConfig α N τ)
/-- There is always a satellite configuration with a single point. -/
instance Besicovitch.SatelliteConfig.instInhabited {α : Type*} {τ : ℝ}
[Inhabited α] [MetricSpace α] : Inhabited (Besicovitch.SatelliteConfig α 0 τ) :=
⟨{ c := default
r := fun _ => 1
rpos := fun _ => zero_lt_one
h := fun i j hij => (hij (Subsingleton.elim (α := Fin 1) i j)).elim
hlast := fun i hi => by
rw [Subsingleton.elim (α := Fin 1) i (last 0)] at hi; exact (lt_irrefl _ hi).elim
inter := fun i hi => by
rw [Subsingleton.elim (α := Fin 1) i (last 0)] at hi; exact (lt_irrefl _ hi).elim }⟩
namespace Besicovitch
namespace SatelliteConfig
variable {α : Type*} [MetricSpace α] {N : ℕ} {τ : ℝ} (a : SatelliteConfig α N τ)
theorem inter' (i : Fin N.succ) : dist (a.c i) (a.c (last N)) ≤ a.r i + a.r (last N) := by
rcases lt_or_ge i (last N) with (H | H)
· exact a.inter i H
· have I : i = last N := top_le_iff.1 H
have := (a.rpos (last N)).le
simp only [I, add_nonneg this this, dist_self]
theorem hlast' (i : Fin N.succ) (h : 1 ≤ τ) : a.r (last N) ≤ τ * a.r i := by
rcases lt_or_ge i (last N) with (H | H)
· exact (a.hlast i H).2
· have : i = last N := top_le_iff.1 H
rw [this]
exact le_mul_of_one_le_left (a.rpos _).le h
end SatelliteConfig
/-! ### Extracting disjoint subfamilies from a ball covering -/
/-- A ball package is a family of balls in a metric space with positive bounded radii. -/
structure BallPackage (β : Type*) (α : Type*) where
/-- Centers of the balls -/
c : β → α
/-- Radii of the balls -/
r : β → ℝ
rpos : ∀ b, 0 < r b
/-- Bound on the radii of the balls -/
r_bound : ℝ
r_le : ∀ b, r b ≤ r_bound
/-- The ball package made of unit balls. -/
def unitBallPackage (α : Type*) : BallPackage α α where
c := id
r _ := 1
rpos _ := zero_lt_one
r_bound := 1
r_le _ := le_rfl
instance BallPackage.instInhabited (α : Type*) : Inhabited (BallPackage α α) :=
⟨unitBallPackage α⟩
/-- A Besicovitch tau-package is a family of balls in a metric space with positive bounded radii,
together with enough data to proceed with the Besicovitch greedy algorithm. We register this in
a single structure to make sure that all our constructions in this algorithm only depend on
one variable. -/
structure TauPackage (β : Type*) (α : Type*) extends BallPackage β α where
/-- Parameter used by the Besicovitch greedy algorithm -/
τ : ℝ
one_lt_tau : 1 < τ
instance TauPackage.instInhabited (α : Type*) : Inhabited (TauPackage α α) :=
⟨{ unitBallPackage α with
τ := 2
one_lt_tau := one_lt_two }⟩
variable {α : Type*} [MetricSpace α] {β : Type u}
namespace TauPackage
variable [Nonempty β] (p : TauPackage β α)
/-- Choose inductively large balls with centers that are not contained in the union of already
chosen balls. This is a transfinite induction. -/
noncomputable def index : Ordinal.{u} → β
| i =>
-- `Z` is the set of points that are covered by already constructed balls
let Z := ⋃ j : { j // j < i }, ball (p.c (index j)) (p.r (index j))
-- `R` is the supremum of the radii of balls with centers not in `Z`
let R := iSup fun b : { b : β // p.c b ∉ Z } => p.r b
-- return an index `b` for which the center `c b` is not in `Z`, and the radius is at
-- least `R / τ`, if such an index exists (and garbage otherwise).
Classical.epsilon fun b : β => p.c b ∉ Z ∧ R ≤ p.τ * p.r b
termination_by i => i
decreasing_by exact j.2
/-- The set of points that are covered by the union of balls selected at steps `< i`. -/
def iUnionUpTo (i : Ordinal.{u}) : Set α :=
⋃ j : { j // j < i }, ball (p.c (p.index j)) (p.r (p.index j))
theorem monotone_iUnionUpTo : Monotone p.iUnionUpTo := by
intro i j hij
simp only [iUnionUpTo]
exact iUnion_mono' fun r => ⟨⟨r, r.2.trans_le hij⟩, Subset.rfl⟩
/-- Supremum of the radii of balls whose centers are not yet covered at step `i`. -/
def R (i : Ordinal.{u}) : ℝ :=
iSup fun b : { b : β // p.c b ∉ p.iUnionUpTo i } => p.r b
/-- Group the balls into disjoint families, by assigning to a ball the smallest color for which
it does not intersect any already chosen ball of this color. -/
noncomputable def color : Ordinal.{u} → ℕ
| i =>
let A : Set ℕ :=
⋃ (j : { j // j < i })
(_ : (closedBall (p.c (p.index j)) (p.r (p.index j)) ∩
closedBall (p.c (p.index i)) (p.r (p.index i))).Nonempty), {color j}
sInf (univ \ A)
termination_by i => i
decreasing_by exact j.2
/-- `p.lastStep` is the first ordinal where the construction stops making sense, i.e., `f` returns
garbage since there is no point left to be chosen. We will only use ordinals before this step. -/
def lastStep : Ordinal.{u} :=
sInf {i | ¬∃ b : β, p.c b ∉ p.iUnionUpTo i ∧ p.R i ≤ p.τ * p.r b}
theorem lastStep_nonempty :
{i | ¬∃ b : β, p.c b ∉ p.iUnionUpTo i ∧ p.R i ≤ p.τ * p.r b}.Nonempty := by
by_contra h
suffices H : Function.Injective p.index from not_injective_of_ordinal p.index H
intro x y hxy
wlog x_le_y : x ≤ y generalizing x y
· exact (this hxy.symm (le_of_not_ge x_le_y)).symm
rcases eq_or_lt_of_le x_le_y with (rfl | H); · rfl
simp only [nonempty_def, not_exists, exists_prop, not_and, not_lt, not_le, mem_setOf_eq,
not_forall] at h
specialize h y
have A : p.c (p.index y) ∉ p.iUnionUpTo y := by
have :
p.index y =
Classical.epsilon fun b : β => p.c b ∉ p.iUnionUpTo y ∧ p.R y ≤ p.τ * p.r b := by
rw [TauPackage.index]; rfl
rw [this]
exact (Classical.epsilon_spec h).1
simp only [iUnionUpTo, not_exists, exists_prop, mem_iUnion, not_and,
Subtype.exists] at A
specialize A x H
replace A : p.r (p.index y) ≤ 0 := by simpa [hxy] using A
exact (lt_irrefl _ ((p.rpos (p.index y)).trans_le A)).elim
/-- Every point is covered by chosen balls, before `p.lastStep`. -/
theorem mem_iUnionUpTo_lastStep (x : β) : p.c x ∈ p.iUnionUpTo p.lastStep := by
have A : ∀ z : β, p.c z ∈ p.iUnionUpTo p.lastStep ∨ p.τ * p.r z < p.R p.lastStep := by
have : p.lastStep ∈ {i | ¬∃ b : β, p.c b ∉ p.iUnionUpTo i ∧ p.R i ≤ p.τ * p.r b} :=
csInf_mem p.lastStep_nonempty
simpa only [not_exists, mem_setOf_eq, not_and_or, not_le, not_notMem]
by_contra h
rcases A x with (H | H); · exact h H
have Rpos : 0 < p.R p.lastStep := by
apply lt_trans (mul_pos (_root_.zero_lt_one.trans p.one_lt_tau) (p.rpos _)) H
have B : p.τ⁻¹ * p.R p.lastStep < p.R p.lastStep := by
conv_rhs => rw [← one_mul (p.R p.lastStep)]
exact mul_lt_mul (inv_lt_one_of_one_lt₀ p.one_lt_tau) le_rfl Rpos zero_le_one
obtain ⟨y, hy1, hy2⟩ : ∃ y, p.c y ∉ p.iUnionUpTo p.lastStep ∧ p.τ⁻¹ * p.R p.lastStep < p.r y := by
have := exists_lt_of_lt_csSup ?_ B
· simpa only [exists_prop, mem_range, exists_exists_and_eq_and, Subtype.exists,
Subtype.coe_mk]
rw [← image_univ, image_nonempty]
exact ⟨⟨_, h⟩, mem_univ _⟩
rcases A y with (Hy | Hy)
· exact hy1 Hy
· rw [← div_eq_inv_mul] at hy2
have := (div_le_iff₀' (_root_.zero_lt_one.trans p.one_lt_tau)).1 hy2.le
exact lt_irrefl _ (Hy.trans_le this)
/-- If there are no configurations of satellites with `N+1` points, one never uses more than `N`
distinct families in the Besicovitch inductive construction. -/
theorem color_lt {i : Ordinal.{u}} (hi : i < p.lastStep) {N : ℕ}
(hN : IsEmpty (SatelliteConfig α N p.τ)) : p.color i < N := by
/- By contradiction, consider the first ordinal `i` for which one would have `p.color i = N`.
Choose for each `k < N` a ball with color `k` that intersects the ball at color `i`
(there is such a ball, otherwise one would have used the color `k` and not `N`).
Then this family of `N+1` balls forms a satellite configuration, which is forbidden by
the assumption `hN`. -/
induction i using Ordinal.induction with | _ i IH
let A : Set ℕ :=
⋃ (j : { j // j < i })
(_ : (closedBall (p.c (p.index j)) (p.r (p.index j)) ∩
closedBall (p.c (p.index i)) (p.r (p.index i))).Nonempty),
{p.color j}
have color_i : p.color i = sInf (univ \ A) := by rw [color]
rw [color_i]
have N_mem : N ∈ univ \ A := by
simp only [A, not_exists, true_and, exists_prop, mem_iUnion, mem_singleton_iff,
not_and, mem_univ, mem_diff, Subtype.exists]
intro j ji _
exact (IH j ji (ji.trans hi)).ne'
suffices sInf (univ \ A) ≠ N by
rcases (csInf_le (OrderBot.bddBelow (univ \ A)) N_mem).lt_or_eq with (H | H)
· exact H
· exact (this H).elim
intro Inf_eq_N
have :
∀ k, k < N → ∃ j, j < i ∧
(closedBall (p.c (p.index j)) (p.r (p.index j)) ∩
closedBall (p.c (p.index i)) (p.r (p.index i))).Nonempty ∧ k = p.color j := by
intro k hk
rw [← Inf_eq_N] at hk
have : k ∈ A := by
simpa only [true_and, mem_univ, Classical.not_not, mem_diff] using
Nat.notMem_of_lt_sInf hk
simp only [] at this
simpa only [A, exists_prop, mem_iUnion, mem_singleton_iff, mem_closedBall, Subtype.exists,
Subtype.coe_mk]
choose! g hg using this
-- Choose for each `k < N` an ordinal `G k < i` giving a ball of color `k` intersecting
-- the last ball.
let G : ℕ → Ordinal := fun n => if n = N then i else g n
have color_G : ∀ n, n ≤ N → p.color (G n) = n := by
intro n hn
rcases hn.eq_or_lt with (rfl | H)
· simp only [G]; simp only [color_i, Inf_eq_N, if_true]
· simp only [G]; simp only [H.ne, (hg n H).right.right.symm, if_false]
have G_lt_last : ∀ n, n ≤ N → G n < p.lastStep := by
intro n hn
rcases hn.eq_or_lt with (rfl | H)
· simp only [G]; simp only [hi, if_true]
· simp only [G]; simp only [H.ne, (hg n H).left.trans hi, if_false]
have fGn :
∀ n, n ≤ N →
p.c (p.index (G n)) ∉ p.iUnionUpTo (G n) ∧ p.R (G n) ≤ p.τ * p.r (p.index (G n)) := by
intro n hn
have :
p.index (G n) =
Classical.epsilon fun t => p.c t ∉ p.iUnionUpTo (G n) ∧ p.R (G n) ≤ p.τ * p.r t := by
rw [index]; rfl
rw [this]
have : ∃ t, p.c t ∉ p.iUnionUpTo (G n) ∧ p.R (G n) ≤ p.τ * p.r t := by
simpa only [not_exists, exists_prop, not_and, not_lt, not_le, mem_setOf_eq, not_forall] using
notMem_of_lt_csInf (G_lt_last n hn) (OrderBot.bddBelow _)
exact Classical.epsilon_spec this
-- the balls with indices `G k` satisfy the characteristic property of satellite configurations.
have Gab :
∀ a b : Fin (Nat.succ N),
G a < G b →
p.r (p.index (G a)) ≤ dist (p.c (p.index (G a))) (p.c (p.index (G b))) ∧
p.r (p.index (G b)) ≤ p.τ * p.r (p.index (G a)) := by
intro a b G_lt
have ha : (a : ℕ) ≤ N := Nat.lt_succ_iff.1 a.2
have hb : (b : ℕ) ≤ N := Nat.lt_succ_iff.1 b.2
constructor
· have := (fGn b hb).1
simp only [iUnionUpTo, not_exists, exists_prop, mem_iUnion, not_and,
Subtype.exists] at this
simpa only [dist_comm, mem_ball, not_lt] using this (G a) G_lt
· apply le_trans _ (fGn a ha).2
have B : p.c (p.index (G b)) ∉ p.iUnionUpTo (G a) := by
intro H; exact (fGn b hb).1 (p.monotone_iUnionUpTo G_lt.le H)
let b' : { t // p.c t ∉ p.iUnionUpTo (G a) } := ⟨p.index (G b), B⟩
apply @le_ciSup _ _ _ (fun t : { t // p.c t ∉ p.iUnionUpTo (G a) } => p.r t) _ b'
refine ⟨p.r_bound, fun t ht => ?_⟩
simp only [exists_prop, mem_range, Subtype.exists] at ht
rcases ht with ⟨u, hu⟩
rw [← hu.2]
exact p.r_le _
-- therefore, one may use them to construct a satellite configuration with `N+1` points
let sc : SatelliteConfig α N p.τ :=
{ c := fun k => p.c (p.index (G k))
r := fun k => p.r (p.index (G k))
rpos := fun k => p.rpos (p.index (G k))
h := by
intro a b a_ne_b
wlog G_le : G a ≤ G b generalizing a b
· exact (this a_ne_b.symm (le_of_not_ge G_le)).symm
have G_lt : G a < G b := by
rcases G_le.lt_or_eq with (H | H); · exact H
have A : (a : ℕ) ≠ b := Fin.val_injective.ne a_ne_b
rw [← color_G a (Nat.lt_succ_iff.1 a.2), ← color_G b (Nat.lt_succ_iff.1 b.2), H] at A
exact (A rfl).elim
exact Or.inl (Gab a b G_lt)
hlast := by
intro a ha
have I : (a : ℕ) < N := ha
have : G a < G (Fin.last N) := by simp [G, I.ne, (hg a I).1]
exact Gab _ _ this
inter := by
intro a ha
have I : (a : ℕ) < N := ha
have J : G (Fin.last N) = i := by dsimp; simp only [G, if_true]
have K : G a = g a := by simp [G, I.ne]
convert dist_le_add_of_nonempty_closedBall_inter_closedBall (hg _ I).2.1 }
-- this is a contradiction
exact hN.false sc
end TauPackage
open TauPackage
/-- The topological Besicovitch covering theorem: there exist finitely many families of disjoint
balls covering all the centers in a package. More specifically, one can use `N` families if there
are no satellite configurations with `N+1` points. -/
theorem exist_disjoint_covering_families {N : ℕ} {τ : ℝ} (hτ : 1 < τ)
(hN : IsEmpty (SatelliteConfig α N τ)) (q : BallPackage β α) :
∃ s : Fin N → Set β,
(∀ i : Fin N, (s i).PairwiseDisjoint fun j => closedBall (q.c j) (q.r j)) ∧
range q.c ⊆ ⋃ i : Fin N, ⋃ j ∈ s i, ball (q.c j) (q.r j) := by
-- first exclude the trivial case where `β` is empty (we need non-emptiness for the transfinite
-- induction, to be able to choose garbage when there is no point left).
cases isEmpty_or_nonempty β
· refine ⟨fun _ => ∅, fun _ => pairwiseDisjoint_empty, ?_⟩
rw [← image_univ, eq_empty_of_isEmpty (univ : Set β)]
simp
-- Now, assume `β` is nonempty.
let p : TauPackage β α :=
{ q with
τ
one_lt_tau := hτ }
-- we use for `s i` the balls of color `i`.
let s := fun i : Fin N =>
⋃ (k : Ordinal.{u}) (_ : k < p.lastStep) (_ : p.color k = i), ({p.index k} : Set β)
refine ⟨s, fun i => ?_, ?_⟩
· -- show that balls of the same color are disjoint
intro x hx y hy x_ne_y
obtain ⟨jx, jx_lt, jxi, rfl⟩ :
∃ jx : Ordinal, jx < p.lastStep ∧ p.color jx = i ∧ x = p.index jx := by
simpa only [s, exists_prop, mem_iUnion, mem_singleton_iff] using hx
obtain ⟨jy, jy_lt, jyi, rfl⟩ :
∃ jy : Ordinal, jy < p.lastStep ∧ p.color jy = i ∧ y = p.index jy := by
simpa only [s, exists_prop, mem_iUnion, mem_singleton_iff] using hy
wlog jxy : jx ≤ jy generalizing jx jy
· exact (this jy jy_lt jyi hy jx jx_lt jxi hx x_ne_y.symm (le_of_not_ge jxy)).symm
replace jxy : jx < jy := by
rcases lt_or_eq_of_le jxy with (H | rfl); · { exact H }; · { exact (x_ne_y rfl).elim }
let A : Set ℕ :=
⋃ (j : { j // j < jy })
(_ : (closedBall (p.c (p.index j)) (p.r (p.index j)) ∩
closedBall (p.c (p.index jy)) (p.r (p.index jy))).Nonempty),
{p.color j}
have color_j : p.color jy = sInf (univ \ A) := by rw [TauPackage.color]
have h : p.color jy ∈ univ \ A := by
rw [color_j]
apply csInf_mem
refine ⟨N, ?_⟩
simp only [A, not_exists, true_and, exists_prop, mem_iUnion, mem_singleton_iff, not_and,
mem_univ, mem_diff, Subtype.exists]
intro k hk _
exact (p.color_lt (hk.trans jy_lt) hN).ne'
simp only [A, not_exists, true_and, exists_prop, mem_iUnion, mem_singleton_iff, not_and,
mem_univ, mem_diff, Subtype.exists] at h
specialize h jx jxy
contrapose! h
simpa only [jxi, jyi, and_true, eq_self_iff_true, ← not_disjoint_iff_nonempty_inter] using h
· -- show that the balls of color at most `N` cover every center.
refine range_subset_iff.2 fun b => ?_
obtain ⟨a, ha⟩ :
∃ a : Ordinal, a < p.lastStep ∧ dist (p.c b) (p.c (p.index a)) < p.r (p.index a) := by
simpa only [iUnionUpTo, exists_prop, mem_iUnion, mem_ball, Subtype.exists,
Subtype.coe_mk] using p.mem_iUnionUpTo_lastStep b
simp only [s, exists_prop, mem_iUnion, mem_ball, mem_singleton_iff, biUnion_and',
exists_eq_left, iUnion_exists, exists_and_left]
exact ⟨⟨p.color a, p.color_lt ha.1 hN⟩, a, rfl, ha⟩
/-!
### The measurable Besicovitch covering theorem
-/
open scoped NNReal
variable [SecondCountableTopology α] [MeasurableSpace α] [OpensMeasurableSpace α]
/-- Consider, for each `x` in a set `s`, a radius `r x ∈ (0, 1]`. Then one can find finitely
many disjoint balls of the form `closedBall x (r x)` covering a proportion `1/(N+1)` of `s`, if
there are no satellite configurations with `N+1` points.
-/
theorem exist_finset_disjoint_balls_large_measure (μ : Measure α) [IsFiniteMeasure μ] {N : ℕ}
{τ : ℝ} (hτ : 1 < τ) (hN : IsEmpty (SatelliteConfig α N τ)) (s : Set α) (r : α → ℝ)
(rpos : ∀ x ∈ s, 0 < r x) (rle : ∀ x ∈ s, r x ≤ 1) :
∃ t : Finset α, ↑t ⊆ s ∧ μ (s \ ⋃ x ∈ t, closedBall x (r x)) ≤ N / (N + 1) * μ s ∧
(t : Set α).PairwiseDisjoint fun x => closedBall x (r x) := by
classical
-- exclude the trivial case where `μ s = 0`.
rcases le_or_gt (μ s) 0 with (hμs | hμs)
· have : μ s = 0 := le_bot_iff.1 hμs
refine ⟨∅, by simp only [Finset.coe_empty, empty_subset], ?_, ?_⟩
· simp only [this, Finset.notMem_empty, diff_empty, iUnion_false, iUnion_empty,
nonpos_iff_eq_zero, mul_zero]
· simp only [Finset.coe_empty, pairwiseDisjoint_empty]
cases isEmpty_or_nonempty α
· simp only [eq_empty_of_isEmpty s, measure_empty] at hμs
exact (lt_irrefl _ hμs).elim
have Npos : N ≠ 0 := by
rintro rfl
inhabit α
exact not_isEmpty_of_nonempty _ hN
-- introduce a measurable superset `o` with the same measure, for measure computations
obtain ⟨o, so, omeas, μo⟩ : ∃ o : Set α, s ⊆ o ∧ MeasurableSet o ∧ μ o = μ s :=
exists_measurable_superset μ s
/- We will apply the topological Besicovitch theorem, giving `N` disjoint subfamilies of balls
covering `s`. Among these, one of them covers a proportion at least `1/N` of `s`. A large
enough finite subfamily will then cover a proportion at least `1/(N+1)`. -/
let a : BallPackage s α :=
{ c := fun x => x
r := fun x => r x
rpos := fun x => rpos x x.2
r_bound := 1
r_le := fun x => rle x x.2 }
rcases exist_disjoint_covering_families hτ hN a with ⟨u, hu, hu'⟩
have u_count : ∀ i, (u i).Countable := by
intro i
refine (hu i).countable_of_nonempty_interior fun j _ => ?_
have : (ball (j : α) (r j)).Nonempty := nonempty_ball.2 (a.rpos _)
exact this.mono ball_subset_interior_closedBall
let v : Fin N → Set α := fun i => ⋃ (x : s) (_ : x ∈ u i), closedBall x (r x)
have A : s = ⋃ i : Fin N, s ∩ v i := by
refine Subset.antisymm ?_ (iUnion_subset fun i => inter_subset_left)
intro x hx
obtain ⟨i, y, hxy, h'⟩ :
∃ (i : Fin N) (i_1 : ↥s), i_1 ∈ u i ∧ x ∈ ball (↑i_1) (r ↑i_1) := by
have : x ∈ range a.c := by simpa only [a, Subtype.range_coe_subtype, setOf_mem_eq]
simpa only [mem_iUnion, bex_def] using hu' this
refine mem_iUnion.2 ⟨i, ⟨hx, ?_⟩⟩
simp only [v, exists_prop, mem_iUnion, SetCoe.exists, exists_and_right]
exact ⟨y, ⟨y.2, by simpa only [Subtype.coe_eta]⟩, ball_subset_closedBall h'⟩
have S : ∑ _i : Fin N, μ s / N ≤ ∑ i, μ (s ∩ v i) :=
calc
∑ _i : Fin N, μ s / N = μ s := by
simp only [Finset.card_fin, Finset.sum_const, nsmul_eq_mul]
rw [ENNReal.mul_div_cancel]
· simp only [Npos, Ne, Nat.cast_eq_zero, not_false_iff]
· finiteness
_ ≤ ∑ i, μ (s ∩ v i) := by
conv_lhs => rw [A]
apply measure_iUnion_fintype_le
-- choose an index `i` of a subfamily covering at least a proportion `1/N` of `s`.
obtain ⟨i, -, hi⟩ : ∃ (i : Fin N), i ∈ Finset.univ ∧ μ s / N ≤ μ (s ∩ v i) := by
apply ENNReal.exists_le_of_sum_le _ S
exact ⟨⟨0, bot_lt_iff_ne_bot.2 Npos⟩, Finset.mem_univ _⟩
replace hi : μ s / (N + 1) < μ (s ∩ v i) := by
apply lt_of_lt_of_le _ hi
apply (ENNReal.mul_lt_mul_left hμs.ne' (by finiteness)).2
rw [ENNReal.inv_lt_inv]
conv_lhs => rw [← add_zero (N : ℝ≥0∞)]
exact ENNReal.add_lt_add_left (by finiteness) zero_lt_one
have B : μ (o ∩ v i) = ∑' x : u i, μ (o ∩ closedBall x (r x)) := by
have : o ∩ v i = ⋃ (x : s) (_ : x ∈ u i), o ∩ closedBall x (r x) := by
simp only [v, inter_iUnion]
rw [this, measure_biUnion (u_count i)]
· exact (hu i).mono fun k => inter_subset_right
· exact fun b _ => omeas.inter measurableSet_closedBall
-- A large enough finite subfamily of `u i` will also cover a proportion `> 1/(N+1)` of `s`.
-- Since `s` might not be measurable, we express this in terms of the measurable superset `o`.
obtain ⟨w, hw⟩ :
∃ w : Finset (u i), μ s / (N + 1) <
∑ x ∈ w, μ (o ∩ closedBall (x : α) (r (x : α))) := by
have C : HasSum (fun x : u i => μ (o ∩ closedBall x (r x))) (μ (o ∩ v i)) := by
rw [B]; exact ENNReal.summable.hasSum
have : μ s / (N + 1) < μ (o ∩ v i) := hi.trans_le (measure_mono (inter_subset_inter_left _ so))
exact ((tendsto_order.1 C).1 _ this).exists
-- Bring back the finset `w i` of `↑(u i)` to a finset of `α`, and check that it works by design.
refine ⟨Finset.image (fun x : u i => x) w, ?_, ?_, ?_⟩
-- show that the finset is included in `s`.
· simp only [image_subset_iff, Finset.coe_image]
intro y _
simp only [Subtype.coe_prop, mem_preimage]
-- show that it covers a large enough proportion of `s`. For measure computations, we do not
-- use `s` (which might not be measurable), but its measurable superset `o`. Since their measures
-- are the same, this does not spoil the estimates
· suffices H : μ (o \ ⋃ x ∈ w, closedBall (↑x) (r ↑x)) ≤ N / (N + 1) * μ s by
rw [Finset.set_biUnion_finset_image]
exact le_trans (measure_mono (diff_subset_diff so (Subset.refl _))) H
rw [← diff_inter_self_eq_diff,
measure_diff_le_iff_le_add _ inter_subset_right (by finiteness)]
swap
· exact .inter
(w.nullMeasurableSet_biUnion fun _ _ ↦ measurableSet_closedBall.nullMeasurableSet)
omeas.nullMeasurableSet
calc
μ o = 1 / (N + 1) * μ s + N / (N + 1) * μ s := by
rw [μo, ← add_mul, ENNReal.div_add_div_same, add_comm, ENNReal.div_self, one_mul] <;> simp
_ ≤ μ ((⋃ x ∈ w, closedBall (↑x) (r ↑x)) ∩ o) + N / (N + 1) * μ s := by
gcongr
rw [one_div, mul_comm, ← div_eq_mul_inv]
apply hw.le.trans (le_of_eq _)
rw [← Finset.set_biUnion_coe, inter_comm _ o, inter_iUnion₂, Finset.set_biUnion_coe,
measure_biUnion_finset]
· have : (w : Set (u i)).PairwiseDisjoint
fun b : u i => closedBall (b : α) (r (b : α)) := by
intro k _ l _ hkl; exact hu i k.2 l.2 (Subtype.val_injective.ne hkl)
exact this.mono fun k => inter_subset_right
· intro b _
apply omeas.inter measurableSet_closedBall
-- show that the balls are disjoint
· intro k hk l hl hkl
obtain ⟨k', _, rfl⟩ : ∃ k' : u i, k' ∈ w ∧ ↑k' = k := by
simpa only [mem_image, Finset.mem_coe, Finset.coe_image] using hk
obtain ⟨l', _, rfl⟩ : ∃ l' : u i, l' ∈ w ∧ ↑l' = l := by
simpa only [mem_image, Finset.mem_coe, Finset.coe_image] using hl
have k'nel' : (k' : s) ≠ l' := by intro h; rw [h] at hkl; exact hkl rfl
exact hu i k'.2 l'.2 k'nel'
variable [HasBesicovitchCovering α]
/-- The **measurable Besicovitch covering theorem**. Assume that, for any `x` in a set `s`,
one is given a set of admissible closed balls centered at `x`, with arbitrarily small radii.
Then there exists a disjoint covering of almost all `s` by admissible closed balls centered at some
points of `s`.
This version requires that the underlying measure is finite, and that the space has the Besicovitch
covering property (which is satisfied for instance by normed real vector spaces). It expresses the
conclusion in a slightly awkward form (with a subset of `α × ℝ`) coming from the proof technique.
For a version assuming that the measure is sigma-finite,
see `exists_disjoint_closedBall_covering_ae_aux`.
For a version giving the conclusion in a nicer form, see `exists_disjoint_closedBall_covering_ae`.
-/
theorem exists_disjoint_closedBall_covering_ae_of_finiteMeasure_aux (μ : Measure α)
[IsFiniteMeasure μ] (f : α → Set ℝ) (s : Set α)
(hf : ∀ x ∈ s, ∀ δ > 0, (f x ∩ Ioo 0 δ).Nonempty) :
∃ t : Set (α × ℝ), t.Countable ∧ (∀ p ∈ t, p.1 ∈ s) ∧ (∀ p ∈ t, p.2 ∈ f p.1) ∧
μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.1 p.2) = 0 ∧
t.PairwiseDisjoint fun p => closedBall p.1 p.2 := by
classical
rcases HasBesicovitchCovering.no_satelliteConfig (α := α) with ⟨N, τ, hτ, hN⟩
/- Introduce a property `P` on finsets saying that we have a nice disjoint covering of a
subset of `s` by admissible balls. -/
let P : Finset (α × ℝ) → Prop := fun t =>
((t : Set (α × ℝ)).PairwiseDisjoint fun p => closedBall p.1 p.2) ∧
(∀ p : α × ℝ, p ∈ t → p.1 ∈ s) ∧ ∀ p : α × ℝ, p ∈ t → p.2 ∈ f p.1
/- Given a finite good covering of a subset `s`, one can find a larger finite good covering,
covering additionally a proportion at least `1/(N+1)` of leftover points. This follows from
`exist_finset_disjoint_balls_large_measure` applied to balls not intersecting the initial
covering. -/
have :
∀ t : Finset (α × ℝ), P t → ∃ u : Finset (α × ℝ), t ⊆ u ∧ P u ∧
μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u), closedBall p.1 p.2) ≤
N / (N + 1) * μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.1 p.2) := by
intro t ht
set B := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.1 p.2 with hB
have B_closed : IsClosed B := isClosed_biUnion_finset fun i _ => isClosed_closedBall
set s' := s \ B
have : ∀ x ∈ s', ∃ r ∈ f x ∩ Ioo 0 1, Disjoint B (closedBall x r) := by
intro x hx
have xs : x ∈ s := ((mem_diff x).1 hx).1
rcases eq_empty_or_nonempty B with (hB | hB)
· rcases hf x xs 1 zero_lt_one with ⟨r, hr, h'r⟩
exact ⟨r, ⟨hr, h'r⟩, by simp only [hB, empty_disjoint]⟩
· let r := infDist x B
have : 0 < min r 1 :=
lt_min ((B_closed.notMem_iff_infDist_pos hB).1 ((mem_diff x).1 hx).2) zero_lt_one
rcases hf x xs _ this with ⟨r, hr, h'r⟩
refine ⟨r, ⟨hr, ⟨h'r.1, h'r.2.trans_le (min_le_right _ _)⟩⟩, ?_⟩
rw [disjoint_comm]
exact disjoint_closedBall_of_lt_infDist (h'r.2.trans_le (min_le_left _ _))
choose! r hr using this
obtain ⟨v, vs', hμv, hv⟩ :
∃ v : Finset α,
↑v ⊆ s' ∧
μ (s' \ ⋃ x ∈ v, closedBall x (r x)) ≤ N / (N + 1) * μ s' ∧
(v : Set α).PairwiseDisjoint fun x : α => closedBall x (r x) :=
haveI rI : ∀ x ∈ s', r x ∈ Ioo (0 : ℝ) 1 := fun x hx => (hr x hx).1.2
exist_finset_disjoint_balls_large_measure μ hτ hN s' r (fun x hx => (rI x hx).1) fun x hx =>
(rI x hx).2.le
refine ⟨t ∪ Finset.image (fun x => (x, r x)) v, Finset.subset_union_left, ⟨?_, ?_, ?_⟩, ?_⟩
· simp only [Finset.coe_union, pairwiseDisjoint_union, ht.1, true_and, Finset.coe_image]
constructor
· intro p hp q hq hpq
rcases (mem_image _ _ _).1 hp with ⟨p', p'v, rfl⟩
rcases (mem_image _ _ _).1 hq with ⟨q', q'v, rfl⟩
refine hv p'v q'v fun hp'q' => ?_
rw [hp'q'] at hpq
exact hpq rfl
· intro p hp q hq hpq
rcases (mem_image _ _ _).1 hq with ⟨q', q'v, rfl⟩
apply disjoint_of_subset_left _ (hr q' (vs' q'v)).2
rw [hB, ← Finset.set_biUnion_coe]
exact subset_biUnion_of_mem (u := fun x : α × ℝ => closedBall x.1 x.2) hp
· intro p hp
rcases Finset.mem_union.1 hp with (h'p | h'p)
· exact ht.2.1 p h'p
· rcases Finset.mem_image.1 h'p with ⟨p', p'v, rfl⟩
exact ((mem_diff _).1 (vs' (Finset.mem_coe.2 p'v))).1
· intro p hp
rcases Finset.mem_union.1 hp with (h'p | h'p)
· exact ht.2.2 p h'p
· rcases Finset.mem_image.1 h'p with ⟨p', p'v, rfl⟩
exact (hr p' (vs' p'v)).1.1
· convert hμv using 2
rw [Finset.set_biUnion_union, ← diff_diff, Finset.set_biUnion_finset_image]
/- Define `F` associating to a finite good covering the above enlarged good covering, covering
a proportion `1/(N+1)` of leftover points. Iterating `F`, one will get larger and larger good
coverings, missing in the end only a measure-zero set. -/
choose! F hF using this
let u n := F^[n] ∅
have u_succ : ∀ n : ℕ, u n.succ = F (u n) := fun n => by
simp only [u, Function.comp_apply, Function.iterate_succ']
have Pu : ∀ n, P (u n) := by
intro n
induction n with
| zero =>
simp only [P, u, Prod.forall, id, Function.iterate_zero]
simp only [Finset.notMem_empty, IsEmpty.forall_iff, Finset.coe_empty, forall₂_true_iff,
and_self_iff, pairwiseDisjoint_empty]
| succ n IH =>
rw [u_succ]
exact (hF (u n) IH).2.1
refine ⟨⋃ n, u n, countable_iUnion fun n => (u n).countable_toSet, ?_, ?_, ?_, ?_⟩
· intro p hp
rcases mem_iUnion.1 hp with ⟨n, hn⟩
exact (Pu n).2.1 p (Finset.mem_coe.1 hn)
· intro p hp
rcases mem_iUnion.1 hp with ⟨n, hn⟩
exact (Pu n).2.2 p (Finset.mem_coe.1 hn)
· have A :
∀ n,
μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ n : ℕ, (u n : Set (α × ℝ))), closedBall p.fst p.snd) ≤
μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) := by
intro n
gcongr μ (s \ ?_)
exact biUnion_subset_biUnion_left (subset_iUnion (fun i => (u i : Set (α × ℝ))) n)
have B :
∀ n, μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤
(N / (N + 1) : ℝ≥0∞) ^ n * μ s := fun n ↦ by
induction n with
| zero =>
simp only [u, le_refl, diff_empty, one_mul, iUnion_false, iUnion_empty, pow_zero,
Function.iterate_zero, id, Finset.notMem_empty]
| succ n IH =>
calc
_ ≤ N / (N + 1) * μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) := by
rw [u_succ]; exact (hF (u n) (Pu n)).2.2
_ ≤ _ := by grw [pow_succ', mul_assoc, IH]
have C : Tendsto (fun n : ℕ => ((N : ℝ≥0∞) / (N + 1)) ^ n * μ s) atTop (𝓝 (0 * μ s)) := by
apply ENNReal.Tendsto.mul_const _ (Or.inr (measure_lt_top μ s).ne)
apply ENNReal.tendsto_pow_atTop_nhds_zero_of_lt_one
rw [ENNReal.div_lt_iff, one_mul]
· conv_lhs => rw [← add_zero (N : ℝ≥0∞)]
exact ENNReal.add_lt_add_left (ENNReal.natCast_ne_top N) zero_lt_one
· simp only [true_or, add_eq_zero, Ne, not_false_iff, one_ne_zero, and_false]
· left; finiteness
rw [zero_mul] at C
apply le_bot_iff.1
exact le_of_tendsto_of_tendsto' tendsto_const_nhds C fun n => (A n).trans (B n)
· refine (pairwiseDisjoint_iUnion ?_).2 fun n => (Pu n).1
apply (monotone_nat_of_le_succ fun n => ?_).directed_le
rw [← Nat.succ_eq_add_one, u_succ]
exact (hF (u n) (Pu n)).1
/-- The measurable **Besicovitch covering theorem**.
Assume that, for any `x` in a set `s`, one is given a set of admissible closed balls centered at
`x`, with arbitrarily small radii. Then there exists a disjoint covering of almost all `s` by
admissible closed balls centered at some points of `s`.
This version requires the underlying measure to be sigma-finite, and the space to have the
Besicovitch covering property (which is satisfied for instance by normed real vector spaces).
It expresses the conclusion in a slightly awkward form (with a subset of `α × ℝ`) coming from the
proof technique.
For a version giving the conclusion in a nicer form, see `exists_disjoint_closedBall_covering_ae`.
-/
theorem exists_disjoint_closedBall_covering_ae_aux (μ : Measure α) [SFinite μ] (f : α → Set ℝ)
(s : Set α) (hf : ∀ x ∈ s, ∀ δ > 0, (f x ∩ Ioo 0 δ).Nonempty) :
∃ t : Set (α × ℝ), t.Countable ∧ (∀ p ∈ t, p.1 ∈ s) ∧ (∀ p ∈ t, p.2 ∈ f p.1) ∧
μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.1 p.2) = 0 ∧
t.PairwiseDisjoint fun p => closedBall p.1 p.2 := by
/- This is deduced from the finite measure case, by using a finite measure with respect to which
the initial sigma-finite measure is absolutely continuous. -/
rcases exists_isFiniteMeasure_absolutelyContinuous μ with ⟨ν, hν, hμν, -⟩
rcases exists_disjoint_closedBall_covering_ae_of_finiteMeasure_aux ν f s hf with
⟨t, t_count, ts, tr, tν, tdisj⟩
exact ⟨t, t_count, ts, tr, hμν tν, tdisj⟩
/-- The measurable **Besicovitch covering theorem**.
Assume that, for any `x` in a set `s`, one is given a set of admissible closed balls centered at
`x`, with arbitrarily small radii. Then there exists a disjoint covering of almost all `s` by
admissible closed balls centered at some points of `s`. We can even require that the radius at `x`
is bounded by a given function `R x`. (Take `R = 1` if you don't need this additional feature).
This version requires the underlying measure to be sigma-finite, and the space to have the
Besicovitch covering property (which is satisfied for instance by normed real vector spaces).
-/
theorem exists_disjoint_closedBall_covering_ae (μ : Measure α) [SFinite μ] (f : α → Set ℝ)
(s : Set α) (hf : ∀ x ∈ s, ∀ δ > 0, (f x ∩ Ioo 0 δ).Nonempty) (R : α → ℝ)
(hR : ∀ x ∈ s, 0 < R x) :
∃ (t : Set α) (r : α → ℝ), t.Countable ∧ t ⊆ s ∧
(∀ x ∈ t, r x ∈ f x ∩ Ioo 0 (R x)) ∧ μ (s \ ⋃ x ∈ t, closedBall x (r x)) = 0 ∧
t.PairwiseDisjoint fun x => closedBall x (r x) := by
let g x := f x ∩ Ioo 0 (R x)
have hg : ∀ x ∈ s, ∀ δ > 0, (g x ∩ Ioo 0 δ).Nonempty := fun x hx δ δpos ↦ by
rcases hf x hx (min δ (R x)) (lt_min δpos (hR x hx)) with ⟨r, hr⟩
exact ⟨r, ⟨⟨hr.1, hr.2.1, hr.2.2.trans_le (min_le_right _ _)⟩,
⟨hr.2.1, hr.2.2.trans_le (min_le_left _ _)⟩⟩⟩
rcases exists_disjoint_closedBall_covering_ae_aux μ g s hg with ⟨v, v_count, vs, vg, μv, v_disj⟩
obtain ⟨r, t, rfl⟩ : ∃ (r : α → ℝ) (t : Set α), v = graphOn r t := by
have I : ∀ p ∈ v, 0 ≤ p.2 := fun p hp => (vg p hp).2.1.le
rw [exists_eq_graphOn]
refine fun x hx y hy heq ↦ v_disj.eq hx hy <| not_disjoint_iff.2 ⟨x.1, ?_⟩
simp [*]
have hinj : InjOn (fun x ↦ (x, r x)) t := LeftInvOn.injOn (f₁' := Prod.fst) fun _ _ ↦ rfl
simp only [graphOn, forall_mem_image, biUnion_image, hinj.pairwiseDisjoint_image] at *
exact ⟨t, r, countable_of_injective_of_countable_image hinj v_count, vs, vg, μv, v_disj⟩
/-- In a space with the Besicovitch property, any set `s` can be covered with balls whose measures
add up to at most `μ s + ε`, for any positive `ε`. This works even if one restricts the set of
allowed radii around a point `x` to a set `f x` which accumulates at `0`. -/
theorem exists_closedBall_covering_tsum_measure_le (μ : Measure α) [SFinite μ]
[Measure.OuterRegular μ] {ε : ℝ≥0∞} (hε : ε ≠ 0) (f : α → Set ℝ) (s : Set α)
(hf : ∀ x ∈ s, ∀ δ > 0, (f x ∩ Ioo 0 δ).Nonempty) :
∃ (t : Set α) (r : α → ℝ), t.Countable ∧ t ⊆ s ∧ (∀ x ∈ t, r x ∈ f x) ∧
(s ⊆ ⋃ x ∈ t, closedBall x (r x)) ∧ (∑' x : t, μ (closedBall x (r x))) ≤ μ s + ε := by
/- For the proof, first cover almost all `s` with disjoint balls thanks to the usual Besicovitch
theorem. Taking the balls included in a well-chosen open neighborhood `u` of `s`, one may
ensure that their measures add at most to `μ s + ε / 2`. Let `s'` be the remaining set, of
measure `0`. Applying the other version of Besicovitch, one may cover it with at most `N`
disjoint subfamilies. Making sure that they are all included in a neighborhood `v` of `s'` of
measure at most `ε / (2 N)`, the sum of their measures is at most `ε / 2`,
completing the proof. -/
classical
obtain ⟨u, su, u_open, μu⟩ : ∃ U, U ⊇ s ∧ IsOpen U ∧ μ U ≤ μ s + ε / 2 :=
Set.exists_isOpen_le_add _ _
(by
simpa only [or_false, Ne, ENNReal.div_eq_zero_iff, ENNReal.ofNat_ne_top] using hε)
have : ∀ x ∈ s, ∃ R > 0, ball x R ⊆ u := fun x hx =>
Metric.mem_nhds_iff.1 (u_open.mem_nhds (su hx))
choose! R hR using this
obtain ⟨t0, r0, t0_count, t0s, hr0, μt0, t0_disj⟩ :
∃ (t0 : Set α) (r0 : α → ℝ), t0.Countable ∧ t0 ⊆ s ∧
(∀ x ∈ t0, r0 x ∈ f x ∩ Ioo 0 (R x)) ∧ μ (s \ ⋃ x ∈ t0, closedBall x (r0 x)) = 0 ∧
t0.PairwiseDisjoint fun x => closedBall x (r0 x) :=
exists_disjoint_closedBall_covering_ae μ f s hf R fun x hx => (hR x hx).1
-- we have constructed an almost everywhere covering of `s` by disjoint balls. Let `s'` be the
-- remaining set.
let s' := s \ ⋃ x ∈ t0, closedBall x (r0 x)
have s's : s' ⊆ s := diff_subset
obtain ⟨N, τ, hτ, H⟩ : ∃ N τ, 1 < τ ∧ IsEmpty (Besicovitch.SatelliteConfig α N τ) :=
HasBesicovitchCovering.no_satelliteConfig
obtain ⟨v, s'v, v_open, μv⟩ : ∃ v, v ⊇ s' ∧ IsOpen v ∧ μ v ≤ μ s' + ε / 2 / N :=
Set.exists_isOpen_le_add _ _
(by simp only [ne_eq, ENNReal.div_eq_zero_iff, hε, ENNReal.ofNat_ne_top, or_self,
ENNReal.natCast_ne_top, not_false_eq_true])
have : ∀ x ∈ s', ∃ r1 ∈ f x ∩ Ioo (0 : ℝ) 1, closedBall x r1 ⊆ v := by
intro x hx
rcases Metric.mem_nhds_iff.1 (v_open.mem_nhds (s'v hx)) with ⟨r, rpos, hr⟩
rcases hf x (s's hx) (min r 1) (lt_min rpos zero_lt_one) with ⟨R', hR'⟩
exact
⟨R', ⟨hR'.1, hR'.2.1, hR'.2.2.trans_le (min_le_right _ _)⟩,
Subset.trans (closedBall_subset_ball (hR'.2.2.trans_le (min_le_left _ _))) hr⟩
choose! r1 hr1 using this
let q : BallPackage s' α :=
{ c := fun x => x
r := fun x => r1 x
rpos := fun x => (hr1 x.1 x.2).1.2.1
r_bound := 1
r_le := fun x => (hr1 x.1 x.2).1.2.2.le }
-- by Besicovitch, we cover `s'` with at most `N` families of disjoint balls, all included in
-- a suitable neighborhood `v` of `s'`.
obtain ⟨S, S_disj, hS⟩ :
∃ S : Fin N → Set s',
(∀ i : Fin N, (S i).PairwiseDisjoint fun j => closedBall (q.c j) (q.r j)) ∧
range q.c ⊆ ⋃ i : Fin N, ⋃ j ∈ S i, ball (q.c j) (q.r j) :=
exist_disjoint_covering_families hτ H q
have S_count : ∀ i, (S i).Countable := by
intro i
apply (S_disj i).countable_of_nonempty_interior fun j _ => ?_
have : (ball (j : α) (r1 j)).Nonempty := nonempty_ball.2 (q.rpos _)
exact this.mono ball_subset_interior_closedBall
let r x := if x ∈ s' then r1 x else r0 x
have r_t0 : ∀ x ∈ t0, r x = r0 x := by
intro x hx
have : x ∉ s' := by
simp only [s', not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and, not_lt, not_le,
mem_diff, not_forall]
intro _
refine ⟨x, hx, ?_⟩
rw [dist_self]
exact (hr0 x hx).2.1.le
simp only [r, if_neg this]
-- the desired covering set is given by the union of the families constructed in the first and
-- second steps.
refine ⟨t0 ∪ ⋃ i : Fin N, ((↑) : s' → α) '' S i, r, ?_, ?_, ?_, ?_, ?_⟩
-- it remains to check that they have the desired properties
· exact t0_count.union (countable_iUnion fun i => (S_count i).image _)
· simp only [t0s, true_and, union_subset_iff, image_subset_iff, iUnion_subset_iff]
intro i x _
exact s's x.2
· intro x hx
cases hx with
| inl hx =>
rw [r_t0 x hx]
exact (hr0 _ hx).1
| inr hx =>
have h'x : x ∈ s' := by
simp only [mem_iUnion, mem_image] at hx
rcases hx with ⟨i, y, _, rfl⟩
exact y.2
simp only [r, if_pos h'x, (hr1 x h'x).1.1]
· intro x hx
by_cases h'x : x ∈ s'
· obtain ⟨i, y, ySi, xy⟩ : ∃ (i : Fin N) (y : ↥s'), y ∈ S i ∧ x ∈ ball (y : α) (r1 y) := by
have A : x ∈ range q.c := by
simpa only [q, not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and,
not_le, mem_setOf_eq, Subtype.range_coe_subtype, mem_diff] using h'x
simpa only [mem_iUnion, mem_image, bex_def] using hS A
refine mem_iUnion₂.2 ⟨y, Or.inr ?_, ?_⟩
· simp only [mem_iUnion, mem_image]
exact ⟨i, y, ySi, rfl⟩
· have : (y : α) ∈ s' := y.2
simp only [r, if_pos this]
exact ball_subset_closedBall xy
· obtain ⟨y, yt0, hxy⟩ : ∃ y : α, y ∈ t0 ∧ x ∈ closedBall y (r0 y) := by
simpa [s', hx, -mem_closedBall] using h'x
refine mem_iUnion₂.2 ⟨y, Or.inl yt0, ?_⟩
rwa [r_t0 _ yt0]
-- the only nontrivial property is the measure control, which we check now
· -- the sets in the first step have measure at most `μ s + ε / 2`
have A : (∑' x : t0, μ (closedBall x (r x))) ≤ μ s + ε / 2 :=
calc
(∑' x : t0, μ (closedBall x (r x))) = ∑' x : t0, μ (closedBall x (r0 x)) := by
congr 1; ext x; rw [r_t0 x x.2]
_ = μ (⋃ x : t0, closedBall x (r0 x)) := by
haveI : Encodable t0 := t0_count.toEncodable
rw [measure_iUnion]
· exact (pairwise_subtype_iff_pairwise_set _ _).2 t0_disj
· exact fun i => measurableSet_closedBall
_ ≤ μ u := by
apply measure_mono
simp only [SetCoe.forall, iUnion_subset_iff]
intro x hx
apply Subset.trans (closedBall_subset_ball (hr0 x hx).2.2) (hR x (t0s hx)).2
_ ≤ μ s + ε / 2 := μu
-- each subfamily in the second step has measure at most `ε / (2 N)`.
have B : ∀ i : Fin N, (∑' x : ((↑) : s' → α) '' S i, μ (closedBall x (r x))) ≤ ε / 2 / N :=
fun i =>
calc
(∑' x : ((↑) : s' → α) '' S i, μ (closedBall x (r x))) =
∑' x : S i, μ (closedBall x (r x)) := by
have : InjOn ((↑) : s' → α) (S i) := Subtype.val_injective.injOn
let F : S i ≃ ((↑) : s' → α) '' S i := this.bijOn_image.equiv _
exact (F.tsum_eq fun x => μ (closedBall x (r x))).symm
_ = ∑' x : S i, μ (closedBall x (r1 x)) := by
grind
_ = μ (⋃ x : S i, closedBall x (r1 x)) := by
haveI : Encodable (S i) := (S_count i).toEncodable
rw [measure_iUnion]
· exact (pairwise_subtype_iff_pairwise_set _ _).2 (S_disj i)
· exact fun i => measurableSet_closedBall
_ ≤ μ v := by
apply measure_mono
simp only [SetCoe.forall, iUnion_subset_iff]
intro x xs' _
exact (hr1 x xs').2
_ ≤ ε / 2 / N := by have : μ s' = 0 := μt0; rwa [this, zero_add] at μv
-- add up all these to prove the desired estimate
calc
(∑' x : ↥(t0 ∪ ⋃ i : Fin N, ((↑) : s' → α) '' S i), μ (closedBall x (r x))) ≤
(∑' x : t0, μ (closedBall x (r x))) +
∑' x : ⋃ i : Fin N, ((↑) : s' → α) '' S i, μ (closedBall x (r x)) :=
ENNReal.tsum_union_le (fun x => μ (closedBall x (r x))) _ _
_ ≤
(∑' x : t0, μ (closedBall x (r x))) +
∑ i : Fin N, ∑' x : ((↑) : s' → α) '' S i, μ (closedBall x (r x)) :=
(add_le_add le_rfl (ENNReal.tsum_iUnion_le (fun x => μ (closedBall x (r x))) _))
_ ≤ μ s + ε / 2 + ∑ i : Fin N, ε / 2 / N := by
gcongr
apply B
_ ≤ μ s + ε / 2 + ε / 2 := by
gcongr
simp only [Finset.card_fin, Finset.sum_const, nsmul_eq_mul, ENNReal.mul_div_le]
_ = μ s + ε := by rw [add_assoc, ENNReal.add_halves]
/-! ### Consequences on differentiation of measures -/
/-- In a space with the Besicovitch covering property, the set of closed balls with positive radius
forms a Vitali family. This is essentially a restatement of the measurable Besicovitch theorem. -/
protected def vitaliFamily (μ : Measure α) [SFinite μ] : VitaliFamily μ where
setsAt x := (fun r : ℝ => closedBall x r) '' Ioi (0 : ℝ)
measurableSet _ := forall_mem_image.2 fun _ _ ↦ isClosed_closedBall.measurableSet
nonempty_interior _ := forall_mem_image.2 fun _ rpos ↦
(nonempty_ball.2 rpos).mono ball_subset_interior_closedBall
nontrivial x ε εpos := ⟨closedBall x ε, mem_image_of_mem _ εpos, Subset.rfl⟩
covering := by
intro s f fsubset ffine
let g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x}
have A : ∀ x ∈ s, ∀ δ > 0, (g x ∩ Ioo 0 δ).Nonempty := by
intro x xs δ δpos
obtain ⟨t, tf, ht⟩ : ∃ (t : Set α), t ∈ f x ∧ t ⊆ closedBall x (δ / 2) :=
ffine x xs (δ / 2) (half_pos δpos)
obtain ⟨r, rpos, rfl⟩ : ∃ r : ℝ, 0 < r ∧ closedBall x r = t := by simpa using fsubset x xs tf
rcases le_total r (δ / 2) with (H | H)
· exact ⟨r, ⟨rpos, tf⟩, ⟨rpos, H.trans_lt (half_lt_self δpos)⟩⟩
· have : closedBall x r = closedBall x (δ / 2) :=
Subset.antisymm ht (closedBall_subset_closedBall H)
rw [this] at tf
exact ⟨δ / 2, ⟨half_pos δpos, tf⟩, ⟨half_pos δpos, half_lt_self δpos⟩⟩
obtain ⟨t, r, _, ts, tg, μt, tdisj⟩ :
∃ (t : Set α) (r : α → ℝ),
t.Countable ∧
t ⊆ s ∧
(∀ x ∈ t, r x ∈ g x ∩ Ioo 0 1) ∧
μ (s \ ⋃ x ∈ t, closedBall x (r x)) = 0 ∧
t.PairwiseDisjoint fun x => closedBall x (r x) :=
exists_disjoint_closedBall_covering_ae μ g s A (fun _ => 1) fun _ _ => zero_lt_one
let F : α → α × Set α := fun x => (x, closedBall x (r x))
refine ⟨F '' t, ?_, ?_, ?_, ?_⟩
· rintro - ⟨x, hx, rfl⟩; exact ts hx
· rintro p ⟨x, hx, rfl⟩ q ⟨y, hy, rfl⟩ hxy
exact tdisj hx hy (ne_of_apply_ne F hxy)
· rintro - ⟨x, hx, rfl⟩; exact (tg x hx).1.2
· rwa [biUnion_image]
/-- The main feature of the Besicovitch Vitali family is that its filter at a point `x` corresponds
to convergence along closed balls. We record one of the two implications here, which will enable us
to deduce specific statements on differentiation of measures in this context from the general
versions. -/
theorem tendsto_filterAt (μ : Measure α) [SFinite μ] (x : α) :
Tendsto (fun r => closedBall x r) (𝓝[>] 0) ((Besicovitch.vitaliFamily μ).filterAt x) := by
intro s hs
simp only [mem_map]
obtain ⟨ε, εpos, hε⟩ :
∃ (ε : ℝ), ε > 0 ∧
∀ a : Set α, a ∈ (Besicovitch.vitaliFamily μ).setsAt x → a ⊆ closedBall x ε → a ∈ s :=
(VitaliFamily.mem_filterAt_iff _).1 hs
filter_upwards [Ioc_mem_nhdsGT εpos] with _r hr
apply hε
· exact mem_image_of_mem _ hr.1
· exact closedBall_subset_closedBall hr.2
variable [MetricSpace β] [MeasurableSpace β] [BorelSpace β] [SecondCountableTopology β]
[HasBesicovitchCovering β]
/-- In a space with the Besicovitch covering property, the ratio of the measure of balls converges
almost surely to the Radon-Nikodym derivative. -/
theorem ae_tendsto_rnDeriv (ρ μ : Measure β) [IsLocallyFiniteMeasure μ] [IsLocallyFiniteMeasure ρ] :
∀ᵐ x ∂μ,
Tendsto (fun r => ρ (closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 (ρ.rnDeriv μ x)) := by
filter_upwards [VitaliFamily.ae_tendsto_rnDeriv (Besicovitch.vitaliFamily μ) ρ] with x hx
exact hx.comp (tendsto_filterAt μ x)
/-- Given a measurable set `s`, then `μ (s ∩ closedBall x r) / μ (closedBall x r)` converges when
`r` tends to `0`, for almost every `x`. The limit is `1` for `x ∈ s` and `0` for `x ∉ s`.
This shows that almost every point of `s` is a Lebesgue density point for `s`.
A version for non-measurable sets holds, but it only gives the first conclusion,
see `ae_tendsto_measure_inter_div`. -/
theorem ae_tendsto_measure_inter_div_of_measurableSet (μ : Measure β) [IsLocallyFiniteMeasure μ]
{s : Set β} (hs : MeasurableSet s) :
∀ᵐ x ∂μ,
Tendsto (fun r => μ (s ∩ closedBall x r) / μ (closedBall x r)) (𝓝[>] 0)
(𝓝 (s.indicator 1 x)) := by
filter_upwards [VitaliFamily.ae_tendsto_measure_inter_div_of_measurableSet
(Besicovitch.vitaliFamily μ) hs]
intro x hx
exact hx.comp (tendsto_filterAt μ x)
/-- Given an arbitrary set `s`, then `μ (s ∩ closedBall x r) / μ (closedBall x r)` converges
to `1` when `r` tends to `0`, for almost every `x` in `s`.
This shows that almost every point of `s` is a Lebesgue density point for `s`.
A stronger version holds for measurable sets, see `ae_tendsto_measure_inter_div_of_measurableSet`.
See also `IsUnifLocDoublingMeasure.ae_tendsto_measure_inter_div`. -/
theorem ae_tendsto_measure_inter_div (μ : Measure β) [IsLocallyFiniteMeasure μ] (s : Set β) :
∀ᵐ x ∂μ.restrict s,
Tendsto (fun r => μ (s ∩ closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 1) := by
filter_upwards [VitaliFamily.ae_tendsto_measure_inter_div (Besicovitch.vitaliFamily μ) s] with x
hx using hx.comp (tendsto_filterAt μ x)
end Besicovitch |
.lake/packages/mathlib/Mathlib/MeasureTheory/Covering/LiminfLimsup.lean | import Mathlib.MeasureTheory.Covering.DensityTheorem
/-!
# Liminf, limsup, and uniformly locally doubling measures.
This file is a place to collect lemmas about liminf and limsup for subsets of a metric space
carrying a uniformly locally doubling measure.
## Main results:
* `blimsup_cthickening_mul_ae_eq`: the limsup of the closed thickening of a sequence of subsets
of a metric space is unchanged almost everywhere for a uniformly locally doubling measure if the
sequence of distances is multiplied by a positive scale factor. This is a generalisation of a
result of Cassels, appearing as Lemma 9 on page 217 of
[J.W.S. Cassels, *Some metrical theorems in Diophantine approximation. I*](cassels1950).
* `blimsup_thickening_mul_ae_eq`: a variant of `blimsup_cthickening_mul_ae_eq` for thickenings
rather than closed thickenings.
-/
open Set Filter Metric MeasureTheory TopologicalSpace
open scoped NNReal ENNReal Topology
variable {α : Type*}
variable [PseudoMetricSpace α] [SecondCountableTopology α] [MeasurableSpace α] [BorelSpace α]
variable (μ : Measure α) [IsLocallyFiniteMeasure μ] [IsUnifLocDoublingMeasure μ]
/-- This is really an auxiliary result en route to `blimsup_cthickening_ae_le_of_eventually_mul_le`
(which is itself an auxiliary result en route to `blimsup_cthickening_mul_ae_eq`).
NB: The `: Set α` type ascription is present because of
https://github.com/leanprover-community/mathlib/issues/16932. -/
theorem blimsup_cthickening_ae_le_of_eventually_mul_le_aux (p : ℕ → Prop) {s : ℕ → Set α}
(hs : ∀ i, IsClosed (s i)) {r₁ r₂ : ℕ → ℝ} (hr : Tendsto r₁ atTop (𝓝[>] 0)) (hrp : 0 ≤ r₁)
{M : ℝ} (hM : 0 < M) (hM' : M < 1) (hMr : ∀ᶠ i in atTop, M * r₁ i ≤ r₂ i) :
(blimsup (fun i => cthickening (r₁ i) (s i)) atTop p : Set α) ≤ᵐ[μ]
(blimsup (fun i => cthickening (r₂ i) (s i)) atTop p : Set α) := by
/- Sketch of proof:
Assume that `p` is identically true for simplicity. Let `Y₁ i = cthickening (r₁ i) (s i)`, define
`Y₂` similarly except using `r₂`, and let `(Z i) = ⋃_{j ≥ i} (Y₂ j)`. Our goal is equivalent to
showing that `μ ((limsup Y₁) \ (Z i)) = 0` for all `i`.
Assume for contradiction that `μ ((limsup Y₁) \ (Z i)) ≠ 0` for some `i` and let
`W = (limsup Y₁) \ (Z i)`. Apply Lebesgue's density theorem to obtain a point `d` in `W` of
density `1`. Since `d ∈ limsup Y₁`, there is a subsequence of `j ↦ Y₁ j`, indexed by
`f 0 < f 1 < ...`, such that `d ∈ Y₁ (f j)` for all `j`. For each `j`, we may thus choose
`w j ∈ s (f j)` such that `d ∈ B j`, where `B j = closedBall (w j) (r₁ (f j))`. Note that
since `d` has density one, `μ (W ∩ (B j)) / μ (B j) → 1`.
We obtain our contradiction by showing that there exists `η < 1` such that
`μ (W ∩ (B j)) / μ (B j) ≤ η` for sufficiently large `j`. In fact we claim that `η = 1 - C⁻¹`
is such a value where `C` is the scaling constant of `M⁻¹` for the uniformly locally doubling
measure `μ`.
To prove the claim, let `b j = closedBall (w j) (M * r₁ (f j))` and for given `j` consider the
sets `b j` and `W ∩ (B j)`. These are both subsets of `B j` and are disjoint for large enough `j`
since `M * r₁ j ≤ r₂ j` and thus `b j ⊆ Z i ⊆ Wᶜ`. We thus have:
`μ (b j) + μ (W ∩ (B j)) ≤ μ (B j)`. Combining this with `μ (B j) ≤ C * μ (b j)` we obtain
the required inequality. -/
set Y₁ : ℕ → Set α := fun i => cthickening (r₁ i) (s i)
set Y₂ : ℕ → Set α := fun i => cthickening (r₂ i) (s i)
let Z : ℕ → Set α := fun i => ⋃ (j) (_ : p j ∧ i ≤ j), Y₂ j
suffices ∀ i, μ (atTop.blimsup Y₁ p \ Z i) = 0 by
rwa [ae_le_set, @blimsup_eq_iInf_biSup_of_nat _ _ _ Y₂, iInf_eq_iInter, diff_iInter,
measure_iUnion_null_iff]
intro i
set W := atTop.blimsup Y₁ p \ Z i
by_contra contra
obtain ⟨d, hd, hd'⟩ : ∃ d, d ∈ W ∧ ∀ {ι : Type _} {l : Filter ι} (w : ι → α) (δ : ι → ℝ),
Tendsto δ l (𝓝[>] 0) → (∀ᶠ j in l, d ∈ closedBall (w j) (2 * δ j)) →
Tendsto (fun j => μ (W ∩ closedBall (w j) (δ j)) / μ (closedBall (w j) (δ j))) l (𝓝 1) :=
Measure.exists_mem_of_measure_ne_zero_of_ae contra
(IsUnifLocDoublingMeasure.ae_tendsto_measure_inter_div μ W 2)
replace hd : d ∈ blimsup Y₁ atTop p := ((mem_diff _).mp hd).1
obtain ⟨f : ℕ → ℕ, hf⟩ := exists_forall_mem_of_hasBasis_mem_blimsup' atTop_basis hd
simp only [forall_and] at hf
obtain ⟨hf₀ : ∀ j, d ∈ cthickening (r₁ (f j)) (s (f j)), hf₁, hf₂ : ∀ j, j ≤ f j⟩ := hf
have hf₃ : Tendsto f atTop atTop :=
tendsto_atTop_atTop.mpr fun j => ⟨f j, fun i hi => (hf₂ j).trans (hi.trans <| hf₂ i)⟩
replace hr : Tendsto (r₁ ∘ f) atTop (𝓝[>] 0) := hr.comp hf₃
replace hMr : ∀ᶠ j in atTop, M * r₁ (f j) ≤ r₂ (f j) := hf₃.eventually hMr
replace hf₀ : ∀ j, ∃ w ∈ s (f j), d ∈ closedBall w (2 * r₁ (f j)) := by
intro j
specialize hrp (f j)
rw [Pi.zero_apply] at hrp
rcases eq_or_lt_of_le hrp with (hr0 | hrp')
· specialize hf₀ j
rw [← hr0, cthickening_zero, (hs (f j)).closure_eq] at hf₀
exact ⟨d, hf₀, by simp [← hr0]⟩
· simpa using mem_iUnion₂.mp (cthickening_subset_iUnion_closedBall_of_lt (s (f j))
(by positivity) (lt_two_mul_self hrp') (hf₀ j))
choose w hw hw' using hf₀
let C := IsUnifLocDoublingMeasure.scalingConstantOf μ M⁻¹
have hC : 0 < C :=
lt_of_lt_of_le zero_lt_one (IsUnifLocDoublingMeasure.one_le_scalingConstantOf μ M⁻¹)
suffices ∃ η < (1 : ℝ≥0),
∀ᶠ j in atTop, μ (W ∩ closedBall (w j) (r₁ (f j))) / μ (closedBall (w j) (r₁ (f j))) ≤ η by
obtain ⟨η, hη, hη'⟩ := this
replace hη' : 1 ≤ η := by
simpa only [ENNReal.one_le_coe_iff] using
le_of_tendsto (hd' w (fun j => r₁ (f j)) hr <| Eventually.of_forall hw') hη'
exact (lt_self_iff_false _).mp (lt_of_lt_of_le hη hη')
refine ⟨1 - C⁻¹, tsub_lt_self zero_lt_one (inv_pos.mpr hC), ?_⟩
replace hC : C ≠ 0 := ne_of_gt hC
let b : ℕ → Set α := fun j => closedBall (w j) (M * r₁ (f j))
let B : ℕ → Set α := fun j => closedBall (w j) (r₁ (f j))
have h₁ : ∀ j, b j ⊆ B j := fun j =>
closedBall_subset_closedBall (mul_le_of_le_one_left (hrp (f j)) hM'.le)
have h₂ : ∀ j, W ∩ B j ⊆ B j := fun j => inter_subset_right
have h₃ : ∀ᶠ j in atTop, Disjoint (b j) (W ∩ B j) := by
apply hMr.mp
rw [eventually_atTop]
refine
⟨i, fun j hj hj' => Disjoint.inf_right (B j) <| Disjoint.inf_right' (blimsup Y₁ atTop p) ?_⟩
change Disjoint (b j) (Z i)ᶜ
rw [disjoint_compl_right_iff_subset]
refine (closedBall_subset_cthickening (hw j) (M * r₁ (f j))).trans
((cthickening_mono hj' _).trans fun a ha => ?_)
simp only [Z, mem_iUnion, exists_prop]
exact ⟨f j, ⟨hf₁ j, hj.le.trans (hf₂ j)⟩, ha⟩
have h₄ : ∀ᶠ j in atTop, μ (B j) ≤ C * μ (b j) :=
(hr.eventually (IsUnifLocDoublingMeasure.eventually_measure_le_scaling_constant_mul'
μ M hM)).mono fun j hj => hj (w j)
refine (h₃.and h₄).mono fun j hj₀ => ?_
change μ (W ∩ B j) / μ (B j) ≤ ↑(1 - C⁻¹)
rcases eq_or_ne (μ (B j)) ∞ with (hB | hB); · simp [hB]
apply ENNReal.div_le_of_le_mul
rw [ENNReal.coe_sub, ENNReal.coe_one, ENNReal.sub_mul fun _ _ => hB, one_mul]
replace hB : ↑C⁻¹ * μ (B j) ≠ ∞ := by finiteness
obtain ⟨hj₁ : Disjoint (b j) (W ∩ B j), hj₂ : μ (B j) ≤ C * μ (b j)⟩ := hj₀
replace hj₂ : ↑C⁻¹ * μ (B j) ≤ μ (b j) := by
rw [ENNReal.coe_inv hC, ← ENNReal.div_eq_inv_mul]
exact ENNReal.div_le_of_le_mul' hj₂
have hj₃ : ↑C⁻¹ * μ (B j) + μ (W ∩ B j) ≤ μ (B j) := by
grw [hj₂]
rw [← measure_union' hj₁ measurableSet_closedBall]
grw [union_subset (h₁ j) (h₂ j)]
replace hj₃ := tsub_le_tsub_right hj₃ (↑C⁻¹ * μ (B j))
rwa [ENNReal.add_sub_cancel_left hB] at hj₃
/-- This is really an auxiliary result en route to `blimsup_cthickening_mul_ae_eq`.
NB: The `: Set α` type ascription is present because of
https://github.com/leanprover-community/mathlib/issues/16932. -/
theorem blimsup_cthickening_ae_le_of_eventually_mul_le (p : ℕ → Prop) {s : ℕ → Set α} {M : ℝ}
(hM : 0 < M) {r₁ r₂ : ℕ → ℝ} (hr : Tendsto r₁ atTop (𝓝[>] 0))
(hMr : ∀ᶠ i in atTop, M * r₁ i ≤ r₂ i) :
(blimsup (fun i => cthickening (r₁ i) (s i)) atTop p : Set α) ≤ᵐ[μ]
(blimsup (fun i => cthickening (r₂ i) (s i)) atTop p : Set α) := by
let R₁ i := max 0 (r₁ i)
let R₂ i := max 0 (r₂ i)
have hRp : 0 ≤ R₁ := fun i => le_max_left 0 (r₁ i)
replace hMr : ∀ᶠ i in atTop, M * R₁ i ≤ R₂ i := by
refine hMr.mono fun i hi ↦ ?_
rw [mul_max_of_nonneg _ _ hM.le, mul_zero]
exact max_le_max (le_refl 0) hi
simp_rw [← cthickening_max_zero (r₁ _), ← cthickening_max_zero (r₂ _)]
rcases le_or_gt 1 M with hM' | hM'
· apply HasSubset.Subset.eventuallyLE
change _ ≤ _
refine mono_blimsup' (hMr.mono fun i hi _ => cthickening_mono ?_ (s i))
exact (le_mul_of_one_le_left (hRp i) hM').trans hi
· simp only [← @cthickening_closure _ _ _ (s _)]
have hs : ∀ i, IsClosed (closure (s i)) := fun i => isClosed_closure
exact blimsup_cthickening_ae_le_of_eventually_mul_le_aux μ p hs
(tendsto_nhds_max_right hr) hRp hM hM' hMr
/-- Given a sequence of subsets `sᵢ` of a metric space, together with a sequence of radii `rᵢ`
such that `rᵢ → 0`, the set of points which belong to infinitely many of the closed
`rᵢ`-thickenings of `sᵢ` is unchanged almost everywhere for a uniformly locally doubling measure if
the `rᵢ` are all scaled by a positive constant.
This lemma is a generalisation of Lemma 9 appearing on page 217 of
[J.W.S. Cassels, *Some metrical theorems in Diophantine approximation. I*](cassels1950).
See also `blimsup_thickening_mul_ae_eq`.
NB: The `: Set α` type ascription is present because of
https://github.com/leanprover-community/mathlib/issues/16932. -/
theorem blimsup_cthickening_mul_ae_eq (p : ℕ → Prop) (s : ℕ → Set α) {M : ℝ} (hM : 0 < M)
(r : ℕ → ℝ) (hr : Tendsto r atTop (𝓝 0)) :
(blimsup (fun i => cthickening (M * r i) (s i)) atTop p : Set α) =ᵐ[μ]
(blimsup (fun i => cthickening (r i) (s i)) atTop p : Set α) := by
have : ∀ (p : ℕ → Prop) {r : ℕ → ℝ} (_ : Tendsto r atTop (𝓝[>] 0)),
(blimsup (fun i => cthickening (M * r i) (s i)) atTop p : Set α) =ᵐ[μ]
(blimsup (fun i => cthickening (r i) (s i)) atTop p : Set α) := by
clear p hr r; intro p r hr
have hr' : Tendsto (fun i => M * r i) atTop (𝓝[>] 0) := by
convert TendstoNhdsWithinIoi.const_mul hM hr <;> simp only [mul_zero]
refine eventuallyLE_antisymm_iff.mpr ⟨?_, ?_⟩
· exact blimsup_cthickening_ae_le_of_eventually_mul_le μ p (inv_pos.mpr hM) hr'
(Eventually.of_forall fun i => by rw [inv_mul_cancel_left₀ hM.ne' (r i)])
· exact blimsup_cthickening_ae_le_of_eventually_mul_le μ p hM hr
(Eventually.of_forall fun i => le_refl _)
let r' : ℕ → ℝ := fun i => if 0 < r i then r i else 1 / ((i : ℝ) + 1)
have hr' : Tendsto r' atTop (𝓝[>] 0) := by
refine tendsto_nhdsWithin_iff.mpr
⟨Tendsto.if' hr tendsto_one_div_add_atTop_nhds_zero_nat, Eventually.of_forall fun i => ?_⟩
by_cases hi : 0 < r i
· simp [r', hi]
· simp only [r', hi, one_div, mem_Ioi, if_false, inv_pos]; positivity
have h₀ : ∀ i, p i ∧ 0 < r i → cthickening (r i) (s i) = cthickening (r' i) (s i) := by
grind
have h₁ : ∀ i, p i ∧ 0 < r i → cthickening (M * r i) (s i) = cthickening (M * r' i) (s i) := by
rintro i ⟨-, hi⟩; simp only [r', hi, if_true]
have h₂ : ∀ i, p i ∧ r i ≤ 0 → cthickening (M * r i) (s i) = cthickening (r i) (s i) := by
rintro i ⟨-, hi⟩
have hi' : M * r i ≤ 0 := mul_nonpos_of_nonneg_of_nonpos hM.le hi
rw [cthickening_of_nonpos hi, cthickening_of_nonpos hi']
have hp : p = fun i => p i ∧ 0 < r i ∨ p i ∧ r i ≤ 0 := by
ext i; simp [← and_or_left, lt_or_ge 0 (r i)]
rw [hp, blimsup_or_eq_sup, blimsup_or_eq_sup]
simp only [sup_eq_union]
rw [blimsup_congr (Eventually.of_forall h₀), blimsup_congr (Eventually.of_forall h₁),
blimsup_congr (Eventually.of_forall h₂)]
exact ae_eq_set_union (this (fun i => p i ∧ 0 < r i) hr') (ae_eq_refl _)
theorem blimsup_cthickening_ae_eq_blimsup_thickening {p : ℕ → Prop} {s : ℕ → Set α} {r : ℕ → ℝ}
(hr : Tendsto r atTop (𝓝 0)) (hr' : ∀ᶠ i in atTop, p i → 0 < r i) :
(blimsup (fun i => cthickening (r i) (s i)) atTop p : Set α) =ᵐ[μ]
(blimsup (fun i => thickening (r i) (s i)) atTop p : Set α) := by
refine eventuallyLE_antisymm_iff.mpr ⟨?_, HasSubset.Subset.eventuallyLE (?_ : _ ≤ _)⟩
· rw [eventuallyLE_congr (blimsup_cthickening_mul_ae_eq μ p s (one_half_pos (α := ℝ)) r hr).symm
EventuallyEq.rfl]
apply HasSubset.Subset.eventuallyLE
change _ ≤ _
refine mono_blimsup' (hr'.mono fun i hi pi => cthickening_subset_thickening' (hi pi) ?_ (s i))
nlinarith [hi pi]
· exact mono_blimsup fun i _ => thickening_subset_cthickening _ _
/-- An auxiliary result en route to `blimsup_thickening_mul_ae_eq`. -/
theorem blimsup_thickening_mul_ae_eq_aux (p : ℕ → Prop) (s : ℕ → Set α) {M : ℝ} (hM : 0 < M)
(r : ℕ → ℝ) (hr : Tendsto r atTop (𝓝 0)) (hr' : ∀ᶠ i in atTop, p i → 0 < r i) :
(blimsup (fun i => thickening (M * r i) (s i)) atTop p : Set α) =ᵐ[μ]
(blimsup (fun i => thickening (r i) (s i)) atTop p : Set α) := by
have h₁ := blimsup_cthickening_ae_eq_blimsup_thickening (s := s) μ hr hr'
have h₂ := blimsup_cthickening_mul_ae_eq μ p s hM r hr
replace hr : Tendsto (fun i => M * r i) atTop (𝓝 0) := by convert hr.const_mul M; simp
replace hr' : ∀ᶠ i in atTop, p i → 0 < M * r i := hr'.mono fun i hi hip ↦ mul_pos hM (hi hip)
have h₃ := blimsup_cthickening_ae_eq_blimsup_thickening (s := s) μ hr hr'
exact h₃.symm.trans (h₂.trans h₁)
/-- Given a sequence of subsets `sᵢ` of a metric space, together with a sequence of radii `rᵢ`
such that `rᵢ → 0`, the set of points which belong to infinitely many of the
`rᵢ`-thickenings of `sᵢ` is unchanged almost everywhere for a uniformly locally doubling measure if
the `rᵢ` are all scaled by a positive constant.
This lemma is a generalisation of Lemma 9 appearing on page 217 of
[J.W.S. Cassels, *Some metrical theorems in Diophantine approximation. I*](cassels1950).
See also `blimsup_cthickening_mul_ae_eq`.
NB: The `: Set α` type ascription is present because of
https://github.com/leanprover-community/mathlib/issues/16932. -/
theorem blimsup_thickening_mul_ae_eq (p : ℕ → Prop) (s : ℕ → Set α) {M : ℝ} (hM : 0 < M) (r : ℕ → ℝ)
(hr : Tendsto r atTop (𝓝 0)) :
(blimsup (fun i => thickening (M * r i) (s i)) atTop p : Set α) =ᵐ[μ]
(blimsup (fun i => thickening (r i) (s i)) atTop p : Set α) := by
let q : ℕ → Prop := fun i => p i ∧ 0 < r i
have h₁ : blimsup (fun i => thickening (r i) (s i)) atTop p =
blimsup (fun i => thickening (r i) (s i)) atTop q := by
refine blimsup_congr' (Eventually.of_forall fun i h => ?_)
replace hi : 0 < r i := by contrapose! h; apply thickening_of_nonpos h
simp only [q, hi, iff_self_and, imp_true_iff]
have h₂ : blimsup (fun i => thickening (M * r i) (s i)) atTop p =
blimsup (fun i => thickening (M * r i) (s i)) atTop q := by
refine blimsup_congr' (Eventually.of_forall fun i h ↦ ?_)
replace h : 0 < r i := by
rw [← mul_pos_iff_of_pos_left hM]; contrapose! h; apply thickening_of_nonpos h
simp only [q, h, iff_self_and, imp_true_iff]
rw [h₁, h₂]
exact blimsup_thickening_mul_ae_eq_aux μ q s hM r hr (Eventually.of_forall fun i hi => hi.2) |
.lake/packages/mathlib/Mathlib/MeasureTheory/Covering/Vitali.lean | import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
import Mathlib.MeasureTheory.Covering.VitaliFamily
import Mathlib.Data.Set.Pairwise.Lattice
/-!
# Vitali covering theorems
The topological Vitali covering theorem, in its most classical version, states the following.
Consider a family of balls `(B (x_i, r_i))_{i ∈ I}` in a metric space, with uniformly bounded
radii. Then one can extract a disjoint subfamily indexed by `J ⊆ I`, such that any `B (x_i, r_i)`
is included in a ball `B (x_j, 5 r_j)`.
We prove this theorem in `Vitali.exists_disjoint_subfamily_covering_enlargement_closedBall`.
It is deduced from a more general version, called
`Vitali.exists_disjoint_subfamily_covering_enlargement`, which applies to any family of sets
together with a size function `δ` (think "radius" or "diameter").
We deduce the measurable Vitali covering theorem. Assume one is given a family `t` of closed sets
with nonempty interior, such that each `a ∈ t` is included in a ball `B (x, r)` and covers a
definite proportion of the ball `B (x, 6 r)` for a given measure `μ` (think of the situation
where `μ` is a doubling measure and `t` is a family of balls). Consider a set `s` at which the
family is fine, i.e., every point of `s` belongs to arbitrarily small elements of `t`. Then one
can extract from `t` a disjoint subfamily that covers almost all `s`. It is proved in
`Vitali.exists_disjoint_covering_ae`.
A way to restate this theorem is to say that the set of closed sets `a` with nonempty interior
covering a fixed proportion `1/C` of the ball `closedBall x (3 * diam a)` forms a Vitali family.
This version is given in `Vitali.vitaliFamily`.
-/
variable {α ι : Type*}
open Set Metric MeasureTheory TopologicalSpace Filter
open scoped NNReal ENNReal Topology
namespace Vitali
/-- **Vitali covering theorem**: given a set `t` of subsets of a type, one may extract a disjoint
subfamily `u` such that the `τ`-enlargement of this family covers all elements of `t`, where `τ > 1`
is any fixed number.
When `t` is a family of balls, the `τ`-enlargement of `ball x r` is `ball x ((1+2τ) r)`. In general,
it is expressed in terms of a function `δ` (think "radius" or "diameter"), positive and bounded on
all elements of `t`. The condition is that every element `a` of `t` should intersect an
element `b` of `u` of size larger than that of `a` up to `τ`, i.e., `δ b ≥ δ a / τ`.
We state the lemma slightly more generally, with an indexed family of sets `B a` for `a ∈ t`, for
wider applicability.
-/
theorem exists_disjoint_subfamily_covering_enlargement (B : ι → Set α) (t : Set ι) (δ : ι → ℝ)
(τ : ℝ) (hτ : 1 < τ) (δnonneg : ∀ a ∈ t, 0 ≤ δ a) (R : ℝ) (δle : ∀ a ∈ t, δ a ≤ R)
(hne : ∀ a ∈ t, (B a).Nonempty) :
∃ u ⊆ t,
u.PairwiseDisjoint B ∧ ∀ a ∈ t, ∃ b ∈ u, (B a ∩ B b).Nonempty ∧ δ a ≤ τ * δ b := by
/- The proof could be formulated as a transfinite induction. First pick an element of `t` with `δ`
as large as possible (up to a factor of `τ`). Then among the remaining elements not intersecting
the already chosen one, pick another element with large `δ`. Go on forever (transfinitely) until
there is nothing left.
Instead, we give a direct Zorn-based argument. Consider a maximal family `u` of disjoint sets
with the following property: if an element `a` of `t` intersects some element `b` of `u`, then it
intersects some `b' ∈ u` with `δ b' ≥ δ a / τ`. Such a maximal family exists by Zorn. If this
family did not intersect some element `a ∈ t`, then take an element `a' ∈ t` which does not
intersect any element of `u`, with `δ a'` almost as large as possible. One checks easily
that `u ∪ {a'}` still has this property, contradicting the maximality. Therefore, `u`
intersects all elements of `t`, and by definition it satisfies all the desired properties.
-/
let T : Set (Set ι) := { u | u ⊆ t ∧ u.PairwiseDisjoint B ∧
∀ a ∈ t, ∀ b ∈ u, (B a ∩ B b).Nonempty → ∃ c ∈ u, (B a ∩ B c).Nonempty ∧ δ a ≤ τ * δ c }
-- By Zorn, choose a maximal family in the good set `T` of disjoint families.
obtain ⟨u, hu⟩ : ∃ m, Maximal (fun x ↦ x ∈ T) m := by
refine zorn_subset _ fun U UT hU => ?_
refine ⟨⋃₀ U, ?_, fun s hs => subset_sUnion_of_mem hs⟩
simp only [T, Set.sUnion_subset_iff, and_imp, forall_exists_index, mem_sUnion,
Set.mem_setOf_eq]
refine
⟨fun u hu => (UT hu).1, (pairwiseDisjoint_sUnion hU.directedOn).2 fun u hu => (UT hu).2.1,
fun a hat b u uU hbu hab => ?_⟩
obtain ⟨c, cu, ac, hc⟩ : ∃ c, c ∈ u ∧ (B a ∩ B c).Nonempty ∧ δ a ≤ τ * δ c :=
(UT uU).2.2 a hat b hbu hab
exact ⟨c, ⟨u, uU, cu⟩, ac, hc⟩
-- The only nontrivial bit is to check that every `a ∈ t` intersects an element `b ∈ u` with
-- comparatively large `δ b`. Assume this is not the case, then we will contradict the maximality.
refine ⟨u, hu.prop.1, hu.prop.2.1, fun a hat => ?_⟩
by_contra! hcon
have a_disj : ∀ c ∈ u, Disjoint (B a) (B c) := by
intro c hc
by_contra h
rw [not_disjoint_iff_nonempty_inter] at h
obtain ⟨d, du, ad, hd⟩ : ∃ d, d ∈ u ∧ (B a ∩ B d).Nonempty ∧ δ a ≤ τ * δ d :=
hu.prop.2.2 a hat c hc h
exact lt_irrefl _ ((hcon d du ad).trans_le hd)
-- Let `A` be all the elements of `t` which do not intersect the family `u`. It is nonempty as it
-- contains `a`. We will pick an element `a'` of `A` with `δ a'` almost as large as possible.
let A := { a' | a' ∈ t ∧ ∀ c ∈ u, Disjoint (B a') (B c) }
have Anonempty : A.Nonempty := ⟨a, hat, a_disj⟩
let m := sSup (δ '' A)
have bddA : BddAbove (δ '' A) := by
refine ⟨R, fun x xA => ?_⟩
rcases (mem_image _ _ _).1 xA with ⟨a', ha', rfl⟩
exact δle a' ha'.1
obtain ⟨a', a'A, ha'⟩ : ∃ a' ∈ A, m / τ ≤ δ a' := by
have : 0 ≤ m := (δnonneg a hat).trans (le_csSup bddA (mem_image_of_mem _ ⟨hat, a_disj⟩))
rcases eq_or_lt_of_le this with (mzero | mpos)
· refine ⟨a, ⟨hat, a_disj⟩, ?_⟩
simpa only [← mzero, zero_div] using δnonneg a hat
· have I : m / τ < m := by
rw [div_lt_iff₀ (zero_lt_one.trans hτ)]
conv_lhs => rw [← mul_one m]
gcongr
rcases exists_lt_of_lt_csSup (Anonempty.image _) I with ⟨x, xA, hx⟩
rcases (mem_image _ _ _).1 xA with ⟨a', ha', rfl⟩
exact ⟨a', ha', hx.le⟩
clear hat hcon a_disj a
have a'_ne_u : a' ∉ u := fun H => (hne _ a'A.1).ne_empty (disjoint_self.1 (a'A.2 _ H))
-- we claim that `u ∪ {a'}` still belongs to `T`, contradicting the maximality of `u`.
refine a'_ne_u (hu.mem_of_prop_insert ⟨?_, ?_, ?_⟩)
· -- check that `u ∪ {a'}` is made of elements of `t`.
rw [insert_subset_iff]
exact ⟨a'A.1, hu.prop.1⟩
· -- Check that `u ∪ {a'}` is a disjoint family. This follows from the fact that `a'` does not
-- intersect `u`.
exact hu.prop.2.1.insert fun b bu _ => a'A.2 b bu
· -- check that every element `c` of `t` intersecting `u ∪ {a'}` intersects an element of this
-- family with large `δ`.
intro c ct b ba'u hcb
-- if `c` already intersects an element of `u`, then it intersects an element of `u` with
-- large `δ` by the assumption on `u`, and there is nothing left to do.
by_cases! H : ∃ d ∈ u, (B c ∩ B d).Nonempty
· rcases H with ⟨d, du, hd⟩
rcases hu.prop.2.2 c ct d du hd with ⟨d', d'u, hd'⟩
exact ⟨d', mem_insert_of_mem _ d'u, hd'⟩
· -- Otherwise, `c` belongs to `A`. The element of `u ∪ {a'}` that it intersects has to be `a'`.
-- Moreover, `δ c` is smaller than the maximum `m` of `δ` over `A`, which is `≤ δ a' / τ`
-- thanks to the good choice of `a'`. This is the desired inequality.
simp only [← disjoint_iff_inter_eq_empty] at H
rcases mem_insert_iff.1 ba'u with (rfl | H')
· refine ⟨b, mem_insert _ _, hcb, ?_⟩
calc
δ c ≤ m := le_csSup bddA (mem_image_of_mem _ ⟨ct, H⟩)
_ = τ * (m / τ) := by field
_ ≤ τ * δ b := by gcongr
· rw [← not_disjoint_iff_nonempty_inter] at hcb
exact (hcb (H _ H')).elim
/-- Vitali covering theorem, closed balls version: given a family `t` of closed balls, one can
extract a disjoint subfamily `u ⊆ t` so that all balls in `t` are covered by the τ-times
dilations of balls in `u`, for some `τ > 3`. -/
theorem exists_disjoint_subfamily_covering_enlargement_closedBall
[PseudoMetricSpace α] (t : Set ι)
(x : ι → α) (r : ι → ℝ) (R : ℝ) (hr : ∀ a ∈ t, r a ≤ R) (τ : ℝ) (hτ : 3 < τ) :
∃ u ⊆ t,
(u.PairwiseDisjoint fun a => closedBall (x a) (r a)) ∧
∀ a ∈ t, ∃ b ∈ u, closedBall (x a) (r a) ⊆ closedBall (x b) (τ * r b) := by
rcases eq_empty_or_nonempty t with (rfl | _)
· exact ⟨∅, Subset.refl _, pairwiseDisjoint_empty, by simp⟩
by_cases! ht : ∀ a ∈ t, r a < 0
· exact ⟨t, Subset.rfl, fun a ha b _ _ => by
simp only [closedBall_eq_empty.2 (ht a ha), empty_disjoint, Function.onFun],
fun a ha => ⟨a, ha, by simp only [closedBall_eq_empty.2 (ht a ha), empty_subset]⟩⟩
let t' := { a ∈ t | 0 ≤ r a }
rcases exists_disjoint_subfamily_covering_enlargement (fun a => closedBall (x a) (r a)) t' r
((τ - 1) / 2) (by linarith) (fun a ha => ha.2) R (fun a ha => hr a ha.1) fun a ha =>
⟨x a, mem_closedBall_self ha.2⟩ with
⟨u, ut', u_disj, hu⟩
have A : ∀ a ∈ t', ∃ b ∈ u, closedBall (x a) (r a) ⊆ closedBall (x b) (τ * r b) := by
intro a ha
rcases hu a ha with ⟨b, bu, hb, rb⟩
refine ⟨b, bu, ?_⟩
have : dist (x a) (x b) ≤ r a + r b := dist_le_add_of_nonempty_closedBall_inter_closedBall hb
apply closedBall_subset_closedBall'
linarith
refine ⟨u, ut'.trans fun a ha => ha.1, u_disj, fun a ha => ?_⟩
rcases le_or_gt 0 (r a) with (h'a | h'a)
· exact A a ⟨ha, h'a⟩
· rcases ht with ⟨b, rb⟩
rcases A b ⟨rb.1, rb.2⟩ with ⟨c, cu, _⟩
exact ⟨c, cu, by simp only [closedBall_eq_empty.2 h'a, empty_subset]⟩
/-- The measurable **Vitali covering theorem**.
Assume one is given a family `t` of closed sets with nonempty interior, such that each `a ∈ t` is
included in a ball `B (x, r)` and covers a definite proportion of the ball `B (x, 3 r)` for a given
measure `μ` (think of the situation where `μ` is a doubling measure and `t` is a family of balls).
Consider a (possibly non-measurable) set `s` at which the family is fine, i.e., every point of `s`
belongs to arbitrarily small elements of `t`. Then one can extract from `t` a disjoint subfamily
that covers almost all `s`.
For more flexibility, we give a statement with a parameterized family of sets.
-/
theorem exists_disjoint_covering_ae
[PseudoMetricSpace α] [MeasurableSpace α] [OpensMeasurableSpace α]
[SecondCountableTopology α] (μ : Measure α) [IsLocallyFiniteMeasure μ] (s : Set α) (t : Set ι)
(C : ℝ≥0) (r : ι → ℝ) (c : ι → α) (B : ι → Set α) (hB : ∀ a ∈ t, B a ⊆ closedBall (c a) (r a))
(μB : ∀ a ∈ t, μ (closedBall (c a) (3 * r a)) ≤ C * μ (B a))
(ht : ∀ a ∈ t, (interior (B a)).Nonempty) (h't : ∀ a ∈ t, IsClosed (B a))
(hf : ∀ x ∈ s, ∀ ε > (0 : ℝ), ∃ a ∈ t, r a ≤ ε ∧ c a = x) :
∃ u ⊆ t, u.Countable ∧ u.PairwiseDisjoint B ∧ μ (s \ ⋃ a ∈ u, B a) = 0 := by
/- The idea of the proof is the following. Assume for simplicity that `μ` is finite. Applying the
abstract Vitali covering theorem with `δ = r` given by `hf`, one obtains a disjoint subfamily `u`,
such that any element of `t` intersects an element of `u` with comparable radius. Fix `ε > 0`.
Since the elements of `u` have summable measure, one can remove finitely elements `w_1, ..., w_n`.
so that the measure of the remaining elements is `< ε`. Consider now a point `z` not
in the `w_i`. There is a small ball around `z` not intersecting the `w_i` (as they are closed),
an element `a ∈ t` contained in this small ball (as the family `t` is fine at `z`) and an element
`b ∈ u` intersecting `a`, with comparable radius (by definition of `u`). Then `z` belongs to the
enlargement of `b`. This shows that `s \ (w_1 ∪ ... ∪ w_n)` is contained in
`⋃ (b ∈ u \ {w_1, ... w_n}) (enlargement of b)`. The measure of the latter set is bounded by
`∑ (b ∈ u \ {w_1, ... w_n}) C * μ b` (by the doubling property of the measure), which is at most
`C ε`. Letting `ε` tend to `0` shows that `s` is almost everywhere covered by the family `u`.
For the real argument, the measure is only locally finite. Therefore, we implement the same
strategy, but locally restricted to balls on which the measure is finite. For this, we do not
use the whole family `t`, but a subfamily `t'` supported on small balls (which is possible since
the family is assumed to be fine at every point of `s`).
-/
classical
-- choose around each `x` a small ball on which the measure is finite
have : ∀ x, ∃ R, 0 < R ∧ R ≤ 1 ∧ μ (closedBall x (20 * R)) < ∞ := fun x ↦ by
refine ((eventually_le_nhds one_pos).and ?_).exists_gt
refine (tendsto_closedBall_smallSets x).comp ?_ (μ.finiteAt_nhds x).eventually
exact Continuous.tendsto' (by fun_prop) _ _ (mul_zero _)
choose R hR0 hR1 hRμ using this
-- we restrict to a subfamily `t'` of `t`, made of elements small enough to ensure that
-- they only see a finite part of the measure, and with a doubling property
let t' := { a ∈ t | r a ≤ R (c a) }
-- extract a disjoint subfamily `u` of `t'` thanks to the abstract Vitali covering theorem.
obtain ⟨u, ut', u_disj, hu⟩ : ∃ u ⊆ t',
u.PairwiseDisjoint B ∧ ∀ a ∈ t', ∃ b ∈ u, (B a ∩ B b).Nonempty ∧ r a ≤ 2 * r b := by
have A : ∀ a ∈ t', r a ≤ 1 := by
intro a ha
apply ha.2.trans (hR1 (c a))
have A' : ∀ a ∈ t', (B a).Nonempty :=
fun a hat' => Set.Nonempty.mono interior_subset (ht a hat'.1)
refine exists_disjoint_subfamily_covering_enlargement
B t' r 2 one_lt_two (fun a ha => ?_) 1 A A'
exact nonempty_closedBall.1 ((A' a ha).mono (hB a ha.1))
have ut : u ⊆ t := fun a hau => (ut' hau).1
-- As the space is second countable, the family is countable since all its sets have nonempty
-- interior.
have u_count : u.Countable := u_disj.countable_of_nonempty_interior fun a ha => ht a (ut ha)
-- the family `u` will be the desired family
refine ⟨u, fun a hat' => (ut' hat').1, u_count, u_disj, ?_⟩
-- it suffices to show that it covers almost all `s` locally around each point `x`.
refine measure_null_of_locally_null _ fun x _ => ?_
-- let `v` be the subfamily of `u` made of those sets intersecting the small ball `ball x (r x)`
let v := { a ∈ u | (B a ∩ ball x (R x)).Nonempty }
have vu : v ⊆ u := fun a ha => ha.1
-- they are all contained in a fixed ball of finite measure, thanks to our choice of `t'`
obtain ⟨K, μK, hK⟩ : ∃ K, μ (closedBall x K) < ∞ ∧
∀ a ∈ u, (B a ∩ ball x (R x)).Nonempty → B a ⊆ closedBall x K := by
have Idist_v : ∀ a ∈ v, dist (c a) x ≤ r a + R x := by
intro a hav
apply dist_le_add_of_nonempty_closedBall_inter_closedBall
refine hav.2.mono ?_
apply inter_subset_inter _ ball_subset_closedBall
exact hB a (ut (vu hav))
set R0 := sSup (r '' v) with R0_def
have R0_bdd : BddAbove (r '' v) := by
refine ⟨1, fun r' hr' => ?_⟩
rcases (mem_image _ _ _).1 hr' with ⟨b, hb, rfl⟩
exact le_trans (ut' (vu hb)).2 (hR1 (c b))
rcases le_total R0 (R x) with (H | H)
· refine ⟨20 * R x, hRμ x, fun a au hax => ?_⟩
refine (hB a (ut au)).trans ?_
apply closedBall_subset_closedBall'
have : r a ≤ R0 := le_csSup R0_bdd (mem_image_of_mem _ ⟨au, hax⟩)
linarith [Idist_v a ⟨au, hax⟩, hR0 x]
· have R0pos : 0 < R0 := (hR0 x).trans_le H
have vnonempty : v.Nonempty := by
by_contra h
rw [nonempty_iff_ne_empty, Classical.not_not] at h
rw [h, image_empty, Real.sSup_empty] at R0_def
exact lt_irrefl _ (R0pos.trans_le (le_of_eq R0_def))
obtain ⟨a, hav, R0a⟩ : ∃ a ∈ v, R0 / 2 < r a := by
obtain ⟨r', r'mem, hr'⟩ : ∃ r' ∈ r '' v, R0 / 2 < r' :=
exists_lt_of_lt_csSup (vnonempty.image _) (half_lt_self R0pos)
rcases (mem_image _ _ _).1 r'mem with ⟨a, hav, rfl⟩
exact ⟨a, hav, hr'⟩
refine ⟨8 * R0, ?_, ?_⟩
· apply lt_of_le_of_lt (measure_mono _) (hRμ (c a))
apply closedBall_subset_closedBall'
rw [dist_comm]
linarith [Idist_v a hav, (ut' (vu hav)).2]
· intro b bu hbx
refine (hB b (ut bu)).trans ?_
apply closedBall_subset_closedBall'
have : r b ≤ R0 := le_csSup R0_bdd (mem_image_of_mem _ ⟨bu, hbx⟩)
linarith [Idist_v b ⟨bu, hbx⟩]
-- we will show that, in `ball x (R x)`, almost all `s` is covered by the family `u`.
refine ⟨_ ∩ ball x (R x), inter_mem_nhdsWithin _ (ball_mem_nhds _ (hR0 _)),
nonpos_iff_eq_zero.mp (le_of_forall_gt_imp_ge_of_dense fun ε εpos => ?_)⟩
-- the elements of `v` are disjoint and all contained in a finite volume ball, hence the sum
-- of their measures is finite.
have I : (∑' a : v, μ (B a)) < ∞ := by
calc
(∑' a : v, μ (B a)) = μ (⋃ a ∈ v, B a) := by
rw [measure_biUnion (u_count.mono vu) _ fun a ha => (h't _ (vu.trans ut ha)).measurableSet]
exact u_disj.subset vu
_ ≤ μ (closedBall x K) := (measure_mono (iUnion₂_subset fun a ha => hK a (vu ha) ha.2))
_ < ∞ := μK
-- we can obtain a finite subfamily of `v`, such that the measures of the remaining elements
-- add up to an arbitrarily small number, say `ε / C`.
obtain ⟨w, hw⟩ : ∃ w : Finset v, (∑' a : { a // a ∉ w }, μ (B a)) < ε / C :=
haveI : 0 < ε / C := by
simp only [ENNReal.div_pos_iff, εpos.ne', ENNReal.coe_ne_top, Ne, not_false_iff,
and_self_iff]
((tendsto_order.1 (ENNReal.tendsto_tsum_compl_atTop_zero I.ne)).2 _ this).exists
-- main property: the points `z` of `s` which are not covered by `u` are contained in the
-- enlargements of the elements not in `w`.
have M : (s \ ⋃ a ∈ u, B a) ∩
ball x (R x) ⊆ ⋃ a : { a // a ∉ w }, closedBall (c a) (3 * r a) := by
intro z hz
set k := ⋃ (a : v) (_ : a ∈ w), B a
have k_closed : IsClosed k := isClosed_biUnion_finset fun i _ => h't _ (ut (vu i.2))
have z_notmem_k : z ∉ k := by
simp only [k, not_exists, exists_prop, mem_iUnion, forall_exists_index,
SetCoe.exists, not_and, exists_and_right]
intro b hbv _ h'z
have : z ∈ (s \ ⋃ a ∈ u, B a) ∩ ⋃ a ∈ u, B a :=
mem_inter (mem_of_mem_inter_left hz) (mem_biUnion (vu hbv) h'z)
simpa only [diff_inter_self]
-- since the elements of `w` are closed and finitely many, one can find a small ball around `z`
-- not intersecting them
have : ball x (R x) \ k ∈ 𝓝 z := by
apply IsOpen.mem_nhds (isOpen_ball.sdiff k_closed) _
exact (mem_diff _).2 ⟨mem_of_mem_inter_right hz, z_notmem_k⟩
obtain ⟨d, dpos, hd⟩ : ∃ d, 0 < d ∧ closedBall z d ⊆ ball x (R x) \ k :=
nhds_basis_closedBall.mem_iff.1 this
-- choose an element `a` of the family `t` contained in this small ball
obtain ⟨a, hat, ad, rfl⟩ : ∃ a ∈ t, r a ≤ min d (R z) ∧ c a = z :=
hf z ((mem_diff _).1 (mem_of_mem_inter_left hz)).1 (min d (R z)) (lt_min dpos (hR0 z))
have ax : B a ⊆ ball x (R x) := by
refine (hB a hat).trans ?_
refine Subset.trans ?_ (hd.trans Set.diff_subset)
exact closedBall_subset_closedBall (ad.trans (min_le_left _ _))
-- it intersects an element `b` of `u` with comparable diameter, by definition of `u`
obtain ⟨b, bu, ab, bdiam⟩ : ∃ b ∈ u, (B a ∩ B b).Nonempty ∧ r a ≤ 2 * r b :=
hu a ⟨hat, ad.trans (min_le_right _ _)⟩
have bv : b ∈ v := by
refine ⟨bu, ab.mono ?_⟩
rw [inter_comm]
exact inter_subset_inter_right _ ax
let b' : v := ⟨b, bv⟩
-- `b` cannot belong to `w`, as the elements of `w` do not intersect `closedBall z d`,
-- contrary to `b`
have b'_notmem_w : b' ∉ w := by
intro b'w
have b'k : B b' ⊆ k := @Finset.subset_set_biUnion_of_mem _ _ _ (fun y : v => B y) _ b'w
have : (ball x (R x) \ k ∩ k).Nonempty := by
apply ab.mono (inter_subset_inter _ b'k)
refine ((hB _ hat).trans ?_).trans hd
exact closedBall_subset_closedBall (ad.trans (min_le_left _ _))
simpa only [diff_inter_self, Set.not_nonempty_empty]
let b'' : { a // a ∉ w } := ⟨b', b'_notmem_w⟩
-- since `a` and `b` have comparable diameters, it follows that `z` belongs to the
-- enlargement of `b`
have zb : c a ∈ closedBall (c b) (3 * r b) := by
rcases ab with ⟨e, ⟨ea, eb⟩⟩
have A : dist (c a) e ≤ r a := mem_closedBall'.1 (hB a hat ea)
have B : dist e (c b) ≤ r b := mem_closedBall.1 (hB b (ut bu) eb)
simp only [mem_closedBall]
linarith only [dist_triangle (c a) e (c b), A, B, bdiam]
suffices H : closedBall (c b'') (3 * r b'')
⊆ ⋃ a : { a // a ∉ w }, closedBall (c a) (3 * r a) from H zb
exact subset_iUnion (fun a : { a // a ∉ w } => closedBall (c a) (3 * r a)) b''
-- now that we have proved our main inclusion, we can use it to estimate the measure of the points
-- in `ball x (r x)` not covered by `u`.
haveI : Countable v := (u_count.mono vu).to_subtype
calc
μ ((s \ ⋃ a ∈ u, B a) ∩ ball x (R x)) ≤ μ (⋃ a : { a // a ∉ w }, closedBall (c a) (3 * r a)) :=
measure_mono M
_ ≤ ∑' a : { a // a ∉ w }, μ (closedBall (c a) (3 * r a)) := measure_iUnion_le _
_ ≤ ∑' a : { a // a ∉ w }, C * μ (B a) := (ENNReal.tsum_le_tsum fun a => μB a (ut (vu a.1.2)))
_ = C * ∑' a : { a // a ∉ w }, μ (B a) := ENNReal.tsum_mul_left
_ ≤ C * (ε / C) := by gcongr
_ ≤ ε := ENNReal.mul_div_le
/-- Assume that around every point there are arbitrarily small scales at which the measure is
doubling. Then the set of closed sets `a` with nonempty interior contained in `closedBall x r` and
covering a fixed proportion `1/C` of the ball `closedBall x (3 * r)` forms a Vitali family.
This is essentially a restatement of the measurable Vitali theorem. -/
protected def vitaliFamily [PseudoMetricSpace α] [MeasurableSpace α] [OpensMeasurableSpace α]
[SecondCountableTopology α] (μ : Measure α) [IsLocallyFiniteMeasure μ] (C : ℝ≥0)
(h : ∀ x, ∃ᶠ r in 𝓝[>] 0, μ (closedBall x (3 * r)) ≤ C * μ (closedBall x r)) :
VitaliFamily μ where
setsAt x := { a | IsClosed a ∧ (interior a).Nonempty ∧
∃ r, a ⊆ closedBall x r ∧ μ (closedBall x (3 * r)) ≤ C * μ a }
measurableSet _ _ ha := ha.1.measurableSet
nonempty_interior _ _ ha := ha.2.1
nontrivial x ε εpos := by
obtain ⟨r, μr, rpos, rε⟩ :
∃ r, μ (closedBall x (3 * r)) ≤ C * μ (closedBall x r) ∧ r ∈ Ioc (0 : ℝ) ε :=
((h x).and_eventually (Ioc_mem_nhdsGT εpos)).exists
refine ⟨closedBall x r, ⟨isClosed_closedBall, ?_, ⟨r, Subset.rfl, μr⟩⟩,
closedBall_subset_closedBall rε⟩
exact (nonempty_ball.2 rpos).mono ball_subset_interior_closedBall
covering := by
intro s f fsubset ffine
let t : Set (ℝ × α × Set α) :=
{ p | p.2.2 ⊆ closedBall p.2.1 p.1 ∧ μ (closedBall p.2.1 (3 * p.1)) ≤ C * μ p.2.2 ∧
(interior p.2.2).Nonempty ∧ IsClosed p.2.2 ∧ p.2.2 ∈ f p.2.1 ∧ p.2.1 ∈ s }
have A : ∀ x ∈ s, ∀ ε : ℝ, ε > 0 → ∃ p, p ∈ t ∧ p.1 ≤ ε ∧ p.2.1 = x := by
intro x xs ε εpos
rcases ffine x xs ε εpos with ⟨a, ha, h'a⟩
rcases fsubset x xs ha with ⟨a_closed, a_int, ⟨r, ar, μr⟩⟩
refine ⟨⟨min r ε, x, a⟩, ⟨?_, ?_, a_int, a_closed, ha, xs⟩, min_le_right _ _, rfl⟩
· rcases min_cases r ε with (h' | h') <;> rwa [h'.1]
· apply le_trans ?_ μr
gcongr
apply min_le_left
rcases exists_disjoint_covering_ae μ s t C (fun p => p.1) (fun p => p.2.1) (fun p => p.2.2)
(fun p hp => hp.1) (fun p hp => hp.2.1) (fun p hp => hp.2.2.1) (fun p hp => hp.2.2.2.1) A
with ⟨t', t't, _, t'_disj, μt'⟩
refine ⟨(fun p : ℝ × α × Set α => p.2) '' t', ?_, ?_, ?_, ?_⟩
· rintro - ⟨q, hq, rfl⟩
exact (t't hq).2.2.2.2.2
· rintro p ⟨q, hq, rfl⟩ p' ⟨q', hq', rfl⟩ hqq'
exact t'_disj hq hq' (ne_of_apply_ne _ hqq')
· rintro - ⟨q, hq, rfl⟩
exact (t't hq).2.2.2.2.1
· convert μt' using 3
rw [biUnion_image]
end Vitali |
.lake/packages/mathlib/Mathlib/MeasureTheory/Covering/Differentiation.lean | import Mathlib.MeasureTheory.Covering.VitaliFamily
import Mathlib.MeasureTheory.Function.AEMeasurableOrder
import Mathlib.MeasureTheory.Integral.Average
import Mathlib.MeasureTheory.Measure.Decomposition.Lebesgue
import Mathlib.MeasureTheory.Measure.Regular
/-!
# Differentiation of measures
On a second countable metric space with a measure `μ`, consider a Vitali family (i.e., for each `x`
one has a family of sets shrinking to `x`, with a good behavior with respect to covering theorems).
Consider also another measure `ρ`. Then, for almost every `x`, the ratio `ρ a / μ a` converges when
`a` shrinks to `x` along the Vitali family, towards the Radon-Nikodym derivative of `ρ` with
respect to `μ`. This is the main theorem on differentiation of measures.
This theorem is proved in this file, under the name `VitaliFamily.ae_tendsto_rnDeriv`. Note that,
almost surely, `μ a` is eventually positive and finite (see
`VitaliFamily.ae_eventually_measure_pos` and `VitaliFamily.eventually_measure_lt_top`), so the
ratio really makes sense.
For concrete applications, one needs concrete instances of Vitali families, as provided for instance
by `Besicovitch.vitaliFamily` (for balls) or by `Vitali.vitaliFamily` (for doubling measures).
Specific applications to Lebesgue density points and the Lebesgue differentiation theorem are also
derived:
* `VitaliFamily.ae_tendsto_measure_inter_div` states that, for almost every point `x ∈ s`,
then `μ (s ∩ a) / μ a` tends to `1` as `a` shrinks to `x` along a Vitali family.
* `VitaliFamily.ae_tendsto_average_norm_sub` states that, for almost every point `x`, then the
average of `y ↦ ‖f y - f x‖` on `a` tends to `0` as `a` shrinks to `x` along a Vitali family.
## Sketch of proof
Let `v` be a Vitali family for `μ`. Assume for simplicity that `ρ` is absolutely continuous with
respect to `μ`, as the case of a singular measure is easier.
It is easy to see that a set `s` on which `liminf ρ a / μ a < q` satisfies `ρ s ≤ q * μ s`, by using
a disjoint subcovering provided by the definition of Vitali families. Similarly for the limsup.
It follows that a set on which `ρ a / μ a` oscillates has measure `0`, and therefore that
`ρ a / μ a` converges almost surely (`VitaliFamily.ae_tendsto_div`). Moreover, on a set where the
limit is close to a constant `c`, one gets `ρ s ∼ c μ s`, using again a covering lemma as above.
It follows that `ρ` is equal to `μ.withDensity (v.limRatio ρ x)`, where `v.limRatio ρ x` is the
limit of `ρ a / μ a` at `x` (which is well defined almost everywhere). By uniqueness of the
Radon-Nikodym derivative, one gets `v.limRatio ρ x = ρ.rnDeriv μ x` almost everywhere, completing
the proof.
There is a difficulty in this sketch: this argument works well when `v.limRatio ρ` is measurable,
but there is no guarantee that this is the case, especially if one doesn't make further assumptions
on the Vitali family. We use an indirect argument to show that `v.limRatio ρ` is always
almost everywhere measurable, again based on the disjoint subcovering argument
(see `VitaliFamily.exists_measurable_supersets_limRatio`), and then proceed as sketched above
but replacing `v.limRatio ρ` by a measurable version called `v.limRatioMeas ρ`.
## Counterexample
The standing assumption in this file is that spaces are second countable. Without this assumption,
measures may be zero locally but nonzero globally, which is not compatible with differentiation
theory (which deduces global information from local one). Here is an example displaying this
behavior.
Define a measure `μ` by `μ s = 0` if `s` is covered by countably many balls of radius `1`,
and `μ s = ∞` otherwise. This is indeed a countably additive measure, which is moreover
locally finite and doubling at small scales. It vanishes on every ball of radius `1`, so all the
quantities in differentiation theory (defined as ratios of measures as the radius tends to zero)
make no sense. However, the measure is not globally zero if the space is big enough.
## References
* [Herbert Federer, Geometric Measure Theory, Chapter 2.9][Federer1996]
-/
open MeasureTheory Metric Set Filter TopologicalSpace MeasureTheory.Measure
open scoped Filter ENNReal MeasureTheory NNReal Topology
variable {α : Type*} [PseudoMetricSpace α] {m0 : MeasurableSpace α} {μ : Measure α}
(v : VitaliFamily μ)
{E : Type*} [NormedAddCommGroup E]
namespace VitaliFamily
/-- The limit along a Vitali family of `ρ a / μ a` where it makes sense, and garbage otherwise.
Do *not* use this definition: it is only a temporary device to show that this ratio tends almost
everywhere to the Radon-Nikodym derivative. -/
noncomputable def limRatio (ρ : Measure α) (x : α) : ℝ≥0∞ :=
limUnder (v.filterAt x) fun a => ρ a / μ a
/-- For almost every point `x`, sufficiently small sets in a Vitali family around `x` have positive
measure. (This is a nontrivial result, following from the covering property of Vitali families). -/
theorem ae_eventually_measure_pos [SecondCountableTopology α] :
∀ᵐ x ∂μ, ∀ᶠ a in v.filterAt x, 0 < μ a := by
set s := {x | ¬∀ᶠ a in v.filterAt x, 0 < μ a} with hs
simp -zeta only [not_lt, not_eventually, nonpos_iff_eq_zero] at hs
change μ s = 0
let f : α → Set (Set α) := fun _ => {a | μ a = 0}
have h : v.FineSubfamilyOn f s := by
intro x hx ε εpos
rw [hs] at hx
simp only [frequently_filterAt_iff, gt_iff_lt, mem_setOf_eq] at hx
rcases hx ε εpos with ⟨a, a_sets, ax, μa⟩
exact ⟨a, ⟨a_sets, μa⟩, ax⟩
refine le_antisymm ?_ bot_le
calc
μ s ≤ ∑' x : h.index, μ (h.covering x) := h.measure_le_tsum
_ = ∑' x : h.index, 0 := by congr; ext1 x; exact h.covering_mem x.2
_ = 0 := by simp only [tsum_zero]
/-- For every point `x`, sufficiently small sets in a Vitali family around `x` have finite measure.
(This is a trivial result, following from the fact that the measure is locally finite). -/
theorem eventually_measure_lt_top [IsLocallyFiniteMeasure μ] (x : α) :
∀ᶠ a in v.filterAt x, μ a < ∞ :=
(μ.finiteAt_nhds x).eventually.filter_mono inf_le_left
/-- If two measures `ρ` and `ν` have, at every point of a set `s`, arbitrarily small sets in a
Vitali family satisfying `ρ a ≤ ν a`, then `ρ s ≤ ν s` if `ρ ≪ μ`. -/
theorem measure_le_of_frequently_le [SecondCountableTopology α] [BorelSpace α] {ρ : Measure α}
(ν : Measure α) [IsLocallyFiniteMeasure ν] (hρ : ρ ≪ μ) (s : Set α)
(hs : ∀ x ∈ s, ∃ᶠ a in v.filterAt x, ρ a ≤ ν a) : ρ s ≤ ν s := by
-- this follows from a covering argument using the sets satisfying `ρ a ≤ ν a`.
apply ENNReal.le_of_forall_pos_le_add fun ε εpos _ => ?_
obtain ⟨U, sU, U_open, νU⟩ : ∃ (U : Set α), s ⊆ U ∧ IsOpen U ∧ ν U ≤ ν s + ε :=
exists_isOpen_le_add s ν (ENNReal.coe_pos.2 εpos).ne'
let f : α → Set (Set α) := fun _ => {a | ρ a ≤ ν a ∧ a ⊆ U}
have h : v.FineSubfamilyOn f s := by
apply v.fineSubfamilyOn_of_frequently f s fun x hx => ?_
have :=
(hs x hx).and_eventually
((v.eventually_filterAt_mem_setsAt x).and
(v.eventually_filterAt_subset_of_nhds (U_open.mem_nhds (sU hx))))
apply Frequently.mono this
rintro a ⟨ρa, _, aU⟩
exact ⟨ρa, aU⟩
haveI : Encodable h.index := h.index_countable.toEncodable
calc
ρ s ≤ ∑' x : h.index, ρ (h.covering x) := h.measure_le_tsum_of_absolutelyContinuous hρ
_ ≤ ∑' x : h.index, ν (h.covering x) := ENNReal.tsum_le_tsum fun x => (h.covering_mem x.2).1
_ = ν (⋃ x : h.index, h.covering x) := by
rw [measure_iUnion h.covering_disjoint_subtype fun i => h.measurableSet_u i.2]
_ ≤ ν U := (measure_mono (iUnion_subset fun i => (h.covering_mem i.2).2))
_ ≤ ν s + ε := νU
theorem eventually_filterAt_integrableOn (x : α) {f : α → E} (hf : LocallyIntegrable f μ) :
∀ᶠ a in v.filterAt x, IntegrableOn f a μ := by
rcases hf x with ⟨w, w_nhds, hw⟩
filter_upwards [v.eventually_filterAt_subset_of_nhds w_nhds] with a ha
exact hw.mono_set ha
section
variable [SecondCountableTopology α] [BorelSpace α] [IsLocallyFiniteMeasure μ] {ρ : Measure α}
[IsLocallyFiniteMeasure ρ]
/-- If a measure `ρ` is singular with respect to `μ`, then for `μ` almost every `x`, the ratio
`ρ a / μ a` tends to zero when `a` shrinks to `x` along the Vitali family. This makes sense
as `μ a` is eventually positive by `ae_eventually_measure_pos`. -/
theorem ae_eventually_measure_zero_of_singular (hρ : ρ ⟂ₘ μ) :
∀ᵐ x ∂μ, Tendsto (fun a => ρ a / μ a) (v.filterAt x) (𝓝 0) := by
have A : ∀ ε > (0 : ℝ≥0), ∀ᵐ x ∂μ, ∀ᶠ a in v.filterAt x, ρ a < ε * μ a := by
intro ε εpos
set s := {x | ¬∀ᶠ a in v.filterAt x, ρ a < ε * μ a} with hs
change μ s = 0
obtain ⟨o, _, ρo, μo⟩ : ∃ o : Set α, MeasurableSet o ∧ ρ o = 0 ∧ μ oᶜ = 0 := hρ
apply le_antisymm _ bot_le
calc
μ s ≤ μ (s ∩ o ∪ oᶜ) := by
conv_lhs => rw [← inter_union_compl s o]
gcongr
apply inter_subset_right
_ ≤ μ (s ∩ o) + μ oᶜ := measure_union_le _ _
_ = μ (s ∩ o) := by rw [μo, add_zero]
_ = (ε : ℝ≥0∞)⁻¹ * (ε • μ) (s ∩ o) := by
simp only [coe_nnreal_smul_apply, ← mul_assoc, mul_comm _ (ε : ℝ≥0∞)]
rw [ENNReal.mul_inv_cancel (ENNReal.coe_pos.2 εpos).ne' ENNReal.coe_ne_top, one_mul]
_ ≤ (ε : ℝ≥0∞)⁻¹ * ρ (s ∩ o) := by
gcongr
refine v.measure_le_of_frequently_le ρ smul_absolutelyContinuous _ ?_
intro x hx
rw [hs] at hx
simp only [mem_inter_iff, not_lt, not_eventually, mem_setOf_eq] at hx
exact hx.1
_ ≤ (ε : ℝ≥0∞)⁻¹ * ρ o := by gcongr; apply inter_subset_right
_ = 0 := by rw [ρo, mul_zero]
obtain ⟨u, _, u_pos, u_lim⟩ :
∃ u : ℕ → ℝ≥0, StrictAnti u ∧ (∀ n : ℕ, 0 < u n) ∧ Tendsto u atTop (𝓝 0) :=
exists_seq_strictAnti_tendsto (0 : ℝ≥0)
have B : ∀ᵐ x ∂μ, ∀ n, ∀ᶠ a in v.filterAt x, ρ a < u n * μ a :=
ae_all_iff.2 fun n => A (u n) (u_pos n)
filter_upwards [B, v.ae_eventually_measure_pos]
intro x hx h'x
refine tendsto_order.2 ⟨fun z hz => (ENNReal.not_lt_zero hz).elim, fun z hz => ?_⟩
obtain ⟨w, w_pos, w_lt⟩ : ∃ w : ℝ≥0, (0 : ℝ≥0∞) < w ∧ (w : ℝ≥0∞) < z :=
ENNReal.lt_iff_exists_nnreal_btwn.1 hz
obtain ⟨n, hn⟩ : ∃ n, u n < w := ((tendsto_order.1 u_lim).2 w (ENNReal.coe_pos.1 w_pos)).exists
filter_upwards [hx n, h'x, v.eventually_measure_lt_top x]
intro a ha μa_pos μa_lt_top
grw [ENNReal.div_lt_iff (.inl μa_pos.ne') (.inl μa_lt_top.ne), ha, hn]
gcongr
exact μa_lt_top.ne
section AbsolutelyContinuous
variable (hρ : ρ ≪ μ)
include hρ
/-- A set of points `s` satisfying both `ρ a ≤ c * μ a` and `ρ a ≥ d * μ a` at arbitrarily small
sets in a Vitali family has measure `0` if `c < d`. Indeed, the first inequality should imply
that `ρ s ≤ c * μ s`, and the second one that `ρ s ≥ d * μ s`, a contradiction if `0 < μ s`. -/
theorem null_of_frequently_le_of_frequently_ge {c d : ℝ≥0} (hcd : c < d) (s : Set α)
(hc : ∀ x ∈ s, ∃ᶠ a in v.filterAt x, ρ a ≤ c * μ a)
(hd : ∀ x ∈ s, ∃ᶠ a in v.filterAt x, (d : ℝ≥0∞) * μ a ≤ ρ a) : μ s = 0 := by
apply measure_null_of_locally_null s fun x _ => ?_
obtain ⟨o, xo, o_open, μo⟩ : ∃ o : Set α, x ∈ o ∧ IsOpen o ∧ μ o < ∞ :=
Measure.exists_isOpen_measure_lt_top μ x
refine ⟨s ∩ o, inter_mem_nhdsWithin _ (o_open.mem_nhds xo), ?_⟩
let s' := s ∩ o
by_contra h
apply lt_irrefl (ρ s')
calc
ρ s' ≤ c * μ s' := v.measure_le_of_frequently_le (c • μ) hρ s' fun x hx => hc x hx.1
_ < d * μ s' := by
apply (ENNReal.mul_lt_mul_right h _).2 (ENNReal.coe_lt_coe.2 hcd)
exact (lt_of_le_of_lt (measure_mono inter_subset_right) μo).ne
_ ≤ ρ s' := v.measure_le_of_frequently_le ρ smul_absolutelyContinuous s' fun x hx ↦ hd x hx.1
/-- If `ρ` is absolutely continuous with respect to `μ`, then for almost every `x`,
the ratio `ρ a / μ a` converges as `a` shrinks to `x` along a Vitali family for `μ`. -/
theorem ae_tendsto_div : ∀ᵐ x ∂μ, ∃ c, Tendsto (fun a => ρ a / μ a) (v.filterAt x) (𝓝 c) := by
obtain ⟨w, w_count, w_dense, _, w_top⟩ :
∃ w : Set ℝ≥0∞, w.Countable ∧ Dense w ∧ 0 ∉ w ∧ ∞ ∉ w :=
ENNReal.exists_countable_dense_no_zero_top
have I : ∀ x ∈ w, x ≠ ∞ := fun x xs hx => w_top (hx ▸ xs)
have A : ∀ c ∈ w, ∀ d ∈ w, c < d → ∀ᵐ x ∂μ,
¬((∃ᶠ a in v.filterAt x, ρ a / μ a < c) ∧ ∃ᶠ a in v.filterAt x, d < ρ a / μ a) := by
intro c hc d hd hcd
lift c to ℝ≥0 using I c hc
lift d to ℝ≥0 using I d hd
apply v.null_of_frequently_le_of_frequently_ge hρ (ENNReal.coe_lt_coe.1 hcd)
· simp only [and_imp, exists_prop, not_frequently, not_and, not_lt, not_le, not_eventually,
mem_setOf_eq, mem_compl_iff, not_forall]
intro x h1x _
apply h1x.mono fun a ha => ?_
refine (ENNReal.div_le_iff_le_mul ?_ (Or.inr (bot_le.trans_lt ha).ne')).1 ha.le
simp only [ENNReal.coe_ne_top, Ne, or_true, not_false_iff]
· simp only [and_imp, exists_prop, not_frequently, not_and, not_lt, not_le, not_eventually,
mem_setOf_eq, mem_compl_iff, not_forall]
intro x _ h2x
apply h2x.mono fun a ha => ?_
exact ENNReal.mul_le_of_le_div ha.le
have B : ∀ᵐ x ∂μ, ∀ c ∈ w, ∀ d ∈ w, c < d →
¬((∃ᶠ a in v.filterAt x, ρ a / μ a < c) ∧ ∃ᶠ a in v.filterAt x, d < ρ a / μ a) := by
simpa only [ae_ball_iff w_count, ae_all_iff]
filter_upwards [B]
intro x hx
exact tendsto_of_no_upcrossings w_dense hx
theorem ae_tendsto_limRatio :
∀ᵐ x ∂μ, Tendsto (fun a => ρ a / μ a) (v.filterAt x) (𝓝 (v.limRatio ρ x)) := by
filter_upwards [v.ae_tendsto_div hρ]
intro x hx
exact tendsto_nhds_limUnder hx
/-- Given two thresholds `p < q`, the sets `{x | v.limRatio ρ x < p}`
and `{x | q < v.limRatio ρ x}` are obviously disjoint. The key to proving that `v.limRatio ρ` is
almost everywhere measurable is to show that these sets have measurable supersets which are also
disjoint, up to zero measure. This is the content of this lemma. -/
theorem exists_measurable_supersets_limRatio {p q : ℝ≥0} (hpq : p < q) :
∃ a b, MeasurableSet a ∧ MeasurableSet b ∧
{x | v.limRatio ρ x < p} ⊆ a ∧ {x | (q : ℝ≥0∞) < v.limRatio ρ x} ⊆ b ∧ μ (a ∩ b) = 0 := by
/- Here is a rough sketch, assuming that the measure is finite and the limit is well defined
everywhere. Let `u := {x | v.limRatio ρ x < p}` and `w := {x | q < v.limRatio ρ x}`. They
have measurable supersets `u'` and `w'` of the same measure. We will show that these satisfy
the conclusion of the theorem, i.e., `μ (u' ∩ w') = 0`. For this, note that
`ρ (u' ∩ w') = ρ (u ∩ w')` (as `w'` is measurable, see `measure_toMeasurable_add_inter_left`).
The latter set is included in the set where the limit of the ratios is `< p`, and therefore
its measure is `≤ p * μ (u ∩ w')`. Using the same trick in the other direction gives that this
is `p * μ (u' ∩ w')`. We have shown that `ρ (u' ∩ w') ≤ p * μ (u' ∩ w')`. Arguing in the same
way but using the `w` part gives `q * μ (u' ∩ w') ≤ ρ (u' ∩ w')`. If `μ (u' ∩ w')` were nonzero,
this would be a contradiction as `p < q`.
For the rigorous proof, we need to work on a part of the space where the measure is finite
(provided by `spanningSets (ρ + μ)`) and to restrict to the set where the limit is well defined
(called `s` below, of full measure). Otherwise, the argument goes through.
-/
let s := {x | ∃ c, Tendsto (fun a => ρ a / μ a) (v.filterAt x) (𝓝 c)}
let o : ℕ → Set α := spanningSets (ρ + μ)
let u n := s ∩ {x | v.limRatio ρ x < p} ∩ o n
let w n := s ∩ {x | (q : ℝ≥0∞) < v.limRatio ρ x} ∩ o n
-- the supersets are obtained by restricting to the set `s` where the limit is well defined, to
-- a finite measure part `o n`, taking a measurable superset here, and then taking the union over
-- `n`.
refine
⟨toMeasurable μ sᶜ ∪ ⋃ n, toMeasurable (ρ + μ) (u n),
toMeasurable μ sᶜ ∪ ⋃ n, toMeasurable (ρ + μ) (w n), ?_, ?_, ?_, ?_, ?_⟩
-- check that these sets are measurable supersets as required
· exact
(measurableSet_toMeasurable _ _).union
(MeasurableSet.iUnion fun n => measurableSet_toMeasurable _ _)
· exact
(measurableSet_toMeasurable _ _).union
(MeasurableSet.iUnion fun n => measurableSet_toMeasurable _ _)
· intro x hx
by_cases h : x ∈ s
· refine Or.inr (mem_iUnion.2 ⟨spanningSetsIndex (ρ + μ) x, ?_⟩)
exact subset_toMeasurable _ _ ⟨⟨h, hx⟩, mem_spanningSetsIndex _ _⟩
· exact Or.inl (subset_toMeasurable μ sᶜ h)
· intro x hx
by_cases h : x ∈ s
· refine Or.inr (mem_iUnion.2 ⟨spanningSetsIndex (ρ + μ) x, ?_⟩)
exact subset_toMeasurable _ _ ⟨⟨h, hx⟩, mem_spanningSetsIndex _ _⟩
· exact Or.inl (subset_toMeasurable μ sᶜ h)
-- it remains to check the nontrivial part that these sets have zero measure intersection.
-- it suffices to do it for fixed `m` and `n`, as one is taking countable unions.
suffices H : ∀ m n : ℕ, μ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) = 0 by
have A :
(toMeasurable μ sᶜ ∪ ⋃ n, toMeasurable (ρ + μ) (u n)) ∩
(toMeasurable μ sᶜ ∪ ⋃ n, toMeasurable (ρ + μ) (w n)) ⊆
toMeasurable μ sᶜ ∪
⋃ (m) (n), toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n) := by
simp only [inter_union_distrib_left, union_inter_distrib_right, true_and,
subset_union_left, union_subset_iff, inter_self]
refine ⟨?_, ?_, ?_⟩
· exact inter_subset_right.trans subset_union_left
· exact inter_subset_left.trans subset_union_left
· simp_rw [iUnion_inter, inter_iUnion]; exact subset_union_right
refine le_antisymm ((measure_mono A).trans ?_) bot_le
calc
μ (toMeasurable μ sᶜ ∪
⋃ (m) (n), toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) ≤
μ (toMeasurable μ sᶜ) +
μ (⋃ (m) (n), toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) :=
measure_union_le _ _
_ = μ (⋃ (m) (n), toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) := by
have : μ sᶜ = 0 := v.ae_tendsto_div hρ; rw [measure_toMeasurable, this, zero_add]
_ ≤ ∑' (m) (n), μ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) :=
((measure_iUnion_le _).trans (ENNReal.tsum_le_tsum fun m => measure_iUnion_le _))
_ = 0 := by simp only [H, tsum_zero]
-- now starts the nontrivial part of the argument. We fix `m` and `n`, and show that the
-- measurable supersets of `u m` and `w n` have zero measure intersection by using the lemmas
-- `measure_toMeasurable_add_inter_left` (to reduce to `u m` or `w n` instead of the measurable
-- superset) and `measure_le_of_frequently_le` to compare their measures for `ρ` and `μ`.
intro m n
have I : (ρ + μ) (u m) ≠ ∞ := by
apply (lt_of_le_of_lt (measure_mono _) (measure_spanningSets_lt_top (ρ + μ) m)).ne
exact inter_subset_right
have J : (ρ + μ) (w n) ≠ ∞ := by
apply (lt_of_le_of_lt (measure_mono _) (measure_spanningSets_lt_top (ρ + μ) n)).ne
exact inter_subset_right
have A :
ρ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) ≤
p * μ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) :=
calc
ρ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) =
ρ (u m ∩ toMeasurable (ρ + μ) (w n)) :=
measure_toMeasurable_add_inter_left (measurableSet_toMeasurable _ _) I
_ ≤ (p • μ) (u m ∩ toMeasurable (ρ + μ) (w n)) := by
refine v.measure_le_of_frequently_le (p • μ) hρ _ fun x hx => ?_
have L : Tendsto (fun a : Set α => ρ a / μ a) (v.filterAt x) (𝓝 (v.limRatio ρ x)) :=
tendsto_nhds_limUnder hx.1.1.1
have I : ∀ᶠ b : Set α in v.filterAt x, ρ b / μ b < p := (tendsto_order.1 L).2 _ hx.1.1.2
apply I.frequently.mono fun a ha => ?_
rw [coe_nnreal_smul_apply]
refine (ENNReal.div_le_iff_le_mul ?_ (Or.inr (bot_le.trans_lt ha).ne')).1 ha.le
simp only [ENNReal.coe_ne_top, Ne, or_true, not_false_iff]
_ = p * μ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) := by
simp only [coe_nnreal_smul_apply,
measure_toMeasurable_add_inter_right (measurableSet_toMeasurable _ _) I]
have B :
(q : ℝ≥0∞) * μ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) ≤
ρ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) :=
calc
(q : ℝ≥0∞) * μ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) =
(q : ℝ≥0∞) * μ (toMeasurable (ρ + μ) (u m) ∩ w n) := by
conv_rhs => rw [inter_comm]
rw [inter_comm, measure_toMeasurable_add_inter_right (measurableSet_toMeasurable _ _) J]
_ ≤ ρ (toMeasurable (ρ + μ) (u m) ∩ w n) := by
rw [← coe_nnreal_smul_apply]
refine v.measure_le_of_frequently_le _ (.smul_left .rfl _) _ ?_
intro x hx
have L : Tendsto (fun a : Set α => ρ a / μ a) (v.filterAt x) (𝓝 (v.limRatio ρ x)) :=
tendsto_nhds_limUnder hx.2.1.1
have I : ∀ᶠ b : Set α in v.filterAt x, (q : ℝ≥0∞) < ρ b / μ b :=
(tendsto_order.1 L).1 _ hx.2.1.2
apply I.frequently.mono fun a ha => ?_
rw [coe_nnreal_smul_apply]
exact ENNReal.mul_le_of_le_div ha.le
_ = ρ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) := by
conv_rhs => rw [inter_comm]
rw [inter_comm]
exact (measure_toMeasurable_add_inter_left (measurableSet_toMeasurable _ _) J).symm
by_contra h
apply lt_irrefl (ρ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)))
calc
ρ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) ≤
p * μ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) :=
A
_ < q * μ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) := by
gcongr
suffices H : (ρ + μ) (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) ≠ ∞ by
simp only [not_or, ENNReal.add_eq_top, Pi.add_apply, Ne, coe_add] at H
exact H.2
apply (lt_of_le_of_lt (measure_mono inter_subset_left) _).ne
rw [measure_toMeasurable]
apply lt_of_le_of_lt (measure_mono _) (measure_spanningSets_lt_top (ρ + μ) m)
exact inter_subset_right
_ ≤ ρ (toMeasurable (ρ + μ) (u m) ∩ toMeasurable (ρ + μ) (w n)) := B
theorem aemeasurable_limRatio : AEMeasurable (v.limRatio ρ) μ := by
apply ENNReal.aemeasurable_of_exist_almost_disjoint_supersets _ _ fun p q hpq => ?_
exact v.exists_measurable_supersets_limRatio hρ hpq
/-- A measurable version of `v.limRatio ρ`. Do *not* use this definition: it is only a temporary
device to show that `v.limRatio` is almost everywhere equal to the Radon-Nikodym derivative. -/
noncomputable def limRatioMeas : α → ℝ≥0∞ :=
(v.aemeasurable_limRatio hρ).mk _
theorem limRatioMeas_measurable : Measurable (v.limRatioMeas hρ) :=
AEMeasurable.measurable_mk _
theorem ae_tendsto_limRatioMeas :
∀ᵐ x ∂μ, Tendsto (fun a => ρ a / μ a) (v.filterAt x) (𝓝 (v.limRatioMeas hρ x)) := by
filter_upwards [v.ae_tendsto_limRatio hρ, AEMeasurable.ae_eq_mk (v.aemeasurable_limRatio hρ)]
intro x hx h'x
rwa [h'x] at hx
/-- If, for all `x` in a set `s`, one has frequently `ρ a / μ a < p`, then `ρ s ≤ p * μ s`, as
proved in `measure_le_of_frequently_le`. Since `ρ a / μ a` tends almost everywhere to
`v.limRatioMeas hρ x`, the same property holds for sets `s` on which `v.limRatioMeas hρ < p`. -/
theorem measure_le_mul_of_subset_limRatioMeas_lt {p : ℝ≥0} {s : Set α}
(h : s ⊆ {x | v.limRatioMeas hρ x < p}) : ρ s ≤ p * μ s := by
let t := {x : α | Tendsto (fun a => ρ a / μ a) (v.filterAt x) (𝓝 (v.limRatioMeas hρ x))}
have A : μ tᶜ = 0 := v.ae_tendsto_limRatioMeas hρ
suffices H : ρ (s ∩ t) ≤ (p • μ) (s ∩ t) by calc
ρ s = ρ (s ∩ t ∪ s ∩ tᶜ) := by rw [inter_union_compl]
_ ≤ ρ (s ∩ t) + ρ (s ∩ tᶜ) := measure_union_le _ _
_ ≤ (p • μ) (s ∩ t) + ρ tᶜ := by gcongr; apply inter_subset_right
_ ≤ p * μ (s ∩ t) := by simp [(hρ A)]
_ ≤ p * μ s := by gcongr; apply inter_subset_left
refine v.measure_le_of_frequently_le (p • μ) hρ _ fun x hx => ?_
have I : ∀ᶠ b : Set α in v.filterAt x, ρ b / μ b < p := (tendsto_order.1 hx.2).2 _ (h hx.1)
apply I.frequently.mono fun a ha => ?_
rw [coe_nnreal_smul_apply]
refine (ENNReal.div_le_iff_le_mul ?_ (Or.inr (bot_le.trans_lt ha).ne')).1 ha.le
simp only [ENNReal.coe_ne_top, Ne, or_true, not_false_iff]
/-- If, for all `x` in a set `s`, one has frequently `q < ρ a / μ a`, then `q * μ s ≤ ρ s`, as
proved in `measure_le_of_frequently_le`. Since `ρ a / μ a` tends almost everywhere to
`v.limRatioMeas hρ x`, the same property holds for sets `s` on which `q < v.limRatioMeas hρ`. -/
theorem mul_measure_le_of_subset_lt_limRatioMeas {q : ℝ≥0} {s : Set α}
(h : s ⊆ {x | (q : ℝ≥0∞) < v.limRatioMeas hρ x}) : (q : ℝ≥0∞) * μ s ≤ ρ s := by
let t := {x : α | Tendsto (fun a => ρ a / μ a) (v.filterAt x) (𝓝 (v.limRatioMeas hρ x))}
have A : μ tᶜ = 0 := v.ae_tendsto_limRatioMeas hρ
suffices H : (q • μ) (s ∩ t) ≤ ρ (s ∩ t) by calc
(q • μ) s = (q • μ) (s ∩ t ∪ s ∩ tᶜ) := by rw [inter_union_compl]
_ ≤ (q • μ) (s ∩ t) + (q • μ) (s ∩ tᶜ) := measure_union_le _ _
_ ≤ ρ (s ∩ t) + (q • μ) tᶜ := by gcongr; apply inter_subset_right
_ = ρ (s ∩ t) := by simp [A]
_ ≤ ρ s := by gcongr; apply inter_subset_left
refine v.measure_le_of_frequently_le _ (.smul_left .rfl _) _ ?_
intro x hx
have I : ∀ᶠ a in v.filterAt x, (q : ℝ≥0∞) < ρ a / μ a := (tendsto_order.1 hx.2).1 _ (h hx.1)
apply I.frequently.mono fun a ha => ?_
rw [coe_nnreal_smul_apply]
exact ENNReal.mul_le_of_le_div ha.le
/-- The points with `v.limRatioMeas hρ x = ∞` have measure `0` for `μ`. -/
theorem measure_limRatioMeas_top : μ {x | v.limRatioMeas hρ x = ∞} = 0 := by
refine measure_null_of_locally_null _ fun x _ => ?_
obtain ⟨o, xo, o_open, μo⟩ : ∃ o : Set α, x ∈ o ∧ IsOpen o ∧ ρ o < ∞ :=
Measure.exists_isOpen_measure_lt_top ρ x
let s := {x : α | v.limRatioMeas hρ x = ∞} ∩ o
refine ⟨s, inter_mem_nhdsWithin _ (o_open.mem_nhds xo), le_antisymm ?_ bot_le⟩
have ρs : ρ s ≠ ∞ := ((measure_mono inter_subset_right).trans_lt μo).ne
have A : ∀ q : ℝ≥0, 1 ≤ q → μ s ≤ (q : ℝ≥0∞)⁻¹ * ρ s := by
intro q hq
rw [mul_comm, ← div_eq_mul_inv, ENNReal.le_div_iff_mul_le _ (Or.inr ρs), mul_comm]
· apply v.mul_measure_le_of_subset_lt_limRatioMeas hρ
intro y hy
have : v.limRatioMeas hρ y = ∞ := hy.1
simp only [this, ENNReal.coe_lt_top, mem_setOf_eq]
· simp only [(zero_lt_one.trans_le hq).ne', true_or, ENNReal.coe_eq_zero, Ne,
not_false_iff]
have B : Tendsto (fun q : ℝ≥0 => (q : ℝ≥0∞)⁻¹ * ρ s) atTop (𝓝 (∞⁻¹ * ρ s)) := by
apply ENNReal.Tendsto.mul_const _ (Or.inr ρs)
exact ENNReal.tendsto_inv_iff.2 (ENNReal.tendsto_coe_nhds_top.2 tendsto_id)
simp only [zero_mul, ENNReal.inv_top] at B
apply ge_of_tendsto B
exact eventually_atTop.2 ⟨1, A⟩
/-- The points with `v.limRatioMeas hρ x = 0` have measure `0` for `ρ`. -/
theorem measure_limRatioMeas_zero : ρ {x | v.limRatioMeas hρ x = 0} = 0 := by
refine measure_null_of_locally_null _ fun x _ => ?_
obtain ⟨o, xo, o_open, μo⟩ : ∃ o : Set α, x ∈ o ∧ IsOpen o ∧ μ o < ∞ :=
Measure.exists_isOpen_measure_lt_top μ x
let s := {x : α | v.limRatioMeas hρ x = 0} ∩ o
refine ⟨s, inter_mem_nhdsWithin _ (o_open.mem_nhds xo), le_antisymm ?_ bot_le⟩
have μs : μ s ≠ ∞ := ((measure_mono inter_subset_right).trans_lt μo).ne
have A : ∀ q : ℝ≥0, 0 < q → ρ s ≤ q * μ s := by
intro q hq
apply v.measure_le_mul_of_subset_limRatioMeas_lt hρ
intro y hy
have : v.limRatioMeas hρ y = 0 := hy.1
simp only [this, mem_setOf_eq, hq, ENNReal.coe_pos]
have B : Tendsto (fun q : ℝ≥0 => (q : ℝ≥0∞) * μ s) (𝓝[>] (0 : ℝ≥0)) (𝓝 ((0 : ℝ≥0) * μ s)) := by
apply ENNReal.Tendsto.mul_const _ (Or.inr μs)
rw [ENNReal.tendsto_coe]
exact nhdsWithin_le_nhds
simp only [zero_mul, ENNReal.coe_zero] at B
apply ge_of_tendsto B
filter_upwards [self_mem_nhdsWithin] using A
/-- As an intermediate step to show that `μ.withDensity (v.limRatioMeas hρ) = ρ`, we show here
that `μ.withDensity (v.limRatioMeas hρ) ≤ t^2 ρ` for any `t > 1`. -/
theorem withDensity_le_mul {s : Set α} (hs : MeasurableSet s) {t : ℝ≥0} (ht : 1 < t) :
μ.withDensity (v.limRatioMeas hρ) s ≤ (t : ℝ≥0∞) ^ 2 * ρ s := by
/- We cut `s` into the sets where `v.limRatioMeas hρ = 0`, where `v.limRatioMeas hρ = ∞`, and
where `v.limRatioMeas hρ ∈ [t^n, t^(n+1))` for `n : ℤ`. The first and second have measure `0`.
For the latter, since `v.limRatioMeas hρ` fluctuates by at most `t` on this slice, we can use
`measure_le_mul_of_subset_limRatioMeas_lt` and `mul_measure_le_of_subset_lt_limRatioMeas` to
show that the two measures are comparable up to `t` (in fact `t^2` for technical reasons of
strict inequalities). -/
have t_ne_zero' : t ≠ 0 := (zero_lt_one.trans ht).ne'
have t_ne_zero : (t : ℝ≥0∞) ≠ 0 := by simpa only [ENNReal.coe_eq_zero, Ne] using t_ne_zero'
let ν := μ.withDensity (v.limRatioMeas hρ)
let f := v.limRatioMeas hρ
have f_meas : Measurable f := v.limRatioMeas_measurable hρ
-- Note(kmill): smul elaborator when used for CoeFun fails to get CoeFun instance to trigger
-- unless you use the `(... :)` notation. Another fix is using `(2 : Nat)`, so this appears
-- to be an unpleasant interaction with default instances.
have A : ν (s ∩ f ⁻¹' {0}) ≤ ((t : ℝ≥0∞) ^ 2 • ρ :) (s ∩ f ⁻¹' {0}) := by
apply le_trans _ (zero_le _)
have M : MeasurableSet (s ∩ f ⁻¹' {0}) := hs.inter (f_meas (measurableSet_singleton _))
simp only [f, ν, nonpos_iff_eq_zero, M, withDensity_apply, lintegral_eq_zero_iff f_meas]
apply (ae_restrict_iff' M).2
exact Eventually.of_forall fun x hx => hx.2
have B : ν (s ∩ f ⁻¹' {∞}) ≤ ((t : ℝ≥0∞) ^ 2 • ρ :) (s ∩ f ⁻¹' {∞}) := by
apply le_trans (le_of_eq _) (zero_le _)
apply withDensity_absolutelyContinuous μ _
rw [← nonpos_iff_eq_zero]
exact (measure_mono inter_subset_right).trans (v.measure_limRatioMeas_top hρ).le
have C :
∀ n : ℤ,
ν (s ∩ f ⁻¹' Ico ((t : ℝ≥0∞) ^ n) ((t : ℝ≥0∞) ^ (n + 1))) ≤
((t : ℝ≥0∞) ^ 2 • ρ :) (s ∩ f ⁻¹' Ico ((t : ℝ≥0∞) ^ n) ((t : ℝ≥0∞) ^ (n + 1))) := by
intro n
let I := Ico ((t : ℝ≥0∞) ^ n) ((t : ℝ≥0∞) ^ (n + 1))
have M : MeasurableSet (s ∩ f ⁻¹' I) := hs.inter (f_meas measurableSet_Ico)
simp only [ν, I, M, withDensity_apply]
calc
(∫⁻ x in s ∩ f ⁻¹' I, f x ∂μ) ≤ ∫⁻ _ in s ∩ f ⁻¹' I, (t : ℝ≥0∞) ^ (n + 1) ∂μ :=
lintegral_mono_ae ((ae_restrict_iff' M).2 (Eventually.of_forall fun x hx => hx.2.2.le))
_ = (t : ℝ≥0∞) ^ (n + 1) * μ (s ∩ f ⁻¹' I) := by
simp only [lintegral_const, MeasurableSet.univ, Measure.restrict_apply, univ_inter]
_ = (t : ℝ≥0∞) ^ (2 : ℤ) * ((t : ℝ≥0∞) ^ (n - 1) * μ (s ∩ f ⁻¹' I)) := by
rw [← mul_assoc, ← ENNReal.zpow_add t_ne_zero ENNReal.coe_ne_top]
congr 2
abel
_ ≤ (t : ℝ≥0∞) ^ (2 : ℤ) * ρ (s ∩ f ⁻¹' I) := by
gcongr
rw [← ENNReal.coe_zpow (zero_lt_one.trans ht).ne']
apply v.mul_measure_le_of_subset_lt_limRatioMeas hρ
intro x hx
apply lt_of_lt_of_le _ hx.2.1
rw [← ENNReal.coe_zpow (zero_lt_one.trans ht).ne', ENNReal.coe_lt_coe, sub_eq_add_neg,
zpow_add₀ t_ne_zero']
conv_rhs => rw [← mul_one (t ^ n)]
gcongr
rw [zpow_neg_one]
exact inv_lt_one_of_one_lt₀ ht
calc
ν s =
ν (s ∩ f ⁻¹' {0}) + ν (s ∩ f ⁻¹' {∞}) +
∑' n : ℤ, ν (s ∩ f ⁻¹' Ico ((t : ℝ≥0∞) ^ n) ((t : ℝ≥0∞) ^ (n + 1))) :=
measure_eq_measure_preimage_add_measure_tsum_Ico_zpow ν f_meas hs ht
_ ≤
((t : ℝ≥0∞) ^ 2 • ρ :) (s ∩ f ⁻¹' {0}) + ((t : ℝ≥0∞) ^ 2 • ρ :) (s ∩ f ⁻¹' {∞}) +
∑' n : ℤ, ((t : ℝ≥0∞) ^ 2 • ρ :) (s ∩ f ⁻¹' Ico (t ^ n) (t ^ (n + 1))) :=
(add_le_add (add_le_add A B) (ENNReal.tsum_le_tsum C))
_ = ((t : ℝ≥0∞) ^ 2 • ρ :) s :=
(measure_eq_measure_preimage_add_measure_tsum_Ico_zpow ((t : ℝ≥0∞) ^ 2 • ρ) f_meas hs ht).symm
/-- As an intermediate step to show that `μ.withDensity (v.limRatioMeas hρ) = ρ`, we show here
that `ρ ≤ t μ.withDensity (v.limRatioMeas hρ)` for any `t > 1`. -/
theorem le_mul_withDensity {s : Set α} (hs : MeasurableSet s) {t : ℝ≥0} (ht : 1 < t) :
ρ s ≤ t * μ.withDensity (v.limRatioMeas hρ) s := by
/- We cut `s` into the sets where `v.limRatioMeas hρ = 0`, where `v.limRatioMeas hρ = ∞`, and
where `v.limRatioMeas hρ ∈ [t^n, t^(n+1))` for `n : ℤ`. The first and second have measure `0`.
For the latter, since `v.limRatioMeas hρ` fluctuates by at most `t` on this slice, we can use
`measure_le_mul_of_subset_limRatioMeas_lt` and `mul_measure_le_of_subset_lt_limRatioMeas` to
show that the two measures are comparable up to `t`. -/
have t_ne_zero' : t ≠ 0 := (zero_lt_one.trans ht).ne'
have t_ne_zero : (t : ℝ≥0∞) ≠ 0 := by simpa only [ENNReal.coe_eq_zero, Ne] using t_ne_zero'
let ν := μ.withDensity (v.limRatioMeas hρ)
let f := v.limRatioMeas hρ
have f_meas : Measurable f := v.limRatioMeas_measurable hρ
have A : ρ (s ∩ f ⁻¹' {0}) ≤ (t • ν) (s ∩ f ⁻¹' {0}) := by
refine le_trans (measure_mono inter_subset_right) (le_trans (le_of_eq ?_) (zero_le _))
exact v.measure_limRatioMeas_zero hρ
have B : ρ (s ∩ f ⁻¹' {∞}) ≤ (t • ν) (s ∩ f ⁻¹' {∞}) := by
apply le_trans (le_of_eq _) (zero_le _)
apply hρ
rw [← nonpos_iff_eq_zero]
exact (measure_mono inter_subset_right).trans (v.measure_limRatioMeas_top hρ).le
have C :
∀ n : ℤ,
ρ (s ∩ f ⁻¹' Ico ((t : ℝ≥0∞) ^ n) ((t : ℝ≥0∞) ^ (n + 1))) ≤
(t • ν) (s ∩ f ⁻¹' Ico ((t : ℝ≥0∞) ^ n) ((t : ℝ≥0∞) ^ (n + 1))) := by
intro n
let I := Ico ((t : ℝ≥0∞) ^ n) ((t : ℝ≥0∞) ^ (n + 1))
have M : MeasurableSet (s ∩ f ⁻¹' I) := hs.inter (f_meas measurableSet_Ico)
simp only [ν, I, M, withDensity_apply, coe_nnreal_smul_apply]
calc
ρ (s ∩ f ⁻¹' I) ≤ (t : ℝ≥0∞) ^ (n + 1) * μ (s ∩ f ⁻¹' I) := by
rw [← ENNReal.coe_zpow t_ne_zero']
apply v.measure_le_mul_of_subset_limRatioMeas_lt hρ
intro x hx
apply hx.2.2.trans_le (le_of_eq _)
rw [ENNReal.coe_zpow t_ne_zero']
_ = ∫⁻ _ in s ∩ f ⁻¹' I, (t : ℝ≥0∞) ^ (n + 1) ∂μ := by
simp only [lintegral_const, MeasurableSet.univ, Measure.restrict_apply, univ_inter]
_ ≤ ∫⁻ x in s ∩ f ⁻¹' I, t * f x ∂μ := by
apply lintegral_mono_ae ((ae_restrict_iff' M).2 (Eventually.of_forall fun x hx => ?_))
grw [add_comm, ENNReal.zpow_add t_ne_zero ENNReal.coe_ne_top, zpow_one, hx.2.1]
_ = t * ∫⁻ x in s ∩ f ⁻¹' I, f x ∂μ := lintegral_const_mul _ f_meas
calc
ρ s =
ρ (s ∩ f ⁻¹' {0}) + ρ (s ∩ f ⁻¹' {∞}) +
∑' n : ℤ, ρ (s ∩ f ⁻¹' Ico ((t : ℝ≥0∞) ^ n) ((t : ℝ≥0∞) ^ (n + 1))) :=
measure_eq_measure_preimage_add_measure_tsum_Ico_zpow ρ f_meas hs ht
_ ≤
(t • ν) (s ∩ f ⁻¹' {0}) + (t • ν) (s ∩ f ⁻¹' {∞}) +
∑' n : ℤ, (t • ν) (s ∩ f ⁻¹' Ico ((t : ℝ≥0∞) ^ n) ((t : ℝ≥0∞) ^ (n + 1))) :=
(add_le_add (add_le_add A B) (ENNReal.tsum_le_tsum C))
_ = (t • ν) s :=
(measure_eq_measure_preimage_add_measure_tsum_Ico_zpow (t • ν) f_meas hs ht).symm
theorem withDensity_limRatioMeas_eq : μ.withDensity (v.limRatioMeas hρ) = ρ := by
ext1 s hs
refine le_antisymm ?_ ?_
· have : Tendsto (fun t : ℝ≥0 =>
((t : ℝ≥0∞) ^ 2 * ρ s : ℝ≥0∞)) (𝓝[>] 1) (𝓝 ((1 : ℝ≥0∞) ^ 2 * ρ s)) := by
refine ENNReal.Tendsto.mul ?_ ?_ tendsto_const_nhds ?_
· exact ENNReal.Tendsto.pow (ENNReal.tendsto_coe.2 nhdsWithin_le_nhds)
· simp only [one_pow, true_or, Ne, not_false_iff, one_ne_zero]
· simp only [one_pow, Ne, or_true, ENNReal.one_ne_top, not_false_iff]
simp only [one_pow, one_mul] at this
refine ge_of_tendsto this ?_
filter_upwards [self_mem_nhdsWithin] with _ ht
exact v.withDensity_le_mul hρ hs ht
· have :
Tendsto (fun t : ℝ≥0 => (t : ℝ≥0∞) * μ.withDensity (v.limRatioMeas hρ) s) (𝓝[>] 1)
(𝓝 ((1 : ℝ≥0∞) * μ.withDensity (v.limRatioMeas hρ) s)) := by
refine ENNReal.Tendsto.mul_const (ENNReal.tendsto_coe.2 nhdsWithin_le_nhds) ?_
simp only [true_or, Ne, not_false_iff, one_ne_zero]
simp only [one_mul] at this
refine ge_of_tendsto this ?_
filter_upwards [self_mem_nhdsWithin] with _ ht
exact v.le_mul_withDensity hρ hs ht
/-- Weak version of the main theorem on differentiation of measures: given a Vitali family `v`
for a locally finite measure `μ`, and another locally finite measure `ρ`, then for `μ`-almost
every `x` the ratio `ρ a / μ a` converges, when `a` shrinks to `x` along the Vitali family,
towards the Radon-Nikodym derivative of `ρ` with respect to `μ`.
This version assumes that `ρ` is absolutely continuous with respect to `μ`. The general version
without this superfluous assumption is `VitaliFamily.ae_tendsto_rnDeriv`.
-/
theorem ae_tendsto_rnDeriv_of_absolutelyContinuous :
∀ᵐ x ∂μ, Tendsto (fun a => ρ a / μ a) (v.filterAt x) (𝓝 (ρ.rnDeriv μ x)) := by
have A : (μ.withDensity (v.limRatioMeas hρ)).rnDeriv μ =ᵐ[μ] v.limRatioMeas hρ :=
rnDeriv_withDensity μ (v.limRatioMeas_measurable hρ)
rw [v.withDensity_limRatioMeas_eq hρ] at A
filter_upwards [v.ae_tendsto_limRatioMeas hρ, A] with _ _ h'x
rwa [h'x]
end AbsolutelyContinuous
variable (ρ)
/-- Main theorem on differentiation of measures: given a Vitali family `v` for a locally finite
measure `μ`, and another locally finite measure `ρ`, then for `μ`-almost every `x` the
ratio `ρ a / μ a` converges, when `a` shrinks to `x` along the Vitali family, towards the
Radon-Nikodym derivative of `ρ` with respect to `μ`. -/
theorem ae_tendsto_rnDeriv :
∀ᵐ x ∂μ, Tendsto (fun a => ρ a / μ a) (v.filterAt x) (𝓝 (ρ.rnDeriv μ x)) := by
let t := μ.withDensity (ρ.rnDeriv μ)
have eq_add : ρ = ρ.singularPart μ + t := haveLebesgueDecomposition_add _ _
have A : ∀ᵐ x ∂μ, Tendsto (fun a => ρ.singularPart μ a / μ a) (v.filterAt x) (𝓝 0) :=
v.ae_eventually_measure_zero_of_singular (mutuallySingular_singularPart ρ μ)
have B : ∀ᵐ x ∂μ, t.rnDeriv μ x = ρ.rnDeriv μ x :=
rnDeriv_withDensity μ (measurable_rnDeriv ρ μ)
have C : ∀ᵐ x ∂μ, Tendsto (fun a => t a / μ a) (v.filterAt x) (𝓝 (t.rnDeriv μ x)) :=
v.ae_tendsto_rnDeriv_of_absolutelyContinuous (withDensity_absolutelyContinuous _ _)
filter_upwards [A, B, C] with _ Ax Bx Cx
convert Ax.add Cx using 1
· ext1 a
conv_lhs => rw [eq_add]
simp only [Pi.add_apply, coe_add, ENNReal.add_div]
· simp only [Bx, zero_add]
/-! ### Lebesgue density points -/
/-- Given a measurable set `s`, then `μ (s ∩ a) / μ a` converges when `a` shrinks to a typical
point `x` along a Vitali family. The limit is `1` for `x ∈ s` and `0` for `x ∉ s`. This shows that
almost every point of `s` is a Lebesgue density point for `s`. A version for non-measurable sets
holds, but it only gives the first conclusion, see `ae_tendsto_measure_inter_div`. -/
theorem ae_tendsto_measure_inter_div_of_measurableSet {s : Set α} (hs : MeasurableSet s) :
∀ᵐ x ∂μ, Tendsto (fun a => μ (s ∩ a) / μ a) (v.filterAt x) (𝓝 (s.indicator 1 x)) := by
haveI : IsLocallyFiniteMeasure (μ.restrict s) :=
isLocallyFiniteMeasure_of_le restrict_le_self
filter_upwards [ae_tendsto_rnDeriv v (μ.restrict s), rnDeriv_restrict_self μ hs]
intro x hx h'x
simpa only [h'x, restrict_apply' hs, inter_comm] using hx
/-- Given an arbitrary set `s`, then `μ (s ∩ a) / μ a` converges to `1` when `a` shrinks to a
typical point of `s` along a Vitali family. This shows that almost every point of `s` is a
Lebesgue density point for `s`. A stronger version for measurable sets is given
in `ae_tendsto_measure_inter_div_of_measurableSet`. -/
theorem ae_tendsto_measure_inter_div (s : Set α) :
∀ᵐ x ∂μ.restrict s, Tendsto (fun a => μ (s ∩ a) / μ a) (v.filterAt x) (𝓝 1) := by
let t := toMeasurable μ s
have A :
∀ᵐ x ∂μ.restrict s,
Tendsto (fun a => μ (t ∩ a) / μ a) (v.filterAt x) (𝓝 (t.indicator 1 x)) := by
apply ae_mono restrict_le_self
apply ae_tendsto_measure_inter_div_of_measurableSet
exact measurableSet_toMeasurable _ _
have B : ∀ᵐ x ∂μ.restrict s, t.indicator 1 x = (1 : ℝ≥0∞) := by
refine ae_restrict_of_ae_restrict_of_subset (subset_toMeasurable μ s) ?_
filter_upwards [ae_restrict_mem (measurableSet_toMeasurable μ s)] with _ hx
simp only [t, hx, Pi.one_apply, indicator_of_mem]
filter_upwards [A, B] with x hx h'x
rw [h'x] at hx
apply hx.congr' _
filter_upwards [v.eventually_filterAt_measurableSet x] with _ ha
congr 1
exact measure_toMeasurable_inter_of_sFinite ha _
/-! ### Lebesgue differentiation theorem -/
theorem ae_tendsto_lintegral_div' {f : α → ℝ≥0∞} (hf : Measurable f) (h'f : (∫⁻ y, f y ∂μ) ≠ ∞) :
∀ᵐ x ∂μ, Tendsto (fun a => (∫⁻ y in a, f y ∂μ) / μ a) (v.filterAt x) (𝓝 (f x)) := by
let ρ := μ.withDensity f
have : IsFiniteMeasure ρ := isFiniteMeasure_withDensity h'f
filter_upwards [ae_tendsto_rnDeriv v ρ, rnDeriv_withDensity μ hf] with x hx h'x
rw [← h'x]
apply hx.congr' _
filter_upwards [v.eventually_filterAt_measurableSet x] with a ha
rw [← withDensity_apply f ha]
theorem ae_tendsto_lintegral_div {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) (h'f : (∫⁻ y, f y ∂μ) ≠ ∞) :
∀ᵐ x ∂μ, Tendsto (fun a => (∫⁻ y in a, f y ∂μ) / μ a) (v.filterAt x) (𝓝 (f x)) := by
have A : (∫⁻ y, hf.mk f y ∂μ) ≠ ∞ := by
convert h'f using 1
apply lintegral_congr_ae
exact hf.ae_eq_mk.symm
filter_upwards [v.ae_tendsto_lintegral_div' hf.measurable_mk A, hf.ae_eq_mk] with x hx h'x
rw [h'x]
convert hx using 1
ext1 a
congr 1
apply lintegral_congr_ae
exact ae_restrict_of_ae hf.ae_eq_mk
theorem ae_tendsto_lintegral_enorm_sub_div'_of_integrable {f : α → E} (hf : Integrable f μ)
(h'f : StronglyMeasurable f) :
∀ᵐ x ∂μ, Tendsto (fun a => (∫⁻ y in a, ‖f y - f x‖ₑ ∂μ) / μ a) (v.filterAt x) (𝓝 0) := by
/- For every `c`, then `(∫⁻ y in a, ‖f y - c‖ₑ ∂μ) / μ a` tends almost everywhere to `‖f x - c‖`.
We apply this to a countable set of `c` which is dense in the range of `f`, to deduce the
desired convergence.
A minor technical inconvenience is that constants are not integrable, so to apply previous
lemmas we need to replace `c` with the restriction of `c` to a finite measure set `A n` in the
above sketch. -/
let A := MeasureTheory.Measure.finiteSpanningSetsInOpen' μ
rcases h'f.isSeparable_range with ⟨t, t_count, ht⟩
have main :
∀ᵐ x ∂μ,
∀ᵉ (n : ℕ) (c ∈ t),
Tendsto (fun a => (∫⁻ y in a, ‖f y - (A.set n).indicator (fun _ => c) y‖ₑ ∂μ) / μ a)
(v.filterAt x) (𝓝 ‖f x - (A.set n).indicator (fun _ => c) x‖ₑ) := by
simp_rw [ae_all_iff, ae_ball_iff t_count]
intro n c _
apply ae_tendsto_lintegral_div'
· refine (h'f.sub ?_).enorm
exact stronglyMeasurable_const.indicator (IsOpen.measurableSet (A.set_mem n))
· apply ne_of_lt
calc
∫⁻ y, ‖f y - (A.set n).indicator (fun _ : α => c) y‖ₑ ∂μ
≤ ∫⁻ y, ‖f y‖ₑ + ‖(A.set n).indicator (fun _ : α => c) y‖ₑ ∂μ :=
lintegral_mono fun x ↦ enorm_sub_le
_ = ∫⁻ y, ‖f y‖ₑ ∂μ + ∫⁻ y, ‖(A.set n).indicator (fun _ : α => c) y‖ₑ ∂μ :=
lintegral_add_left h'f.enorm _
_ < ∞ + ∞ :=
haveI I : Integrable ((A.set n).indicator fun _ : α => c) μ := by
simp only [integrable_indicator_iff (IsOpen.measurableSet (A.set_mem n)),
integrableOn_const_iff (C := c), A.finite n, or_true]
ENNReal.add_lt_add hf.2 I.2
filter_upwards [main, v.ae_eventually_measure_pos] with x hx h'x
have M c (hc : c ∈ t) :
Tendsto (fun a => (∫⁻ y in a, ‖f y - c‖ₑ ∂μ) / μ a) (v.filterAt x) (𝓝 ‖f x - c‖ₑ) := by
obtain ⟨n, xn⟩ : ∃ n, x ∈ A.set n := by simpa [← A.spanning] using mem_univ x
specialize hx n c hc
simp only [xn, indicator_of_mem] at hx
apply hx.congr' _
filter_upwards [v.eventually_filterAt_subset_of_nhds (IsOpen.mem_nhds (A.set_mem n) xn),
v.eventually_filterAt_measurableSet x] with a ha h'a
congr 1
apply setLIntegral_congr_fun h'a (fun y hy ↦ ?_)
simp only [ha hy, indicator_of_mem]
apply ENNReal.tendsto_nhds_zero.2 fun ε εpos => ?_
obtain ⟨c, ct, xc⟩ : ∃ c ∈ t, ‖f x - c‖ₑ < ε / 2 := by
simp_rw [← edist_eq_enorm_sub]
have : f x ∈ closure t := ht (mem_range_self _)
exact EMetric.mem_closure_iff.1 this (ε / 2) (ENNReal.half_pos (ne_of_gt εpos))
filter_upwards [(tendsto_order.1 (M c ct)).2 (ε / 2) xc, h'x, v.eventually_measure_lt_top x] with
a ha h'a h''a
apply ENNReal.div_le_of_le_mul
calc
(∫⁻ y in a, ‖f y - f x‖ₑ ∂μ) ≤ ∫⁻ y in a, ‖f y - c‖ₑ + ‖f x - c‖ₑ ∂μ := by
apply lintegral_mono fun x => ?_
simpa only [← edist_eq_enorm_sub] using edist_triangle_right _ _ _
_ = (∫⁻ y in a, ‖f y - c‖ₑ ∂μ) + ∫⁻ _ in a, ‖f x - c‖ₑ ∂μ :=
(lintegral_add_right _ measurable_const)
_ ≤ ε / 2 * μ a + ε / 2 * μ a := by
gcongr
· rw [ENNReal.div_lt_iff (Or.inl h'a.ne') (Or.inl h''a.ne)] at ha
exact ha.le
· simp only [lintegral_const, Measure.restrict_apply, MeasurableSet.univ, univ_inter]
gcongr
_ = ε * μ a := by rw [← add_mul, ENNReal.add_halves]
theorem ae_tendsto_lintegral_enorm_sub_div_of_integrable {f : α → E} (hf : Integrable f μ) :
∀ᵐ x ∂μ, Tendsto (fun a => (∫⁻ y in a, ‖f y - f x‖ₑ ∂μ) / μ a) (v.filterAt x) (𝓝 0) := by
have I : Integrable (hf.1.mk f) μ := hf.congr hf.1.ae_eq_mk
filter_upwards [v.ae_tendsto_lintegral_enorm_sub_div'_of_integrable I hf.1.stronglyMeasurable_mk,
hf.1.ae_eq_mk] with x hx h'x
apply hx.congr _
intro a
congr 1
apply lintegral_congr_ae
apply ae_restrict_of_ae
filter_upwards [hf.1.ae_eq_mk] with y hy
rw [hy, h'x]
theorem ae_tendsto_lintegral_enorm_sub_div {f : α → E} (hf : LocallyIntegrable f μ) :
∀ᵐ x ∂μ, Tendsto (fun a => (∫⁻ y in a, ‖f y - f x‖ₑ ∂μ) / μ a) (v.filterAt x) (𝓝 0) := by
rcases hf.exists_nat_integrableOn with ⟨u, u_open, u_univ, hu⟩
have : ∀ n, ∀ᵐ x ∂μ,
Tendsto (fun a => (∫⁻ y in a, ‖(u n).indicator f y - (u n).indicator f x‖ₑ ∂μ) / μ a)
(v.filterAt x) (𝓝 0) := by
intro n
apply ae_tendsto_lintegral_enorm_sub_div_of_integrable
exact (integrable_indicator_iff (u_open n).measurableSet).2 (hu n)
filter_upwards [ae_all_iff.2 this] with x hx
obtain ⟨n, hn⟩ : ∃ n, x ∈ u n := by simpa only [← u_univ, mem_iUnion] using mem_univ x
apply Tendsto.congr' _ (hx n)
filter_upwards [v.eventually_filterAt_subset_of_nhds ((u_open n).mem_nhds hn),
v.eventually_filterAt_measurableSet x] with a ha h'a
congr 1
refine setLIntegral_congr_fun h'a (fun y hy ↦ ?_)
rw [indicator_of_mem (ha hy) f, indicator_of_mem hn f]
/-- *Lebesgue differentiation theorem*: for almost every point `x`, the
average of `‖f y - f x‖` on `a` tends to `0` as `a` shrinks to `x` along a Vitali family. -/
theorem ae_tendsto_average_norm_sub {f : α → E} (hf : LocallyIntegrable f μ) :
∀ᵐ x ∂μ, Tendsto (fun a => ⨍ y in a, ‖f y - f x‖ ∂μ) (v.filterAt x) (𝓝 0) := by
filter_upwards [v.ae_tendsto_lintegral_enorm_sub_div hf] with x hx
have := (ENNReal.tendsto_toReal ENNReal.zero_ne_top).comp hx
simp only [ENNReal.toReal_zero] at this
apply Tendsto.congr' _ this
filter_upwards [v.eventually_measure_lt_top x, v.eventually_filterAt_integrableOn x hf]
with a h'a h''a
simp only [Function.comp_apply, ENNReal.toReal_div, setAverage_eq, div_eq_inv_mul]
have A : IntegrableOn (fun y => (‖f y - f x‖₊ : ℝ)) a μ := by
simp_rw [coe_nnnorm]
exact (h''a.sub (integrableOn_const h'a.ne)).norm
dsimp [enorm]
rw [lintegral_coe_eq_integral _ A, ENNReal.toReal_ofReal (by positivity)]
simp only [coe_nnnorm, measureReal_def]
/-- *Lebesgue differentiation theorem*: for almost every point `x`, the
average of `f` on `a` tends to `f x` as `a` shrinks to `x` along a Vitali family. -/
theorem ae_tendsto_average [NormedSpace ℝ E] [CompleteSpace E] {f : α → E}
(hf : LocallyIntegrable f μ) :
∀ᵐ x ∂μ, Tendsto (fun a => ⨍ y in a, f y ∂μ) (v.filterAt x) (𝓝 (f x)) := by
filter_upwards [v.ae_tendsto_average_norm_sub hf, v.ae_eventually_measure_pos] with x hx h'x
rw [tendsto_iff_norm_sub_tendsto_zero]
refine squeeze_zero' (Eventually.of_forall fun a => norm_nonneg _) ?_ hx
filter_upwards [h'x, v.eventually_measure_lt_top x, v.eventually_filterAt_integrableOn x hf]
with a ha h'a h''a
nth_rw 1 [← setAverage_const ha.ne' h'a.ne (f x)]
simp_rw [setAverage_eq']
rw [← integral_sub]
· exact norm_integral_le_integral_norm _
· exact (integrable_inv_smul_measure ha.ne' h'a.ne).2 h''a
· exact (integrable_inv_smul_measure ha.ne' h'a.ne).2 (integrableOn_const h'a.ne)
end
end VitaliFamily |
.lake/packages/mathlib/Mathlib/MeasureTheory/Covering/OneDim.lean | import Mathlib.MeasureTheory.Covering.DensityTheorem
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
/-!
# Covering theorems for Lebesgue measure in one dimension
We have a general theory of covering theorems for doubling measures, developed notably
in `DensityTheorem.lean`. In this file, we expand the API for this theory in one dimension,
by showing that intervals belong to the relevant Vitali family.
-/
open Set MeasureTheory IsUnifLocDoublingMeasure Filter
open scoped Topology
namespace Real
theorem Icc_mem_vitaliFamily_at_right {x y : ℝ} (hxy : x < y) :
Icc x y ∈ (vitaliFamily (volume : Measure ℝ) 1).setsAt x := by
rw [Icc_eq_closedBall]
refine closedBall_mem_vitaliFamily_of_dist_le_mul _ ?_ (by linarith)
rw [dist_comm, Real.dist_eq, abs_of_nonneg] <;> linarith
theorem tendsto_Icc_vitaliFamily_right (x : ℝ) :
Tendsto (fun y => Icc x y) (𝓝[>] x) ((vitaliFamily (volume : Measure ℝ) 1).filterAt x) := by
refine (VitaliFamily.tendsto_filterAt_iff _).2 ⟨?_, ?_⟩
· filter_upwards [self_mem_nhdsWithin] with y hy using Icc_mem_vitaliFamily_at_right hy
· intro ε εpos
filter_upwards [Icc_mem_nhdsGT <| show x < x + ε by linarith] with y hy
rw [closedBall_eq_Icc]
exact Icc_subset_Icc (by linarith) hy.2
theorem Icc_mem_vitaliFamily_at_left {x y : ℝ} (hxy : x < y) :
Icc x y ∈ (vitaliFamily (volume : Measure ℝ) 1).setsAt y := by
rw [Icc_eq_closedBall]
refine closedBall_mem_vitaliFamily_of_dist_le_mul _ ?_ (by linarith)
rw [Real.dist_eq, abs_of_nonneg] <;> linarith
theorem tendsto_Icc_vitaliFamily_left (x : ℝ) :
Tendsto (fun y => Icc y x) (𝓝[<] x) ((vitaliFamily (volume : Measure ℝ) 1).filterAt x) := by
refine (VitaliFamily.tendsto_filterAt_iff _).2 ⟨?_, ?_⟩
· filter_upwards [self_mem_nhdsWithin] with y hy using Icc_mem_vitaliFamily_at_left hy
· intro ε εpos
filter_upwards [Icc_mem_nhdsLT <| show x - ε < x by linarith] with y hy
rw [closedBall_eq_Icc]
exact Icc_subset_Icc hy.1 (by linarith)
end Real |
.lake/packages/mathlib/Mathlib/MeasureTheory/Covering/BesicovitchVectorSpace.lean | import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.MeasureTheory.Covering.Besicovitch
import Mathlib.Tactic.AdaptationNote
import Mathlib.Algebra.EuclideanDomain.Basic
/-!
# Satellite configurations for Besicovitch covering lemma in vector spaces
The Besicovitch covering theorem ensures that, in a nice metric space, there exists a number `N`
such that, from any family of balls with bounded radii, one can extract `N` families, each made of
disjoint balls, covering together all the centers of the initial family.
A key tool in the proof of this theorem is the notion of a satellite configuration, i.e., a family
of `N + 1` balls, where the first `N` balls all intersect the last one, but none of them contains
the center of another one and their radii are controlled. This is a technical notion, but it shows
up naturally in the proof of the Besicovitch theorem (which goes through a greedy algorithm): to
ensure that in the end one needs at most `N` families of balls, the crucial property of the
underlying metric space is that there should be no satellite configuration of `N + 1` points.
This file is devoted to the study of this property in vector spaces: we prove the main result
of [Füredi and Loeb, On the best constant for the Besicovitch covering theorem][furedi-loeb1994],
which shows that the optimal such `N` in a vector space coincides with the maximal number
of points one can put inside the unit ball of radius `2` under the condition that their distances
are bounded below by `1`.
In particular, this number is bounded by `5 ^ dim` by a straightforward measure argument.
## Main definitions and results
* `multiplicity E` is the maximal number of points one can put inside the unit ball
of radius `2` in the vector space `E`, under the condition that their distances
are bounded below by `1`.
* `multiplicity_le E` shows that `multiplicity E ≤ 5 ^ (dim E)`.
* `good_τ E` is a constant `> 1`, but close enough to `1` that satellite configurations
with this parameter `τ` are not worst than for `τ = 1`.
* `isEmpty_satelliteConfig_multiplicity` is the main theorem, saying that there are
no satellite configurations of `(multiplicity E) + 1` points, for the parameter `goodτ E`.
-/
universe u
open Metric Set Module MeasureTheory Filter Fin
open scoped ENNReal Topology
noncomputable section
namespace Besicovitch
variable {E : Type*} [NormedAddCommGroup E]
namespace SatelliteConfig
variable [NormedSpace ℝ E] {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
/-- Rescaling a satellite configuration in a vector space, to put the basepoint at `0` and the base
radius at `1`. -/
def centerAndRescale : SatelliteConfig E N τ where
c i := (a.r (last N))⁻¹ • (a.c i - a.c (last N))
r i := (a.r (last N))⁻¹ * a.r i
rpos i := by positivity
h i j hij := by
simp (disch := positivity) only [dist_smul₀, dist_sub_right, mul_left_comm τ,
Real.norm_of_nonneg]
rcases a.h hij with (⟨H₁, H₂⟩ | ⟨H₁, H₂⟩) <;> [left; right] <;> constructor <;> gcongr
hlast i hi := by
simp (disch := positivity) only [dist_smul₀, dist_sub_right, mul_left_comm τ,
Real.norm_of_nonneg]
have ⟨H₁, H₂⟩ := a.hlast i hi
constructor <;> gcongr
inter i hi := by
simp (disch := positivity) only [dist_smul₀, ← mul_add, dist_sub_right, Real.norm_of_nonneg]
gcongr
exact a.inter i hi
theorem centerAndRescale_center : a.centerAndRescale.c (last N) = 0 := by
simp [SatelliteConfig.centerAndRescale]
theorem centerAndRescale_radius {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) :
a.centerAndRescale.r (last N) = 1 := by
simp [SatelliteConfig.centerAndRescale, inv_mul_cancel₀ (a.rpos _).ne']
end SatelliteConfig
/-! ### Disjoint balls of radius close to `1` in the radius `2` ball. -/
/-- The maximum cardinality of a `1`-separated set in the ball of radius `2`. This is also the
optimal number of families in the Besicovitch covering theorem. -/
def multiplicity (E : Type*) [NormedAddCommGroup E] :=
sSup {N | ∃ s : Finset E, s.card = N ∧ (∀ c ∈ s, ‖c‖ ≤ 2) ∧ ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖}
section
variable [NormedSpace ℝ E] [FiniteDimensional ℝ E]
open scoped Function in -- required for scoped `on` notation
/-- Any `1`-separated set in the ball of radius `2` has cardinality at most `5 ^ dim`. This is
useful to show that the supremum in the definition of `Besicovitch.multiplicity E` is
well behaved. -/
theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
(h : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖) : s.card ≤ 5 ^ finrank ℝ E := by
/- We consider balls of radius `1/2` around the points in `s`. They are disjoint, and all
contained in the ball of radius `5/2`. A volume argument gives `s.card * (1/2)^dim ≤ (5/2)^dim`,
i.e., `s.card ≤ 5^dim`. -/
borelize E
let μ : Measure E := Measure.addHaar
let δ : ℝ := (1 : ℝ) / 2
let ρ : ℝ := (5 : ℝ) / 2
have ρpos : 0 < ρ := by norm_num
set A := ⋃ c ∈ s, ball (c : E) δ with hA
have D : Set.Pairwise (s : Set E) (Disjoint on fun c => ball (c : E) δ) := by
rintro c hc d hd hcd
apply ball_disjoint_ball
rw [dist_eq_norm]
convert h c hc d hd hcd
norm_num
have A_subset : A ⊆ ball (0 : E) ρ := by
refine iUnion₂_subset fun x hx => ?_
apply ball_subset_ball'
calc
δ + dist x 0 ≤ δ + 2 := by rw [dist_zero_right]; exact add_le_add le_rfl (hs x hx)
_ = 5 / 2 := by norm_num
have I :
(s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) ≤
ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) :=
calc
(s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) = μ A := by
rw [hA, measure_biUnion_finset D fun c _ => measurableSet_ball]
have I : 0 < δ := by norm_num
simp only [μ.addHaar_ball_of_pos _ I]
simp only [Finset.sum_const, nsmul_eq_mul, mul_assoc]
_ ≤ μ (ball (0 : E) ρ) := measure_mono A_subset
_ = ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) := by
simp only [μ.addHaar_ball_of_pos _ ρpos]
have J : (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) ≤ ENNReal.ofReal (ρ ^ finrank ℝ E) :=
(ENNReal.mul_le_mul_right (measure_ball_pos _ _ zero_lt_one).ne' measure_ball_lt_top.ne).1 I
have K : (s.card : ℝ) ≤ (5 : ℝ) ^ finrank ℝ E := by
have := ENNReal.toReal_le_of_le_ofReal (pow_nonneg ρpos.le _) J
simpa [ρ, δ, div_eq_mul_inv, mul_pow] using this
exact mod_cast K
theorem multiplicity_le : multiplicity E ≤ 5 ^ finrank ℝ E := by
apply csSup_le
· refine ⟨0, ⟨∅, by simp⟩⟩
· rintro _ ⟨s, ⟨rfl, h⟩⟩
exact Besicovitch.card_le_of_separated s h.1 h.2
theorem card_le_multiplicity {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
(h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖) : s.card ≤ multiplicity E := by
apply le_csSup
· refine ⟨5 ^ finrank ℝ E, ?_⟩
rintro _ ⟨s, ⟨rfl, h⟩⟩
exact Besicovitch.card_le_of_separated s h.1 h.2
· simp only [mem_setOf_eq, Ne]
exact ⟨s, rfl, hs, h's⟩
variable (E)
/-- If `δ` is small enough, a `(1-δ)`-separated set in the ball of radius `2` also has cardinality
at most `multiplicity E`. -/
theorem exists_goodδ :
∃ δ : ℝ, 0 < δ ∧ δ < 1 ∧ ∀ s : Finset E, (∀ c ∈ s, ‖c‖ ≤ 2) →
(∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - δ ≤ ‖c - d‖) → s.card ≤ multiplicity E := by
classical
/- This follows from a compactness argument: otherwise, one could extract a converging
subsequence, to obtain a `1`-separated set in the ball of radius `2` with cardinality
`N = multiplicity E + 1`. To formalize this, we work with functions `Fin N → E`.
-/
by_contra! h
set N := multiplicity E + 1 with hN
have :
∀ δ : ℝ, 0 < δ → ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧
Pairwise fun i j => 1 - δ ≤ ‖f i - f j‖ := by
intro δ hδ
rcases lt_or_ge δ 1 with (hδ' | hδ')
· rcases h δ hδ hδ' with ⟨s, hs, h's, s_card⟩
obtain ⟨f, f_inj, hfs⟩ : ∃ f : Fin N → E, Function.Injective f ∧ range f ⊆ ↑s := by
have : Fintype.card (Fin N) ≤ s.card := by simp only [Fintype.card_fin]; exact s_card
rcases Function.Embedding.exists_of_card_le_finset this with ⟨f, hf⟩
exact ⟨f, f.injective, hf⟩
simp only [range_subset_iff, Finset.mem_coe] at hfs
exact ⟨f, fun i => hs _ (hfs i), fun i j hij => h's _ (hfs i) _ (hfs j) (f_inj.ne hij)⟩
· exact
⟨fun _ => 0, by simp, fun i j _ => by
simpa only [norm_zero, sub_nonpos, sub_self]⟩
-- For `δ > 0`, `F δ` is a function from `Fin N` to the ball of radius `2` for which two points
-- in the image are separated by `1 - δ`.
choose! F hF using this
-- Choose a converging subsequence when `δ → 0`.
have : ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ Pairwise fun i j => 1 ≤ ‖f i - f j‖ := by
obtain ⟨u, _, zero_lt_u, hu⟩ :
∃ u : ℕ → ℝ,
(∀ m n : ℕ, m < n → u n < u m) ∧ (∀ n : ℕ, 0 < u n) ∧ Filter.Tendsto u Filter.atTop (𝓝 0) :=
exists_seq_strictAnti_tendsto (0 : ℝ)
have A : ∀ n, F (u n) ∈ closedBall (0 : Fin N → E) 2 := by
intro n
simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closedBall, dist_zero_right,
(hF (u n) (zero_lt_u n)).left, forall_const]
obtain ⟨f, fmem, φ, φ_mono, hf⟩ :
∃ f ∈ closedBall (0 : Fin N → E) 2,
∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto ((F ∘ u) ∘ φ) atTop (𝓝 f) :=
IsCompact.tendsto_subseq (isCompact_closedBall _ _) A
refine ⟨f, fun i => ?_, fun i j hij => ?_⟩
· simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closedBall, dist_zero_right] at fmem
exact fmem i
· have A : Tendsto (fun n => ‖F (u (φ n)) i - F (u (φ n)) j‖) atTop (𝓝 ‖f i - f j‖) :=
((hf.apply_nhds i).sub (hf.apply_nhds j)).norm
have B : Tendsto (fun n => 1 - u (φ n)) atTop (𝓝 (1 - 0)) :=
tendsto_const_nhds.sub (hu.comp φ_mono.tendsto_atTop)
rw [sub_zero] at B
exact le_of_tendsto_of_tendsto' B A fun n => (hF (u (φ n)) (zero_lt_u _)).2 hij
rcases this with ⟨f, hf, h'f⟩
-- the range of `f` contradicts the definition of `multiplicity E`.
have finj : Function.Injective f := by
intro i j hij
by_contra h
have : 1 ≤ ‖f i - f j‖ := h'f h
simp only [hij, norm_zero, sub_self] at this
exact lt_irrefl _ (this.trans_lt zero_lt_one)
let s := Finset.image f Finset.univ
have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin N
have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
simp only [s, hf, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
Finset.mem_image, true_and]
have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ := by
simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
Ne, forall_apply_eq_imp_iff, true_and]
intro i j hij
have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
exact h'f this
have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
rw [s_card, hN] at this
exact lt_irrefl _ ((Nat.lt_succ_self (multiplicity E)).trans_le this)
/-- A small positive number such that any `1 - δ`-separated set in the ball of radius `2` has
cardinality at most `Besicovitch.multiplicity E`. -/
def goodδ : ℝ :=
(exists_goodδ E).choose
theorem goodδ_lt_one : goodδ E < 1 :=
(exists_goodδ E).choose_spec.2.1
/-- A number `τ > 1`, but chosen close enough to `1` so that the construction in the Besicovitch
covering theorem using this parameter `τ` will give the smallest possible number of covering
families. -/
def goodτ : ℝ :=
1 + goodδ E / 4
theorem one_lt_goodτ : 1 < goodτ E := by
dsimp [goodτ, goodδ]; linarith [(exists_goodδ E).choose_spec.1]
variable {E}
theorem card_le_multiplicity_of_δ {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
(h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - goodδ E ≤ ‖c - d‖) : s.card ≤ multiplicity E :=
(Classical.choose_spec (exists_goodδ E)).2.2 s hs h's
theorem le_multiplicity_of_δ_of_fin {n : ℕ} (f : Fin n → E) (h : ∀ i, ‖f i‖ ≤ 2)
(h' : Pairwise fun i j => 1 - goodδ E ≤ ‖f i - f j‖) : n ≤ multiplicity E := by
classical
have finj : Function.Injective f := by
intro i j hij
by_contra h
have : 1 - goodδ E ≤ ‖f i - f j‖ := h' h
simp only [hij, norm_zero, sub_self] at this
linarith [goodδ_lt_one E]
let s := Finset.image f Finset.univ
have s_card : s.card = n := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin n
have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
simp only [s, h, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ,
Finset.mem_image, imp_true_iff, true_and]
have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - goodδ E ≤ ‖c - d‖ := by
simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
Ne, forall_apply_eq_imp_iff, true_and]
intro i j hij
have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
exact h' this
have : s.card ≤ multiplicity E := card_le_multiplicity_of_δ hs h's
rwa [s_card] at this
end
namespace SatelliteConfig
/-!
### Relating satellite configurations to separated points in the ball of radius `2`.
We prove that the number of points in a satellite configuration is bounded by the maximal number
of `1`-separated points in the ball of radius `2`. For this, start from a satellite configuration
`c`. Without loss of generality, one can assume that the last ball is centered at `0` and of
radius `1`. Define `c' i = c i` if `‖c i‖ ≤ 2`, and `c' i = (2/‖c i‖) • c i` if `‖c i‖ > 2`.
It turns out that these points are `1 - δ`-separated, where `δ` is arbitrarily small if `τ` is
close enough to `1`. The number of such configurations is bounded by `multiplicity E` if `δ` is
suitably small.
To check that the points `c' i` are `1 - δ`-separated, one treats separately the cases where
both `‖c i‖` and `‖c j‖` are `≤ 2`, where one of them is `≤ 2` and the other one is `> 2`, and
where both of them are `> 2`.
-/
theorem exists_normalized_aux1 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
(lastr : a.r (last N) = 1) (hτ : 1 ≤ τ) (δ : ℝ) (hδ1 : τ ≤ 1 + δ / 4) (hδ2 : δ ≤ 1)
(i j : Fin N.succ) (inej : i ≠ j) : 1 - δ ≤ ‖a.c i - a.c j‖ := by
have ah :
Pairwise fun i j => a.r i ≤ ‖a.c i - a.c j‖ ∧ a.r j ≤ τ * a.r i ∨
a.r j ≤ ‖a.c j - a.c i‖ ∧ a.r i ≤ τ * a.r j := by
simpa only [dist_eq_norm] using a.h
have δnonneg : 0 ≤ δ := by linarith only [hτ, hδ1]
have D : 0 ≤ 1 - δ / 4 := by linarith only [hδ2]
have τpos : 0 < τ := _root_.zero_lt_one.trans_le hτ
have I : (1 - δ / 4) * τ ≤ 1 :=
calc
(1 - δ / 4) * τ ≤ (1 - δ / 4) * (1 + δ / 4) := by gcongr
_ = (1 : ℝ) - δ ^ 2 / 16 := by ring
_ ≤ 1 := by linarith only [sq_nonneg δ]
have J : 1 - δ ≤ 1 - δ / 4 := by linarith only [δnonneg]
have K : 1 - δ / 4 ≤ τ⁻¹ := by rw [inv_eq_one_div, le_div_iff₀ τpos]; exact I
suffices L : τ⁻¹ ≤ ‖a.c i - a.c j‖ by linarith only [J, K, L]
have hτ' : ∀ k, τ⁻¹ ≤ a.r k := by
intro k
rw [inv_eq_one_div, div_le_iff₀ τpos, ← lastr, mul_comm]
exact a.hlast' k hτ
rcases ah inej with (H | H)
· apply le_trans _ H.1
exact hτ' i
· rw [norm_sub_rev]
apply le_trans _ H.1
exact hτ' j
variable [NormedSpace ℝ E]
theorem exists_normalized_aux2 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
(lastc : a.c (last N) = 0) (lastr : a.r (last N) = 1) (hτ : 1 ≤ τ) (δ : ℝ) (hδ1 : τ ≤ 1 + δ / 4)
(hδ2 : δ ≤ 1) (i j : Fin N.succ) (inej : i ≠ j) (hi : ‖a.c i‖ ≤ 2) (hj : 2 < ‖a.c j‖) :
1 - δ ≤ ‖a.c i - (2 / ‖a.c j‖) • a.c j‖ := by
have ah :
Pairwise fun i j => a.r i ≤ ‖a.c i - a.c j‖ ∧ a.r j ≤ τ * a.r i ∨
a.r j ≤ ‖a.c j - a.c i‖ ∧ a.r i ≤ τ * a.r j := by
simpa only [dist_eq_norm] using a.h
have δnonneg : 0 ≤ δ := by linarith only [hτ, hδ1]
have D : 0 ≤ 1 - δ / 4 := by linarith only [hδ2]
have hcrj : ‖a.c j‖ ≤ a.r j + 1 := by simpa only [lastc, lastr, dist_zero_right] using a.inter' j
have I : a.r i ≤ 2 := by
rcases lt_or_ge i (last N) with (H | H)
· apply (a.hlast i H).1.trans
simpa only [dist_eq_norm, lastc, sub_zero] using hi
· have : i = last N := top_le_iff.1 H
rw [this, lastr]
exact one_le_two
have J : (1 - δ / 4) * τ ≤ 1 :=
calc
(1 - δ / 4) * τ ≤ (1 - δ / 4) * (1 + δ / 4) := by gcongr
_ = (1 : ℝ) - δ ^ 2 / 16 := by ring
_ ≤ 1 := by linarith only [sq_nonneg δ]
have A : a.r j - δ ≤ ‖a.c i - a.c j‖ := by
rcases ah inej.symm with (H | H); · rw [norm_sub_rev]; linarith [H.1]
have C : a.r j ≤ 4 :=
calc
a.r j ≤ τ * a.r i := H.2
_ ≤ τ * 2 := by gcongr
_ ≤ 5 / 4 * 2 := by gcongr; linarith only [hδ1, hδ2]
_ ≤ 4 := by norm_num
calc
a.r j - δ ≤ a.r j - a.r j / 4 * δ := by
gcongr _ - ?_
exact mul_le_of_le_one_left δnonneg (by linarith only [C])
_ = (1 - δ / 4) * a.r j := by ring
_ ≤ (1 - δ / 4) * (τ * a.r i) := mul_le_mul_of_nonneg_left H.2 D
_ ≤ 1 * a.r i := by rw [← mul_assoc]; gcongr
_ ≤ ‖a.c i - a.c j‖ := by rw [one_mul]; exact H.1
set d := (2 / ‖a.c j‖) • a.c j with hd
have : a.r j - δ ≤ ‖a.c i - d‖ + (a.r j - 1) :=
calc
a.r j - δ ≤ ‖a.c i - a.c j‖ := A
_ ≤ ‖a.c i - d‖ + ‖d - a.c j‖ := by simp only [← dist_eq_norm, dist_triangle]
_ ≤ ‖a.c i - d‖ + (a.r j - 1) := by
gcongr
have A : 0 ≤ 1 - 2 / ‖a.c j‖ := by simpa [div_le_iff₀ (zero_le_two.trans_lt hj)] using hj.le
rw [← one_smul ℝ (a.c j), hd, ← sub_smul, norm_smul, norm_sub_rev, Real.norm_eq_abs,
abs_of_nonneg A, sub_mul]
field_simp
linarith only [hcrj]
linarith only [this]
theorem exists_normalized_aux3 {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ)
(lastc : a.c (last N) = 0) (lastr : a.r (last N) = 1) (hτ : 1 ≤ τ) (δ : ℝ) (hδ1 : τ ≤ 1 + δ / 4)
(i j : Fin N.succ) (inej : i ≠ j) (hi : 2 < ‖a.c i‖) (hij : ‖a.c i‖ ≤ ‖a.c j‖) :
1 - δ ≤ ‖(2 / ‖a.c i‖) • a.c i - (2 / ‖a.c j‖) • a.c j‖ := by
have ah :
Pairwise fun i j => a.r i ≤ ‖a.c i - a.c j‖ ∧ a.r j ≤ τ * a.r i ∨
a.r j ≤ ‖a.c j - a.c i‖ ∧ a.r i ≤ τ * a.r j := by
simpa only [dist_eq_norm] using a.h
have δnonneg : 0 ≤ δ := by linarith only [hτ, hδ1]
have hcrj : ‖a.c j‖ ≤ a.r j + 1 := by simpa only [lastc, lastr, dist_zero_right] using a.inter' j
have A : a.r i ≤ ‖a.c i‖ := by
have : i < last N := by
apply lt_top_iff_ne_top.2
intro iN
change i = last N at iN
rw [iN, lastc, norm_zero] at hi
exact lt_irrefl _ (zero_le_two.trans_lt hi)
convert (a.hlast i this).1 using 1
rw [dist_eq_norm, lastc, sub_zero]
have hj : 2 < ‖a.c j‖ := hi.trans_le hij
set s := ‖a.c i‖
have spos : 0 < s := zero_lt_two.trans hi
set d := (s / ‖a.c j‖) • a.c j with hd
have I : ‖a.c j - a.c i‖ ≤ ‖a.c j‖ - s + ‖d - a.c i‖ :=
calc
‖a.c j - a.c i‖ ≤ ‖a.c j - d‖ + ‖d - a.c i‖ := by simp [← dist_eq_norm, dist_triangle]
_ = ‖a.c j‖ - ‖a.c i‖ + ‖d - a.c i‖ := by
nth_rw 1 [← one_smul ℝ (a.c j)]
rw [add_left_inj, hd, ← sub_smul, norm_smul, Real.norm_eq_abs, abs_of_nonneg, sub_mul,
one_mul, div_mul_cancel₀ _ (zero_le_two.trans_lt hj).ne']
rwa [sub_nonneg, div_le_iff₀ (zero_lt_two.trans hj), one_mul]
have J : a.r j - ‖a.c j - a.c i‖ ≤ s / 2 * δ :=
calc
a.r j - ‖a.c j - a.c i‖ ≤ s * (τ - 1) := by
rcases ah inej.symm with (H | H)
· calc
a.r j - ‖a.c j - a.c i‖ ≤ 0 := sub_nonpos.2 H.1
_ ≤ s * (τ - 1) := mul_nonneg spos.le (sub_nonneg.2 hτ)
· rw [norm_sub_rev] at H
calc
a.r j - ‖a.c j - a.c i‖ ≤ τ * a.r i - a.r i := sub_le_sub H.2 H.1
_ = a.r i * (τ - 1) := by ring
_ ≤ s * (τ - 1) := mul_le_mul_of_nonneg_right A (sub_nonneg.2 hτ)
_ ≤ s * (δ / 2) := (mul_le_mul_of_nonneg_left (by linarith only [δnonneg, hδ1]) spos.le)
_ = s / 2 * δ := by ring
have invs_nonneg : 0 ≤ 2 / s := div_nonneg zero_le_two (zero_le_two.trans hi.le)
calc
1 - δ = 2 / s * (s / 2 - s / 2 * δ) := by field
_ ≤ 2 / s * ‖d - a.c i‖ :=
(mul_le_mul_of_nonneg_left (by linarith only [hcrj, I, J, hi]) invs_nonneg)
_ = ‖(2 / s) • a.c i - (2 / ‖a.c j‖) • a.c j‖ := by
conv_lhs => rw [norm_sub_rev, ← abs_of_nonneg invs_nonneg]
rw [← Real.norm_eq_abs, ← norm_smul, smul_sub, hd, smul_smul]
congr 3
field
theorem exists_normalized {N : ℕ} {τ : ℝ} (a : SatelliteConfig E N τ) (lastc : a.c (last N) = 0)
(lastr : a.r (last N) = 1) (hτ : 1 ≤ τ) (δ : ℝ) (hδ1 : τ ≤ 1 + δ / 4) (hδ2 : δ ≤ 1) :
∃ c' : Fin N.succ → E, (∀ n, ‖c' n‖ ≤ 2) ∧ Pairwise fun i j => 1 - δ ≤ ‖c' i - c' j‖ := by
let c' : Fin N.succ → E := fun i => if ‖a.c i‖ ≤ 2 then a.c i else (2 / ‖a.c i‖) • a.c i
have norm_c'_le : ∀ i, ‖c' i‖ ≤ 2 := by
intro i
simp only [c']
split_ifs with h; · exact h
by_cases hi : ‖a.c i‖ = 0 <;> simp [norm_smul, hi]
refine ⟨c', fun n => norm_c'_le n, fun i j inej => ?_⟩
-- up to exchanging `i` and `j`, one can assume `‖c i‖ ≤ ‖c j‖`.
wlog hij : ‖a.c i‖ ≤ ‖a.c j‖ generalizing i j
· rw [norm_sub_rev]; exact this j i inej.symm (le_of_not_ge hij)
rcases le_or_gt ‖a.c j‖ 2 with (Hj | Hj)
-- case `‖c j‖ ≤ 2` (and therefore also `‖c i‖ ≤ 2`)
· simp_rw [c', Hj, hij.trans Hj, if_true]
exact exists_normalized_aux1 a lastr hτ δ hδ1 hδ2 i j inej
-- case `2 < ‖c j‖`
· have H'j : ‖a.c j‖ ≤ 2 ↔ False := by simpa only [not_le, iff_false] using Hj
rcases le_or_gt ‖a.c i‖ 2 with (Hi | Hi)
· -- case `‖c i‖ ≤ 2`
simp_rw [c', Hi, if_true, H'j, if_false]
exact exists_normalized_aux2 a lastc lastr hτ δ hδ1 hδ2 i j inej Hi Hj
· -- case `2 < ‖c i‖`
have H'i : ‖a.c i‖ ≤ 2 ↔ False := by simpa only [not_le, iff_false] using Hi
simp_rw [c', H'i, if_false, H'j, if_false]
exact exists_normalized_aux3 a lastc lastr hτ δ hδ1 i j inej Hi hij
end SatelliteConfig
variable (E)
variable [NormedSpace ℝ E] [FiniteDimensional ℝ E]
/-- In a normed vector space `E`, there can be no satellite configuration with `multiplicity E + 1`
points and the parameter `goodτ E`. This will ensure that in the inductive construction to get
the Besicovitch covering families, there will never be more than `multiplicity E` nonempty
families. -/
theorem isEmpty_satelliteConfig_multiplicity :
IsEmpty (SatelliteConfig E (multiplicity E) (goodτ E)) :=
⟨by
intro a
let b := a.centerAndRescale
rcases b.exists_normalized a.centerAndRescale_center a.centerAndRescale_radius
(one_lt_goodτ E).le (goodδ E) le_rfl (goodδ_lt_one E).le with
⟨c', c'_le_two, hc'⟩
exact
lt_irrefl _ ((Nat.lt_succ_self _).trans_le (le_multiplicity_of_δ_of_fin c' c'_le_two hc'))⟩
instance (priority := 100) instHasBesicovitchCovering : HasBesicovitchCovering E :=
⟨⟨multiplicity E, goodτ E, one_lt_goodτ E, isEmpty_satelliteConfig_multiplicity E⟩⟩
end Besicovitch |
.lake/packages/mathlib/Mathlib/MeasureTheory/Covering/VitaliFamily.lean | import Mathlib.MeasureTheory.Measure.AbsolutelyContinuous
/-!
# Vitali families
On a metric space `X` with a measure `μ`, consider for each `x : X` a family of measurable sets with
nonempty interiors, called `setsAt x`. This family is a Vitali family if it satisfies the following
property: consider a (possibly non-measurable) set `s`, and for any `x` in `s` a
subfamily `f x` of `setsAt x` containing sets of arbitrarily small diameter. Then one can extract
a disjoint subfamily covering almost all `s`.
Vitali families are provided by covering theorems such as the Besicovitch covering theorem or the
Vitali covering theorem. They make it possible to formulate general versions of theorems on
differentiations of measure that apply in both contexts.
This file gives the basic definition of Vitali families. More interesting developments of this
notion are deferred to other files:
* constructions of specific Vitali families are provided by the Besicovitch covering theorem, in
`Besicovitch.vitaliFamily`, and by the Vitali covering theorem, in `Vitali.vitaliFamily`.
* The main theorem on differentiation of measures along a Vitali family is proved in
`VitaliFamily.ae_tendsto_rnDeriv`.
## Main definitions
* `VitaliFamily μ` is a structure made, for each `x : X`, of a family of sets around `x`, such that
one can extract an almost everywhere disjoint covering from any subfamily containing sets of
arbitrarily small diameters.
Let `v` be such a Vitali family.
* `v.FineSubfamilyOn` describes the subfamilies of `v` from which one can extract almost
everywhere disjoint coverings. This property, called
`v.FineSubfamilyOn.exists_disjoint_covering_ae`, is essentially a restatement of the definition
of a Vitali family. We also provide an API to use efficiently such a disjoint covering.
* `v.filterAt x` is a filter on sets of `X`, such that convergence with respect to this filter
means convergence when sets in the Vitali family shrink towards `x`.
## References
* [Herbert Federer, Geometric Measure Theory, Chapter 2.8][Federer1996]
(Vitali families are called Vitali relations there)
-/
open MeasureTheory Metric Set Filter TopologicalSpace MeasureTheory.Measure
open scoped Topology
variable {X : Type*} [PseudoMetricSpace X]
/-- On a metric space `X` with a measure `μ`, consider for each `x : X` a family of measurable sets
with nonempty interiors, called `setsAt x`. This family is a Vitali family if it satisfies the
following property: consider a (possibly non-measurable) set `s`, and for any `x` in `s` a
subfamily `f x` of `setsAt x` containing sets of arbitrarily small diameter. Then one can extract
a disjoint subfamily covering almost all `s`.
Vitali families are provided by covering theorems such as the Besicovitch covering theorem or the
Vitali covering theorem. They make it possible to formulate general versions of theorems on
differentiations of measure that apply in both contexts.
-/
structure VitaliFamily {m : MeasurableSpace X} (μ : Measure X) where
/-- Sets of the family "centered" at a given point. -/
setsAt : X → Set (Set X)
/-- All sets of the family are measurable. -/
measurableSet : ∀ x : X, ∀ s ∈ setsAt x, MeasurableSet s
/-- All sets of the family have nonempty interior. -/
nonempty_interior : ∀ x : X, ∀ s ∈ setsAt x, (interior s).Nonempty
/-- For any closed ball around `x`, there exists a set of the family contained in this ball. -/
nontrivial : ∀ (x : X), ∀ ε > (0 : ℝ), ∃ s ∈ setsAt x, s ⊆ closedBall x ε
/-- Consider a (possibly non-measurable) set `s`,
and for any `x` in `s` a subfamily `f x` of `setsAt x`
containing sets of arbitrarily small diameter.
Then one can extract a disjoint subfamily covering almost all `s`. -/
covering : ∀ (s : Set X) (f : X → Set (Set X)),
(∀ x ∈ s, f x ⊆ setsAt x) → (∀ x ∈ s, ∀ ε > (0 : ℝ), ∃ t ∈ f x, t ⊆ closedBall x ε) →
∃ t : Set (X × Set X), (∀ p ∈ t, p.1 ∈ s) ∧ (t.PairwiseDisjoint fun p ↦ p.2) ∧
(∀ p ∈ t, p.2 ∈ f p.1) ∧ μ (s \ ⋃ p ∈ t, p.2) = 0
namespace VitaliFamily
variable {m0 : MeasurableSpace X} {μ : Measure X}
/-- A Vitali family for a measure `μ` is also a Vitali family for any measure absolutely continuous
with respect to `μ`. -/
def mono (v : VitaliFamily μ) (ν : Measure X) (hν : ν ≪ μ) : VitaliFamily ν where
__ := v
covering s f h h' :=
let ⟨t, ts, disj, mem_f, hμ⟩ := v.covering s f h h'
⟨t, ts, disj, mem_f, hν hμ⟩
/-- Given a Vitali family `v` for a measure `μ`, a family `f` is a fine subfamily on a set `s` if
every point `x` in `s` belongs to arbitrarily small sets in `v.setsAt x ∩ f x`. This is precisely
the subfamilies for which the Vitali family definition ensures that one can extract a disjoint
covering of almost all `s`. -/
def FineSubfamilyOn (v : VitaliFamily μ) (f : X → Set (Set X)) (s : Set X) : Prop :=
∀ x ∈ s, ∀ ε > 0, ∃ t ∈ v.setsAt x ∩ f x, t ⊆ closedBall x ε
namespace FineSubfamilyOn
variable {v : VitaliFamily μ} {f : X → Set (Set X)} {s : Set X} (h : v.FineSubfamilyOn f s)
include h
theorem exists_disjoint_covering_ae :
∃ t : Set (X × Set X),
(∀ p : X × Set X, p ∈ t → p.1 ∈ s) ∧
(t.PairwiseDisjoint fun p => p.2) ∧
(∀ p : X × Set X, p ∈ t → p.2 ∈ v.setsAt p.1 ∩ f p.1) ∧
μ (s \ ⋃ (p : X × Set X) (_ : p ∈ t), p.2) = 0 :=
v.covering s (fun x => v.setsAt x ∩ f x) (fun _ _ => inter_subset_left) h
/-- Given `h : v.FineSubfamilyOn f s`, then `h.index` is a set parametrizing a disjoint
covering of almost every `s`. -/
protected def index : Set (X × Set X) :=
h.exists_disjoint_covering_ae.choose
/-- Given `h : v.FineSubfamilyOn f s`, then `h.covering p` is a set in the family,
for `p ∈ h.index`, such that these sets form a disjoint covering of almost every `s`. -/
@[nolint unusedArguments]
protected def covering (_h : FineSubfamilyOn v f s) : X × Set X → Set X :=
fun p => p.2
theorem index_subset : ∀ p : X × Set X, p ∈ h.index → p.1 ∈ s :=
h.exists_disjoint_covering_ae.choose_spec.1
theorem covering_disjoint : h.index.PairwiseDisjoint h.covering :=
h.exists_disjoint_covering_ae.choose_spec.2.1
open scoped Function in -- required for scoped `on` notation
theorem covering_disjoint_subtype : Pairwise (Disjoint on fun x : h.index => h.covering x) :=
(pairwise_subtype_iff_pairwise_set _ _).2 h.covering_disjoint
theorem covering_mem {p : X × Set X} (hp : p ∈ h.index) : h.covering p ∈ f p.1 :=
(h.exists_disjoint_covering_ae.choose_spec.2.2.1 p hp).2
theorem covering_mem_family {p : X × Set X} (hp : p ∈ h.index) : h.covering p ∈ v.setsAt p.1 :=
(h.exists_disjoint_covering_ae.choose_spec.2.2.1 p hp).1
theorem measure_diff_biUnion : μ (s \ ⋃ p ∈ h.index, h.covering p) = 0 :=
h.exists_disjoint_covering_ae.choose_spec.2.2.2
theorem index_countable [SecondCountableTopology X] : h.index.Countable :=
h.covering_disjoint.countable_of_nonempty_interior fun _ hx =>
v.nonempty_interior _ _ (h.covering_mem_family hx)
protected theorem measurableSet_u {p : X × Set X} (hp : p ∈ h.index) :
MeasurableSet (h.covering p) :=
v.measurableSet p.1 _ (h.covering_mem_family hp)
theorem measure_le_tsum_of_absolutelyContinuous [SecondCountableTopology X] {ρ : Measure X}
(hρ : ρ ≪ μ) : ρ s ≤ ∑' p : h.index, ρ (h.covering p) :=
calc
ρ s ≤ ρ ((s \ ⋃ p ∈ h.index, h.covering p) ∪ ⋃ p ∈ h.index, h.covering p) :=
measure_mono (by simp only [subset_union_left, diff_union_self])
_ ≤ ρ (s \ ⋃ p ∈ h.index, h.covering p) + ρ (⋃ p ∈ h.index, h.covering p) :=
(measure_union_le _ _)
_ = ∑' p : h.index, ρ (h.covering p) := by
rw [hρ h.measure_diff_biUnion, zero_add,
measure_biUnion h.index_countable h.covering_disjoint fun x hx => h.measurableSet_u hx]
theorem measure_le_tsum [SecondCountableTopology X] : μ s ≤ ∑' x : h.index, μ (h.covering x) :=
h.measure_le_tsum_of_absolutelyContinuous Measure.AbsolutelyContinuous.rfl
end FineSubfamilyOn
/-- One can enlarge a Vitali family by adding to the sets `f x` at `x` all sets which are not
contained in a `δ`-neighborhood on `x`. This does not change the local filter at a point, but it
can be convenient to get a nicer global behavior. -/
def enlarge (v : VitaliFamily μ) (δ : ℝ) (δpos : 0 < δ) : VitaliFamily μ where
setsAt x := v.setsAt x ∪ {s | MeasurableSet s ∧ (interior s).Nonempty ∧ ¬s ⊆ closedBall x δ}
measurableSet := by
rintro x s (hs | hs)
exacts [v.measurableSet _ _ hs, hs.1]
nonempty_interior := by
rintro x s (hs | hs)
exacts [v.nonempty_interior _ _ hs, hs.2.1]
nontrivial := by
intro x ε εpos
rcases v.nontrivial x ε εpos with ⟨s, hs, h's⟩
exact ⟨s, mem_union_left _ hs, h's⟩
covering := by
intro s f fset ffine
let g : X → Set (Set X) := fun x => f x ∩ v.setsAt x
have : ∀ x ∈ s, ∀ ε : ℝ, ε > 0 → ∃ t ∈ g x, t ⊆ closedBall x ε := by
intro x hx ε εpos
obtain ⟨t, tf, ht⟩ : ∃ t ∈ f x, t ⊆ closedBall x (min ε δ) :=
ffine x hx (min ε δ) (lt_min εpos δpos)
rcases fset x hx tf with (h't | h't)
· exact ⟨t, ⟨tf, h't⟩, ht.trans (closedBall_subset_closedBall (min_le_left _ _))⟩
· refine False.elim (h't.2.2 ?_)
exact ht.trans (closedBall_subset_closedBall (min_le_right _ _))
rcases v.covering s g (fun x _ => inter_subset_right) this with ⟨t, ts, tdisj, tg, μt⟩
exact ⟨t, ts, tdisj, fun p hp => (tg p hp).1, μt⟩
variable (v : VitaliFamily μ)
/-- Given a vitali family `v`, then `v.filterAt x` is the filter on `Set X` made of those families
that contain all sets of `v.setsAt x` of a sufficiently small diameter. This filter makes it
possible to express limiting behavior when sets in `v.setsAt x` shrink to `x`. -/
def filterAt (x : X) : Filter (Set X) := (𝓝 x).smallSets ⊓ 𝓟 (v.setsAt x)
theorem _root_.Filter.HasBasis.vitaliFamily {ι : Sort*} {p : ι → Prop} {s : ι → Set X} {x : X}
(h : (𝓝 x).HasBasis p s) : (v.filterAt x).HasBasis p (fun i ↦ {t ∈ v.setsAt x | t ⊆ s i}) := by
simpa only [← Set.setOf_inter_eq_sep] using h.smallSets.inf_principal _
theorem filterAt_basis_closedBall (x : X) :
(v.filterAt x).HasBasis (0 < ·) ({t ∈ v.setsAt x | t ⊆ closedBall x ·}) :=
nhds_basis_closedBall.vitaliFamily v
theorem mem_filterAt_iff {x : X} {s : Set (Set X)} :
s ∈ v.filterAt x ↔ ∃ ε > (0 : ℝ), ∀ t ∈ v.setsAt x, t ⊆ closedBall x ε → t ∈ s := by
simp only [(v.filterAt_basis_closedBall x).mem_iff, ← and_imp, subset_def, mem_setOf]
instance filterAt_neBot (x : X) : (v.filterAt x).NeBot :=
(v.filterAt_basis_closedBall x).neBot_iff.2 <| v.nontrivial _ _
theorem eventually_filterAt_iff {x : X} {P : Set X → Prop} :
(∀ᶠ t in v.filterAt x, P t) ↔ ∃ ε > (0 : ℝ), ∀ t ∈ v.setsAt x, t ⊆ closedBall x ε → P t :=
v.mem_filterAt_iff
theorem tendsto_filterAt_iff {ι : Type*} {l : Filter ι} {f : ι → Set X} {x : X} :
Tendsto f l (v.filterAt x) ↔
(∀ᶠ i in l, f i ∈ v.setsAt x) ∧ ∀ ε > (0 : ℝ), ∀ᶠ i in l, f i ⊆ closedBall x ε := by
simp only [filterAt, tendsto_inf, nhds_basis_closedBall.smallSets.tendsto_right_iff,
tendsto_principal, and_comm, mem_powerset_iff]
theorem eventually_filterAt_mem_setsAt (x : X) : ∀ᶠ t in v.filterAt x, t ∈ v.setsAt x :=
(v.tendsto_filterAt_iff.mp tendsto_id).1
theorem eventually_filterAt_subset_closedBall (x : X) {ε : ℝ} (hε : 0 < ε) :
∀ᶠ t : Set X in v.filterAt x, t ⊆ closedBall x ε :=
(v.tendsto_filterAt_iff.mp tendsto_id).2 ε hε
theorem eventually_filterAt_measurableSet (x : X) : ∀ᶠ t in v.filterAt x, MeasurableSet t := by
filter_upwards [v.eventually_filterAt_mem_setsAt x] with _ ha using v.measurableSet _ _ ha
theorem frequently_filterAt_iff {x : X} {P : Set X → Prop} :
(∃ᶠ t in v.filterAt x, P t) ↔ ∀ ε > (0 : ℝ), ∃ t ∈ v.setsAt x, t ⊆ closedBall x ε ∧ P t := by
simp only [(v.filterAt_basis_closedBall x).frequently_iff, ← and_assoc, subset_def, mem_setOf]
theorem eventually_filterAt_subset_of_nhds {x : X} {o : Set X} (hx : o ∈ 𝓝 x) :
∀ᶠ t in v.filterAt x, t ⊆ o :=
(eventually_smallSets_subset.2 hx).filter_mono inf_le_left
theorem fineSubfamilyOn_of_frequently (v : VitaliFamily μ) (f : X → Set (Set X)) (s : Set X)
(h : ∀ x ∈ s, ∃ᶠ t in v.filterAt x, t ∈ f x) : v.FineSubfamilyOn f s := by
intro x hx ε εpos
obtain ⟨t, tv, ht, tf⟩ : ∃ t ∈ v.setsAt x, t ⊆ closedBall x ε ∧ t ∈ f x :=
v.frequently_filterAt_iff.1 (h x hx) ε εpos
exact ⟨t, ⟨tv, tf⟩, ht⟩
end VitaliFamily |
.lake/packages/mathlib/Mathlib/MeasureTheory/Covering/DensityTheorem.lean | import Mathlib.MeasureTheory.Measure.Doubling
import Mathlib.MeasureTheory.Covering.Vitali
import Mathlib.MeasureTheory.Covering.Differentiation
/-!
# Uniformly locally doubling measures and Lebesgue's density theorem
Lebesgue's density theorem states that given a set `S` in a sigma compact metric space with
locally-finite uniformly locally doubling measure `μ` then for almost all points `x` in `S`, for any
sequence of closed balls `B₀, B₁, B₂, ...` containing `x`, the limit `μ (S ∩ Bⱼ) / μ (Bⱼ) → 1` as
`j → ∞`.
In this file we combine general results about existence of Vitali families for uniformly locally
doubling measures with results about differentiation along a Vitali family to obtain an explicit
form of Lebesgue's density theorem.
## Main results
* `IsUnifLocDoublingMeasure.ae_tendsto_measure_inter_div`: a version of Lebesgue's density
theorem for sequences of balls converging on a point but whose centres are not required to be
fixed.
-/
noncomputable section
open Set Filter Metric MeasureTheory TopologicalSpace
open scoped NNReal Topology
namespace IsUnifLocDoublingMeasure
variable {α : Type*} [PseudoMetricSpace α] [MeasurableSpace α] (μ : Measure α)
[IsUnifLocDoublingMeasure μ]
section
variable [SecondCountableTopology α] [BorelSpace α] [IsLocallyFiniteMeasure μ]
open scoped Topology
/-- A Vitali family in a space with a uniformly locally doubling measure, designed so that the sets
at `x` contain all `closedBall y r` when `dist x y ≤ K * r`. -/
irreducible_def vitaliFamily (K : ℝ) : VitaliFamily μ := by
/- the Vitali covering theorem gives a family that works well at small scales, thanks to the
doubling property. We enlarge this family to add large sets, to make sure that all balls and not
only small ones belong to the family, for convenience. -/
let R := scalingScaleOf μ (max (4 * K + 3) 3)
have Rpos : 0 < R := scalingScaleOf_pos _ _
have A : ∀ x : α, ∃ᶠ r in 𝓝[>] (0 : ℝ),
μ (closedBall x (3 * r)) ≤ scalingConstantOf μ (max (4 * K + 3) 3) * μ (closedBall x r) := by
intro x
apply frequently_iff.2 fun {U} hU => ?_
obtain ⟨ε, εpos, hε⟩ := mem_nhdsGT_iff_exists_Ioc_subset.1 hU
refine ⟨min ε R, hε ⟨lt_min εpos Rpos, min_le_left _ _⟩, ?_⟩
exact measure_mul_le_scalingConstantOf_mul μ
⟨zero_lt_three, le_max_right _ _⟩ (min_le_right _ _)
exact (Vitali.vitaliFamily μ (scalingConstantOf μ (max (4 * K + 3) 3)) A).enlarge (R / 4)
(by linarith)
/-- In the Vitali family `IsUnifLocDoublingMeasure.vitaliFamily K`, the sets based at `x`
contain all balls `closedBall y r` when `dist x y ≤ K * r`. -/
theorem closedBall_mem_vitaliFamily_of_dist_le_mul {K : ℝ} {x y : α} {r : ℝ} (h : dist x y ≤ K * r)
(rpos : 0 < r) : closedBall y r ∈ (vitaliFamily μ K).setsAt x := by
let R := scalingScaleOf μ (max (4 * K + 3) 3)
simp only [vitaliFamily, VitaliFamily.enlarge, Vitali.vitaliFamily, mem_union, mem_setOf_eq,
isClosed_closedBall, true_and, (nonempty_ball.2 rpos).mono ball_subset_interior_closedBall,
measurableSet_closedBall]
/- The measure is doubling on scales smaller than `R`. Therefore, we treat differently small
and large balls. For large balls, this follows directly from the enlargement we used in the
definition. -/
by_cases H : closedBall y r ⊆ closedBall x (R / 4)
swap; · exact Or.inr H
left
/- For small balls, there is the difficulty that `r` could be large but still the ball could be
small, if the annulus `{y | ε ≤ dist y x ≤ R/4}` is empty. We split between the cases `r ≤ R`
and `r > R`, and use the doubling for the former and rough estimates for the latter. -/
rcases le_or_gt r R with (hr | hr)
· refine ⟨(K + 1) * r, ?_⟩
constructor
· apply closedBall_subset_closedBall'
rw [dist_comm]
linarith
· have I1 : closedBall x (3 * ((K + 1) * r)) ⊆ closedBall y ((4 * K + 3) * r) := by
apply closedBall_subset_closedBall'
linarith
have I2 : closedBall y ((4 * K + 3) * r) ⊆ closedBall y (max (4 * K + 3) 3 * r) := by
apply closedBall_subset_closedBall
exact mul_le_mul_of_nonneg_right (le_max_left _ _) rpos.le
apply (measure_mono (I1.trans I2)).trans
exact measure_mul_le_scalingConstantOf_mul _
⟨zero_lt_three.trans_le (le_max_right _ _), le_rfl⟩ hr
· refine ⟨R / 4, H, ?_⟩
have : closedBall x (3 * (R / 4)) ⊆ closedBall y r := by
apply closedBall_subset_closedBall'
have A : y ∈ closedBall y r := mem_closedBall_self rpos.le
have B := mem_closedBall'.1 (H A)
linarith
apply (measure_mono this).trans _
refine le_mul_of_one_le_left (zero_le _) ?_
exact ENNReal.one_le_coe_iff.2 (le_max_right _ _)
theorem tendsto_closedBall_filterAt {K : ℝ} {x : α} {ι : Type*} {l : Filter ι} (w : ι → α)
(δ : ι → ℝ) (δlim : Tendsto δ l (𝓝[>] 0)) (xmem : ∀ᶠ j in l, x ∈ closedBall (w j) (K * δ j)) :
Tendsto (fun j => closedBall (w j) (δ j)) l ((vitaliFamily μ K).filterAt x) := by
refine (vitaliFamily μ K).tendsto_filterAt_iff.mpr ⟨?_, fun ε hε => ?_⟩
· filter_upwards [xmem, δlim self_mem_nhdsWithin] with j hj h'j
exact closedBall_mem_vitaliFamily_of_dist_le_mul μ hj h'j
· rcases l.eq_or_neBot with rfl | h
· simp
have hK : 0 ≤ K := by
rcases (xmem.and (δlim self_mem_nhdsWithin)).exists with ⟨j, hj, h'j⟩
have : 0 ≤ K * δ j := nonempty_closedBall.1 ⟨x, hj⟩
exact (mul_nonneg_iff_left_nonneg_of_pos (mem_Ioi.1 h'j)).1 this
have δpos := eventually_mem_of_tendsto_nhdsWithin δlim
replace δlim := tendsto_nhds_of_tendsto_nhdsWithin δlim
replace hK : 0 < K + 1 := by linarith
apply (((Metric.tendsto_nhds.mp δlim _ (div_pos hε hK)).and δpos).and xmem).mono
rintro j ⟨⟨hjε, hj₀ : 0 < δ j⟩, hx⟩ y hy
replace hjε : (K + 1) * δ j < ε := by
simpa [abs_eq_self.mpr hj₀.le] using (lt_div_iff₀' hK).mp hjε
simp only [mem_closedBall] at hx hy ⊢
linarith [dist_triangle_right y x (w j)]
end
section Applications
variable [SecondCountableTopology α] [BorelSpace α] [IsLocallyFiniteMeasure μ] {E : Type*}
[NormedAddCommGroup E]
/-- A version of **Lebesgue's density theorem** for a sequence of closed balls whose centers are
not required to be fixed.
See also `Besicovitch.ae_tendsto_measure_inter_div`. -/
theorem ae_tendsto_measure_inter_div (S : Set α) (K : ℝ) : ∀ᵐ x ∂μ.restrict S,
∀ {ι : Type*} {l : Filter ι} (w : ι → α) (δ : ι → ℝ) (_ : Tendsto δ l (𝓝[>] 0))
(_ : ∀ᶠ j in l, x ∈ closedBall (w j) (K * δ j)),
Tendsto (fun j => μ (S ∩ closedBall (w j) (δ j)) / μ (closedBall (w j) (δ j))) l (𝓝 1) := by
filter_upwards [(vitaliFamily μ K).ae_tendsto_measure_inter_div S] with x hx ι l w δ δlim
xmem using hx.comp (tendsto_closedBall_filterAt μ _ _ δlim xmem)
/-- A version of **Lebesgue differentiation theorem** for a sequence of closed balls whose
centers are not required to be fixed. -/
theorem ae_tendsto_average_norm_sub {f : α → E} (hf : LocallyIntegrable f μ) (K : ℝ) : ∀ᵐ x ∂μ,
∀ {ι : Type*} {l : Filter ι} (w : ι → α) (δ : ι → ℝ) (_ : Tendsto δ l (𝓝[>] 0))
(_ : ∀ᶠ j in l, x ∈ closedBall (w j) (K * δ j)),
Tendsto (fun j => ⨍ y in closedBall (w j) (δ j), ‖f y - f x‖ ∂μ) l (𝓝 0) := by
filter_upwards [(vitaliFamily μ K).ae_tendsto_average_norm_sub hf] with x hx ι l w δ δlim
xmem using hx.comp (tendsto_closedBall_filterAt μ _ _ δlim xmem)
/-- A version of **Lebesgue differentiation theorem** for a sequence of closed balls whose
centers are not required to be fixed. -/
theorem ae_tendsto_average [NormedSpace ℝ E] [CompleteSpace E]
{f : α → E} (hf : LocallyIntegrable f μ) (K : ℝ) : ∀ᵐ x ∂μ,
∀ {ι : Type*} {l : Filter ι} (w : ι → α) (δ : ι → ℝ) (_ : Tendsto δ l (𝓝[>] 0))
(_ : ∀ᶠ j in l, x ∈ closedBall (w j) (K * δ j)),
Tendsto (fun j => ⨍ y in closedBall (w j) (δ j), f y ∂μ) l (𝓝 (f x)) := by
filter_upwards [(vitaliFamily μ K).ae_tendsto_average hf] with x hx ι l w δ δlim xmem using
hx.comp (tendsto_closedBall_filterAt μ _ _ δlim xmem)
end Applications
end IsUnifLocDoublingMeasure |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/Gamma.lean | import Mathlib.Analysis.SpecialFunctions.PolarCoord
import Mathlib.Analysis.SpecialFunctions.Gamma.Basic
/-!
# Integrals involving the Gamma function
In this file, we collect several integrals over `ℝ` or `ℂ` that evaluate in terms of the
`Real.Gamma` function.
-/
open Real Set MeasureTheory MeasureTheory.Measure
section real
theorem integral_rpow_mul_exp_neg_rpow {p q : ℝ} (hp : 0 < p) (hq : -1 < q) :
∫ x in Ioi (0 : ℝ), x ^ q * exp (-x ^ p) = (1 / p) * Gamma ((q + 1) / p) := by
calc
_ = ∫ (x : ℝ) in Ioi 0, (1 / p * x ^ (1 / p - 1)) • ((x ^ (1 / p)) ^ q * exp (-x)) := by
rw [← integral_comp_rpow_Ioi _ (one_div_ne_zero (ne_of_gt hp)),
abs_eq_self.mpr (le_of_lt (one_div_pos.mpr hp))]
refine setIntegral_congr_fun measurableSet_Ioi (fun _ hx => ?_)
rw [← rpow_mul (le_of_lt hx) _ p, one_div_mul_cancel (ne_of_gt hp), rpow_one]
_ = ∫ (x : ℝ) in Ioi 0, 1 / p * exp (-x) * x ^ (1 / p - 1 + q / p) := by
simp_rw [smul_eq_mul, mul_assoc]
refine setIntegral_congr_fun measurableSet_Ioi (fun _ hx => ?_)
rw [← rpow_mul (le_of_lt hx), div_mul_eq_mul_div, one_mul, rpow_add hx]
ring_nf
_ = (1 / p) * Gamma ((q + 1) / p) := by
rw [Gamma_eq_integral (div_pos (neg_lt_iff_pos_add.mp hq) hp)]
simp_rw [show 1 / p - 1 + q / p = (q + 1) / p - 1 by ring, ← integral_const_mul,
← mul_assoc]
theorem integral_rpow_mul_exp_neg_mul_rpow {p q b : ℝ} (hp : 0 < p) (hq : -1 < q) (hb : 0 < b) :
∫ x in Ioi (0 : ℝ), x ^ q * exp (-b * x ^ p) =
b ^ (-(q + 1) / p) * (1 / p) * Gamma ((q + 1) / p) := by
calc
_ = ∫ x in Ioi (0 : ℝ), b ^ (-p⁻¹ * q) * ((b ^ p⁻¹ * x) ^ q * rexp (-(b ^ p⁻¹ * x) ^ p)) := by
refine setIntegral_congr_fun measurableSet_Ioi (fun _ hx => ?_)
rw [mul_rpow _ (le_of_lt hx), mul_rpow _ (le_of_lt hx), ← rpow_mul, ← rpow_mul,
inv_mul_cancel₀, rpow_one, mul_assoc, ← mul_assoc, ← rpow_add, neg_mul p⁻¹, neg_add_cancel,
rpow_zero, one_mul, neg_mul]
all_goals positivity
_ = (b ^ p⁻¹)⁻¹ * ∫ x in Ioi (0 : ℝ), b ^ (-p⁻¹ * q) * (x ^ q * rexp (-x ^ p)) := by
rw [integral_comp_mul_left_Ioi (fun x => b ^ (-p⁻¹ * q) * (x ^ q * exp (-x ^ p))) 0,
mul_zero, smul_eq_mul]
all_goals positivity
_ = b ^ (-(q + 1) / p) * (1 / p) * Gamma ((q + 1) / p) := by
rw [integral_const_mul, integral_rpow_mul_exp_neg_rpow _ hq, mul_assoc, ← mul_assoc,
← rpow_neg_one, ← rpow_mul, ← rpow_add]
· congr; ring
all_goals positivity
theorem integral_exp_neg_rpow {p : ℝ} (hp : 0 < p) :
∫ x in Ioi (0 : ℝ), exp (-x ^ p) = Gamma (1 / p + 1) := by
convert (integral_rpow_mul_exp_neg_rpow hp neg_one_lt_zero) using 1
· simp_rw [rpow_zero, one_mul]
· rw [zero_add, Gamma_add_one (one_div_ne_zero (ne_of_gt hp))]
theorem integral_exp_neg_mul_rpow {p b : ℝ} (hp : 0 < p) (hb : 0 < b) :
∫ x in Ioi (0 : ℝ), exp (-b * x ^ p) = b ^ (-1 / p) * Gamma (1 / p + 1) := by
convert (integral_rpow_mul_exp_neg_mul_rpow hp neg_one_lt_zero hb) using 1
· simp_rw [rpow_zero, one_mul]
· rw [zero_add, Gamma_add_one (one_div_ne_zero (ne_of_gt hp)), mul_assoc]
end real
section complex
theorem Complex.integral_rpow_mul_exp_neg_rpow {p q : ℝ} (hp : 1 ≤ p) (hq : -2 < q) :
∫ x : ℂ, ‖x‖ ^ q * rexp (-‖x‖ ^ p) = (2 * π / p) * Real.Gamma ((q + 2) / p) := by
calc
_ = ∫ x in Ioi (0 : ℝ) ×ˢ Ioo (-π) π, x.1 * (|x.1| ^ q * rexp (-|x.1| ^ p)) := by
rw [← Complex.integral_comp_polarCoord_symm, polarCoord_target]
simp_rw [Complex.norm_polarCoord_symm, smul_eq_mul]
_ = (∫ x in Ioi (0 : ℝ), x * |x| ^ q * rexp (-|x| ^ p)) * ∫ _ in Ioo (-π) π, 1 := by
rw [← setIntegral_prod_mul, volume_eq_prod]
simp_rw [mul_one]
congr! 2; ring
_ = 2 * π * ∫ x in Ioi (0 : ℝ), x * |x| ^ q * rexp (-|x| ^ p) := by
simp_rw [integral_const, measureReal_restrict_apply MeasurableSet.univ, Set.univ_inter,
volume_real_Ioo_of_le (a := -π) (b := π) (by linarith [pi_nonneg]),
sub_neg_eq_add, ← two_mul, smul_eq_mul, mul_one, mul_comm]
_ = 2 * π * ∫ x in Ioi (0 : ℝ), x ^ (q + 1) * rexp (-x ^ p) := by
congr 1
refine setIntegral_congr_fun measurableSet_Ioi (fun x hx => ?_)
rw [mem_Ioi] at hx
rw [abs_eq_self.mpr hx.le, rpow_add hx, rpow_one]
ring
_ = (2 * Real.pi / p) * Real.Gamma ((q + 2) / p) := by
rw [_root_.integral_rpow_mul_exp_neg_rpow (by linarith) (by linarith), add_assoc,
one_add_one_eq_two]
ring
theorem Complex.integral_rpow_mul_exp_neg_mul_rpow {p q b : ℝ} (hp : 1 ≤ p) (hq : -2 < q)
(hb : 0 < b) :
∫ x : ℂ, ‖x‖ ^ q * rexp (-b * ‖x‖ ^ p) = (2 * π / p) *
b ^ (-(q + 2) / p) * Real.Gamma ((q + 2) / p) := by
calc
_ = ∫ x in Ioi (0 : ℝ) ×ˢ Ioo (-π) π, x.1 * (|x.1| ^ q * rexp (-b * |x.1| ^ p)) := by
rw [← Complex.integral_comp_polarCoord_symm, polarCoord_target]
simp_rw [Complex.norm_polarCoord_symm, smul_eq_mul]
_ = (∫ x in Ioi (0 : ℝ), x * |x| ^ q * rexp (-b * |x| ^ p)) * ∫ _ in Ioo (-π) π, 1 := by
rw [← setIntegral_prod_mul, volume_eq_prod]
simp_rw [mul_one]
congr! 2; ring
_ = 2 * π * ∫ x in Ioi (0 : ℝ), x * |x| ^ q * rexp (-b * |x| ^ p) := by
simp_rw [integral_const, measureReal_restrict_apply MeasurableSet.univ, Set.univ_inter,
volume_real_Ioo_of_le (a := -π) (b := π) (by linarith [pi_nonneg]),
sub_neg_eq_add, ← two_mul, smul_eq_mul, mul_one, mul_comm]
_ = 2 * π * ∫ x in Ioi (0 : ℝ), x ^ (q + 1) * rexp (-b * x ^ p) := by
congr 1
refine setIntegral_congr_fun measurableSet_Ioi (fun x hx => ?_)
rw [mem_Ioi] at hx
rw [abs_eq_self.mpr hx.le, rpow_add hx, rpow_one]
ring
_ = (2 * π / p) * b ^ (-(q + 2) / p) * Real.Gamma ((q + 2) / p) := by
rw [_root_.integral_rpow_mul_exp_neg_mul_rpow (by linarith) (by linarith) hb, add_assoc,
one_add_one_eq_two]
ring
theorem Complex.integral_exp_neg_rpow {p : ℝ} (hp : 1 ≤ p) :
∫ x : ℂ, rexp (-‖x‖ ^ p) = π * Real.Gamma (2 / p + 1) := by
convert (integral_rpow_mul_exp_neg_rpow hp (by linarith : (-2 : ℝ) < 0)) using 1
· simp_rw [rpow_zero, one_mul]
· rw [zero_add, Real.Gamma_add_one (div_ne_zero two_ne_zero (by linarith))]
ring
theorem Complex.integral_exp_neg_mul_rpow {p b : ℝ} (hp : 1 ≤ p) (hb : 0 < b) :
∫ x : ℂ, rexp (-b * ‖x‖ ^ p) = π * b ^ (-2 / p) * Real.Gamma (2 / p + 1) := by
convert (integral_rpow_mul_exp_neg_mul_rpow hp (by linarith : (-2 : ℝ) < 0)) hb using 1
· simp_rw [rpow_zero, one_mul]
· rw [zero_add, Real.Gamma_add_one (div_ne_zero two_ne_zero (by linarith))]
ring
end complex |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/FinMeasAdditive.lean | import Mathlib.MeasureTheory.Function.SimpleFuncDenseLp
/-!
# Additivity on measurable sets with finite measure
Let `T : Set α → E →L[ℝ] F` be additive for measurable sets with finite measure, in the sense that
for `s, t` two such sets, `Disjoint s t → T (s ∪ t) = T s + T t`. `T` is akin to a bilinear map on
`Set α × E`, or a linear map on indicator functions.
This property is named `FinMeasAdditive` in this file. We also define `DominatedFinMeasAdditive`,
which requires in addition that the norm on every set is less than the measure of the set
(up to a multiplicative constant); in `Mathlib/MeasureTheory/Integral/SetToL1.lean` we extend
set functions with this stronger property to integrable (L1) functions.
## Main definitions
- `FinMeasAdditive μ T`: the property that `T` is additive on measurable sets with finite measure.
For two such sets, `Disjoint s t → T (s ∪ t) = T s + T t`.
- `DominatedFinMeasAdditive μ T C`: `FinMeasAdditive μ T ∧ ∀ s, ‖T s‖ ≤ C * μ.real s`.
This is the property needed to perform the extension from indicators to L1.
## Implementation notes
The starting object `T : Set α → E →L[ℝ] F` matters only through its restriction on measurable sets
with finite measure. Its value on other sets is ignored.
-/
noncomputable section
open Set Filter ENNReal Finset
namespace MeasureTheory
variable {α E F F' G 𝕜 : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup F'] [NormedSpace ℝ F']
[NormedAddCommGroup G] {m : MeasurableSpace α} {μ : Measure α}
local infixr:25 " →ₛ " => SimpleFunc
section FinMeasAdditive
/-- A set function is `FinMeasAdditive` if its value on the union of two disjoint measurable
sets with finite measure is the sum of its values on each set. -/
def FinMeasAdditive {β} [AddMonoid β] {_ : MeasurableSpace α} (μ : Measure α) (T : Set α → β) :
Prop :=
∀ s t, MeasurableSet s → MeasurableSet t → μ s ≠ ∞ → μ t ≠ ∞ → Disjoint s t →
T (s ∪ t) = T s + T t
namespace FinMeasAdditive
variable {β : Type*} [AddCommMonoid β] {T T' : Set α → β}
theorem zero : FinMeasAdditive μ (0 : Set α → β) := fun _ _ _ _ _ _ _ => by simp
theorem add (hT : FinMeasAdditive μ T) (hT' : FinMeasAdditive μ T') :
FinMeasAdditive μ (T + T') := by
intro s t hs ht hμs hμt hst
simp only [hT s t hs ht hμs hμt hst, hT' s t hs ht hμs hμt hst, Pi.add_apply]
abel
theorem smul [DistribSMul 𝕜 β] (hT : FinMeasAdditive μ T) (c : 𝕜) :
FinMeasAdditive μ fun s => c • T s := fun s t hs ht hμs hμt hst => by
simp [hT s t hs ht hμs hμt hst]
theorem of_eq_top_imp_eq_top {μ' : Measure α} (h : ∀ s, MeasurableSet s → μ s = ∞ → μ' s = ∞)
(hT : FinMeasAdditive μ T) : FinMeasAdditive μ' T := fun s t hs ht hμ's hμ't hst =>
hT s t hs ht (mt (h s hs) hμ's) (mt (h t ht) hμ't) hst
theorem of_smul_measure {c : ℝ≥0∞} (hc_ne_top : c ≠ ∞) (hT : FinMeasAdditive (c • μ) T) :
FinMeasAdditive μ T := by
refine of_eq_top_imp_eq_top (fun s _ hμs => ?_) hT
rw [Measure.smul_apply, smul_eq_mul, ENNReal.mul_eq_top] at hμs
simp only [hc_ne_top, or_false, Ne, false_and] at hμs
exact hμs.2
theorem smul_measure (c : ℝ≥0∞) (hc_ne_zero : c ≠ 0) (hT : FinMeasAdditive μ T) :
FinMeasAdditive (c • μ) T := by
refine of_eq_top_imp_eq_top (fun s _ hμs => ?_) hT
rw [Measure.smul_apply, smul_eq_mul, ENNReal.mul_eq_top]
simp only [hc_ne_zero, true_and, Ne, not_false_iff]
exact Or.inl hμs
theorem smul_measure_iff (c : ℝ≥0∞) (hc_ne_zero : c ≠ 0) (hc_ne_top : c ≠ ∞) :
FinMeasAdditive (c • μ) T ↔ FinMeasAdditive μ T :=
⟨fun hT => of_smul_measure hc_ne_top hT, fun hT => smul_measure c hc_ne_zero hT⟩
theorem map_empty_eq_zero {β} [AddCancelMonoid β] {T : Set α → β} (hT : FinMeasAdditive μ T) :
T ∅ = 0 := by
have h_empty : μ ∅ ≠ ∞ := (measure_empty.le.trans_lt ENNReal.coe_lt_top).ne
specialize hT ∅ ∅ MeasurableSet.empty MeasurableSet.empty h_empty h_empty (disjoint_empty _)
rw [Set.union_empty] at hT
nth_rw 1 [← add_zero (T ∅)] at hT
exact (add_left_cancel hT).symm
theorem map_iUnion_fin_meas_set_eq_sum (T : Set α → β) (T_empty : T ∅ = 0)
(h_add : FinMeasAdditive μ T) {ι} (S : ι → Set α) (sι : Finset ι)
(hS_meas : ∀ i, MeasurableSet (S i)) (hSp : ∀ i ∈ sι, μ (S i) ≠ ∞)
(h_disj : ∀ᵉ (i ∈ sι) (j ∈ sι), i ≠ j → Disjoint (S i) (S j)) :
T (⋃ i ∈ sι, S i) = ∑ i ∈ sι, T (S i) := by
classical
revert hSp h_disj
refine Finset.induction_on sι ?_ ?_
· simp only [Finset.notMem_empty, IsEmpty.forall_iff, iUnion_false, iUnion_empty, sum_empty,
imp_true_iff, T_empty]
intro a s has h hps h_disj
rw [Finset.sum_insert has, ← h]
swap; · exact fun i hi => hps i (Finset.mem_insert_of_mem hi)
swap
· exact fun i hi j hj hij =>
h_disj i (Finset.mem_insert_of_mem hi) j (Finset.mem_insert_of_mem hj) hij
rw [←
h_add (S a) (⋃ i ∈ s, S i) (hS_meas a) (measurableSet_biUnion _ fun i _ => hS_meas i)
(hps a (Finset.mem_insert_self a s))]
· congr; convert Finset.iSup_insert a s S
· exact (measure_biUnion_lt_top s.finite_toSet fun i hi ↦
(hps i <| Finset.mem_insert_of_mem hi).lt_top).ne
· simp_rw [Set.disjoint_iUnion_right]
intro i hi
refine h_disj a (Finset.mem_insert_self a s) i (Finset.mem_insert_of_mem hi) fun hai ↦ ?_
rw [← hai] at hi
exact has hi
end FinMeasAdditive
/-- A `FinMeasAdditive` set function whose norm on every set is less than the measure of the
set (up to a multiplicative constant). -/
def DominatedFinMeasAdditive {β} [SeminormedAddCommGroup β] {_ : MeasurableSpace α} (μ : Measure α)
(T : Set α → β) (C : ℝ) : Prop :=
FinMeasAdditive μ T ∧ ∀ s, MeasurableSet s → μ s < ∞ → ‖T s‖ ≤ C * μ.real s
namespace DominatedFinMeasAdditive
variable {β : Type*} [SeminormedAddCommGroup β] {T T' : Set α → β} {C C' : ℝ}
theorem zero {m : MeasurableSpace α} (μ : Measure α) (hC : 0 ≤ C) :
DominatedFinMeasAdditive μ (0 : Set α → β) C := by
refine ⟨FinMeasAdditive.zero, fun s _ _ => ?_⟩
rw [Pi.zero_apply, norm_zero]
exact mul_nonneg hC toReal_nonneg
theorem eq_zero_of_measure_zero {β : Type*} [NormedAddCommGroup β] {T : Set α → β} {C : ℝ}
(hT : DominatedFinMeasAdditive μ T C) {s : Set α} (hs : MeasurableSet s) (hs_zero : μ s = 0) :
T s = 0 := by
refine norm_eq_zero.mp ?_
refine ((hT.2 s hs (by simp [hs_zero])).trans (le_of_eq ?_)).antisymm (norm_nonneg _)
rw [measureReal_def, hs_zero, ENNReal.toReal_zero, mul_zero]
theorem eq_zero {β : Type*} [NormedAddCommGroup β] {T : Set α → β} {C : ℝ} {_ : MeasurableSpace α}
(hT : DominatedFinMeasAdditive (0 : Measure α) T C) {s : Set α} (hs : MeasurableSet s) :
T s = 0 :=
eq_zero_of_measure_zero hT hs (by simp only [Measure.coe_zero, Pi.zero_apply])
theorem add (hT : DominatedFinMeasAdditive μ T C) (hT' : DominatedFinMeasAdditive μ T' C') :
DominatedFinMeasAdditive μ (T + T') (C + C') := by
refine ⟨hT.1.add hT'.1, fun s hs hμs => ?_⟩
rw [Pi.add_apply, add_mul]
exact (norm_add_le _ _).trans (add_le_add (hT.2 s hs hμs) (hT'.2 s hs hμs))
theorem smul [SeminormedAddGroup 𝕜] [DistribSMul 𝕜 β] [IsBoundedSMul 𝕜 β]
(hT : DominatedFinMeasAdditive μ T C) (c : 𝕜) :
DominatedFinMeasAdditive μ (fun s => c • T s) (‖c‖ * C) := by
refine ⟨hT.1.smul c, fun s hs hμs => (norm_smul_le _ _).trans ?_⟩
rw [mul_assoc]
exact mul_le_mul le_rfl (hT.2 s hs hμs) (norm_nonneg _) (norm_nonneg _)
theorem of_measure_le {μ' : Measure α} (h : μ ≤ μ') (hT : DominatedFinMeasAdditive μ T C)
(hC : 0 ≤ C) : DominatedFinMeasAdditive μ' T C := by
have h' : ∀ s, μ s = ∞ → μ' s = ∞ := fun s hs ↦ top_unique <| hs.symm.trans_le (h _)
refine ⟨hT.1.of_eq_top_imp_eq_top fun s _ ↦ h' s, fun s hs hμ's ↦ ?_⟩
have hμs : μ s < ∞ := (h s).trans_lt hμ's
calc
‖T s‖ ≤ C * μ.real s := hT.2 s hs hμs
_ ≤ C * μ'.real s := by
simp only [measureReal_def]
gcongr
exacts [hμ's.ne, h s]
theorem add_measure_right {_ : MeasurableSpace α} (μ ν : Measure α)
(hT : DominatedFinMeasAdditive μ T C) (hC : 0 ≤ C) : DominatedFinMeasAdditive (μ + ν) T C :=
of_measure_le (Measure.le_add_right le_rfl) hT hC
theorem add_measure_left {_ : MeasurableSpace α} (μ ν : Measure α)
(hT : DominatedFinMeasAdditive ν T C) (hC : 0 ≤ C) : DominatedFinMeasAdditive (μ + ν) T C :=
of_measure_le (Measure.le_add_left le_rfl) hT hC
theorem of_smul_measure {c : ℝ≥0∞} (hc_ne_top : c ≠ ∞) (hT : DominatedFinMeasAdditive (c • μ) T C) :
DominatedFinMeasAdditive μ T (c.toReal * C) := by
have h : ∀ s, MeasurableSet s → c • μ s = ∞ → μ s = ∞ := by
intro s _ hcμs
simp only [hc_ne_top, Algebra.id.smul_eq_mul, ENNReal.mul_eq_top, or_false, Ne,
false_and] at hcμs
exact hcμs.2
refine ⟨hT.1.of_eq_top_imp_eq_top (μ := c • μ) h, fun s hs hμs => ?_⟩
have hcμs : c • μ s ≠ ∞ := mt (h s hs) hμs.ne
rw [smul_eq_mul] at hcμs
refine (hT.2 s hs hcμs.lt_top).trans (le_of_eq ?_)
simp only [measureReal_ennreal_smul_apply]
ring
theorem of_measure_le_smul {μ' : Measure α} {c : ℝ≥0∞} (hc : c ≠ ∞) (h : μ ≤ c • μ')
(hT : DominatedFinMeasAdditive μ T C) (hC : 0 ≤ C) :
DominatedFinMeasAdditive μ' T (c.toReal * C) :=
(hT.of_measure_le h hC).of_smul_measure hc
end DominatedFinMeasAdditive
end FinMeasAdditive
namespace SimpleFunc
/-- Extend `Set α → (F →L[ℝ] F')` to `(α →ₛ F) → F'`. -/
def setToSimpleFunc {_ : MeasurableSpace α} (T : Set α → F →L[ℝ] F') (f : α →ₛ F) : F' :=
∑ x ∈ f.range, T (f ⁻¹' {x}) x
@[simp]
theorem setToSimpleFunc_zero {m : MeasurableSpace α} (f : α →ₛ F) :
setToSimpleFunc (0 : Set α → F →L[ℝ] F') f = 0 := by simp [setToSimpleFunc]
theorem setToSimpleFunc_zero' {T : Set α → E →L[ℝ] F'}
(h_zero : ∀ s, MeasurableSet s → μ s < ∞ → T s = 0) (f : α →ₛ E) (hf : Integrable f μ) :
setToSimpleFunc T f = 0 := by
simp_rw [setToSimpleFunc]
refine sum_eq_zero fun x _ => ?_
by_cases hx0 : x = 0
· simp [hx0]
rw [h_zero (f ⁻¹' ({x} : Set E)) (measurableSet_fiber _ _)
(measure_preimage_lt_top_of_integrable f hf hx0),
ContinuousLinearMap.zero_apply]
@[simp]
theorem setToSimpleFunc_zero_apply {m : MeasurableSpace α} (T : Set α → F →L[ℝ] F') :
setToSimpleFunc T (0 : α →ₛ F) = 0 := by
cases isEmpty_or_nonempty α <;> simp [setToSimpleFunc]
theorem setToSimpleFunc_eq_sum_filter [DecidablePred fun x ↦ x ≠ (0 : F)]
{m : MeasurableSpace α} (T : Set α → F →L[ℝ] F') (f : α →ₛ F) :
setToSimpleFunc T f = ∑ x ∈ f.range with x ≠ 0, T (f ⁻¹' {x}) x := by
symm
refine sum_filter_of_ne fun x _ => mt fun hx0 => ?_
rw [hx0]
exact ContinuousLinearMap.map_zero _
theorem map_setToSimpleFunc (T : Set α → F →L[ℝ] F') (h_add : FinMeasAdditive μ T) {f : α →ₛ G}
(hf : Integrable f μ) {g : G → F} (hg : g 0 = 0) :
(f.map g).setToSimpleFunc T = ∑ x ∈ f.range, T (f ⁻¹' {x}) (g x) := by
classical
have T_empty : T ∅ = 0 := h_add.map_empty_eq_zero
have hfp : ∀ x ∈ f.range, x ≠ 0 → μ (f ⁻¹' {x}) ≠ ∞ := fun x _ hx0 =>
(measure_preimage_lt_top_of_integrable f hf hx0).ne
simp only [setToSimpleFunc, range_map]
refine Finset.sum_image' _ fun b hb => ?_
rcases mem_range.1 hb with ⟨a, rfl⟩
by_cases h0 : g (f a) = 0
· simp_rw [h0]
rw [ContinuousLinearMap.map_zero, Finset.sum_eq_zero fun x hx => ?_]
rw [mem_filter] at hx
rw [hx.2, ContinuousLinearMap.map_zero]
have h_left_eq :
T (map g f ⁻¹' {g (f a)}) (g (f a))
= T (f ⁻¹' ({b ∈ f.range | g b = g (f a)} : Finset _)) (g (f a)) := by
rw [map_preimage_singleton]
rw [h_left_eq]
have h_left_eq' :
T (f ⁻¹' ({b ∈ f.range | g b = g (f a)} : Finset _)) (g (f a))
= T (⋃ y ∈ {b ∈ f.range | g b = g (f a)}, f ⁻¹' {y}) (g (f a)) := by
rw [← Finset.set_biUnion_preimage_singleton]
rw [h_left_eq']
rw [h_add.map_iUnion_fin_meas_set_eq_sum T T_empty]
· simp only [sum_apply, ContinuousLinearMap.coe_sum']
refine Finset.sum_congr rfl fun x hx => ?_
rw [mem_filter] at hx
rw [hx.2]
· exact fun i => measurableSet_fiber _ _
· grind
· grind [Set.disjoint_iff]
theorem setToSimpleFunc_congr' (T : Set α → E →L[ℝ] F) (h_add : FinMeasAdditive μ T) {f g : α →ₛ E}
(hf : Integrable f μ) (hg : Integrable g μ)
(h : Pairwise fun x y => T (f ⁻¹' {x} ∩ g ⁻¹' {y}) = 0) :
f.setToSimpleFunc T = g.setToSimpleFunc T :=
show ((pair f g).map Prod.fst).setToSimpleFunc T = ((pair f g).map Prod.snd).setToSimpleFunc T by
have h_pair : Integrable (f.pair g) μ := integrable_pair hf hg
rw [map_setToSimpleFunc T h_add h_pair Prod.fst_zero]
rw [map_setToSimpleFunc T h_add h_pair Prod.snd_zero]
refine Finset.sum_congr rfl fun p hp => ?_
rcases mem_range.1 hp with ⟨a, rfl⟩
by_cases eq : f a = g a
· dsimp only [pair_apply]; rw [eq]
· have : T (pair f g ⁻¹' {(f a, g a)}) = 0 := by
have h_eq : T ((⇑(f.pair g)) ⁻¹' {(f a, g a)}) = T (f ⁻¹' {f a} ∩ g ⁻¹' {g a}) := by
congr; rw [pair_preimage_singleton f g]
rw [h_eq]
exact h eq
simp only [this, ContinuousLinearMap.zero_apply, pair_apply]
theorem setToSimpleFunc_congr (T : Set α → E →L[ℝ] F)
(h_zero : ∀ s, MeasurableSet s → μ s = 0 → T s = 0) (h_add : FinMeasAdditive μ T) {f g : α →ₛ E}
(hf : Integrable f μ) (h : f =ᵐ[μ] g) : f.setToSimpleFunc T = g.setToSimpleFunc T := by
refine setToSimpleFunc_congr' T h_add hf ((integrable_congr h).mp hf) ?_
refine fun x y hxy => h_zero _ ((measurableSet_fiber f x).inter (measurableSet_fiber g y)) ?_
rw [EventuallyEq, ae_iff] at h
refine measure_mono_null (fun z => ?_) h
simp_rw [Set.mem_inter_iff, Set.mem_setOf_eq, Set.mem_preimage, Set.mem_singleton_iff]
intro h
rwa [h.1, h.2]
theorem setToSimpleFunc_congr_left (T T' : Set α → E →L[ℝ] F)
(h : ∀ s, MeasurableSet s → μ s < ∞ → T s = T' s) (f : α →ₛ E) (hf : Integrable f μ) :
setToSimpleFunc T f = setToSimpleFunc T' f := by
simp_rw [setToSimpleFunc]
refine sum_congr rfl fun x _ => ?_
by_cases hx0 : x = 0
· simp [hx0]
· rw [h (f ⁻¹' {x}) (SimpleFunc.measurableSet_fiber _ _)
(SimpleFunc.measure_preimage_lt_top_of_integrable _ hf hx0)]
theorem setToSimpleFunc_add_left {m : MeasurableSpace α} (T T' : Set α → F →L[ℝ] F') {f : α →ₛ F} :
setToSimpleFunc (T + T') f = setToSimpleFunc T f + setToSimpleFunc T' f := by
simp_rw [setToSimpleFunc, Pi.add_apply]
push_cast
simp_rw [Pi.add_apply, sum_add_distrib]
theorem setToSimpleFunc_add_left' (T T' T'' : Set α → E →L[ℝ] F)
(h_add : ∀ s, MeasurableSet s → μ s < ∞ → T'' s = T s + T' s) {f : α →ₛ E}
(hf : Integrable f μ) : setToSimpleFunc T'' f = setToSimpleFunc T f + setToSimpleFunc T' f := by
classical
simp_rw [setToSimpleFunc_eq_sum_filter]
suffices ∀ x ∈ {x ∈ f.range | x ≠ 0}, T'' (f ⁻¹' {x}) = T (f ⁻¹' {x}) + T' (f ⁻¹' {x}) by
rw [← sum_add_distrib]
refine Finset.sum_congr rfl fun x hx => ?_
rw [this x hx]
push_cast
rw [Pi.add_apply]
intro x hx
refine
h_add (f ⁻¹' {x}) (measurableSet_preimage _ _) (measure_preimage_lt_top_of_integrable _ hf ?_)
rw [mem_filter] at hx
exact hx.2
theorem setToSimpleFunc_smul_left {m : MeasurableSpace α} (T : Set α → F →L[ℝ] F') (c : ℝ)
(f : α →ₛ F) : setToSimpleFunc (fun s => c • T s) f = c • setToSimpleFunc T f := by
simp_rw [setToSimpleFunc, ContinuousLinearMap.smul_apply, smul_sum]
theorem setToSimpleFunc_smul_left' (T T' : Set α → E →L[ℝ] F') (c : ℝ)
(h_smul : ∀ s, MeasurableSet s → μ s < ∞ → T' s = c • T s) {f : α →ₛ E} (hf : Integrable f μ) :
setToSimpleFunc T' f = c • setToSimpleFunc T f := by
classical
simp_rw [setToSimpleFunc_eq_sum_filter]
suffices ∀ x ∈ {x ∈ f.range | x ≠ 0}, T' (f ⁻¹' {x}) = c • T (f ⁻¹' {x}) by
rw [smul_sum]
refine Finset.sum_congr rfl fun x hx => ?_
rw [this x hx, ContinuousLinearMap.smul_apply]
intro x hx
refine
h_smul (f ⁻¹' {x}) (measurableSet_preimage _ _) (measure_preimage_lt_top_of_integrable _ hf ?_)
rw [mem_filter] at hx
exact hx.2
theorem setToSimpleFunc_add (T : Set α → E →L[ℝ] F) (h_add : FinMeasAdditive μ T) {f g : α →ₛ E}
(hf : Integrable f μ) (hg : Integrable g μ) :
setToSimpleFunc T (f + g) = setToSimpleFunc T f + setToSimpleFunc T g :=
have hp_pair : Integrable (f.pair g) μ := integrable_pair hf hg
calc
setToSimpleFunc T (f + g) = ∑ x ∈ (pair f g).range, T (pair f g ⁻¹' {x}) (x.fst + x.snd) := by
rw [add_eq_map₂, map_setToSimpleFunc T h_add hp_pair]; simp
_ = ∑ x ∈ (pair f g).range, (T (pair f g ⁻¹' {x}) x.fst + T (pair f g ⁻¹' {x}) x.snd) :=
(Finset.sum_congr rfl fun _ _ => ContinuousLinearMap.map_add _ _ _)
_ = (∑ x ∈ (pair f g).range, T (pair f g ⁻¹' {x}) x.fst) +
∑ x ∈ (pair f g).range, T (pair f g ⁻¹' {x}) x.snd := by
rw [Finset.sum_add_distrib]
_ = ((pair f g).map Prod.fst).setToSimpleFunc T +
((pair f g).map Prod.snd).setToSimpleFunc T := by
rw [map_setToSimpleFunc T h_add hp_pair Prod.snd_zero,
map_setToSimpleFunc T h_add hp_pair Prod.fst_zero]
theorem setToSimpleFunc_neg (T : Set α → E →L[ℝ] F) (h_add : FinMeasAdditive μ T) {f : α →ₛ E}
(hf : Integrable f μ) : setToSimpleFunc T (-f) = -setToSimpleFunc T f :=
calc
setToSimpleFunc T (-f) = setToSimpleFunc T (f.map Neg.neg) := rfl
_ = -setToSimpleFunc T f := by
rw [map_setToSimpleFunc T h_add hf neg_zero, setToSimpleFunc, ← sum_neg_distrib]
exact Finset.sum_congr rfl fun x _ => ContinuousLinearMap.map_neg _ _
theorem setToSimpleFunc_sub (T : Set α → E →L[ℝ] F) (h_add : FinMeasAdditive μ T) {f g : α →ₛ E}
(hf : Integrable f μ) (hg : Integrable g μ) :
setToSimpleFunc T (f - g) = setToSimpleFunc T f - setToSimpleFunc T g := by
rw [sub_eq_add_neg, setToSimpleFunc_add T h_add hf, setToSimpleFunc_neg T h_add hg,
sub_eq_add_neg]
rw [integrable_iff] at hg ⊢
intro x hx_ne
rw [SimpleFunc.coe_neg, Pi.neg_def, ← Function.comp_def, preimage_comp, neg_preimage,
Set.neg_singleton]
refine hg (-x) ?_
simp [hx_ne]
theorem setToSimpleFunc_smul_real (T : Set α → E →L[ℝ] F) (h_add : FinMeasAdditive μ T) (c : ℝ)
{f : α →ₛ E} (hf : Integrable f μ) : setToSimpleFunc T (c • f) = c • setToSimpleFunc T f :=
calc
setToSimpleFunc T (c • f) = ∑ x ∈ f.range, T (f ⁻¹' {x}) (c • x) := by
rw [smul_eq_map c f, map_setToSimpleFunc T h_add hf]; dsimp only; rw [smul_zero]
_ = ∑ x ∈ f.range, c • T (f ⁻¹' {x}) x :=
(Finset.sum_congr rfl fun b _ => by rw [ContinuousLinearMap.map_smul (T (f ⁻¹' {b})) c b])
_ = c • setToSimpleFunc T f := by simp only [setToSimpleFunc, smul_sum]
theorem setToSimpleFunc_smul {E} [NormedAddCommGroup E] [SMulZeroClass 𝕜 E]
[NormedSpace ℝ E] [DistribSMul 𝕜 F] (T : Set α → E →L[ℝ] F) (h_add : FinMeasAdditive μ T)
(h_smul : ∀ c : 𝕜, ∀ s x, T s (c • x) = c • T s x) (c : 𝕜) {f : α →ₛ E} (hf : Integrable f μ) :
setToSimpleFunc T (c • f) = c • setToSimpleFunc T f :=
calc
setToSimpleFunc T (c • f) = ∑ x ∈ f.range, T (f ⁻¹' {x}) (c • x) := by
rw [smul_eq_map c f, map_setToSimpleFunc T h_add hf]; dsimp only; rw [smul_zero]
_ = ∑ x ∈ f.range, c • T (f ⁻¹' {x}) x := Finset.sum_congr rfl fun b _ => by rw [h_smul]
_ = c • setToSimpleFunc T f := by simp only [setToSimpleFunc, smul_sum]
section Order
variable {G' G'' : Type*}
[NormedAddCommGroup G''] [PartialOrder G''] [IsOrderedAddMonoid G''] [NormedSpace ℝ G'']
[NormedAddCommGroup G'] [PartialOrder G'] [NormedSpace ℝ G']
theorem setToSimpleFunc_mono_left {m : MeasurableSpace α} (T T' : Set α → F →L[ℝ] G'')
(hTT' : ∀ s x, T s x ≤ T' s x) (f : α →ₛ F) : setToSimpleFunc T f ≤ setToSimpleFunc T' f := by
simp_rw [setToSimpleFunc]; gcongr; apply hTT'
theorem setToSimpleFunc_mono_left' (T T' : Set α → E →L[ℝ] G'')
(hTT' : ∀ s, MeasurableSet s → μ s < ∞ → ∀ x, T s x ≤ T' s x) (f : α →ₛ E)
(hf : Integrable f μ) : setToSimpleFunc T f ≤ setToSimpleFunc T' f := by
unfold setToSimpleFunc
gcongr with i _
by_cases h0 : i = 0
· simp [h0]
· exact hTT' _ (measurableSet_fiber _ _) (measure_preimage_lt_top_of_integrable _ hf h0) i
theorem setToSimpleFunc_nonneg {m : MeasurableSpace α} (T : Set α → G' →L[ℝ] G'')
(hT_nonneg : ∀ s x, 0 ≤ x → 0 ≤ T s x) (f : α →ₛ G') (hf : 0 ≤ f) :
0 ≤ setToSimpleFunc T f := by
refine sum_nonneg fun i hi => hT_nonneg _ i ?_
rw [mem_range] at hi
obtain ⟨y, hy⟩ := Set.mem_range.mp hi
rw [← hy]
refine le_trans ?_ (hf y)
simp
theorem setToSimpleFunc_nonneg' (T : Set α → G' →L[ℝ] G'')
(hT_nonneg : ∀ s, MeasurableSet s → μ s < ∞ → ∀ x, 0 ≤ x → 0 ≤ T s x) (f : α →ₛ G') (hf : 0 ≤ f)
(hfi : Integrable f μ) : 0 ≤ setToSimpleFunc T f := by
refine sum_nonneg fun i hi => ?_
by_cases h0 : i = 0
· simp [h0]
refine
hT_nonneg _ (measurableSet_fiber _ _) (measure_preimage_lt_top_of_integrable _ hfi h0) i ?_
rw [mem_range] at hi
obtain ⟨y, hy⟩ := Set.mem_range.mp hi
rw [← hy]
convert hf y
theorem setToSimpleFunc_mono [IsOrderedAddMonoid G']
{T : Set α → G' →L[ℝ] G''} (h_add : FinMeasAdditive μ T)
(hT_nonneg : ∀ s, MeasurableSet s → μ s < ∞ → ∀ x, 0 ≤ x → 0 ≤ T s x) {f g : α →ₛ G'}
(hfi : Integrable f μ) (hgi : Integrable g μ) (hfg : f ≤ g) :
setToSimpleFunc T f ≤ setToSimpleFunc T g := by
rw [← sub_nonneg, ← setToSimpleFunc_sub T h_add hgi hfi]
refine setToSimpleFunc_nonneg' T hT_nonneg _ ?_ (hgi.sub hfi)
intro x
simp only [coe_sub, sub_nonneg, coe_zero, Pi.zero_apply, Pi.sub_apply]
exact hfg x
end Order
theorem norm_setToSimpleFunc_le_sum_opNorm {m : MeasurableSpace α} (T : Set α → F' →L[ℝ] F)
(f : α →ₛ F') : ‖f.setToSimpleFunc T‖ ≤ ∑ x ∈ f.range, ‖T (f ⁻¹' {x})‖ * ‖x‖ :=
calc
‖∑ x ∈ f.range, T (f ⁻¹' {x}) x‖ ≤ ∑ x ∈ f.range, ‖T (f ⁻¹' {x}) x‖ := norm_sum_le _ _
_ ≤ ∑ x ∈ f.range, ‖T (f ⁻¹' {x})‖ * ‖x‖ := by
gcongr with b; apply ContinuousLinearMap.le_opNorm
theorem norm_setToSimpleFunc_le_sum_mul_norm (T : Set α → F →L[ℝ] F') {C : ℝ}
(hT_norm : ∀ s, MeasurableSet s → ‖T s‖ ≤ C * μ.real s) (f : α →ₛ F) :
‖f.setToSimpleFunc T‖ ≤ C * ∑ x ∈ f.range, μ.real (f ⁻¹' {x}) * ‖x‖ :=
calc
‖f.setToSimpleFunc T‖ ≤ ∑ x ∈ f.range, ‖T (f ⁻¹' {x})‖ * ‖x‖ :=
norm_setToSimpleFunc_le_sum_opNorm T f
_ ≤ ∑ x ∈ f.range, C * μ.real (f ⁻¹' {x}) * ‖x‖ := by
gcongr
exact hT_norm _ <| SimpleFunc.measurableSet_fiber _ _
_ ≤ C * ∑ x ∈ f.range, μ.real (f ⁻¹' {x}) * ‖x‖ := by simp_rw [mul_sum, ← mul_assoc]; rfl
theorem norm_setToSimpleFunc_le_sum_mul_norm_of_integrable (T : Set α → E →L[ℝ] F') {C : ℝ}
(hT_norm : ∀ s, MeasurableSet s → μ s < ∞ → ‖T s‖ ≤ C * μ.real s) (f : α →ₛ E)
(hf : Integrable f μ) :
‖f.setToSimpleFunc T‖ ≤ C * ∑ x ∈ f.range, μ.real (f ⁻¹' {x}) * ‖x‖ :=
calc
‖f.setToSimpleFunc T‖ ≤ ∑ x ∈ f.range, ‖T (f ⁻¹' {x})‖ * ‖x‖ :=
norm_setToSimpleFunc_le_sum_opNorm T f
_ ≤ ∑ x ∈ f.range, C * μ.real (f ⁻¹' {x}) * ‖x‖ := by
refine Finset.sum_le_sum fun b hb => ?_
obtain rfl | hb := eq_or_ne b 0
· simp
gcongr
exact hT_norm _ (SimpleFunc.measurableSet_fiber _ _) <|
SimpleFunc.measure_preimage_lt_top_of_integrable _ hf hb
_ ≤ C * ∑ x ∈ f.range, μ.real (f ⁻¹' {x}) * ‖x‖ := by simp_rw [mul_sum, ← mul_assoc]; rfl
theorem setToSimpleFunc_indicator (T : Set α → F →L[ℝ] F') (hT_empty : T ∅ = 0)
{m : MeasurableSpace α} {s : Set α} (hs : MeasurableSet s) (x : F) :
SimpleFunc.setToSimpleFunc T
(SimpleFunc.piecewise s hs (SimpleFunc.const α x) (SimpleFunc.const α 0)) =
T s x := by
classical
obtain rfl | hs_empty := s.eq_empty_or_nonempty
· simp only [hT_empty, ContinuousLinearMap.zero_apply, piecewise_empty, const_zero,
setToSimpleFunc_zero_apply]
simp_rw [setToSimpleFunc]
obtain rfl | hs_univ := eq_or_ne s univ
· haveI hα := hs_empty.to_type
simp [← Function.const_def]
rw [range_indicator hs hs_empty hs_univ]
by_cases hx0 : x = 0
· simp_rw [hx0]; simp
rw [sum_insert]
swap; · rw [Finset.mem_singleton]; exact hx0
rw [sum_singleton, (T _).map_zero, add_zero]
congr
simp only [coe_piecewise, piecewise_eq_indicator, coe_const, Function.const_zero,
piecewise_eq_indicator]
rw [indicator_preimage, ← Function.const_def, preimage_const_of_mem]
swap; · exact Set.mem_singleton x
rw [← Function.const_zero, ← Function.const_def, preimage_const_of_notMem]
swap; · rw [Set.mem_singleton_iff]; exact Ne.symm hx0
simp
theorem setToSimpleFunc_const' [Nonempty α] (T : Set α → F →L[ℝ] F') (x : F)
{m : MeasurableSpace α} : SimpleFunc.setToSimpleFunc T (SimpleFunc.const α x) = T univ x := by
simp only [setToSimpleFunc, range_const, Set.mem_singleton, preimage_const_of_mem,
sum_singleton, ← Function.const_def, coe_const]
theorem setToSimpleFunc_const (T : Set α → F →L[ℝ] F') (hT_empty : T ∅ = 0) (x : F)
{m : MeasurableSpace α} : SimpleFunc.setToSimpleFunc T (SimpleFunc.const α x) = T univ x := by
cases isEmpty_or_nonempty α
· have h_univ_empty : (univ : Set α) = ∅ := Subsingleton.elim _ _
rw [h_univ_empty, hT_empty]
simp only [setToSimpleFunc, ContinuousLinearMap.zero_apply, sum_empty,
range_eq_empty_of_isEmpty]
· exact setToSimpleFunc_const' T x
end SimpleFunc
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/IntegrableOn.lean | import Mathlib.MeasureTheory.Function.L1Space.Integrable
import Mathlib.MeasureTheory.Function.LpSpace.Indicator
/-! # Functions integrable on a set and at a filter
We define `IntegrableOn f s μ := Integrable f (μ.restrict s)` and prove theorems like
`integrableOn_union : IntegrableOn f (s ∪ t) μ ↔ IntegrableOn f s μ ∧ IntegrableOn f t μ`.
Next we define a predicate `IntegrableAtFilter (f : α → E) (l : Filter α) (μ : Measure α)`
saying that `f` is integrable at some set `s ∈ l` and prove that a measurable function is integrable
at `l` with respect to `μ` provided that `f` is bounded above at `l ⊓ ae μ` and `μ` is finite
at `l`.
-/
noncomputable section
open Set Filter TopologicalSpace MeasureTheory Function
open scoped Topology Interval Filter ENNReal MeasureTheory
variable {α β ε ε' E F : Type*} {mα : MeasurableSpace α}
section
variable [TopologicalSpace β] [ENorm ε] [TopologicalSpace ε]
{l l' : Filter α} {f g : α → β} {μ ν : Measure α}
/-- A function `f` is strongly measurable at a filter `l` w.r.t. a measure `μ` if it is
ae strongly measurable w.r.t. `μ.restrict s` for some `s ∈ l`. -/
def StronglyMeasurableAtFilter (f : α → β) (l : Filter α) (μ : Measure α := by volume_tac) :=
∃ s ∈ l, AEStronglyMeasurable f (μ.restrict s)
@[simp]
theorem stronglyMeasurableAt_bot {f : α → β} : StronglyMeasurableAtFilter f ⊥ μ :=
⟨∅, mem_bot, by simp⟩
protected theorem StronglyMeasurableAtFilter.eventually (h : StronglyMeasurableAtFilter f l μ) :
∀ᶠ s in l.smallSets, AEStronglyMeasurable f (μ.restrict s) :=
(eventually_smallSets' fun _ _ => AEStronglyMeasurable.mono_set).2 h
protected theorem StronglyMeasurableAtFilter.filter_mono (h : StronglyMeasurableAtFilter f l μ)
(h' : l' ≤ l) : StronglyMeasurableAtFilter f l' μ :=
let ⟨s, hsl, hs⟩ := h
⟨s, h' hsl, hs⟩
protected theorem MeasureTheory.AEStronglyMeasurable.stronglyMeasurableAtFilter
(h : AEStronglyMeasurable f μ) : StronglyMeasurableAtFilter f l μ :=
⟨univ, univ_mem, by rwa [Measure.restrict_univ]⟩
theorem AEStronglyMeasurable.stronglyMeasurableAtFilter_of_mem {s}
(h : AEStronglyMeasurable f (μ.restrict s)) (hl : s ∈ l) : StronglyMeasurableAtFilter f l μ :=
⟨s, hl, h⟩
protected theorem MeasureTheory.StronglyMeasurable.stronglyMeasurableAtFilter
(h : StronglyMeasurable f) : StronglyMeasurableAtFilter f l μ :=
h.aestronglyMeasurable.stronglyMeasurableAtFilter
end
namespace MeasureTheory
section NormedAddCommGroup
theorem HasFiniteIntegral.restrict_of_bounded [NormedAddCommGroup E] {f : α → E} {s : Set α}
{μ : Measure α} (C : ℝ) (hs : μ s < ∞) (hf : ∀ᵐ x ∂μ.restrict s, ‖f x‖ ≤ C) :
HasFiniteIntegral f (μ.restrict s) :=
haveI : IsFiniteMeasure (μ.restrict s) := ⟨by rwa [Measure.restrict_apply_univ]⟩
.of_bounded hf
@[deprecated (since := "2025-07-26")]
alias hasFiniteIntegral_restrict_of_bounded := HasFiniteIntegral.restrict_of_bounded
variable [NormedAddCommGroup E] {f g : α → ε} {s t : Set α} {μ ν : Measure α}
[TopologicalSpace ε] [ContinuousENorm ε]
theorem HasFiniteIntegral.restrict_of_bounded_enorm {C : ℝ≥0∞} (hC : ‖C‖ₑ ≠ ∞ := by finiteness)
(hs : μ s ≠ ∞ := by finiteness) (hf : ∀ᵐ x ∂μ.restrict s, ‖f x‖ₑ ≤ C) :
HasFiniteIntegral f (μ.restrict s) :=
haveI : IsFiniteMeasure (μ.restrict s) := ⟨by rw [Measure.restrict_apply_univ]; exact hs.lt_top⟩
.of_bounded_enorm hC hf
/-- A function is `IntegrableOn` a set `s` if it is almost everywhere strongly measurable on `s`
and if the integral of its pointwise norm over `s` is less than infinity. -/
def IntegrableOn (f : α → ε) (s : Set α) (μ : Measure α := by volume_tac) : Prop :=
Integrable f (μ.restrict s)
theorem IntegrableOn.integrable (h : IntegrableOn f s μ) : Integrable f (μ.restrict s) :=
h
variable [TopologicalSpace ε'] [ESeminormedAddMonoid ε']
@[simp]
theorem integrableOn_empty : IntegrableOn f ∅ μ := by
simp [IntegrableOn]
@[simp]
theorem integrableOn_univ : IntegrableOn f univ μ ↔ Integrable f μ := by
rw [IntegrableOn, Measure.restrict_univ]
theorem integrableOn_zero : IntegrableOn (fun _ => (0 : ε')) s μ :=
integrable_zero _ _ _
theorem IntegrableOn.of_measure_zero (hs : μ s = 0) : IntegrableOn f s μ := by
simp [IntegrableOn, Measure.restrict_eq_zero.2 hs]
@[simp]
theorem integrableOn_const_iff {C : ε'} (hC : ‖C‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn (fun _ ↦ C) s μ ↔ ‖C‖ₑ = 0 ∨ μ s < ∞ := by
rw [IntegrableOn, integrable_const_iff_enorm hC, isFiniteMeasure_restrict, lt_top_iff_ne_top]
theorem integrableOn_const {C : ε'} (hs : μ s ≠ ∞ := by finiteness)
(hC : ‖C‖ₑ ≠ ∞ := by finiteness) : IntegrableOn (fun _ ↦ C) s μ :=
(integrableOn_const_iff hC).2 <| Or.inr <| lt_top_iff_ne_top.2 hs
theorem IntegrableOn.mono (h : IntegrableOn f t ν) (hs : s ⊆ t) (hμ : μ ≤ ν) : IntegrableOn f s μ :=
h.mono_measure <| Measure.restrict_mono hs hμ
theorem IntegrableOn.mono_set (h : IntegrableOn f t μ) (hst : s ⊆ t) : IntegrableOn f s μ :=
h.mono hst le_rfl
theorem IntegrableOn.mono_measure (h : IntegrableOn f s ν) (hμ : μ ≤ ν) : IntegrableOn f s μ :=
h.mono (Subset.refl _) hμ
theorem IntegrableOn.mono_set_ae (h : IntegrableOn f t μ) (hst : s ≤ᵐ[μ] t) : IntegrableOn f s μ :=
h.integrable.mono_measure <| Measure.restrict_mono_ae hst
theorem IntegrableOn.congr_set_ae (h : IntegrableOn f t μ) (hst : s =ᵐ[μ] t) : IntegrableOn f s μ :=
h.mono_set_ae hst.le
theorem integrableOn_congr_set_ae (hst : s =ᵐ[μ] t) : IntegrableOn f s μ ↔ IntegrableOn f t μ :=
⟨fun h ↦ h.congr_set_ae hst.symm, fun h ↦ h.congr_set_ae hst⟩
theorem IntegrableOn.congr_fun_ae (h : IntegrableOn f s μ) (hst : f =ᵐ[μ.restrict s] g) :
IntegrableOn g s μ :=
Integrable.congr h hst
theorem integrableOn_congr_fun_ae (hst : f =ᵐ[μ.restrict s] g) :
IntegrableOn f s μ ↔ IntegrableOn g s μ :=
⟨fun h => h.congr_fun_ae hst, fun h => h.congr_fun_ae hst.symm⟩
theorem IntegrableOn.congr_fun (h : IntegrableOn f s μ) (hst : EqOn f g s) (hs : MeasurableSet s) :
IntegrableOn g s μ :=
h.congr_fun_ae ((ae_restrict_iff' hs).2 (Eventually.of_forall hst))
theorem integrableOn_congr_fun (hst : EqOn f g s) (hs : MeasurableSet s) :
IntegrableOn f s μ ↔ IntegrableOn g s μ :=
⟨fun h => h.congr_fun hst hs, fun h => h.congr_fun hst.symm hs⟩
theorem Integrable.integrableOn (h : Integrable f μ) : IntegrableOn f s μ := h.restrict
@[simp]
lemma IntegrableOn.of_subsingleton_codomain [Subsingleton ε'] {f : α → ε'} :
IntegrableOn f s μ :=
Integrable.of_subsingleton_codomain
lemma Integrable.of_bound [IsFiniteMeasure μ] {f : α → E} (hf : AEStronglyMeasurable f μ) (C : ℝ)
(hfC : ∀ᵐ x ∂μ, ‖f x‖ ≤ C) : Integrable f μ := ⟨hf, .of_bounded hfC⟩
lemma IntegrableOn.of_bound (hs : μ s < ∞) {f : α → E} (hf : AEStronglyMeasurable f (μ.restrict s))
(C : ℝ) (hfC : ∀ᵐ x ∂μ.restrict s, ‖f x‖ ≤ C) : IntegrableOn f s μ :=
⟨hf, .restrict_of_bounded C hs hfC⟩
theorem IntegrableOn.restrict (h : IntegrableOn f s μ) : IntegrableOn f s (μ.restrict t) := by
dsimp only [IntegrableOn] at h ⊢
exact h.mono_measure <| Measure.restrict_mono_measure Measure.restrict_le_self _
theorem IntegrableOn.inter_of_restrict (h : IntegrableOn f s (μ.restrict t)) :
IntegrableOn f (s ∩ t) μ := by
have := h.mono_set (inter_subset_left (t := t))
rwa [IntegrableOn, μ.restrict_restrict_of_subset inter_subset_right] at this
lemma Integrable.piecewise {f g : α → ε'} [DecidablePred (· ∈ s)]
(hs : MeasurableSet s) (hf : IntegrableOn f s μ) (hg : IntegrableOn g sᶜ μ) :
Integrable (s.piecewise f g) μ := by
rw [IntegrableOn] at hf hg
rw [← memLp_one_iff_integrable] at hf hg ⊢
exact MemLp.piecewise hs hf hg
theorem IntegrableOn.left_of_union (h : IntegrableOn f (s ∪ t) μ) : IntegrableOn f s μ :=
h.mono_set subset_union_left
theorem IntegrableOn.right_of_union (h : IntegrableOn f (s ∪ t) μ) : IntegrableOn f t μ :=
h.mono_set subset_union_right
theorem IntegrableOn.union [PseudoMetrizableSpace ε]
(hs : IntegrableOn f s μ) (ht : IntegrableOn f t μ) :
IntegrableOn f (s ∪ t) μ :=
(hs.add_measure ht).mono_measure <| Measure.restrict_union_le _ _
@[simp]
theorem integrableOn_union [PseudoMetrizableSpace ε] :
IntegrableOn f (s ∪ t) μ ↔ IntegrableOn f s μ ∧ IntegrableOn f t μ :=
⟨fun h => ⟨h.left_of_union, h.right_of_union⟩, fun h => h.1.union h.2⟩
@[simp]
theorem integrableOn_singleton_iff {f : α → ε'} {x : α}
[MeasurableSingletonClass α] (hfx : ‖f x‖ₑ ≠ ⊤ := by finiteness) :
IntegrableOn f {x} μ ↔ ‖f x‖ₑ = 0 ∨ μ {x} < ∞ := by
have : f =ᵐ[μ.restrict {x}] fun _ => f x := by
filter_upwards [ae_restrict_mem (measurableSet_singleton x)] with _ ha
simp only [mem_singleton_iff.1 ha]
rw [IntegrableOn, integrable_congr this, integrable_const_iff_enorm, isFiniteMeasure_restrict,
lt_top_iff_ne_top]
exact hfx
theorem integrableOn_singleton {f : α → ε'} {x : α} [MeasurableSingletonClass α]
(hfx : ‖f x‖ₑ ≠ ⊤ := by finiteness) (hx : μ {x} < ∞ := by finiteness) : IntegrableOn f {x} μ :=
(integrableOn_singleton_iff hfx).mpr (Or.inr hx)
@[simp]
theorem integrableOn_finite_biUnion [PseudoMetrizableSpace ε]
{s : Set β} (hs : s.Finite) {t : β → Set α} :
IntegrableOn f (⋃ i ∈ s, t i) μ ↔ ∀ i ∈ s, IntegrableOn f (t i) μ := by
induction s, hs using Set.Finite.induction_on with
| empty => simp
| insert _ _ hf => simp [hf, or_imp, forall_and]
@[simp]
theorem integrableOn_finset_iUnion [PseudoMetrizableSpace ε] {s : Finset β} {t : β → Set α} :
IntegrableOn f (⋃ i ∈ s, t i) μ ↔ ∀ i ∈ s, IntegrableOn f (t i) μ :=
integrableOn_finite_biUnion s.finite_toSet
@[simp]
theorem integrableOn_finite_iUnion [PseudoMetrizableSpace ε] [Finite β] {t : β → Set α} :
IntegrableOn f (⋃ i, t i) μ ↔ ∀ i, IntegrableOn f (t i) μ := by
cases nonempty_fintype β
simpa using integrableOn_finset_iUnion (f := f) (μ := μ) (s := Finset.univ) (t := t)
-- TODO: generalise this lemma and the next to enorm classes; this entails assuming that
-- f is finite on almost every element of `s`
lemma IntegrableOn.finset [MeasurableSingletonClass α] {μ : Measure α} [IsFiniteMeasure μ]
{s : Finset α} {f : α → E} : IntegrableOn f s μ := by
rw [← (s : Set α).biUnion_of_singleton]
simp [integrableOn_finset_iUnion, measure_lt_top]
lemma IntegrableOn.of_finite [MeasurableSingletonClass α] {μ : Measure α} [IsFiniteMeasure μ]
{s : Set α} (hs : s.Finite) {f : α → E} : IntegrableOn f s μ := by
simpa using IntegrableOn.finset (s := hs.toFinset)
lemma IntegrableOn.of_subsingleton [MeasurableSingletonClass α] {μ : Measure α} [IsFiniteMeasure μ]
{s : Set α} (hs : s.Subsingleton) {f : α → E} :
IntegrableOn f s μ :=
.of_finite hs.finite
theorem IntegrableOn.add_measure [PseudoMetrizableSpace ε]
(hμ : IntegrableOn f s μ) (hν : IntegrableOn f s ν) :
IntegrableOn f s (μ + ν) := by
delta IntegrableOn; rw [Measure.restrict_add]; exact hμ.integrable.add_measure hν
@[simp]
theorem integrableOn_add_measure [PseudoMetrizableSpace ε] :
IntegrableOn f s (μ + ν) ↔ IntegrableOn f s μ ∧ IntegrableOn f s ν :=
⟨fun h =>
⟨h.mono_measure (Measure.le_add_right le_rfl), h.mono_measure (Measure.le_add_left le_rfl)⟩,
fun h => h.1.add_measure h.2⟩
theorem _root_.MeasurableEmbedding.integrableOn_map_iff [MeasurableSpace β] {e : α → β}
(he : MeasurableEmbedding e) {f : β → ε} {μ : Measure α} {s : Set β} :
IntegrableOn f s (μ.map e) ↔ IntegrableOn (f ∘ e) (e ⁻¹' s) μ := by
simp_rw [IntegrableOn, he.restrict_map, he.integrable_map_iff]
theorem _root_.MeasurableEmbedding.integrableOn_iff_comap [MeasurableSpace β] {e : α → β}
(he : MeasurableEmbedding e) {f : β → ε} {μ : Measure β} {s : Set β} (hs : s ⊆ range e) :
IntegrableOn f s μ ↔ IntegrableOn (f ∘ e) (e ⁻¹' s) (μ.comap e) := by
simp_rw [← he.integrableOn_map_iff, he.map_comap, IntegrableOn,
Measure.restrict_restrict_of_subset hs]
theorem _root_.MeasurableEmbedding.integrableOn_range_iff_comap [MeasurableSpace β] {e : α → β}
(he : MeasurableEmbedding e) {f : β → ε} {μ : Measure β} :
IntegrableOn f (range e) μ ↔ Integrable (f ∘ e) (μ.comap e) := by
rw [he.integrableOn_iff_comap .rfl, preimage_range, integrableOn_univ]
theorem integrableOn_iff_comap_subtypeVal (hs : MeasurableSet s) :
IntegrableOn f s μ ↔ Integrable (f ∘ (↑) : s → ε) (μ.comap (↑)) := by
rw [← (MeasurableEmbedding.subtype_coe hs).integrableOn_range_iff_comap, Subtype.range_val]
theorem integrableOn_map_equiv [MeasurableSpace β] (e : α ≃ᵐ β) {f : β → ε} {μ : Measure α}
{s : Set β} : IntegrableOn f s (μ.map e) ↔ IntegrableOn (f ∘ e) (e ⁻¹' s) μ := by
simp only [IntegrableOn, e.restrict_map, integrable_map_equiv e]
theorem MeasurePreserving.integrableOn_comp_preimage [MeasurableSpace β] {e : α → β} {ν}
(h₁ : MeasurePreserving e μ ν) (h₂ : MeasurableEmbedding e) {f : β → ε} {s : Set β} :
IntegrableOn (f ∘ e) (e ⁻¹' s) μ ↔ IntegrableOn f s ν :=
(h₁.restrict_preimage_emb h₂ s).integrable_comp_emb h₂
theorem MeasurePreserving.integrableOn_image [MeasurableSpace β] {e : α → β} {ν}
(h₁ : MeasurePreserving e μ ν) (h₂ : MeasurableEmbedding e) {f : β → ε} {s : Set α} :
IntegrableOn f (e '' s) ν ↔ IntegrableOn (f ∘ e) s μ :=
((h₁.restrict_image_emb h₂ s).integrable_comp_emb h₂).symm
section indicator
-- All results in this section hold for any enormed monoid.
variable {f : α → ε'}
theorem integrable_indicator_iff (hs : MeasurableSet s) :
Integrable (indicator s f) μ ↔ IntegrableOn f s μ := by
simp_rw [IntegrableOn, Integrable, hasFiniteIntegral_iff_enorm,
enorm_indicator_eq_indicator_enorm, lintegral_indicator hs,
aestronglyMeasurable_indicator_iff hs]
theorem IntegrableOn.integrable_indicator (h : IntegrableOn f s μ) (hs : MeasurableSet s) :
Integrable (indicator s f) μ :=
(integrable_indicator_iff hs).2 h
theorem IntegrableOn.integrable_indicator₀ (h : IntegrableOn f s μ) (hs : NullMeasurableSet s μ) :
Integrable (indicator s f) μ :=
(h.congr_set_ae hs.toMeasurable_ae_eq).integrable_indicator
(measurableSet_toMeasurable μ s) |>.congr
(indicator_ae_eq_of_ae_eq_set hs.toMeasurable_ae_eq)
@[fun_prop]
theorem Integrable.indicator (h : Integrable f μ) (hs : MeasurableSet s) :
Integrable (indicator s f) μ :=
h.integrableOn.integrable_indicator hs
@[fun_prop]
theorem Integrable.indicator₀ (h : Integrable f μ) (hs : NullMeasurableSet s μ) :
Integrable (s.indicator f) μ :=
h.integrableOn.integrable_indicator₀ hs
theorem IntegrableOn.indicator (h : IntegrableOn f s μ) (ht : MeasurableSet t) :
IntegrableOn (indicator t f) s μ :=
Integrable.indicator h ht
theorem integrable_indicatorConstLp {E} [NormedAddCommGroup E] {p : ℝ≥0∞} {s : Set α}
(hs : MeasurableSet s) (hμs : μ s ≠ ∞) (c : E) :
Integrable (indicatorConstLp p hs hμs c) μ := by
rw [integrable_congr indicatorConstLp_coeFn, integrable_indicator_iff hs, IntegrableOn,
integrable_const_iff, isFiniteMeasure_restrict]
exact .inr hμs
end indicator
/-- If a function is integrable on a set `s` and nonzero there, then the measurable hull of `s` is
well behaved: the restriction of the measure to `toMeasurable μ s` coincides with its restriction
to `s`. -/
theorem IntegrableOn.restrict_toMeasurable {f : α → ε'}
(hf : IntegrableOn f s μ) (h's : ∀ x ∈ s, ‖f x‖ₑ ≠ 0) :
μ.restrict (toMeasurable μ s) = μ.restrict s := by
rcases exists_seq_strictAnti_tendsto' ENNReal.zero_lt_top with ⟨u, _, u_pos, u_lim⟩
let v n := toMeasurable (μ.restrict s) { x | u n ≤ ‖f x‖ₑ }
have A : ∀ n, μ (s ∩ v n) ≠ ∞ := by
intro n
rw [inter_comm, ← Measure.restrict_apply (measurableSet_toMeasurable _ _),
measure_toMeasurable]
exact (hf.measure_enorm_ge_lt_top (u_pos n).1 (u_pos n).2.ne).ne
apply Measure.restrict_toMeasurable_of_cover _ A
intro x hx
obtain ⟨n, hn⟩ : ∃ n, u n < ‖f x‖ₑ :=
((tendsto_order.1 u_lim).2 _ (pos_of_ne_zero (h's x hx))).exists
exact mem_iUnion.2 ⟨n, subset_toMeasurable _ _ hn.le⟩
-- TODO: investigate generalising this section to e-seminormed monoids
section ENormedAddMonoid
variable {ε' : Type*} [TopologicalSpace ε'] [ENormedAddMonoid ε'] [PseudoMetrizableSpace ε']
-- TODO: generalise this to e-seminormed commutative monoids,
-- by merely assuming ‖f x‖ₑ vanishes on t \ s
/-- If a function is integrable on a set `s`, and its enorm vanishes on `t \ s`,
then it is integrable on `t` if `t` is null-measurable. -/
theorem IntegrableOn.of_ae_diff_eq_zero {f : α → ε'}
(hf : IntegrableOn f s μ) (ht : NullMeasurableSet t μ)
(h't : ∀ᵐ x ∂μ, x ∈ t \ s → f x = 0) : IntegrableOn f t μ := by
let u := { x ∈ s | f x ≠ 0 }
have hu : IntegrableOn f u μ := hf.mono_set fun x hx => hx.1
let v := toMeasurable μ u
have A : IntegrableOn f v μ := by
rw [IntegrableOn, hu.restrict_toMeasurable]
· exact hu
· intro x hx; simpa using hx.2
have B : IntegrableOn f (t \ v) μ := by
apply integrableOn_zero.congr
filter_upwards [ae_restrict_of_ae h't,
ae_restrict_mem₀ (ht.diff (measurableSet_toMeasurable μ u).nullMeasurableSet)] with x hxt hx
by_cases h'x : x ∈ s
· by_contra H
exact hx.2 (subset_toMeasurable μ u ⟨h'x, Ne.symm H⟩)
· exact (hxt ⟨hx.1, h'x⟩).symm
apply (A.union B).mono_set _
rw [union_diff_self]
exact subset_union_right
/-- If a function is integrable on a set `s`, and vanishes on `t \ s`, then it is integrable on `t`
if `t` is measurable. -/
theorem IntegrableOn.of_forall_diff_eq_zero {f : α → ε'}
(hf : IntegrableOn f s μ) (ht : MeasurableSet t)
(h't : ∀ x ∈ t \ s, f x = 0) : IntegrableOn f t μ :=
hf.of_ae_diff_eq_zero ht.nullMeasurableSet (Eventually.of_forall h't)
/-- If a function is integrable on a set `s` and vanishes almost everywhere on its complement,
then it is integrable. -/
theorem IntegrableOn.integrable_of_ae_notMem_eq_zero
{f : α → ε'} (hf : IntegrableOn f s μ) (h't : ∀ᵐ x ∂μ, x ∉ s → f x = 0) : Integrable f μ := by
rw [← integrableOn_univ]
apply hf.of_ae_diff_eq_zero nullMeasurableSet_univ
filter_upwards [h't] with x hx h'x using hx h'x.2
@[deprecated (since := "2025-05-23")]
alias IntegrableOn.integrable_of_ae_not_mem_eq_zero := IntegrableOn.integrable_of_ae_notMem_eq_zero
/-- If a function is integrable on a set `s` and vanishes everywhere on its complement,
then it is integrable. -/
theorem IntegrableOn.integrable_of_forall_notMem_eq_zero
{f : α → ε'} (hf : IntegrableOn f s μ) (h't : ∀ x, x ∉ s → f x = 0) : Integrable f μ :=
hf.integrable_of_ae_notMem_eq_zero (Eventually.of_forall fun x hx => h't x hx)
@[deprecated (since := "2025-05-23")]
alias IntegrableOn.integrable_of_forall_not_mem_eq_zero :=
IntegrableOn.integrable_of_forall_notMem_eq_zero
theorem IntegrableOn.of_inter_support {f : α → ε'}
(hs : MeasurableSet s) (hf : IntegrableOn f (s ∩ support f) μ) :
IntegrableOn f s μ := by
simpa using hf.of_forall_diff_eq_zero hs
theorem integrableOn_iff_integrable_of_support_subset
{f : α → ε'} (h1s : support f ⊆ s) : IntegrableOn f s μ ↔ Integrable f μ := by
refine ⟨fun h => ?_, fun h => h.integrableOn⟩
refine h.integrable_of_forall_notMem_eq_zero fun x hx => ?_
contrapose! hx
exact h1s (mem_support.2 hx)
end ENormedAddMonoid
theorem integrableOn_Lp_of_measure_ne_top {E} [NormedAddCommGroup E] {p : ℝ≥0∞} {s : Set α}
(f : Lp E p μ) (hp : 1 ≤ p) (hμs : μ s ≠ ∞) : IntegrableOn f s μ := by
refine memLp_one_iff_integrable.mp ?_
have hμ_restrict_univ : (μ.restrict s) Set.univ < ∞ := by
simpa only [Set.univ_inter, MeasurableSet.univ, Measure.restrict_apply, lt_top_iff_ne_top]
haveI hμ_finite : IsFiniteMeasure (μ.restrict s) := ⟨hμ_restrict_univ⟩
exact ((Lp.memLp _).restrict s).mono_exponent hp
theorem Integrable.lintegral_lt_top {f : α → ℝ} (hf : Integrable f μ) :
(∫⁻ x, ENNReal.ofReal (f x) ∂μ) < ∞ :=
calc
(∫⁻ x, ENNReal.ofReal (f x) ∂μ) ≤ ∫⁻ x, ↑‖f x‖₊ ∂μ := lintegral_ofReal_le_lintegral_enorm f
_ < ∞ := hf.2
theorem IntegrableOn.setLIntegral_lt_top {f : α → ℝ} {s : Set α} (hf : IntegrableOn f s μ) :
(∫⁻ x in s, ENNReal.ofReal (f x) ∂μ) < ∞ :=
Integrable.lintegral_lt_top hf
/-- We say that a function `f` is *integrable at filter* `l` if it is integrable on some
set `s ∈ l`. Equivalently, it is eventually integrable on `s` in `l.smallSets`. -/
def IntegrableAtFilter (f : α → ε) (l : Filter α) (μ : Measure α := by volume_tac) :=
∃ s ∈ l, IntegrableOn f s μ
variable {l l' : Filter α}
theorem _root_.MeasurableEmbedding.integrableAtFilter_map_iff [MeasurableSpace β] {e : α → β}
(he : MeasurableEmbedding e) {f : β → ε} :
IntegrableAtFilter f (l.map e) (μ.map e) ↔ IntegrableAtFilter (f ∘ e) l μ := by
simp_rw [IntegrableAtFilter, he.integrableOn_map_iff]
constructor <;> rintro ⟨s, hs⟩
· exact ⟨_, hs⟩
· exact ⟨e '' s, by rwa [mem_map, he.injective.preimage_image]⟩
theorem _root_.MeasurableEmbedding.integrableAtFilter_iff_comap [MeasurableSpace β] {e : α → β}
(he : MeasurableEmbedding e) {f : β → ε} {μ : Measure β} :
IntegrableAtFilter f (l.map e) μ ↔ IntegrableAtFilter (f ∘ e) l (μ.comap e) := by
simp_rw [← he.integrableAtFilter_map_iff, IntegrableAtFilter, he.map_comap]
constructor <;> rintro ⟨s, hs, int⟩
· exact ⟨s, hs, int.mono_measure <| μ.restrict_le_self⟩
· exact ⟨_, inter_mem hs range_mem_map, int.inter_of_restrict⟩
theorem Integrable.integrableAtFilter (h : Integrable f μ) (l : Filter α) :
IntegrableAtFilter f l μ :=
⟨univ, Filter.univ_mem, integrableOn_univ.2 h⟩
protected theorem IntegrableAtFilter.eventually (h : IntegrableAtFilter f l μ) :
∀ᶠ s in l.smallSets, IntegrableOn f s μ :=
Iff.mpr (eventually_smallSets' fun _s _t hst ht => ht.mono_set hst) h
theorem integrableAtFilter_atBot_iff [Preorder α] [IsDirected α fun (x1 x2 : α) => x1 ≥ x2]
[Nonempty α] :
IntegrableAtFilter f atBot μ ↔ ∃ a, IntegrableOn f (Iic a) μ := by
refine ⟨fun ⟨s, hs, hi⟩ ↦ ?_, fun ⟨a, ha⟩ ↦ ⟨Iic a, Iic_mem_atBot a, ha⟩⟩
obtain ⟨t, ht⟩ := mem_atBot_sets.mp hs
exact ⟨t, hi.mono_set fun _ hx ↦ ht _ hx⟩
theorem integrableAtFilter_atTop_iff [Preorder α] [IsDirected α fun (x1 x2 : α) => x1 ≤ x2]
[Nonempty α] :
IntegrableAtFilter f atTop μ ↔ ∃ a, IntegrableOn f (Ici a) μ :=
integrableAtFilter_atBot_iff (α := αᵒᵈ)
protected theorem IntegrableAtFilter.add [ContinuousAdd ε'] {f g : α → ε'}
(hf : IntegrableAtFilter f l μ) (hg : IntegrableAtFilter g l μ) :
IntegrableAtFilter (f + g) l μ := by
rcases hf with ⟨s, sl, hs⟩
rcases hg with ⟨t, tl, ht⟩
refine ⟨s ∩ t, inter_mem sl tl, ?_⟩
exact (hs.mono_set inter_subset_left).add (ht.mono_set inter_subset_right)
protected theorem IntegrableAtFilter.neg {f : α → E} (hf : IntegrableAtFilter f l μ) :
IntegrableAtFilter (-f) l μ := by
rcases hf with ⟨s, sl, hs⟩
exact ⟨s, sl, hs.neg⟩
protected theorem IntegrableAtFilter.sub {f g : α → E}
(hf : IntegrableAtFilter f l μ) (hg : IntegrableAtFilter g l μ) :
IntegrableAtFilter (f - g) l μ := by
rw [sub_eq_add_neg]
exact hf.add hg.neg
protected theorem IntegrableAtFilter.smul {𝕜 : Type*} [NormedAddCommGroup 𝕜] [SMulZeroClass 𝕜 E]
[IsBoundedSMul 𝕜 E] {f : α → E} (hf : IntegrableAtFilter f l μ) (c : 𝕜) :
IntegrableAtFilter (c • f) l μ := by
rcases hf with ⟨s, sl, hs⟩
exact ⟨s, sl, hs.smul c⟩
protected theorem IntegrableAtFilter.enorm (hf : IntegrableAtFilter f l μ) :
IntegrableAtFilter (fun x => ‖f x‖ₑ) l μ :=
Exists.casesOn hf fun s hs ↦ ⟨s, hs.1, hs.2.enorm⟩
protected theorem IntegrableAtFilter.norm {f : α → E} (hf : IntegrableAtFilter f l μ) :
IntegrableAtFilter (fun x => ‖f x‖) l μ :=
Exists.casesOn hf fun s hs ↦ ⟨s, hs.1, hs.2.norm⟩
theorem IntegrableAtFilter.filter_mono (hl : l ≤ l') (hl' : IntegrableAtFilter f l' μ) :
IntegrableAtFilter f l μ :=
let ⟨s, hs, hsf⟩ := hl'
⟨s, hl hs, hsf⟩
theorem IntegrableAtFilter.inf_of_left (hl : IntegrableAtFilter f l μ) :
IntegrableAtFilter f (l ⊓ l') μ :=
hl.filter_mono inf_le_left
theorem IntegrableAtFilter.inf_of_right (hl : IntegrableAtFilter f l μ) :
IntegrableAtFilter f (l' ⊓ l) μ :=
hl.filter_mono inf_le_right
@[simp]
theorem IntegrableAtFilter.inf_ae_iff {l : Filter α} :
IntegrableAtFilter f (l ⊓ ae μ) μ ↔ IntegrableAtFilter f l μ := by
refine ⟨?_, fun h ↦ h.filter_mono inf_le_left⟩
rintro ⟨s, ⟨t, ht, u, hu, rfl⟩, hf⟩
refine ⟨t, ht, hf.congr_set_ae <| eventuallyEq_set.2 ?_⟩
filter_upwards [hu] with x hx using (and_iff_left hx).symm
alias ⟨IntegrableAtFilter.of_inf_ae, _⟩ := IntegrableAtFilter.inf_ae_iff
variable {ε' : Type*} [TopologicalSpace ε'] [ENormedAddMonoid ε'] in
@[simp]
theorem integrableAtFilter_top [PseudoMetrizableSpace ε'] {f : α → ε'} :
IntegrableAtFilter f ⊤ μ ↔ Integrable f μ := by
refine ⟨fun h ↦ ?_, fun h ↦ h.integrableAtFilter ⊤⟩
obtain ⟨s, hsf, hs⟩ := h
exact (integrableOn_iff_integrable_of_support_subset fun _ _ ↦ hsf _).mp hs
theorem IntegrableAtFilter.sup_iff [PseudoMetrizableSpace ε'] {f : α → ε'} {l l' : Filter α} :
IntegrableAtFilter f (l ⊔ l') μ ↔ IntegrableAtFilter f l μ ∧ IntegrableAtFilter f l' μ := by
constructor
· exact fun h => ⟨h.filter_mono le_sup_left, h.filter_mono le_sup_right⟩
· exact fun ⟨⟨s, hsl, hs⟩, ⟨t, htl, ht⟩⟩ ↦ ⟨s ∪ t, union_mem_sup hsl htl, hs.union ht⟩
/-- If `μ` is a measure finite at filter `l` and `f` is a function such that its norm is bounded
above at `l`, then `f` is integrable at `l`. -/
theorem Measure.FiniteAtFilter.integrableAtFilter {f : α → E} {l : Filter α}
[IsMeasurablyGenerated l] (hfm : StronglyMeasurableAtFilter f l μ) (hμ : μ.FiniteAtFilter l)
(hf : l.IsBoundedUnder (· ≤ ·) (norm ∘ f)) : IntegrableAtFilter f l μ := by
obtain ⟨C, hC⟩ : ∃ C, ∀ᶠ s in l.smallSets, ∀ x ∈ s, ‖f x‖ ≤ C :=
hf.imp fun C hC => eventually_smallSets.2 ⟨_, hC, fun t => id⟩
rcases (hfm.eventually.and (hμ.eventually.and hC)).exists_measurable_mem_of_smallSets with
⟨s, hsl, hsm, hfm, hμ, hC⟩
refine ⟨s, hsl, ⟨hfm, .restrict_of_bounded hμ (C := C) ?_⟩⟩
rw [ae_restrict_eq hsm, eventually_inf_principal]
exact Eventually.of_forall hC
theorem Measure.FiniteAtFilter.integrableAtFilter_of_tendsto_ae {f : α → E} {l : Filter α}
[IsMeasurablyGenerated l] (hfm : StronglyMeasurableAtFilter f l μ) (hμ : μ.FiniteAtFilter l) {b}
(hf : Tendsto f (l ⊓ ae μ) (𝓝 b)) : IntegrableAtFilter f l μ :=
(hμ.inf_of_left.integrableAtFilter (hfm.filter_mono inf_le_left)
hf.norm.isBoundedUnder_le).of_inf_ae
alias _root_.Filter.Tendsto.integrableAtFilter_ae :=
Measure.FiniteAtFilter.integrableAtFilter_of_tendsto_ae
theorem Measure.FiniteAtFilter.integrableAtFilter_of_tendsto {f : α → E} {l : Filter α}
[IsMeasurablyGenerated l] (hfm : StronglyMeasurableAtFilter f l μ) (hμ : μ.FiniteAtFilter l) {b}
(hf : Tendsto f l (𝓝 b)) : IntegrableAtFilter f l μ :=
hμ.integrableAtFilter hfm hf.norm.isBoundedUnder_le
alias _root_.Filter.Tendsto.integrableAtFilter :=
Measure.FiniteAtFilter.integrableAtFilter_of_tendsto
lemma Measure.integrableOn_of_bounded {f : α → E} (s_finite : μ s ≠ ∞)
(f_mble : AEStronglyMeasurable f μ) {M : ℝ} (f_bdd : ∀ᵐ a ∂(μ.restrict s), ‖f a‖ ≤ M) :
IntegrableOn f s μ :=
⟨f_mble.restrict, .restrict_of_bounded (C := M) s_finite.lt_top f_bdd⟩
theorem integrable_add_of_disjoint {f g : α → E} (h : Disjoint (support f) (support g))
(hf : StronglyMeasurable f) (hg : StronglyMeasurable g) :
Integrable (f + g) μ ↔ Integrable f μ ∧ Integrable g μ := by
refine ⟨fun hfg => ⟨?_, ?_⟩, fun h => h.1.add h.2⟩
· rw [← indicator_add_eq_left h]; exact hfg.indicator hf.measurableSet_support
· rw [← indicator_add_eq_right h]; exact hfg.indicator hg.measurableSet_support
/-- If a function converges along a filter to a limit `a`, is integrable along this filter, and
all elements of the filter have infinite measure, then the limit has to vanish. -/
lemma IntegrableAtFilter.eq_zero_of_tendsto {f : α → E}
(h : IntegrableAtFilter f l μ) (h' : ∀ s ∈ l, μ s = ∞) {a : E}
(hf : Tendsto f l (𝓝 a)) : a = 0 := by
by_contra H
obtain ⟨ε, εpos, hε⟩ : ∃ (ε : ℝ), 0 < ε ∧ ε < ‖a‖ := exists_between (norm_pos_iff.mpr H)
rcases h with ⟨u, ul, hu⟩
let v := u ∩ {b | ε < ‖f b‖}
have hv : IntegrableOn f v μ := hu.mono_set inter_subset_left
have vl : v ∈ l := inter_mem ul ((tendsto_order.1 hf.norm).1 _ hε)
have : μ.restrict v v < ∞ := lt_of_le_of_lt (measure_mono inter_subset_right)
(Integrable.measure_gt_lt_top hv.norm εpos)
have : μ v ≠ ∞ := ne_of_lt (by simpa only [Measure.restrict_apply_self])
exact this (h' v vl)
end NormedAddCommGroup
end MeasureTheory
open MeasureTheory
variable [NormedAddCommGroup E]
/-- A function which is continuous on a set `s` is almost everywhere measurable with respect to
`μ.restrict s`. -/
theorem ContinuousOn.aemeasurable [TopologicalSpace α] [OpensMeasurableSpace α] [MeasurableSpace β]
[TopologicalSpace β] [BorelSpace β] {f : α → β} {s : Set α} {μ : Measure α}
(hf : ContinuousOn f s) (hs : MeasurableSet s) : AEMeasurable f (μ.restrict s) := by
classical
nontriviality α; inhabit α
have : (Set.piecewise s f fun _ => f default) =ᵐ[μ.restrict s] f := piecewise_ae_eq_restrict hs
refine ⟨Set.piecewise s f fun _ => f default, ?_, this.symm⟩
apply measurable_of_isOpen
intro t ht
obtain ⟨u, u_open, hu⟩ : ∃ u : Set α, IsOpen u ∧ f ⁻¹' t ∩ s = u ∩ s :=
_root_.continuousOn_iff'.1 hf t ht
rw [piecewise_preimage, Set.ite, hu]
exact (u_open.measurableSet.inter hs).union ((measurable_const ht.measurableSet).diff hs)
theorem ContinuousOn.aemeasurable₀ [TopologicalSpace α] [OpensMeasurableSpace α] [MeasurableSpace β]
[TopologicalSpace β] [BorelSpace β] {f : α → β} {s : Set α} {μ : Measure α}
(hf : ContinuousOn f s) (hs : NullMeasurableSet s μ) : AEMeasurable f (μ.restrict s) := by
rcases hs.exists_measurable_subset_ae_eq with ⟨t, ts, ht, t_eq_s⟩
rw [← Measure.restrict_congr_set t_eq_s]
exact ContinuousOn.aemeasurable (hf.mono ts) ht
/-- A function which is continuous on a separable set `s` is almost everywhere strongly measurable
with respect to `μ.restrict s`. -/
theorem ContinuousOn.aestronglyMeasurable_of_isSeparable [TopologicalSpace α]
[PseudoMetrizableSpace α] [OpensMeasurableSpace α] [TopologicalSpace β]
[PseudoMetrizableSpace β] {f : α → β} {s : Set α} {μ : Measure α} (hf : ContinuousOn f s)
(hs : MeasurableSet s) (h's : TopologicalSpace.IsSeparable s) :
AEStronglyMeasurable f (μ.restrict s) := by
letI := pseudoMetrizableSpacePseudoMetric α
borelize β
rw [aestronglyMeasurable_iff_aemeasurable_separable]
refine ⟨hf.aemeasurable hs, f '' s, hf.isSeparable_image h's, ?_⟩
exact mem_of_superset (self_mem_ae_restrict hs) (subset_preimage_image _ _)
/-- A function which is continuous on a set `s` is almost everywhere strongly measurable with
respect to `μ.restrict s` when either the source space or the target space is second-countable. -/
theorem ContinuousOn.aestronglyMeasurable [TopologicalSpace α] [TopologicalSpace β]
[h : SecondCountableTopologyEither α β] [OpensMeasurableSpace α] [PseudoMetrizableSpace β]
{f : α → β} {s : Set α} {μ : Measure α} (hf : ContinuousOn f s) (hs : MeasurableSet s) :
AEStronglyMeasurable f (μ.restrict s) := by
borelize β
refine
aestronglyMeasurable_iff_aemeasurable_separable.2
⟨hf.aemeasurable hs, f '' s, ?_,
mem_of_superset (self_mem_ae_restrict hs) (subset_preimage_image _ _)⟩
cases h.out
· rw [image_eq_range]
exact isSeparable_range <| continuousOn_iff_continuous_restrict.1 hf
· exact .of_separableSpace _
/-- A function which is continuous on a compact set `s` is almost everywhere strongly measurable
with respect to `μ.restrict s`. -/
theorem ContinuousOn.aestronglyMeasurable_of_isCompact [TopologicalSpace α] [OpensMeasurableSpace α]
[TopologicalSpace β] [PseudoMetrizableSpace β] {f : α → β} {s : Set α} {μ : Measure α}
(hf : ContinuousOn f s) (hs : IsCompact s) (h's : MeasurableSet s) :
AEStronglyMeasurable f (μ.restrict s) := by
letI := pseudoMetrizableSpacePseudoMetric β
borelize β
rw [aestronglyMeasurable_iff_aemeasurable_separable]
refine ⟨hf.aemeasurable h's, f '' s, ?_, ?_⟩
· exact (hs.image_of_continuousOn hf).isSeparable
· exact mem_of_superset (self_mem_ae_restrict h's) (subset_preimage_image _ _)
theorem ContinuousOn.integrableAt_nhdsWithin_of_isSeparable [TopologicalSpace α]
[PseudoMetrizableSpace α] [OpensMeasurableSpace α] {μ : Measure α} [IsLocallyFiniteMeasure μ]
{a : α} {t : Set α} {f : α → E} (hft : ContinuousOn f t) (ht : MeasurableSet t)
(h't : TopologicalSpace.IsSeparable t) (ha : a ∈ t) : IntegrableAtFilter f (𝓝[t] a) μ :=
haveI : (𝓝[t] a).IsMeasurablyGenerated := ht.nhdsWithin_isMeasurablyGenerated _
(hft a ha).integrableAtFilter
⟨_, self_mem_nhdsWithin, hft.aestronglyMeasurable_of_isSeparable ht h't⟩
(μ.finiteAt_nhdsWithin _ _)
theorem ContinuousOn.integrableAt_nhdsWithin [TopologicalSpace α]
[SecondCountableTopologyEither α E] [OpensMeasurableSpace α] {μ : Measure α}
[IsLocallyFiniteMeasure μ] {a : α} {t : Set α} {f : α → E} (hft : ContinuousOn f t)
(ht : MeasurableSet t) (ha : a ∈ t) : IntegrableAtFilter f (𝓝[t] a) μ :=
haveI : (𝓝[t] a).IsMeasurablyGenerated := ht.nhdsWithin_isMeasurablyGenerated _
(hft a ha).integrableAtFilter ⟨_, self_mem_nhdsWithin, hft.aestronglyMeasurable ht⟩
(μ.finiteAt_nhdsWithin _ _)
theorem Continuous.integrableAt_nhds [TopologicalSpace α] [SecondCountableTopologyEither α E]
[OpensMeasurableSpace α] {μ : Measure α} [IsLocallyFiniteMeasure μ] {f : α → E}
(hf : Continuous f) (a : α) : IntegrableAtFilter f (𝓝 a) μ := by
rw [← nhdsWithin_univ]
exact hf.continuousOn.integrableAt_nhdsWithin MeasurableSet.univ (mem_univ a)
/-- If a function is continuous on an open set `s`, then it is strongly measurable at the filter
`𝓝 x` for all `x ∈ s` if either the source space or the target space is second-countable. -/
theorem ContinuousOn.stronglyMeasurableAtFilter [TopologicalSpace α] [OpensMeasurableSpace α]
[TopologicalSpace β] [PseudoMetrizableSpace β] [SecondCountableTopologyEither α β] {f : α → β}
{s : Set α} {μ : Measure α} (hs : IsOpen s) (hf : ContinuousOn f s) :
∀ x ∈ s, StronglyMeasurableAtFilter f (𝓝 x) μ := fun _x hx =>
⟨s, IsOpen.mem_nhds hs hx, hf.aestronglyMeasurable hs.measurableSet⟩
theorem ContinuousAt.stronglyMeasurableAtFilter [TopologicalSpace α] [OpensMeasurableSpace α]
[SecondCountableTopologyEither α E] {f : α → E} {s : Set α} {μ : Measure α} (hs : IsOpen s)
(hf : ∀ x ∈ s, ContinuousAt f x) : ∀ x ∈ s, StronglyMeasurableAtFilter f (𝓝 x) μ :=
ContinuousOn.stronglyMeasurableAtFilter hs <| continuousOn_of_forall_continuousAt hf
theorem Continuous.stronglyMeasurableAtFilter [TopologicalSpace α] [OpensMeasurableSpace α]
[TopologicalSpace β] [PseudoMetrizableSpace β] [SecondCountableTopologyEither α β] {f : α → β}
(hf : Continuous f) (μ : Measure α) (l : Filter α) : StronglyMeasurableAtFilter f l μ :=
hf.stronglyMeasurable.stronglyMeasurableAtFilter
/-- If a function is continuous on a measurable set `s`, then it is measurable at the filter
`𝓝[s] x` for all `x`. -/
theorem ContinuousOn.stronglyMeasurableAtFilter_nhdsWithin {α β : Type*} [MeasurableSpace α]
[TopologicalSpace α] [OpensMeasurableSpace α] [TopologicalSpace β] [PseudoMetrizableSpace β]
[SecondCountableTopologyEither α β] {f : α → β} {s : Set α} {μ : Measure α}
(hf : ContinuousOn f s) (hs : MeasurableSet s) (x : α) :
StronglyMeasurableAtFilter f (𝓝[s] x) μ :=
⟨s, self_mem_nhdsWithin, hf.aestronglyMeasurable hs⟩
/-! ### Lemmas about adding and removing interval boundaries
The primed lemmas take explicit arguments about the measure being finite at the endpoint, while
the unprimed ones use `[NoAtoms μ]`.
-/
section PartialOrder
variable [PartialOrder α] [MeasurableSingletonClass α]
[TopologicalSpace ε'] [ESeminormedAddMonoid ε'] [PseudoMetrizableSpace ε']
{f : α → ε'} {μ : Measure α} {a b : α}
theorem integrableOn_Icc_iff_integrableOn_Ioc'
(ha : μ {a} ≠ ∞ := by finiteness) (ha' : ‖f a‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Icc a b) μ ↔ IntegrableOn f (Ioc a b) μ := by
by_cases hab : a ≤ b
· rw [← Ioc_union_left hab, integrableOn_union, eq_true (integrableOn_singleton ha'), and_true]
· rw [Icc_eq_empty hab, Ioc_eq_empty]
contrapose! hab
exact hab.le
theorem integrableOn_Icc_iff_integrableOn_Ico'
(hb : μ {b} ≠ ∞) (hb' : ‖f b‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Icc a b) μ ↔ IntegrableOn f (Ico a b) μ := by
by_cases hab : a ≤ b
· rw [← Ico_union_right hab, integrableOn_union, eq_true (integrableOn_singleton hb'), and_true]
· rw [Icc_eq_empty hab, Ico_eq_empty]
contrapose! hab
exact hab.le
theorem integrableOn_Ico_iff_integrableOn_Ioo'
(ha : μ {a} ≠ ∞) (ha' : ‖f a‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Ico a b) μ ↔ IntegrableOn f (Ioo a b) μ := by
by_cases hab : a < b
· rw [← Ioo_union_left hab, integrableOn_union,
eq_true (integrableOn_singleton ha'), and_true]
· rw [Ioo_eq_empty hab, Ico_eq_empty hab]
theorem integrableOn_Ioc_iff_integrableOn_Ioo'
(hb : μ {b} ≠ ∞) (hb' : ‖f b‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Ioc a b) μ ↔ IntegrableOn f (Ioo a b) μ := by
by_cases hab : a < b
· rw [← Ioo_union_right hab, integrableOn_union, eq_true (integrableOn_singleton hb'), and_true]
· rw [Ioo_eq_empty hab, Ioc_eq_empty hab]
theorem integrableOn_Icc_iff_integrableOn_Ioo' (ha : μ {a} ≠ ∞)
(ha' : ‖f a‖ₑ ≠ ∞ := by finiteness) (hb : μ {b} ≠ ∞) (hb' : ‖f b‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Icc a b) μ ↔ IntegrableOn f (Ioo a b) μ := by
rw [integrableOn_Icc_iff_integrableOn_Ioc' ha ha', integrableOn_Ioc_iff_integrableOn_Ioo' hb hb']
theorem integrableOn_Ici_iff_integrableOn_Ioi'
(hb : μ {b} ≠ ∞ := by finiteness) (hb' : ‖f b‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Ici b) μ ↔ IntegrableOn f (Ioi b) μ := by
rw [← Ioi_union_left, integrableOn_union, eq_true (integrableOn_singleton hb'), and_true]
theorem integrableOn_Iic_iff_integrableOn_Iio'
(hb : μ {b} ≠ ∞ := by finiteness) (hb' : ‖f b‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Iic b) μ ↔ IntegrableOn f (Iio b) μ := by
rw [← Iio_union_right, integrableOn_union, eq_true (integrableOn_singleton hb'), and_true]
variable [NoAtoms μ]
theorem integrableOn_Icc_iff_integrableOn_Ioc (ha : ‖f a‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Icc a b) μ ↔ IntegrableOn f (Ioc a b) μ :=
integrableOn_Icc_iff_integrableOn_Ioc' (by rw [measure_singleton]; exact ENNReal.zero_ne_top) ha
theorem integrableOn_Icc_iff_integrableOn_Ico (hb : ‖f b‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Icc a b) μ ↔ IntegrableOn f (Ico a b) μ :=
integrableOn_Icc_iff_integrableOn_Ico' (by rw [measure_singleton]; exact ENNReal.zero_ne_top) hb
theorem integrableOn_Ico_iff_integrableOn_Ioo (ha : ‖f a‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Ico a b) μ ↔ IntegrableOn f (Ioo a b) μ :=
integrableOn_Ico_iff_integrableOn_Ioo' (by rw [measure_singleton]; exact ENNReal.zero_ne_top) ha
theorem integrableOn_Ioc_iff_integrableOn_Ioo (hb : ‖f b‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Ioc a b) μ ↔ IntegrableOn f (Ioo a b) μ :=
integrableOn_Ioc_iff_integrableOn_Ioo' (by rw [measure_singleton]; exact ENNReal.zero_ne_top) hb
theorem integrableOn_Icc_iff_integrableOn_Ioo
(ha : ‖f a‖ₑ ≠ ∞ := by finiteness) (hb : ‖f b‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Icc a b) μ ↔ IntegrableOn f (Ioo a b) μ := by
rw [integrableOn_Icc_iff_integrableOn_Ioc ha, integrableOn_Ioc_iff_integrableOn_Ioo hb]
theorem integrableOn_Ici_iff_integrableOn_Ioi (hb : ‖f b‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Ici b) μ ↔ IntegrableOn f (Ioi b) μ :=
integrableOn_Ici_iff_integrableOn_Ioi' (by rw [measure_singleton]; exact ENNReal.zero_ne_top) hb
theorem integrableOn_Iic_iff_integrableOn_Iio (hb : ‖f b‖ₑ ≠ ∞ := by finiteness) :
IntegrableOn f (Iic b) μ ↔ IntegrableOn f (Iio b) μ :=
integrableOn_Iic_iff_integrableOn_Iio' (by rw [measure_singleton]; exact ENNReal.zero_ne_top) hb
end PartialOrder |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/ExpDecay.lean | import Mathlib.MeasureTheory.Integral.Asymptotics
import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic
import Mathlib.MeasureTheory.Integral.IntegralEqImproper
/-!
# Integrals with exponential decay at ∞
As easy special cases of general theorems in the library, we prove the following test
for integrability:
* `integrable_of_isBigO_exp_neg`: If `f` is continuous on `[a,∞)`, for some `a ∈ ℝ`, and there
exists `b > 0` such that `f(x) = O(exp(-b x))` as `x → ∞`, then `f` is integrable on `(a, ∞)`.
-/
noncomputable section
open Real intervalIntegral MeasureTheory Set Filter
open scoped Topology
/-- `exp (-b * x)` is integrable on `(a, ∞)`. -/
theorem exp_neg_integrableOn_Ioi (a : ℝ) {b : ℝ} (h : 0 < b) :
IntegrableOn (fun x : ℝ => exp (-b * x)) (Ioi a) := by
have : Tendsto (fun x => -exp (-b * x) / b) atTop (𝓝 (-0 / b)) := by
refine Tendsto.div_const (Tendsto.neg ?_) _
exact tendsto_exp_atBot.comp (tendsto_id.const_mul_atTop_of_neg (neg_neg_iff_pos.2 h))
refine integrableOn_Ioi_deriv_of_nonneg' (fun x _ => ?_) (fun x _ => (exp_pos _).le) this
simpa [h.ne'] using ((hasDerivAt_id x).const_mul b).neg.exp.neg.div_const b
/-- If `f` is continuous on `[a, ∞)`, and is `O (exp (-b * x))` at `∞` for some `b > 0`, then
`f` is integrable on `(a, ∞)`. -/
theorem integrable_of_isBigO_exp_neg {f : ℝ → ℝ} {a b : ℝ} (h0 : 0 < b)
(hf : ContinuousOn f (Ici a)) (ho : f =O[atTop] fun x => exp (-b * x)) :
IntegrableOn f (Ioi a) :=
integrableOn_Ici_iff_integrableOn_Ioi (by finiteness) |>.mp <|
(hf.locallyIntegrableOn measurableSet_Ici).integrableOn_of_isBigO_atTop
ho ⟨Ioi b, Ioi_mem_atTop b, exp_neg_integrableOn_Ioi b h0⟩ |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/BoundedContinuousFunction.lean | import Mathlib.MeasureTheory.Integral.Bochner.Basic
import Mathlib.Topology.ContinuousMap.Bounded.Normed
import Mathlib.Topology.Algebra.Order.LiminfLimsup
/-!
# Integration of bounded continuous functions
In this file, some results are collected about integrals of bounded continuous functions. They are
mostly specializations of results in general integration theory, but they are used directly in this
specialized form in some other files, in particular in those related to the topology of weak
convergence of probability measures and finite measures.
-/
open MeasureTheory Filter
open scoped ENNReal NNReal BoundedContinuousFunction Topology
namespace BoundedContinuousFunction
section NNRealValued
lemma apply_le_nndist_zero {X : Type*} [TopologicalSpace X] (f : X →ᵇ ℝ≥0) (x : X) :
f x ≤ nndist 0 f := by
convert nndist_coe_le_nndist x
simp only [coe_zero, Pi.zero_apply, NNReal.nndist_zero_eq_val]
variable {X : Type*} [MeasurableSpace X] [TopologicalSpace X]
lemma lintegral_le_edist_mul (f : X →ᵇ ℝ≥0) (μ : Measure X) :
(∫⁻ x, f x ∂μ) ≤ edist 0 f * (μ Set.univ) :=
le_trans (lintegral_mono (fun x ↦ ENNReal.coe_le_coe.mpr (f.apply_le_nndist_zero x))) (by simp)
theorem measurable_coe_ennreal_comp [OpensMeasurableSpace X] (f : X →ᵇ ℝ≥0) :
Measurable fun x ↦ (f x : ℝ≥0∞) :=
measurable_coe_nnreal_ennreal.comp f.continuous.measurable
variable (μ : Measure X) [IsFiniteMeasure μ]
theorem lintegral_lt_top_of_nnreal (f : X →ᵇ ℝ≥0) : ∫⁻ x, f x ∂μ < ∞ := by
apply IsFiniteMeasure.lintegral_lt_top_of_bounded_to_ennreal
refine ⟨nndist f 0, fun x ↦ ?_⟩
have key := BoundedContinuousFunction.NNReal.upper_bound f x
rwa [ENNReal.coe_le_coe]
theorem integrable_of_nnreal [OpensMeasurableSpace X] (f : X →ᵇ ℝ≥0) :
Integrable (((↑) : ℝ≥0 → ℝ) ∘ ⇑f) μ := by
refine ⟨(NNReal.continuous_coe.comp f.continuous).measurable.aestronglyMeasurable, ?_⟩
simp only [hasFiniteIntegral_iff_enorm, Function.comp_apply, NNReal.enorm_eq]
exact lintegral_lt_top_of_nnreal _ f
theorem integral_eq_integral_nnrealPart_sub [OpensMeasurableSpace X] (f : X →ᵇ ℝ) :
∫ x, f x ∂μ = (∫ x, (f.nnrealPart x : ℝ) ∂μ) - ∫ x, ((-f).nnrealPart x : ℝ) ∂μ := by
simp only [f.self_eq_nnrealPart_sub_nnrealPart_neg, Pi.sub_apply, integral_sub,
integrable_of_nnreal]
simp only [Function.comp_apply]
theorem lintegral_of_real_lt_top (f : X →ᵇ ℝ) :
∫⁻ x, ENNReal.ofReal (f x) ∂μ < ∞ := lintegral_lt_top_of_nnreal _ f.nnrealPart
theorem toReal_lintegral_coe_eq_integral [OpensMeasurableSpace X] (f : X →ᵇ ℝ≥0) (μ : Measure X) :
(∫⁻ x, (f x : ℝ≥0∞) ∂μ).toReal = ∫ x, (f x : ℝ) ∂μ := by
rw [integral_eq_lintegral_of_nonneg_ae _ (by simpa [Function.comp_apply] using
(NNReal.continuous_coe.comp f.continuous).measurable.aestronglyMeasurable)]
· simp only [ENNReal.ofReal_coe_nnreal]
· exact Eventually.of_forall (by simp only [Pi.zero_apply, NNReal.zero_le_coe, imp_true_iff])
end NNRealValued
section BochnerIntegral
variable {X : Type*} [MeasurableSpace X] [TopologicalSpace X]
variable (μ : Measure X)
variable {E : Type*} [NormedAddCommGroup E]
lemma lintegral_nnnorm_le (f : X →ᵇ E) :
∫⁻ x, ‖f x‖₊ ∂μ ≤ ‖f‖₊ * (μ Set.univ) := by
calc ∫⁻ x, ‖f x‖₊ ∂μ
_ ≤ ∫⁻ _, ‖f‖₊ ∂μ := by gcongr; apply nnnorm_coe_le_nnnorm
_ = ‖f‖₊ * (μ Set.univ) := by rw [lintegral_const]
variable [OpensMeasurableSpace X] [SecondCountableTopology E] [MeasurableSpace E] [BorelSpace E]
lemma integrable [IsFiniteMeasure μ] (f : X →ᵇ E) :
Integrable f μ := by
refine ⟨f.continuous.measurable.aestronglyMeasurable, (hasFiniteIntegral_def _ _).mp ?_⟩
calc ∫⁻ x, ‖f x‖₊ ∂μ
_ ≤ ‖f‖₊ * (μ Set.univ) := f.lintegral_nnnorm_le μ
_ < ∞ := ENNReal.mul_lt_top ENNReal.coe_lt_top (measure_lt_top μ Set.univ)
variable [NormedSpace ℝ E]
lemma norm_integral_le_mul_norm [IsFiniteMeasure μ] (f : X →ᵇ E) :
‖∫ x, f x ∂μ‖ ≤ μ.real Set.univ * ‖f‖ := by
calc ‖∫ x, f x ∂μ‖
_ ≤ ∫ x, ‖f x‖ ∂μ := norm_integral_le_integral_norm _
_ ≤ ∫ _, ‖f‖ ∂μ := ?_
_ = μ.real Set.univ • ‖f‖ := by rw [integral_const]
apply integral_mono _ (integrable_const ‖f‖) (fun x ↦ f.norm_coe_le_norm x) -- NOTE: `gcongr`?
exact (integrable_norm_iff f.continuous.measurable.aestronglyMeasurable).mpr (f.integrable μ)
lemma norm_integral_le_norm [IsProbabilityMeasure μ] (f : X →ᵇ E) :
‖∫ x, f x ∂μ‖ ≤ ‖f‖ := by
convert f.norm_integral_le_mul_norm μ
simp
lemma isBounded_range_integral
{ι : Type*} (μs : ι → Measure X) [∀ i, IsProbabilityMeasure (μs i)] (f : X →ᵇ E) :
Bornology.IsBounded (Set.range (fun i ↦ ∫ x, f x ∂ (μs i))) := by
apply isBounded_iff_forall_norm_le.mpr ⟨‖f‖, fun v hv ↦ ?_⟩
obtain ⟨i, hi⟩ := hv
rw [← hi]
apply f.norm_integral_le_norm (μs i)
end BochnerIntegral
section RealValued
variable {X : Type*} [TopologicalSpace X]
variable [MeasurableSpace X] [OpensMeasurableSpace X] {μ : Measure X} [IsFiniteMeasure μ]
lemma integral_add_const (f : X →ᵇ ℝ) (c : ℝ) :
∫ x, (f + const X c) x ∂μ = ∫ x, f x ∂μ + μ.real Set.univ • c := by
simp [integral_add (f.integrable _) (integrable_const c)]
lemma integral_const_sub (f : X →ᵇ ℝ) (c : ℝ) :
∫ x, (const X c - f) x ∂μ = μ.real Set.univ • c - ∫ x, f x ∂μ := by
simp [integral_sub (integrable_const c) (f.integrable _)]
end RealValued
section tendsto_integral
variable {X : Type*} [TopologicalSpace X] [MeasurableSpace X] [OpensMeasurableSpace X]
lemma tendsto_integral_of_forall_limsup_integral_le_integral {ι : Type*} {L : Filter ι}
{μ : Measure X} [IsProbabilityMeasure μ] {μs : ι → Measure X} [∀ i, IsProbabilityMeasure (μs i)]
(h : ∀ f : X →ᵇ ℝ, 0 ≤ f → L.limsup (fun i ↦ ∫ x, f x ∂ (μs i)) ≤ ∫ x, f x ∂μ)
(f : X →ᵇ ℝ) :
Tendsto (fun i ↦ ∫ x, f x ∂ (μs i)) L (𝓝 (∫ x, f x ∂μ)) := by
rcases eq_or_neBot L with rfl | hL
· simp only [tendsto_bot]
have obs := BoundedContinuousFunction.isBounded_range_integral μs f
have bdd_above := BddAbove.isBoundedUnder L.univ_mem (by simpa using obs.bddAbove)
have bdd_below := BddBelow.isBoundedUnder L.univ_mem (by simpa using obs.bddBelow)
apply tendsto_of_le_liminf_of_limsup_le _ _ bdd_above bdd_below
· have key := h _ (f.norm_sub_nonneg)
simp_rw [f.integral_const_sub ‖f‖] at key
simp only [measureReal_univ_eq_one, smul_eq_mul, one_mul] at key
have := limsup_const_sub L (fun i ↦ ∫ x, f x ∂ (μs i)) ‖f‖ bdd_above.isCobounded_ge bdd_below
rwa [this, _root_.sub_le_sub_iff_left ‖f‖] at key
· have key := h _ (f.add_norm_nonneg)
simp_rw [f.integral_add_const ‖f‖] at key
simp only [measureReal_univ_eq_one, smul_eq_mul, one_mul] at key
have := limsup_add_const L (fun i ↦ ∫ x, f x ∂ (μs i)) ‖f‖ bdd_above bdd_below.isCobounded_le
rwa [this, add_le_add_iff_right] at key
lemma tendsto_integral_of_forall_integral_le_liminf_integral {ι : Type*} {L : Filter ι}
{μ : Measure X} [IsProbabilityMeasure μ] {μs : ι → Measure X} [∀ i, IsProbabilityMeasure (μs i)]
(h : ∀ f : X →ᵇ ℝ, 0 ≤ f → ∫ x, f x ∂μ ≤ L.liminf (fun i ↦ ∫ x, f x ∂ (μs i)))
(f : X →ᵇ ℝ) :
Tendsto (fun i ↦ ∫ x, f x ∂ (μs i)) L (𝓝 (∫ x, f x ∂μ)) := by
rcases eq_or_neBot L with rfl | hL
· simp only [tendsto_bot]
have obs := BoundedContinuousFunction.isBounded_range_integral μs f
have bdd_above := BddAbove.isBoundedUnder L.univ_mem (by simpa using obs.bddAbove)
have bdd_below := BddBelow.isBoundedUnder L.univ_mem (by simpa using obs.bddBelow)
apply @tendsto_of_le_liminf_of_limsup_le ℝ ι _ _ _ L (fun i ↦ ∫ x, f x ∂ (μs i)) (∫ x, f x ∂μ)
· have key := h _ (f.add_norm_nonneg)
simp_rw [f.integral_add_const ‖f‖] at key
simp only [measureReal_univ_eq_one, smul_eq_mul, one_mul] at key
have := liminf_add_const L (fun i ↦ ∫ x, f x ∂ (μs i)) ‖f‖ bdd_above.isCobounded_ge bdd_below
rwa [this, add_le_add_iff_right] at key
· have key := h _ (f.norm_sub_nonneg)
simp_rw [f.integral_const_sub ‖f‖] at key
simp only [measureReal_univ_eq_one, smul_eq_mul, one_mul] at key
have := liminf_const_sub L (fun i ↦ ∫ x, f x ∂ (μs i)) ‖f‖ bdd_above bdd_below.isCobounded_le
rwa [this, sub_le_sub_iff_left] at key
· exact bdd_above
· exact bdd_below
end tendsto_integral --section
end BoundedContinuousFunction |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/CircleAverage.lean | import Mathlib.MeasureTheory.Integral.CircleIntegral
import Mathlib.MeasureTheory.Integral.IntervalAverage
import Mathlib.MeasureTheory.Integral.IntervalIntegral.Periodic
/-!
# Circle Averages
For a function `f` on the complex plane, this file introduces the definition
`Real.circleAverage f c R` as a shorthand for the average of `f` on the circle with center `c` and
radius `R`, equipped with the rotation-invariant measure of total volume one. Like
`IntervalAverage`, this notion exists as a convenience. It avoids notationally inconvenient
compositions of `f` with `circleMap` and avoids the need to manually eliminate `2 * π` every time
an average is computed.
Note: Like the interval average defined in `Mathlib/MeasureTheory/Integral/IntervalAverage.lean`,
the `circleAverage` defined here is a purely measure-theoretic average. It should not be confused
with `circleIntegral`, which is the path integral over the circle path. The relevant integrability
property `circleAverage` is `CircleIntegrable`, as defined in
`Mathlib/MeasureTheory/Integral/CircleIntegral.lean`.
Implementation Note: Like `circleMap`, `circleAverage`s are defined for negative radii. The theorem
`circleAverage_congr_negRadius` shows that the average is independent of the radius' sign.
-/
open Complex Filter Metric Real
variable
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F]
{𝕜 : Type*} [NormedDivisionRing 𝕜] [Module 𝕜 E] [NormSMulClass 𝕜 E] [SMulCommClass ℝ 𝕜 E]
{f f₁ f₂ : ℂ → E} {c : ℂ} {R : ℝ} {a : 𝕜}
namespace Real
/-!
### Definition
-/
variable (f c R) in
/--
Define `circleAverage f c R` as the average value of `f` on the circle with center `c` and radius
`R`. This is a real notion, which should not be confused with the complex path integral notion
defined in `circleIntegral` (integrating with respect to `dz`).
-/
noncomputable def circleAverage : E :=
(2 * π)⁻¹ • ∫ θ in 0..2 * π, f (circleMap c R θ)
lemma circleAverage_def :
circleAverage f c R = (2 * π)⁻¹ • ∫ θ in 0..2 * π, f (circleMap c R θ) := rfl
/-- Expression of `circleAverage` in terms of interval averages. -/
lemma circleAverage_eq_intervalAverage :
circleAverage f c R = ⨍ θ in 0..2 * π, f (circleMap c R θ) := by
simp [circleAverage, interval_average_eq]
/-- Interval averages for zero radii equal values at the center point. -/
@[simp] lemma circleAverage_zero [CompleteSpace E] :
circleAverage f c 0 = f c := by
rw [circleAverage]
simp only [circleMap_zero_radius, Function.const_apply,
intervalIntegral.integral_const, sub_zero,
← smul_assoc, smul_eq_mul, inv_mul_cancel₀ (mul_ne_zero two_ne_zero pi_ne_zero),
one_smul]
/--
Expression of `circleAverage` with arbitrary center in terms of `circleAverage` with center zero.
-/
lemma circleAverage_fun_add :
circleAverage (fun z ↦ f (z + c)) 0 R = circleAverage f c R := by
unfold circleAverage circleMap
congr
ext θ
simp only [zero_add]
congr 1
ring
/--
Expression of the `circleAverage` in terms of a `circleIntegral`.
-/
theorem circleAverage_eq_circleIntegral {F : Type*} [NormedAddCommGroup F] [NormedSpace ℂ F]
{f : ℂ → F} (h : R ≠ 0) :
circleAverage f c R = (2 * π * I)⁻¹ • (∮ z in C(c, R), (z - c)⁻¹ • f z) := by
calc circleAverage f c R
_ = (↑(2 * π) : ℂ)⁻¹ • ∫ θ in 0..2 * π, f (circleMap c R θ) := by
simp [circleAverage, ← coe_smul]
_ = (2 * π * I)⁻¹ • ∫ θ in 0..2 * π, I • f (circleMap c R θ) := by
rw [intervalIntegral.integral_smul, mul_inv_rev, smul_smul]
match_scalars
field
_ = (2 * π * I)⁻¹ • (∮ z in C(c, R), (z - c)⁻¹ • f z) := by
unfold circleIntegral
congr with θ
simp [deriv_circleMap, circleMap_sub_center, smul_smul]
field_simp [circleMap_ne_center h]
/-!
## Congruence Lemmata
-/
/-- Circle averages do not change when shifting the angle. -/
lemma circleAverage_eq_integral_add (η : ℝ) :
circleAverage f c R = (2 * π)⁻¹ • ∫ θ in 0..2 * π, f (circleMap c R (θ + η)) := by
rw [intervalIntegral.integral_comp_add_right (fun θ ↦ f (circleMap c R θ))]
have t₀ : (fun θ ↦ f (circleMap c R θ)).Periodic (2 * π) :=
fun x ↦ by simp [periodic_circleMap c R x]
have := t₀.intervalIntegral_add_eq 0 η
rw [zero_add, add_comm] at this
rw [zero_add]
simp only [circleAverage, mul_inv_rev]
congr
/-- Circle averages do not change when replacing the radius by its negative. -/
@[simp] theorem circleAverage_neg_radius :
circleAverage f c (-R) = circleAverage f c R := by
unfold circleAverage
simp_rw [circleMap_neg_radius, ← circleAverage_def, circleAverage_eq_integral_add π]
/-- Circle averages do not change when replacing the radius by its absolute value. -/
@[simp] theorem circleAverage_abs_radius :
circleAverage f c |R| = circleAverage f c R := by
by_cases! hR : 0 ≤ R
· rw [abs_of_nonneg hR]
· rw [abs_of_neg hR, circleAverage_neg_radius]
/-- If two functions agree outside of a discrete set in the circle, then their averages agree. -/
theorem circleAverage_congr_codiscreteWithin
(hf : f₁ =ᶠ[codiscreteWithin (sphere c |R|)] f₂) (hR : R ≠ 0) :
circleAverage f₁ c R = circleAverage f₂ c R := by
unfold circleAverage
congr 1
apply intervalIntegral.integral_congr_ae_restrict
apply ae_restrict_le_codiscreteWithin measurableSet_uIoc
apply codiscreteWithin.mono (by tauto) (circleMap_preimage_codiscrete hR hf)
/-- If two functions agree on the circle, then their circle averages agree. -/
theorem circleAverage_congr_sphere {f₁ f₂ : ℂ → E} (hf : Set.EqOn f₁ f₂ (sphere c |R|)) :
circleAverage f₁ c R = circleAverage f₂ c R := by
unfold circleAverage
congr 1
exact intervalIntegral.integral_congr (fun x ↦ by simp [hf (circleMap_mem_sphere' c R x)])
/--
Express the circle average over an arbitrary circle as a circle average over the unit circle.
-/
theorem circleAverage_eq_circleAverage_zero_one :
circleAverage f c R = (circleAverage (fun z ↦ f (R * z + c)) 0 1) := by
unfold circleAverage circleMap
congr with θ
ring_nf
simp
/--
The circle average of a function `f` on the unit sphere equals the circle average of the function
`z ↦ f z⁻¹`.
-/
@[simp]
theorem circleAverage_zero_one_congr_inv {f : ℂ → E} :
circleAverage (f ·⁻¹) 0 1 = circleAverage f 0 1 := by
unfold circleAverage
congr 1
calc ∫ θ in 0..2 * π, f (circleMap 0 1 θ)⁻¹
_ = ∫ θ in 0..2 * π, f (circleMap 0 1 (-θ)) := by
simp [circleMap_zero_inv]
_ = ∫ θ in 0..2 * π, f (circleMap 0 1 θ) := by
rw [intervalIntegral.integral_comp_neg (fun w ↦ f (circleMap 0 1 w))]
have t₀ : Function.Periodic (fun w ↦ f (circleMap 0 1 w)) (2 * π) :=
fun x ↦ by simp [periodic_circleMap 0 1 x]
simpa using (t₀.intervalIntegral_add_eq_of_pos two_pi_pos (-(2 * π)) 0)
/-!
## Constant Functions
-/
/--
The circle average of a constant function equals the constant.
-/
theorem circleAverage_const [CompleteSpace E] (a : E) (c : ℂ) (R : ℝ) :
circleAverage (fun _ ↦ a) c R = a := by
simp only [circleAverage, intervalIntegral.integral_const, ← smul_assoc, sub_zero, smul_eq_mul]
ring_nf
simp
/--
If `f x` equals `a` on for every point of the circle, then the circle average of `f` equals `a`.
-/
theorem circleAverage_const_on_circle [CompleteSpace E] {a : E}
(hf : ∀ x ∈ Metric.sphere c |R|, f x = a) :
circleAverage f c R = a := by
rw [circleAverage]
conv =>
left; arg 2; arg 1
intro θ
rw [hf (circleMap c R θ) (circleMap_mem_sphere' c R θ)]
apply circleAverage_const a c R
/-!
## Inequalities
-/
/--
Circle averages respect the `≤` relation.
-/
@[gcongr]
theorem circleAverage_mono {c : ℂ} {R : ℝ} {f₁ f₂ : ℂ → ℝ} (hf₁ : CircleIntegrable f₁ c R)
(hf₂ : CircleIntegrable f₂ c R) (h : ∀ x ∈ Metric.sphere c |R|, f₁ x ≤ f₂ x) :
circleAverage f₁ c R ≤ circleAverage f₂ c R := by
apply (mul_le_mul_iff_of_pos_left (by simp [pi_pos])).2
apply intervalIntegral.integral_mono_on_of_le_Ioo (le_of_lt two_pi_pos) hf₁ hf₂
exact fun x _ ↦ by simp [h (circleMap c R x)]
/--
If `f x` is smaller than `a` on for every point of the circle, then the circle average of `f` is
smaller than `a`.
-/
theorem circleAverage_mono_on_of_le_circle {f : ℂ → ℝ} {a : ℝ} (hf : CircleIntegrable f c R)
(h₂f : ∀ x ∈ Metric.sphere c |R|, f x ≤ a) :
circleAverage f c R ≤ a := by
rw [← circleAverage_const a c |R|, circleAverage, circleAverage, smul_eq_mul, smul_eq_mul,
mul_le_mul_iff_of_pos_left (inv_pos.2 two_pi_pos)]
exact intervalIntegral.integral_mono_on_of_le_Ioo (le_of_lt two_pi_pos) hf
intervalIntegrable_const (fun θ _ ↦ h₂f (circleMap c R θ) (circleMap_mem_sphere' c R θ))
/--
Analogue of `intervalIntegral.abs_integral_le_integral_abs`: The absolute value of a circle average
is less than or equal to the circle average of the absolute value of the function.
-/
theorem abs_circleAverage_le_circleAverage_abs {f : ℂ → ℝ} :
|circleAverage f c R| ≤ circleAverage |f| c R := by
rw [circleAverage, circleAverage, smul_eq_mul, smul_eq_mul, abs_mul,
abs_of_pos (inv_pos.2 two_pi_pos), mul_le_mul_iff_of_pos_left (inv_pos.2 two_pi_pos)]
exact intervalIntegral.abs_integral_le_integral_abs (le_of_lt two_pi_pos)
/-!
## Commutativity with Linear Maps
-/
/-- Circle averages commute with continuous linear maps. -/
theorem _root_.ContinuousLinearMap.circleAverage_comp_comm [CompleteSpace E] (L : E →L[ℝ] F)
{f : ℂ → E} (hf : CircleIntegrable f c R) :
circleAverage (L ∘ f) c R = L (circleAverage f c R) := by
unfold circleAverage
rw [map_smul]
congr
exact L.intervalIntegral_comp_comm hf
/-!
## Behaviour with Respect to Arithmetic Operations
-/
/-- Circle averages commute with scalar multiplication. -/
theorem circleAverage_smul :
circleAverage (a • f) c R = a • circleAverage f c R := by
unfold circleAverage
have := SMulCommClass.symm ℝ 𝕜 E
rw [smul_comm]
simp [intervalIntegral.integral_smul]
/-- Circle averages commute with scalar multiplication. -/
theorem circleAverage_fun_smul :
circleAverage (fun z ↦ a • f z) c R = a • circleAverage f c R :=
circleAverage_smul
/-- Circle averages commute with addition. -/
theorem circleAverage_add (hf₁ : CircleIntegrable f₁ c R) (hf₂ : CircleIntegrable f₂ c R) :
circleAverage (f₁ + f₂) c R = circleAverage f₁ c R + circleAverage f₂ c R := by
rw [circleAverage, circleAverage, circleAverage, ← smul_add]
congr
apply intervalIntegral.integral_add hf₁ hf₂
/-- Circle averages commute with sums. -/
theorem circleAverage_sum {ι : Type*} {s : Finset ι} {f : ι → ℂ → E}
(h : ∀ i ∈ s, CircleIntegrable (f i) c R) :
circleAverage (∑ i ∈ s, f i) c R = ∑ i ∈ s, circleAverage (f i) c R := by
unfold circleAverage
simp [← Finset.smul_sum, intervalIntegral.integral_finset_sum h]
/-- Circle averages commute with subtraction. -/
theorem circleAverage_sub (hf₁ : CircleIntegrable f₁ c R) (hf₂ : CircleIntegrable f₂ c R) :
circleAverage (f₁ - f₂) c R = circleAverage f₁ c R - circleAverage f₂ c R := by
rw [circleAverage, circleAverage, circleAverage, ← smul_sub]
congr
apply intervalIntegral.integral_sub hf₁ hf₂
end Real |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/Indicator.lean | import Mathlib.MeasureTheory.Constructions.BorelSpace.Metrizable
import Mathlib.MeasureTheory.Integral.Lebesgue.DominatedConvergence
/-!
# Results about indicator functions, their integrals, and measures
This file has a few measure-theoretic or integration-related results on indicator functions.
## Implementation notes
This file exists to avoid importing `Mathlib/MeasureTheory/Constructions/BorelSpace/Metrizable.lean`
in `Mathlib/MeasureTheory/Integral/Lebesgue/Basic.lean`.
## TODO
The result `MeasureTheory.tendsto_measure_of_tendsto_indicator` here could be proved without
integration, if we had convergence of measures results for countably generated filters. Ideally,
the present file would then become unnecessary: lemmas such as
`MeasureTheory.tendsto_measure_of_ae_tendsto_indicator` would not need integration so could be
moved out of `Mathlib/MeasureTheory/Integral/Lebesgue/Basic.lean`, and the lemmas in this file could
be moved to, e.g., `Mathlib/MeasureTheory/Constructions/BorelSpace/Metrizable.lean`.
-/
namespace MeasureTheory
section TendstoIndicator
open Set Filter ENNReal Topology
variable {α : Type*} [MeasurableSpace α] {A : Set α}
variable {ι : Type*} (L : Filter ι) [IsCountablyGenerated L] {As : ι → Set α}
/-- If the indicators of measurable sets `Aᵢ` tend pointwise almost everywhere to the indicator
of a measurable set `A` and we eventually have `Aᵢ ⊆ B` for some set `B` of finite measure, then
the measures of `Aᵢ` tend to the measure of `A`. -/
lemma tendsto_measure_of_ae_tendsto_indicator {μ : Measure α} (A_mble : MeasurableSet A)
(As_mble : ∀ i, MeasurableSet (As i)) {B : Set α} (B_mble : MeasurableSet B)
(B_finmeas : μ B ≠ ∞) (As_le_B : ∀ᶠ i in L, As i ⊆ B)
(h_lim : ∀ᵐ x ∂μ, ∀ᶠ i in L, x ∈ As i ↔ x ∈ A) :
Tendsto (fun i ↦ μ (As i)) L (𝓝 (μ A)) := by
simp_rw [← MeasureTheory.lintegral_indicator_one A_mble,
← MeasureTheory.lintegral_indicator_one (As_mble _)]
refine tendsto_lintegral_filter_of_dominated_convergence (B.indicator (1 : α → ℝ≥0∞))
(Eventually.of_forall ?_) ?_ ?_ ?_
· exact fun i ↦ Measurable.indicator measurable_const (As_mble i)
· filter_upwards [As_le_B] with i hi
exact Eventually.of_forall (fun x ↦ indicator_le_indicator_of_subset hi (by simp) x)
· rwa [← lintegral_indicator_one B_mble] at B_finmeas
· simpa only [Pi.one_def, tendsto_indicator_const_apply_iff_eventually] using h_lim
/-- If `μ` is a finite measure and the indicators of measurable sets `Aᵢ` tend pointwise
almost everywhere to the indicator of a measurable set `A`, then the measures `μ Aᵢ` tend to
the measure `μ A`. -/
lemma tendsto_measure_of_ae_tendsto_indicator_of_isFiniteMeasure
{μ : Measure α} [IsFiniteMeasure μ] (A_mble : MeasurableSet A)
(As_mble : ∀ i, MeasurableSet (As i)) (h_lim : ∀ᵐ x ∂μ, ∀ᶠ i in L, x ∈ As i ↔ x ∈ A) :
Tendsto (fun i ↦ μ (As i)) L (𝓝 (μ A)) :=
tendsto_measure_of_ae_tendsto_indicator L A_mble As_mble MeasurableSet.univ
(by finiteness) (Eventually.of_forall (fun i ↦ subset_univ (As i))) h_lim
/-- If the indicators of measurable sets `Aᵢ` tend pointwise to the indicator of a set `A`
and we eventually have `Aᵢ ⊆ B` for some set `B` of finite measure, then the measures of `Aᵢ`
tend to the measure of `A`. -/
lemma tendsto_measure_of_tendsto_indicator {μ : Measure α}
(As_mble : ∀ i, MeasurableSet (As i)) {B : Set α} (B_mble : MeasurableSet B)
(B_finmeas : μ B ≠ ∞) (As_le_B : ∀ᶠ i in L, As i ⊆ B)
(h_lim : ∀ x, ∀ᶠ i in L, x ∈ As i ↔ x ∈ A) :
Tendsto (fun i ↦ μ (As i)) L (𝓝 (μ A)) := by
rcases L.eq_or_neBot with rfl | _
· exact tendsto_bot
apply tendsto_measure_of_ae_tendsto_indicator L ?_ As_mble B_mble B_finmeas As_le_B
(ae_of_all μ h_lim)
exact measurableSet_of_tendsto_indicator L As_mble h_lim
/-- If `μ` is a finite measure and the indicators of measurable sets `Aᵢ` tend pointwise to
the indicator of a set `A`, then the measures `μ Aᵢ` tend to the measure `μ A`. -/
lemma tendsto_measure_of_tendsto_indicator_of_isFiniteMeasure
(μ : Measure α) [IsFiniteMeasure μ] (As_mble : ∀ i, MeasurableSet (As i))
(h_lim : ∀ x, ∀ᶠ i in L, x ∈ As i ↔ x ∈ A) :
Tendsto (fun i ↦ μ (As i)) L (𝓝 (μ A)) := by
rcases L.eq_or_neBot with rfl | _
· exact tendsto_bot
apply tendsto_measure_of_ae_tendsto_indicator_of_isFiniteMeasure L ?_ As_mble (ae_of_all μ h_lim)
exact measurableSet_of_tendsto_indicator L As_mble h_lim
end TendstoIndicator -- section
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/Asymptotics.lean | import Mathlib.MeasureTheory.Group.Measure
import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap
/-!
# Bounding of integrals by asymptotics
We establish integrability of `f` from `f = O(g)`.
## Main results
* `Asymptotics.IsBigO.integrableAtFilter`: If `f = O[l] g` on measurably generated `l`,
`f` is strongly measurable at `l`, and `g` is integrable at `l`, then `f` is integrable at `l`.
* `MeasureTheory.LocallyIntegrable.integrable_of_isBigO_cocompact`: If `f` is locally integrable,
and `f =O[cocompact] g` for some `g` integrable at `cocompact`, then `f` is integrable.
* `MeasureTheory.LocallyIntegrable.integrable_of_isBigO_atBot_atTop`: If `f` is locally integrable,
and `f =O[atBot] g`, `f =O[atTop] g'` for some `g`, `g'` integrable `atBot` and `atTop`
respectively, then `f` is integrable.
* `MeasureTheory.LocallyIntegrable.integrable_of_isBigO_atTop_of_norm_isNegInvariant`:
If `f` is locally integrable, `‖f(-x)‖ = ‖f(x)‖`, and `f =O[atTop] g` for some
`g` integrable `atTop`, then `f` is integrable.
-/
open Asymptotics MeasureTheory Set Filter
variable {α E F : Type*} [NormedAddCommGroup E] {f : α → E} {g : α → F} {a : α} {l : Filter α}
namespace Asymptotics
section Basic
variable [MeasurableSpace α] [NormedAddCommGroup F] {μ : Measure α}
/-- If `f = O[l] g` on measurably generated `l`, `f` is strongly measurable at `l`,
and `g` is integrable at `l`, then `f` is integrable at `l`. -/
theorem IsBigO.integrableAtFilter [IsMeasurablyGenerated l]
(hf : f =O[l] g) (hfm : StronglyMeasurableAtFilter f l μ) (hg : IntegrableAtFilter g l μ) :
IntegrableAtFilter f l μ := by
obtain ⟨C, hC⟩ := hf.bound
obtain ⟨s, hsl, hsm, hfg, hf, hg⟩ :=
(hC.smallSets.and <| hfm.eventually.and hg.eventually).exists_measurable_mem_of_smallSets
refine ⟨s, hsl, (hg.norm.const_mul C).mono hf ?_⟩
refine (ae_restrict_mem hsm).mono fun x hx ↦ ?_
exact (hfg x hx).trans (le_abs_self _)
/-- Variant of `MeasureTheory.Integrable.mono` taking `f =O[⊤] (g)` instead of `‖f(x)‖ ≤ ‖g(x)‖` -/
theorem IsBigO.integrable (hfm : AEStronglyMeasurable f μ)
(hf : f =O[⊤] g) (hg : Integrable g μ) : Integrable f μ := by
rewrite [← integrableAtFilter_top] at *
exact hf.integrableAtFilter ⟨univ, univ_mem, hfm.restrict⟩ hg
end Basic
variable {ι : Type*} [MeasurableSpace ι] {f : ι × α → E} {s : Set ι} {μ : Measure ι}
/-- Let `f : X x Y → Z`. If as `y` tends to `l`, `f(x, y) = O(g(y))` uniformly on `s : Set X`
of finite measure, then f is eventually (as `y` tends to `l`) integrable along `s`. -/
theorem IsBigO.eventually_integrableOn [Norm F]
(hf : f =O[𝓟 s ×ˢ l] (g ∘ Prod.snd))
(hfm : ∀ᶠ x in l, AEStronglyMeasurable (fun i ↦ f (i, x)) (μ.restrict s))
(hs : MeasurableSet s) (hμ : μ s < ⊤) :
∀ᶠ x in l, IntegrableOn (fun i ↦ f (i, x)) s μ := by
obtain ⟨C, hC⟩ := hf.bound
obtain ⟨t, htl, ht⟩ := hC.exists_mem
obtain ⟨u, hu, v, hv, huv⟩ := Filter.mem_prod_iff.mp htl
obtain ⟨w, hwl, hw⟩ := hfm.exists_mem
refine eventually_iff_exists_mem.mpr ⟨w ∩ v, inter_mem hwl hv, fun x hx ↦ ?_⟩
haveI : IsFiniteMeasure (μ.restrict s) := ⟨Measure.restrict_apply_univ s ▸ hμ⟩
refine Integrable.mono' (integrable_const (C * ‖g x‖)) (hw x hx.1) ?_
filter_upwards [MeasureTheory.self_mem_ae_restrict hs]
intro y hy
exact ht (y, x) <| huv ⟨hu hy, hx.2⟩
variable [NormedSpace ℝ E] [NormedAddCommGroup F]
/-- Let `f : X x Y → Z`. If as `y` tends to `l`, `f(x, y) = O(g(y))` uniformly on `s : Set X`
of finite measure, then the integral of `f` along `s` is `O(g(y))`. -/
theorem IsBigO.set_integral_isBigO
(hf : f =O[𝓟 s ×ˢ l] (g ∘ Prod.snd)) (hs : MeasurableSet s) (hμ : μ s < ⊤) :
(fun x ↦ ∫ i in s, f (i, x) ∂μ) =O[l] g := by
obtain ⟨C, hC⟩ := hf.bound
obtain ⟨t, htl, ht⟩ := hC.exists_mem
obtain ⟨u, hu, v, hv, huv⟩ := Filter.mem_prod_iff.mp htl
refine isBigO_iff.mpr ⟨C * μ.real s, eventually_iff_exists_mem.mpr ⟨v, hv, fun x hx ↦ ?_⟩⟩
rw [mul_assoc, ← smul_eq_mul _ ‖g x‖, ← MeasureTheory.measureReal_restrict_apply_univ,
← integral_const, mul_comm, ← smul_eq_mul, ← integral_smul_const]
haveI : IsFiniteMeasure (μ.restrict s) := ⟨by rw [Measure.restrict_apply_univ s]; exact hμ⟩
refine (norm_integral_le_integral_norm _).trans <|
integral_mono_of_nonneg (univ_mem' fun _ ↦ norm_nonneg _) (integrable_const _) ?_
filter_upwards [MeasureTheory.self_mem_ae_restrict hs]
intro y hy
rw [smul_eq_mul, mul_comm]
exact ht (y, x) <| huv ⟨hu hy, hx⟩
end Asymptotics
variable [TopologicalSpace α] [SecondCountableTopology α] [MeasurableSpace α] {μ : Measure α}
[NormedAddCommGroup F]
namespace MeasureTheory
/-- If `f` is locally integrable, and `f =O[cocompact] g` for some `g` integrable at `cocompact`,
then `f` is integrable. -/
theorem LocallyIntegrable.integrable_of_isBigO_cocompact [IsMeasurablyGenerated (cocompact α)]
(hf : LocallyIntegrable f μ) (ho : f =O[cocompact α] g)
(hg : IntegrableAtFilter g (cocompact α) μ) : Integrable f μ := by
refine integrable_iff_integrableAtFilter_cocompact.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
section LinearOrder
variable [LinearOrder α] [CompactIccSpace α] {g' : α → F}
/-- If `f` is locally integrable, and `f =O[atBot] g`, `f =O[atTop] g'` for some
`g`, `g'` integrable at `atBot` and `atTop` respectively, then `f` is integrable. -/
theorem LocallyIntegrable.integrable_of_isBigO_atBot_atTop
[IsMeasurablyGenerated (atBot (α := α))] [IsMeasurablyGenerated (atTop (α := α))]
(hf : LocallyIntegrable f μ)
(ho : f =O[atBot] g) (hg : IntegrableAtFilter g atBot μ)
(ho' : f =O[atTop] g') (hg' : IntegrableAtFilter g' atTop μ) : Integrable f μ := by
refine integrable_iff_integrableAtFilter_atBot_atTop.mpr
⟨⟨ho.integrableAtFilter ?_ hg, ho'.integrableAtFilter ?_ hg'⟩, hf⟩
all_goals exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
/-- If `f` is locally integrable on `(∞, a]`, and `f =O[atBot] g`, for some
`g` integrable at `atBot`, then `f` is integrable on `(∞, a]`. -/
theorem LocallyIntegrableOn.integrableOn_of_isBigO_atBot [IsMeasurablyGenerated (atBot (α := α))]
(hf : LocallyIntegrableOn f (Iic a) μ) (ho : f =O[atBot] g)
(hg : IntegrableAtFilter g atBot μ) : IntegrableOn f (Iic a) μ := by
refine integrableOn_Iic_iff_integrableAtFilter_atBot.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact ⟨Iic a, Iic_mem_atBot a, hf.aestronglyMeasurable⟩
/-- If `f` is locally integrable on `[a, ∞)`, and `f =O[atTop] g`, for some
`g` integrable at `atTop`, then `f` is integrable on `[a, ∞)`. -/
theorem LocallyIntegrableOn.integrableOn_of_isBigO_atTop [IsMeasurablyGenerated (atTop (α := α))]
(hf : LocallyIntegrableOn f (Ici a) μ) (ho : f =O[atTop] g)
(hg : IntegrableAtFilter g atTop μ) : IntegrableOn f (Ici a) μ := by
refine integrableOn_Ici_iff_integrableAtFilter_atTop.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact ⟨Ici a, Ici_mem_atTop a, hf.aestronglyMeasurable⟩
/-- If `f` is locally integrable, `f` has a top element, and `f =O[atBot] g`, for some
`g` integrable at `atBot`, then `f` is integrable. -/
theorem LocallyIntegrable.integrable_of_isBigO_atBot [IsMeasurablyGenerated (atBot (α := α))]
[OrderTop α] (hf : LocallyIntegrable f μ) (ho : f =O[atBot] g)
(hg : IntegrableAtFilter g atBot μ) : Integrable f μ := by
refine integrable_iff_integrableAtFilter_atBot.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
/-- If `f` is locally integrable, `f` has a bottom element, and `f =O[atTop] g`, for some
`g` integrable at `atTop`, then `f` is integrable. -/
theorem LocallyIntegrable.integrable_of_isBigO_atTop [IsMeasurablyGenerated (atTop (α := α))]
[OrderBot α] (hf : LocallyIntegrable f μ) (ho : f =O[atTop] g)
(hg : IntegrableAtFilter g atTop μ) : Integrable f μ := by
refine integrable_iff_integrableAtFilter_atTop.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
end LinearOrder
section LinearOrderedAddCommGroup
variable [AddCommGroup α] [LinearOrder α] [IsOrderedAddMonoid α] [CompactIccSpace α]
/-- If `f` is locally integrable, `‖f(-x)‖ = ‖f(x)‖`, and `f =O[atTop] g`, for some
`g` integrable at `atTop`, then `f` is integrable. -/
theorem LocallyIntegrable.integrable_of_isBigO_atTop_of_norm_isNegInvariant
[IsMeasurablyGenerated (atTop (α := α))] [MeasurableNeg α] [μ.IsNegInvariant]
(hf : LocallyIntegrable f μ) (hsymm : norm ∘ f =ᵐ[μ] norm ∘ f ∘ Neg.neg) (ho : f =O[atTop] g)
(hg : IntegrableAtFilter g atTop μ) : Integrable f μ := by
have h_int := (hf.locallyIntegrableOn (Ici 0)).integrableOn_of_isBigO_atTop ho hg
rw [← integrableOn_univ, ← Iic_union_Ici_of_le le_rfl, integrableOn_union]
refine ⟨?_, h_int⟩
have h_map_neg : (μ.restrict (Ici 0)).map Neg.neg = μ.restrict (Iic 0) := by
conv => rhs; rw [← Measure.map_neg_eq_self μ, measurableEmbedding_neg.restrict_map]
simp
rw [IntegrableOn, ← h_map_neg, measurableEmbedding_neg.integrable_map_iff]
refine h_int.congr' ?_ hsymm.restrict
refine AEStronglyMeasurable.comp_aemeasurable ?_ measurable_neg.aemeasurable
exact h_map_neg ▸ hf.aestronglyMeasurable.restrict
end LinearOrderedAddCommGroup
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/LebesgueNormedSpace.lean | import Mathlib.MeasureTheory.Measure.WithDensity
import Mathlib.Analysis.Normed.Module.Basic
/-! # A lemma about measurability with density under scalar multiplication in normed spaces -/
open MeasureTheory Filter ENNReal Set
open NNReal ENNReal
variable {α : Type*} {m : MeasurableSpace α} {μ : MeasureTheory.Measure α}
theorem aemeasurable_withDensity_iff {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[SecondCountableTopology E] [MeasurableSpace E] [BorelSpace E] {f : α → ℝ≥0}
(hf : Measurable f) {g : α → E} :
AEMeasurable g (μ.withDensity fun x => (f x : ℝ≥0∞)) ↔
AEMeasurable (fun x => (f x : ℝ) • g x) μ := by
constructor
· rintro ⟨g', g'meas, hg'⟩
have A : MeasurableSet { x : α | f x ≠ 0 } := (hf (measurableSet_singleton 0)).compl
refine ⟨fun x => (f x : ℝ) • g' x, hf.coe_nnreal_real.smul g'meas, ?_⟩
apply @ae_of_ae_restrict_of_ae_restrict_compl _ _ _ { x | f x ≠ 0 }
· rw [EventuallyEq, ae_withDensity_iff hf.coe_nnreal_ennreal] at hg'
rw [ae_restrict_iff' A]
filter_upwards [hg']
intro a ha h'a
have : (f a : ℝ≥0∞) ≠ 0 := by simpa only [Ne, ENNReal.coe_eq_zero] using h'a
rw [ha this]
· filter_upwards [ae_restrict_mem A.compl]
intro x hx
simp only [Classical.not_not, mem_setOf_eq, mem_compl_iff] at hx
simp [hx]
· rintro ⟨g', g'meas, hg'⟩
refine ⟨fun x => (f x : ℝ)⁻¹ • g' x, hf.coe_nnreal_real.inv.smul g'meas, ?_⟩
rw [EventuallyEq, ae_withDensity_iff hf.coe_nnreal_ennreal]
filter_upwards [hg']
intro x hx h'x
rw [← hx, smul_smul, inv_mul_cancel₀, one_smul]
simp only [Ne, ENNReal.coe_eq_zero] at h'x
simpa only [NNReal.coe_eq_zero, Ne] using h'x |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/TorusIntegral.lean | import Mathlib.MeasureTheory.Integral.CircleIntegral
import Mathlib.MeasureTheory.Integral.Prod
import Mathlib.Order.Fin.Tuple
import Mathlib.Util.Superscript
/-!
# Integral over a torus in `ℂⁿ`
In this file we define the integral of a function `f : ℂⁿ → E` over a torus
`{z : ℂⁿ | ∀ i, z i ∈ Metric.sphere (c i) (R i)}`. In order to do this, we define
`torusMap (c : ℂⁿ) (R θ : ℝⁿ)` to be the point in `ℂⁿ` given by $z_k=c_k+R_ke^{θ_ki}$,
where $i$ is the imaginary unit, then define `torusIntegral f c R` as the integral over
the cube $[0, (fun _ ↦ 2π)] = \{θ\|∀ k, 0 ≤ θ_k ≤ 2π\}$ of the Jacobian of the
`torusMap` multiplied by `f (torusMap c R θ)`.
We also define a predicate saying that `f ∘ torusMap c R` is integrable on the cube
`[0, (fun _ ↦ 2π)]`.
## Main definitions
* `torusMap c R`: the generalized multidimensional exponential map from `ℝⁿ` to `ℂⁿ` that sends
$θ=(θ_0,…,θ_{n-1})$ to $z=(z_0,…,z_{n-1})$, where $z_k= c_k + R_ke^{θ_k i}$;
* `TorusIntegrable f c R`: a function `f : ℂⁿ → E` is integrable over the generalized torus
with center `c : ℂⁿ` and radius `R : ℝⁿ` if `f ∘ torusMap c R` is integrable on the
closed cube `Icc (0 : ℝⁿ) (fun _ ↦ 2 * π)`;
* `torusIntegral f c R`: the integral of a function `f : ℂⁿ → E` over a torus with
center `c ∈ ℂⁿ` and radius `R ∈ ℝⁿ` defined as
$\iiint_{[0, 2 * π]} (∏_{k = 1}^{n} i R_k e^{θ_k * i}) • f (c + Re^{θ_k i})\,dθ_0…dθ_{k-1}$.
## Main statements
* `torusIntegral_dim0`, `torusIntegral_dim1`, `torusIntegral_succ`: formulas for `torusIntegral`
in cases of dimension `0`, `1`, and `n + 1`.
## Notation
- `ℝ⁰`, `ℝ¹`, `ℝⁿ`, `ℝⁿ⁺¹`: local notation for `Fin 0 → ℝ`, `Fin 1 → ℝ`, `Fin n → ℝ`, and
`Fin (n + 1) → ℝ`, respectively;
- `ℂ⁰`, `ℂ¹`, `ℂⁿ`, `ℂⁿ⁺¹`: local notation for `Fin 0 → ℂ`, `Fin 1 → ℂ`, `Fin n → ℂ`, and
`Fin (n + 1) → ℂ`, respectively;
- `∯ z in T(c, R), f z`: notation for `torusIntegral f c R`;
- `∮ z in C(c, R), f z`: notation for `circleIntegral f c R`, defined elsewhere;
- `∏ k, f k`: notation for `Finset.prod`, defined elsewhere;
- `π`: notation for `Real.pi`, defined elsewhere.
## Tags
integral, torus
-/
variable {n : ℕ}
variable {E : Type*} [NormedAddCommGroup E]
noncomputable section
open Complex Set MeasureTheory Function Filter TopologicalSpace
open Mathlib.Tactic (superscriptTerm)
open scoped Real
local syntax:arg term:max noWs superscriptTerm : term
local macro_rules | `($t:term$n:superscript) => `(Fin $n → $t)
/-!
### `torusMap`, a parametrization of a torus
-/
/-- The n-dimensional exponential map $θ_i ↦ c + R e^{θ_i*I}, θ ∈ ℝⁿ$ representing
a torus in `ℂⁿ` with center `c ∈ ℂⁿ` and generalized radius `R ∈ ℝⁿ`, so we can adjust
it to every n axis. -/
def torusMap (c : ℂⁿ) (R : ℝⁿ) : ℝⁿ → ℂⁿ := fun θ i => c i + R i * exp (θ i * I)
theorem torusMap_sub_center (c : ℂⁿ) (R : ℝⁿ) (θ : ℝⁿ) : torusMap c R θ - c = torusMap 0 R θ := by
ext1 i; simp [torusMap]
theorem torusMap_eq_center_iff {c : ℂⁿ} {R : ℝⁿ} {θ : ℝⁿ} : torusMap c R θ = c ↔ R = 0 := by
simp [funext_iff, torusMap, exp_ne_zero]
@[simp]
theorem torusMap_zero_radius (c : ℂⁿ) : torusMap c 0 = const ℝⁿ c :=
funext fun _ ↦ torusMap_eq_center_iff.2 rfl
/-!
### Integrability of a function on a generalized torus
-/
/-- A function `f : ℂⁿ → E` is integrable on the generalized torus if the function
`f ∘ torusMap c R θ` is integrable on `Icc (0 : ℝⁿ) (fun _ ↦ 2 * π)`. -/
def TorusIntegrable (f : ℂⁿ → E) (c : ℂⁿ) (R : ℝⁿ) : Prop :=
IntegrableOn (fun θ : ℝⁿ => f (torusMap c R θ)) (Icc (0 : ℝⁿ) fun _ => 2 * π) volume
namespace TorusIntegrable
variable {f g : ℂⁿ → E} {c : ℂⁿ} {R : ℝⁿ}
/-- Constant functions are torus integrable -/
theorem torusIntegrable_const (a : E) (c : ℂⁿ) (R : ℝⁿ) : TorusIntegrable (fun _ => a) c R := by
simp [TorusIntegrable, measure_Icc_lt_top]
/-- If `f` is torus integrable then `-f` is torus integrable. -/
protected nonrec theorem neg (hf : TorusIntegrable f c R) : TorusIntegrable (-f) c R := hf.neg
/-- If `f` and `g` are two torus integrable functions, then so is `f + g`. -/
protected nonrec theorem add (hf : TorusIntegrable f c R) (hg : TorusIntegrable g c R) :
TorusIntegrable (f + g) c R :=
hf.add hg
/-- If `f` and `g` are two torus integrable functions, then so is `f - g`. -/
protected nonrec theorem sub (hf : TorusIntegrable f c R) (hg : TorusIntegrable g c R) :
TorusIntegrable (f - g) c R :=
hf.sub hg
theorem torusIntegrable_zero_radius {f : ℂⁿ → E} {c : ℂⁿ} : TorusIntegrable f c 0 := by
rw [TorusIntegrable, torusMap_zero_radius]
apply torusIntegrable_const (f c) c 0
/-- The function given in the definition of `torusIntegral` is integrable. -/
theorem function_integrable [NormedSpace ℂ E] (hf : TorusIntegrable f c R) :
IntegrableOn (fun θ : ℝⁿ => (∏ i, R i * exp (θ i * I) * I : ℂ) • f (torusMap c R θ))
(Icc (0 : ℝⁿ) fun _ => 2 * π) volume := by
refine (hf.norm.const_mul (∏ i, |R i|)).mono' ?_ ?_
· refine (Continuous.aestronglyMeasurable ?_).smul hf.1; fun_prop
simp [norm_smul]
end TorusIntegrable
variable [NormedSpace ℂ E] {f g : ℂⁿ → E} {c : ℂⁿ} {R : ℝⁿ}
/-- The integral over a generalized torus with center `c ∈ ℂⁿ` and radius `R ∈ ℝⁿ`, defined
as the `•`-product of the derivative of `torusMap` and `f (torusMap c R θ)` -/
def torusIntegral (f : ℂⁿ → E) (c : ℂⁿ) (R : ℝⁿ) :=
∫ θ : ℝⁿ in Icc (0 : ℝⁿ) fun _ => 2 * π, (∏ i, R i * exp (θ i * I) * I : ℂ) • f (torusMap c R θ)
@[inherit_doc torusIntegral]
notation3 "∯ " (...) " in " "T(" c ", " R ")" ", " r:(scoped f => torusIntegral f c R) => r
theorem torusIntegral_radius_zero (hn : n ≠ 0) (f : ℂⁿ → E) (c : ℂⁿ) :
(∯ x in T(c, 0), f x) = 0 := by
simp only [torusIntegral, Pi.zero_apply, ofReal_zero, zero_mul, Fin.prod_const,
zero_pow hn, zero_smul, integral_zero]
theorem torusIntegral_neg (f : ℂⁿ → E) (c : ℂⁿ) (R : ℝⁿ) :
(∯ x in T(c, R), -f x) = -∯ x in T(c, R), f x := by simp [torusIntegral, integral_neg]
theorem torusIntegral_add (hf : TorusIntegrable f c R) (hg : TorusIntegrable g c R) :
(∯ x in T(c, R), f x + g x) = (∯ x in T(c, R), f x) + ∯ x in T(c, R), g x := by
simpa only [torusIntegral, smul_add, Pi.add_apply] using
integral_add hf.function_integrable hg.function_integrable
theorem torusIntegral_sub (hf : TorusIntegrable f c R) (hg : TorusIntegrable g c R) :
(∯ x in T(c, R), f x - g x) = (∯ x in T(c, R), f x) - ∯ x in T(c, R), g x := by
simpa only [sub_eq_add_neg, ← torusIntegral_neg] using torusIntegral_add hf hg.neg
theorem torusIntegral_smul {𝕜 : Type*} [RCLike 𝕜] [NormedSpace 𝕜 E] [SMulCommClass 𝕜 ℂ E] (a : 𝕜)
(f : ℂⁿ → E) (c : ℂⁿ) (R : ℝⁿ) : (∯ x in T(c, R), a • f x) = a • ∯ x in T(c, R), f x := by
simp only [torusIntegral, integral_smul, ← smul_comm a (_ : ℂ) (_ : E)]
theorem torusIntegral_const_mul (a : ℂ) (f : ℂⁿ → ℂ) (c : ℂⁿ) (R : ℝⁿ) :
(∯ x in T(c, R), a * f x) = a * ∯ x in T(c, R), f x :=
torusIntegral_smul a f c R
/-- If for all `θ : ℝⁿ`, `‖f (torusMap c R θ)‖` is less than or equal to a constant `C : ℝ`, then
`‖∯ x in T(c, R), f x‖` is less than or equal to `(2 * π)^n * (∏ i, |R i|) * C` -/
theorem norm_torusIntegral_le_of_norm_le_const {C : ℝ} (hf : ∀ θ, ‖f (torusMap c R θ)‖ ≤ C) :
‖∯ x in T(c, R), f x‖ ≤ ((2 * π) ^ (n : ℕ) * ∏ i, |R i|) * C :=
calc
‖∯ x in T(c, R), f x‖ ≤ (∏ i, |R i|) * C * (volume (Icc (0 : ℝⁿ) fun _ => 2 * π)).toReal :=
norm_setIntegral_le_of_norm_le_const measure_Icc_lt_top fun θ _ =>
calc
‖(∏ i : Fin n, R i * exp (θ i * I) * I : ℂ) • f (torusMap c R θ)‖ =
(∏ i : Fin n, |R i|) * ‖f (torusMap c R θ)‖ := by simp [norm_smul]
_ ≤ (∏ i : Fin n, |R i|) * C := mul_le_mul_of_nonneg_left (hf _) <| by positivity
_ = ((2 * π) ^ (n : ℕ) * ∏ i, |R i|) * C := by
simp only [Pi.zero_def, Real.volume_Icc_pi_toReal fun _ => Real.two_pi_pos.le, sub_zero,
Fin.prod_const, mul_assoc, mul_comm ((2 * π) ^ (n : ℕ))]
@[simp]
theorem torusIntegral_dim0 [CompleteSpace E]
(f : ℂ⁰ → E) (c : ℂ⁰) (R : ℝ⁰) : (∯ x in T(c, R), f x) = f c := by
simp only [torusIntegral, Fin.prod_univ_zero, one_smul,
Subsingleton.elim (fun _ : Fin 0 => 2 * π) 0, Icc_self, Measure.restrict_singleton, volume_pi,
integral_dirac, Measure.pi_of_empty (fun _ : Fin 0 ↦ volume) 0,
Measure.dirac_apply_of_mem (mem_singleton _), Subsingleton.elim (torusMap c R 0) c]
/-- In dimension one, `torusIntegral` is the same as `circleIntegral`
(up to the natural equivalence between `ℂ` and `Fin 1 → ℂ`). -/
theorem torusIntegral_dim1 (f : ℂ¹ → E) (c : ℂ¹) (R : ℝ¹) :
(∯ x in T(c, R), f x) = ∮ z in C(c 0, R 0), f fun _ => z := by
have H₁ : (((MeasurableEquiv.funUnique _ _).symm) ⁻¹' Icc 0 fun _ => 2 * π) = Icc 0 (2 * π) :=
(OrderIso.funUnique (Fin 1) ℝ).symm.preimage_Icc _ _
have H₂ : torusMap c R = fun θ _ ↦ circleMap (c 0) (R 0) (θ 0) := by
ext θ i : 2
rw [Subsingleton.elim i 0]; rfl
rw [torusIntegral, circleIntegral, intervalIntegral.integral_of_le Real.two_pi_pos.le,
Measure.restrict_congr_set Ioc_ae_eq_Icc,
← ((volume_preserving_funUnique (Fin 1) ℝ).symm _).setIntegral_preimage_emb
(MeasurableEquiv.measurableEmbedding _), H₁, H₂]
simp [circleMap_zero]
/-- Recurrent formula for `torusIntegral`, see also `torusIntegral_succ`. -/
theorem torusIntegral_succAbove
{f : ℂⁿ⁺¹ → E} {c : ℂⁿ⁺¹} {R : ℝⁿ⁺¹} (hf : TorusIntegrable f c R)
(i : Fin (n + 1)) :
(∯ x in T(c, R), f x) =
∮ x in C(c i, R i), ∯ y in T(c ∘ i.succAbove, R ∘ i.succAbove), f (i.insertNth x y) := by
set e : ℝ × ℝⁿ ≃ᵐ ℝⁿ⁺¹ := (MeasurableEquiv.piFinSuccAbove (fun _ => ℝ) i).symm
have hem : MeasurePreserving e :=
(volume_preserving_piFinSuccAbove (fun _ : Fin (n + 1) => ℝ) i).symm _
have heπ : (e ⁻¹' Icc 0 fun _ => 2 * π) = Icc 0 (2 * π) ×ˢ Icc (0 : ℝⁿ) fun _ => 2 * π :=
((Fin.insertNthOrderIso (fun _ => ℝ) i).preimage_Icc _ _).trans (Icc_prod_eq _ _)
rw [torusIntegral, ← hem.map_eq, setIntegral_map_equiv, heπ, Measure.volume_eq_prod,
setIntegral_prod, circleIntegral_def_Icc]
· refine setIntegral_congr_fun measurableSet_Icc fun θ _ => ?_
simp +unfoldPartialApp only [e, torusIntegral, ← integral_smul,
deriv_circleMap, i.prod_univ_succAbove _, smul_smul, torusMap, circleMap_zero]
refine setIntegral_congr_fun measurableSet_Icc fun Θ _ => ?_
simp only [MeasurableEquiv.piFinSuccAbove_symm_apply, i.insertNth_apply_same,
i.insertNth_apply_succAbove, (· ∘ ·), Fin.insertNthEquiv, Equiv.coe_fn_mk]
congr 2
simp only [funext_iff, i.forall_iff_succAbove, circleMap, Fin.insertNth_apply_same,
Fin.insertNth_apply_succAbove, imp_true_iff, and_self_iff]
· have := hf.function_integrable
rwa [← hem.integrableOn_comp_preimage e.measurableEmbedding, heπ] at this
/-- Recurrent formula for `torusIntegral`, see also `torusIntegral_succAbove`. -/
theorem torusIntegral_succ
{f : ℂⁿ⁺¹ → E} {c : ℂⁿ⁺¹} {R : ℝⁿ⁺¹} (hf : TorusIntegrable f c R) :
(∯ x in T(c, R), f x) =
∮ x in C(c 0, R 0), ∯ y in T(c ∘ Fin.succ, R ∘ Fin.succ), f (Fin.cons x y) := by
simpa using torusIntegral_succAbove hf 0 |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/CircleTransform.lean | import Mathlib.Data.Complex.Basic
import Mathlib.MeasureTheory.Integral.CircleIntegral
/-!
# Circle integral transform
In this file we define the circle integral transform of a function `f` with complex domain. This is
defined as $(2πi)^{-1}\frac{f(x)}{x-w}$ where `x` moves along a circle. We then prove some basic
facts about these functions.
These results are useful for proving that the uniform limit of a sequence of holomorphic functions
is holomorphic.
-/
open Set MeasureTheory Metric Filter Function
open scoped Interval Real
noncomputable section
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] (R : ℝ) (z w : ℂ)
namespace Complex
/-- Given a function `f : ℂ → E`, `circleTransform R z w f` is the function mapping `θ` to
`(2 * ↑π * I)⁻¹ • deriv (circleMap z R) θ • ((circleMap z R θ) - w)⁻¹ • f (circleMap z R θ)`.
If `f` is differentiable and `w` is in the interior of the ball, then the integral from `0` to
`2 * π` of this gives the value `f(w)`. -/
def circleTransform (f : ℂ → E) (θ : ℝ) : E :=
(2 * ↑π * I)⁻¹ • deriv (circleMap z R) θ • (circleMap z R θ - w)⁻¹ • f (circleMap z R θ)
/-- The derivative of `circleTransform` w.r.t. `w`. -/
def circleTransformDeriv (f : ℂ → E) (θ : ℝ) : E :=
(2 * ↑π * I)⁻¹ • deriv (circleMap z R) θ • ((circleMap z R θ - w) ^ 2)⁻¹ • f (circleMap z R θ)
theorem circleTransformDeriv_periodic (f : ℂ → E) :
Periodic (circleTransformDeriv R z w f) (2 * π) := by
have := periodic_circleMap
simp_rw [Periodic] at *
intro x
simp_rw [circleTransformDeriv, this]
congr 2
simp [this]
theorem circleTransformDeriv_eq (f : ℂ → E) : circleTransformDeriv R z w f =
fun θ => (circleMap z R θ - w)⁻¹ • circleTransform R z w f θ := by
ext
simp_rw [circleTransformDeriv, circleTransform, ← mul_smul, ← mul_assoc]
ring_nf
rw [inv_pow]
congr
ring
theorem integral_circleTransform (f : ℂ → E) :
(∫ θ : ℝ in 0..2 * π, circleTransform R z w f θ) =
(2 * ↑π * I)⁻¹ • ∮ z in C(z, R), (z - w)⁻¹ • f z := by
simp_rw [circleTransform, circleIntegral, deriv_circleMap, circleMap]
simp
theorem continuous_circleTransform {R : ℝ} (hR : 0 < R) {f : ℂ → E} {z w : ℂ}
(hf : ContinuousOn f <| sphere z R) (hw : w ∈ ball z R) :
Continuous (circleTransform R z w f) := by
apply_rules [Continuous.smul, continuous_const]
· rw [funext <| deriv_circleMap _ _]
apply_rules [Continuous.mul, continuous_circleMap 0 R, continuous_const]
· exact continuous_circleMap_inv hw
· apply ContinuousOn.comp_continuous hf (continuous_circleMap z R)
exact fun _ => (circleMap_mem_sphere _ hR.le) _
theorem continuous_circleTransformDeriv {R : ℝ} (hR : 0 < R) {f : ℂ → E} {z w : ℂ}
(hf : ContinuousOn f (sphere z R)) (hw : w ∈ ball z R) :
Continuous (circleTransformDeriv R z w f) := by
rw [circleTransformDeriv_eq]
exact (continuous_circleMap_inv hw).smul (continuous_circleTransform hR hf hw)
/-- A useful bound for circle integrals (with complex codomain) -/
def circleTransformBoundingFunction (R : ℝ) (z : ℂ) (w : ℂ × ℝ) : ℂ :=
circleTransformDeriv R z w.1 (fun _ => 1) w.2
theorem continuousOn_prod_circle_transform_function {R r : ℝ} (hr : r < R) {z : ℂ} :
ContinuousOn (fun w : ℂ × ℝ => (circleMap z R w.snd - w.fst)⁻¹ ^ 2)
(closedBall z r ×ˢ univ) := by
simp_rw [← one_div]
apply_rules [ContinuousOn.pow, ContinuousOn.div, continuousOn_const]
· exact ((continuous_circleMap z R).comp_continuousOn continuousOn_snd).sub continuousOn_fst
· rintro ⟨a, b⟩ ⟨ha, -⟩
have ha2 : a ∈ ball z R := closedBall_subset_ball hr ha
exact sub_ne_zero.2 (circleMap_ne_mem_ball ha2 b)
theorem continuousOn_norm_circleTransformBoundingFunction {R r : ℝ} (hr : r < R) (z : ℂ) :
ContinuousOn ((‖·‖) ∘ circleTransformBoundingFunction R z) (closedBall z r ×ˢ univ) := by
have : ContinuousOn (circleTransformBoundingFunction R z) (closedBall z r ×ˢ univ) := by
apply_rules [ContinuousOn.smul, continuousOn_const]
· simp only [deriv_circleMap]
apply_rules [ContinuousOn.mul, (continuous_circleMap 0 R).comp_continuousOn continuousOn_snd,
continuousOn_const]
· simpa only [inv_pow] using continuousOn_prod_circle_transform_function hr
exact this.norm
theorem norm_circleTransformBoundingFunction_le {R r : ℝ} (hr : r < R) (hr' : 0 ≤ r) (z : ℂ) :
∃ x : closedBall z r ×ˢ [[0, 2 * π]], ∀ y : closedBall z r ×ˢ [[0, 2 * π]],
‖circleTransformBoundingFunction R z y‖ ≤ ‖circleTransformBoundingFunction R z x‖ := by
have cts := continuousOn_norm_circleTransformBoundingFunction hr z
have comp : IsCompact (closedBall z r ×ˢ [[0, 2 * π]]) := by
apply_rules [IsCompact.prod, ProperSpace.isCompact_closedBall z r, isCompact_uIcc]
have none : (closedBall z r ×ˢ [[0, 2 * π]]).Nonempty :=
(nonempty_closedBall.2 hr').prod nonempty_uIcc
have := IsCompact.exists_isMaxOn comp none (cts.mono <| prod_mono_right (subset_univ _))
simpa [isMaxOn_iff] using this
/-- The derivative of a `circleTransform` is locally bounded. -/
theorem circleTransformDeriv_bound {R : ℝ} (hR : 0 < R) {z x : ℂ} {f : ℂ → ℂ} (hx : x ∈ ball z R)
(hf : ContinuousOn f (sphere z R)) : ∃ B ε : ℝ, 0 < ε ∧
ball x ε ⊆ ball z R ∧ ∀ (t : ℝ), ∀ y ∈ ball x ε, ‖circleTransformDeriv R z y f t‖ ≤ B := by
obtain ⟨r, hr, hrx⟩ := exists_lt_mem_ball_of_mem_ball hx
obtain ⟨ε', hε', H⟩ := exists_ball_subset_ball hrx
obtain ⟨⟨⟨a, b⟩, ⟨ha, hb⟩⟩, hab⟩ :=
norm_circleTransformBoundingFunction_le hr (pos_of_mem_ball hrx).le z
let V : ℝ → ℂ → ℂ := fun θ w => circleTransformDeriv R z w (fun _ => 1) θ
obtain ⟨X, -, HX2⟩ := (isCompact_sphere z R).exists_isMaxOn
(NormedSpace.sphere_nonempty.2 hR.le) hf.norm
refine ⟨‖V b a‖ * ‖f X‖, ε', hε', H.trans (ball_subset_ball hr.le), fun y v hv ↦ ?_⟩
obtain ⟨y1, hy1, hfun⟩ :=
Periodic.exists_mem_Ico₀ (circleTransformDeriv_periodic R z v f) Real.two_pi_pos y
have hy2 : y1 ∈ [[0, 2 * π]] := Icc_subset_uIcc <| Ico_subset_Icc_self hy1
simp only [isMaxOn_iff, mem_sphere_iff_norm] at HX2
have := mul_le_mul (hab ⟨⟨v, y1⟩, ⟨ball_subset_closedBall (H hv), hy2⟩⟩)
(HX2 (circleMap z R y1) (circleMap_mem_sphere z hR.le y1)) (norm_nonneg _)
(norm_nonneg _)
rw [hfun]
simpa [V, circleTransformBoundingFunction, circleTransformDeriv, mul_assoc] using this
end Complex |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/IntegrationByParts.lean | import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts
deprecated_module (since := "2025-04-06") |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/Average.lean | import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap
/-!
# Integral average of a function
In this file we define `MeasureTheory.average μ f` (notation: `⨍ x, f x ∂μ`) to be the average
value of `f` with respect to measure `μ`. It is defined as `∫ x, f x ∂((μ univ)⁻¹ • μ)`, so it
is equal to zero if `f` is not integrable or if `μ` is an infinite measure. If `μ` is a probability
measure, then the average of any function is equal to its integral.
For the average on a set, we use `⨍ x in s, f x ∂μ` (notation for `⨍ x, f x ∂(μ.restrict s)`). For
average w.r.t. the volume, one can omit `∂volume`.
Both have a version for the Lebesgue integral rather than Bochner.
We prove several version of the first moment method: An integrable function is below/above its
average on a set of positive measure:
* `measure_le_setLAverage_pos` for the Lebesgue integral
* `measure_le_setAverage_pos` for the Bochner integral
## Implementation notes
The average is defined as an integral over `(μ univ)⁻¹ • μ` so that all theorems about Bochner
integrals work for the average without modifications. For theorems that require integrability of a
function, we provide a convenience lemma `MeasureTheory.Integrable.to_average`.
## Tags
integral, center mass, average value
-/
open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function
open scoped Topology ENNReal Convex
variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α}
{s t : Set α}
/-!
### Average value of a function w.r.t. a measure
The (Bochner, Lebesgue) average value of a function `f` w.r.t. a measure `μ` (notation:
`⨍ x, f x ∂μ`, `⨍⁻ x, f x ∂μ`) is defined as the (Bochner, Lebesgue) integral divided by the total
measure, so it is equal to zero if `μ` is an infinite measure, and (typically) equal to infinity if
`f` is not integrable. If `μ` is a probability measure, then the average of any function is equal to
its integral.
-/
namespace MeasureTheory
section ENNReal
variable (μ) {f g : α → ℝ≥0∞}
/-- Average value of an `ℝ≥0∞`-valued function `f` w.r.t. a measure `μ`, denoted `⨍⁻ x, f x ∂μ`.
It is equal to `(μ univ)⁻¹ * ∫⁻ x, f x ∂μ`, so it takes value zero if `μ` is an infinite measure. If
`μ` is a probability measure, then the average of any function is equal to its integral.
For the average on a set, use `⨍⁻ x in s, f x ∂μ`, defined as `⨍⁻ x, f x ∂(μ.restrict s)`. For the
average w.r.t. the volume, one can omit `∂volume`. -/
noncomputable def laverage (f : α → ℝ≥0∞) := ∫⁻ x, f x ∂(μ univ)⁻¹ • μ
/-- Average value of an `ℝ≥0∞`-valued function `f` w.r.t. a measure `μ`.
It is equal to `(μ univ)⁻¹ * ∫⁻ x, f x ∂μ`, so it takes value zero if `μ` is an infinite measure. If
`μ` is a probability measure, then the average of any function is equal to its integral.
For the average on a set, use `⨍⁻ x in s, f x ∂μ`, defined as `⨍⁻ x, f x ∂(μ.restrict s)`. For the
average w.r.t. the volume, one can omit `∂volume`. -/
notation3 "⨍⁻ " (...) ", " r:60:(scoped f => f) " ∂" μ:70 => laverage μ r
/-- Average value of an `ℝ≥0∞`-valued function `f` w.r.t. the standard measure.
It is equal to `(volume univ)⁻¹ * ∫⁻ x, f x`, so it takes value zero if the space has infinite
measure. In a probability space, the average of any function is equal to its integral.
For the average on a set, use `⨍⁻ x in s, f x`, defined as `⨍⁻ x, f x ∂(volume.restrict s)`. -/
notation3 "⨍⁻ " (...) ", " r:60:(scoped f => laverage volume f) => r
/-- Average value of an `ℝ≥0∞`-valued function `f` w.r.t. a measure `μ` on a set `s`.
It is equal to `(μ s)⁻¹ * ∫⁻ x, f x ∂μ`, so it takes value zero if `s` has infinite measure. If `s`
has measure `1`, then the average of any function is equal to its integral.
For the average w.r.t. the volume, one can omit `∂volume`. -/
notation3 "⨍⁻ " (...) " in " s ", " r:60:(scoped f => f) " ∂" μ:70 =>
laverage (Measure.restrict μ s) r
/-- Average value of an `ℝ≥0∞`-valued function `f` w.r.t. the standard measure on a set `s`.
It is equal to `(volume s)⁻¹ * ∫⁻ x, f x`, so it takes value zero if `s` has infinite measure. If
`s` has measure `1`, then the average of any function is equal to its integral. -/
notation3 (prettyPrint := false)
"⨍⁻ " (...) " in " s ", " r:60:(scoped f => laverage Measure.restrict volume s f) => r
@[simp]
theorem laverage_zero : ⨍⁻ _x, (0 : ℝ≥0∞) ∂μ = 0 := by rw [laverage, lintegral_zero]
@[simp]
theorem laverage_zero_measure (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂(0 : Measure α) = 0 := by simp [laverage]
theorem laverage_eq' (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂(μ univ)⁻¹ • μ := rfl
theorem laverage_eq (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = (∫⁻ x, f x ∂μ) / μ univ := by
rw [laverage_eq', lintegral_smul_measure, ENNReal.div_eq_inv_mul, smul_eq_mul]
theorem laverage_eq_lintegral [IsProbabilityMeasure μ] (f : α → ℝ≥0∞) :
⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂μ := by rw [laverage, measure_univ, inv_one, one_smul]
@[simp]
theorem measure_mul_laverage [IsFiniteMeasure μ] (f : α → ℝ≥0∞) :
μ univ * ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂μ := by
rcases eq_or_ne μ 0 with hμ | hμ
· rw [hμ, lintegral_zero_measure, laverage_zero_measure, mul_zero]
· rw [laverage_eq, ENNReal.mul_div_cancel (measure_univ_ne_zero.2 hμ) (measure_ne_top _ _)]
theorem setLAverage_eq (f : α → ℝ≥0∞) (s : Set α) :
⨍⁻ x in s, f x ∂μ = (∫⁻ x in s, f x ∂μ) / μ s := by rw [laverage_eq, restrict_apply_univ]
@[deprecated (since := "2025-04-22")] alias setLaverage_eq := setLAverage_eq
theorem setLAverage_eq' (f : α → ℝ≥0∞) (s : Set α) :
⨍⁻ x in s, f x ∂μ = ∫⁻ x, f x ∂(μ s)⁻¹ • μ.restrict s := by
simp only [laverage_eq', restrict_apply_univ]
@[deprecated (since := "2025-04-22")] alias setLaverage_eq' := setLAverage_eq'
variable {μ}
theorem laverage_congr {f g : α → ℝ≥0∞} (h : f =ᵐ[μ] g) : ⨍⁻ x, f x ∂μ = ⨍⁻ x, g x ∂μ := by
simp only [laverage_eq, lintegral_congr_ae h]
theorem setLAverage_congr (h : s =ᵐ[μ] t) : ⨍⁻ x in s, f x ∂μ = ⨍⁻ x in t, f x ∂μ := by
simp only [setLAverage_eq, setLIntegral_congr h, measure_congr h]
@[deprecated (since := "2025-04-22")] alias setLaverage_congr := setLAverage_congr
theorem setLAverage_congr_fun_ae (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) :
⨍⁻ x in s, f x ∂μ = ⨍⁻ x in s, g x ∂μ := by
simp only [laverage_eq, setLIntegral_congr_fun_ae hs h]
theorem setLAverage_congr_fun (hs : MeasurableSet s) (h : EqOn f g s) :
⨍⁻ x in s, f x ∂μ = ⨍⁻ x in s, g x ∂μ := by
simp only [laverage_eq, setLIntegral_congr_fun hs h]
@[deprecated (since := "2025-04-22")] alias setLaverage_congr_fun := setLAverage_congr_fun
theorem laverage_lt_top (hf : ∫⁻ x, f x ∂μ ≠ ∞) : ⨍⁻ x, f x ∂μ < ∞ := by
obtain rfl | hμ := eq_or_ne μ 0
· simp
· rw [laverage_eq]
have := measure_univ_ne_zero.2 hμ
finiteness
theorem setLAverage_lt_top : ∫⁻ x in s, f x ∂μ ≠ ∞ → ⨍⁻ x in s, f x ∂μ < ∞ :=
laverage_lt_top
@[deprecated (since := "2025-04-22")] alias setLaverage_lt_top := setLAverage_lt_top
theorem laverage_add_measure :
⨍⁻ x, f x ∂(μ + ν) =
μ univ / (μ univ + ν univ) * ⨍⁻ x, f x ∂μ + ν univ / (μ univ + ν univ) * ⨍⁻ x, f x ∂ν := by
by_cases hμ : IsFiniteMeasure μ; swap
· rw [not_isFiniteMeasure_iff] at hμ
simp [laverage_eq, hμ]
by_cases hν : IsFiniteMeasure ν; swap
· rw [not_isFiniteMeasure_iff] at hν
simp [laverage_eq, hν]
simp only [← ENNReal.mul_div_right_comm, measure_mul_laverage, ← ENNReal.add_div,
← lintegral_add_measure, ← Measure.add_apply, ← laverage_eq]
theorem measure_mul_setLAverage (f : α → ℝ≥0∞) (h : μ s ≠ ∞) :
μ s * ⨍⁻ x in s, f x ∂μ = ∫⁻ x in s, f x ∂μ := by
have := Fact.mk h.lt_top
rw [← measure_mul_laverage, restrict_apply_univ]
@[deprecated (since := "2025-04-22")] alias measure_mul_setLaverage := measure_mul_setLAverage
theorem laverage_union (hd : AEDisjoint μ s t) (ht : NullMeasurableSet t μ) :
⨍⁻ x in s ∪ t, f x ∂μ =
μ s / (μ s + μ t) * ⨍⁻ x in s, f x ∂μ + μ t / (μ s + μ t) * ⨍⁻ x in t, f x ∂μ := by
rw [restrict_union₀ hd ht, laverage_add_measure, restrict_apply_univ, restrict_apply_univ]
theorem laverage_union_mem_openSegment (hd : AEDisjoint μ s t) (ht : NullMeasurableSet t μ)
(hs₀ : μ s ≠ 0) (ht₀ : μ t ≠ 0) (hsμ : μ s ≠ ∞) (htμ : μ t ≠ ∞) :
⨍⁻ x in s ∪ t, f x ∂μ ∈ openSegment ℝ≥0∞ (⨍⁻ x in s, f x ∂μ) (⨍⁻ x in t, f x ∂μ) := by
refine
⟨μ s / (μ s + μ t), μ t / (μ s + μ t), ENNReal.div_pos hs₀ <| add_ne_top.2 ⟨hsμ, htμ⟩,
ENNReal.div_pos ht₀ <| add_ne_top.2 ⟨hsμ, htμ⟩, ?_, (laverage_union hd ht).symm⟩
rw [← ENNReal.add_div,
ENNReal.div_self (add_eq_zero.not.2 fun h => hs₀ h.1) (add_ne_top.2 ⟨hsμ, htμ⟩)]
theorem laverage_union_mem_segment (hd : AEDisjoint μ s t) (ht : NullMeasurableSet t μ)
(hsμ : μ s ≠ ∞) (htμ : μ t ≠ ∞) :
⨍⁻ x in s ∪ t, f x ∂μ ∈ [⨍⁻ x in s, f x ∂μ -[ℝ≥0∞] ⨍⁻ x in t, f x ∂μ] := by
by_cases hs₀ : μ s = 0
· rw [← ae_eq_empty] at hs₀
rw [restrict_congr_set (hs₀.union EventuallyEq.rfl), empty_union]
exact right_mem_segment _ _ _
· refine
⟨μ s / (μ s + μ t), μ t / (μ s + μ t), zero_le _, zero_le _, ?_, (laverage_union hd ht).symm⟩
rw [← ENNReal.add_div,
ENNReal.div_self (add_eq_zero.not.2 fun h => hs₀ h.1) (add_ne_top.2 ⟨hsμ, htμ⟩)]
theorem laverage_mem_openSegment_compl_self [IsFiniteMeasure μ] (hs : NullMeasurableSet s μ)
(hs₀ : μ s ≠ 0) (hsc₀ : μ sᶜ ≠ 0) :
⨍⁻ x, f x ∂μ ∈ openSegment ℝ≥0∞ (⨍⁻ x in s, f x ∂μ) (⨍⁻ x in sᶜ, f x ∂μ) := by
simpa only [union_compl_self, restrict_univ] using
laverage_union_mem_openSegment aedisjoint_compl_right hs.compl hs₀ hsc₀ (measure_ne_top _ _)
(measure_ne_top _ _)
@[simp]
theorem laverage_const (μ : Measure α) [IsFiniteMeasure μ] [h : NeZero μ] (c : ℝ≥0∞) :
⨍⁻ _x, c ∂μ = c := by
simp only [laverage, lintegral_const, measure_univ, mul_one]
theorem setLAverage_const (hs₀ : μ s ≠ 0) (hs : μ s ≠ ∞) (c : ℝ≥0∞) : ⨍⁻ _x in s, c ∂μ = c := by
simp only [setLAverage_eq, lintegral_const, Measure.restrict_apply, MeasurableSet.univ,
univ_inter, div_eq_mul_inv, mul_assoc, ENNReal.mul_inv_cancel hs₀ hs, mul_one]
@[deprecated (since := "2025-04-22")] alias setLaverage_const := setLAverage_const
theorem laverage_one [IsFiniteMeasure μ] [NeZero μ] : ⨍⁻ _x, (1 : ℝ≥0∞) ∂μ = 1 :=
laverage_const _ _
theorem setLAverage_one (hs₀ : μ s ≠ 0) (hs : μ s ≠ ∞) : ⨍⁻ _x in s, (1 : ℝ≥0∞) ∂μ = 1 :=
setLAverage_const hs₀ hs _
@[deprecated (since := "2025-04-22")] alias setLaverage_one := setLAverage_one
@[simp]
theorem laverage_mul_measure_univ (μ : Measure α) [IsFiniteMeasure μ] (f : α → ℝ≥0∞) :
(⨍⁻ (a : α), f a ∂μ) * μ univ = ∫⁻ x, f x ∂μ := by
obtain rfl | hμ := eq_or_ne μ 0
· simp
· rw [laverage_eq, ENNReal.div_mul_cancel (measure_univ_ne_zero.2 hμ) (measure_ne_top _ _)]
theorem lintegral_laverage (μ : Measure α) [IsFiniteMeasure μ] (f : α → ℝ≥0∞) :
∫⁻ _x, ⨍⁻ a, f a ∂μ ∂μ = ∫⁻ x, f x ∂μ := by
simp
theorem setLIntegral_setLAverage (μ : Measure α) [IsFiniteMeasure μ] (f : α → ℝ≥0∞) (s : Set α) :
∫⁻ _x in s, ⨍⁻ a in s, f a ∂μ ∂μ = ∫⁻ x in s, f x ∂μ :=
lintegral_laverage _ _
@[deprecated (since := "2025-04-22")] alias setLintegral_setLaverage := setLIntegral_setLAverage
end ENNReal
section NormedAddCommGroup
variable (μ)
variable {f g : α → E}
/-- Average value of a function `f` w.r.t. a measure `μ`, denoted `⨍ x, f x ∂μ`.
It is equal to `(μ.real univ)⁻¹ • ∫ x, f x ∂μ`, so it takes value zero if `f` is not integrable or
if `μ` is an infinite measure. If `μ` is a probability measure, then the average of any function is
equal to its integral.
For the average on a set, use `⨍ x in s, f x ∂μ`, defined as `⨍ x, f x ∂(μ.restrict s)`. For the
average w.r.t. the volume, one can omit `∂volume`. -/
noncomputable def average (f : α → E) :=
∫ x, f x ∂(μ univ)⁻¹ • μ
/-- Average value of a function `f` w.r.t. a measure `μ`.
It is equal to `(μ.real univ)⁻¹ • ∫ x, f x ∂μ`, so it takes value zero if `f` is not integrable or
if `μ` is an infinite measure. If `μ` is a probability measure, then the average of any function is
equal to its integral.
For the average on a set, use `⨍ x in s, f x ∂μ`, defined as `⨍ x, f x ∂(μ.restrict s)`. For the
average w.r.t. the volume, one can omit `∂volume`. -/
notation3 "⨍ " (...) ", " r:60:(scoped f => f) " ∂" μ:70 => average μ r
/-- Average value of a function `f` w.r.t. the standard measure.
It is equal to `(volume.real univ)⁻¹ * ∫ x, f x`, so it takes value zero if `f` is not integrable
or if the space has infinite measure. In a probability space, the average of any function is equal
to its integral.
For the average on a set, use `⨍ x in s, f x`, defined as `⨍ x, f x ∂(volume.restrict s)`. -/
notation3 "⨍ " (...) ", " r:60:(scoped f => average volume f) => r
/-- Average value of a function `f` w.r.t. a measure `μ` on a set `s`.
It is equal to `(μ.real s)⁻¹ * ∫ x, f x ∂μ`, so it takes value zero if `f` is not integrable on
`s` or if `s` has infinite measure. If `s` has measure `1`, then the average of any function is
equal to its integral.
For the average w.r.t. the volume, one can omit `∂volume`. -/
notation3 "⨍ " (...) " in " s ", " r:60:(scoped f => f) " ∂" μ:70 =>
average (Measure.restrict μ s) r
/-- Average value of a function `f` w.r.t. the standard measure on a set `s`.
It is equal to `(volume.real s)⁻¹ * ∫ x, f x`, so it takes value zero `f` is not integrable on `s`
or if `s` has infinite measure. If `s` has measure `1`, then the average of any function is equal to
its integral. -/
notation3 "⨍ " (...) " in " s ", " r:60:(scoped f => average (Measure.restrict volume s) f) => r
@[simp]
theorem average_zero : ⨍ _, (0 : E) ∂μ = 0 := by rw [average, integral_zero]
@[simp]
theorem average_zero_measure (f : α → E) : ⨍ x, f x ∂(0 : Measure α) = 0 := by
rw [average, smul_zero, integral_zero_measure]
@[simp]
theorem average_neg (f : α → E) : ⨍ x, -f x ∂μ = -⨍ x, f x ∂μ :=
integral_neg f
theorem average_eq' (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂(μ univ)⁻¹ • μ :=
rfl
theorem average_eq (f : α → E) : ⨍ x, f x ∂μ = (μ.real univ)⁻¹ • ∫ x, f x ∂μ := by
rw [average_eq', integral_smul_measure, ENNReal.toReal_inv, measureReal_def]
theorem average_eq_integral [IsProbabilityMeasure μ] (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by
rw [average, measure_univ, inv_one, one_smul]
@[simp]
theorem measure_smul_average [IsFiniteMeasure μ] (f : α → E) :
μ.real univ • ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by
rcases eq_or_ne μ 0 with hμ | hμ
· rw [hμ, integral_zero_measure, average_zero_measure, smul_zero]
· rw [average_eq, smul_inv_smul₀]
refine (ENNReal.toReal_pos ?_ <| measure_ne_top _ _).ne'
rwa [Ne, measure_univ_eq_zero]
theorem setAverage_eq (f : α → E) (s : Set α) :
⨍ x in s, f x ∂μ = (μ.real s)⁻¹ • ∫ x in s, f x ∂μ := by
rw [average_eq, measureReal_restrict_apply_univ]
theorem setAverage_eq' (f : α → E) (s : Set α) :
⨍ x in s, f x ∂μ = ∫ x, f x ∂(μ s)⁻¹ • μ.restrict s := by
simp only [average_eq', restrict_apply_univ]
variable {μ}
theorem average_congr {f g : α → E} (h : f =ᵐ[μ] g) : ⨍ x, f x ∂μ = ⨍ x, g x ∂μ := by
simp only [average_eq, integral_congr_ae h]
theorem setAverage_congr (h : s =ᵐ[μ] t) : ⨍ x in s, f x ∂μ = ⨍ x in t, f x ∂μ := by
simp only [setAverage_eq, setIntegral_congr_set h, measureReal_congr h]
theorem setAverage_congr_fun (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) :
⨍ x in s, f x ∂μ = ⨍ x in s, g x ∂μ := by simp only [average_eq, setIntegral_congr_ae hs h]
theorem average_add_measure [IsFiniteMeasure μ] {ν : Measure α} [IsFiniteMeasure ν] {f : α → E}
(hμ : Integrable f μ) (hν : Integrable f ν) :
⨍ x, f x ∂(μ + ν) =
(μ.real univ / (μ.real univ + ν.real univ)) • ⨍ x, f x ∂μ +
(ν.real univ / (μ.real univ + ν.real univ)) • ⨍ x, f x ∂ν := by
simp only [div_eq_inv_mul, mul_smul, measure_smul_average, ← smul_add,
← integral_add_measure hμ hν]
rw [average_eq, measureReal_add_apply]
theorem average_pair [CompleteSpace E]
{f : α → E} {g : α → F} (hfi : Integrable f μ) (hgi : Integrable g μ) :
⨍ x, (f x, g x) ∂μ = (⨍ x, f x ∂μ, ⨍ x, g x ∂μ) :=
integral_pair hfi.to_average hgi.to_average
theorem measure_smul_setAverage (f : α → E) {s : Set α} (h : μ s ≠ ∞) :
μ.real s • ⨍ x in s, f x ∂μ = ∫ x in s, f x ∂μ := by
haveI := Fact.mk h.lt_top
rw [← measure_smul_average, measureReal_restrict_apply_univ]
theorem average_union {f : α → E} {s t : Set α} (hd : AEDisjoint μ s t) (ht : NullMeasurableSet t μ)
(hsμ : μ s ≠ ∞) (htμ : μ t ≠ ∞) (hfs : IntegrableOn f s μ) (hft : IntegrableOn f t μ) :
⨍ x in s ∪ t, f x ∂μ =
(μ.real s / (μ.real s + μ.real t)) • ⨍ x in s, f x ∂μ +
(μ.real t / (μ.real s + μ.real t)) • ⨍ x in t, f x ∂μ := by
haveI := Fact.mk hsμ.lt_top; haveI := Fact.mk htμ.lt_top
rw [restrict_union₀ hd ht, average_add_measure hfs hft, measureReal_restrict_apply_univ,
measureReal_restrict_apply_univ]
theorem average_union_mem_openSegment {f : α → E} {s t : Set α} (hd : AEDisjoint μ s t)
(ht : NullMeasurableSet t μ) (hs₀ : μ s ≠ 0) (ht₀ : μ t ≠ 0) (hsμ : μ s ≠ ∞) (htμ : μ t ≠ ∞)
(hfs : IntegrableOn f s μ) (hft : IntegrableOn f t μ) :
⨍ x in s ∪ t, f x ∂μ ∈ openSegment ℝ (⨍ x in s, f x ∂μ) (⨍ x in t, f x ∂μ) := by
replace hs₀ : 0 < μ.real s := ENNReal.toReal_pos hs₀ hsμ
replace ht₀ : 0 < μ.real t := ENNReal.toReal_pos ht₀ htμ
exact mem_openSegment_iff_div.mpr
⟨μ.real s, μ.real t, hs₀, ht₀, (average_union hd ht hsμ htμ hfs hft).symm⟩
theorem average_union_mem_segment {f : α → E} {s t : Set α} (hd : AEDisjoint μ s t)
(ht : NullMeasurableSet t μ) (hsμ : μ s ≠ ∞) (htμ : μ t ≠ ∞) (hfs : IntegrableOn f s μ)
(hft : IntegrableOn f t μ) :
⨍ x in s ∪ t, f x ∂μ ∈ [⨍ x in s, f x ∂μ -[ℝ] ⨍ x in t, f x ∂μ] := by
by_cases hse : μ s = 0
· rw [← ae_eq_empty] at hse
rw [restrict_congr_set (hse.union EventuallyEq.rfl), empty_union]
exact right_mem_segment _ _ _
· refine
mem_segment_iff_div.mpr
⟨μ.real s, μ.real t, ENNReal.toReal_nonneg, ENNReal.toReal_nonneg, ?_,
(average_union hd ht hsμ htμ hfs hft).symm⟩
calc
0 < μ.real s := ENNReal.toReal_pos hse hsμ
_ ≤ _ := le_add_of_nonneg_right ENNReal.toReal_nonneg
theorem average_mem_openSegment_compl_self [IsFiniteMeasure μ] {f : α → E} {s : Set α}
(hs : NullMeasurableSet s μ) (hs₀ : μ s ≠ 0) (hsc₀ : μ sᶜ ≠ 0) (hfi : Integrable f μ) :
⨍ x, f x ∂μ ∈ openSegment ℝ (⨍ x in s, f x ∂μ) (⨍ x in sᶜ, f x ∂μ) := by
simpa only [union_compl_self, restrict_univ] using
average_union_mem_openSegment aedisjoint_compl_right hs.compl hs₀ hsc₀ (measure_ne_top _ _)
(measure_ne_top _ _) hfi.integrableOn hfi.integrableOn
variable [CompleteSpace E]
@[simp]
theorem average_const (μ : Measure α) [IsFiniteMeasure μ] [h : NeZero μ] (c : E) :
⨍ _x, c ∂μ = c := by
rw [average, integral_const, measureReal_def, measure_univ, ENNReal.toReal_one, one_smul]
theorem setAverage_const {s : Set α} (hs₀ : μ s ≠ 0) (hs : μ s ≠ ∞) (c : E) :
⨍ _ in s, c ∂μ = c :=
have := NeZero.mk hs₀; have := Fact.mk hs.lt_top; average_const _ _
theorem integral_average (μ : Measure α) [IsFiniteMeasure μ] (f : α → E) :
∫ _, ⨍ a, f a ∂μ ∂μ = ∫ x, f x ∂μ := by simp
theorem setIntegral_setAverage (μ : Measure α) [IsFiniteMeasure μ] (f : α → E) (s : Set α) :
∫ _ in s, ⨍ a in s, f a ∂μ ∂μ = ∫ x in s, f x ∂μ :=
integral_average _ _
theorem integral_sub_average (μ : Measure α) [IsFiniteMeasure μ] (f : α → E) :
∫ x, f x - ⨍ a, f a ∂μ ∂μ = 0 := by
by_cases hf : Integrable f μ
· rw [integral_sub hf (integrable_const _), integral_average, sub_self]
refine integral_undef fun h => hf ?_
convert h.add (integrable_const (⨍ a, f a ∂μ))
exact (sub_add_cancel _ _).symm
theorem setAverage_sub_setAverage (hs : μ s ≠ ∞) (f : α → E) :
∫ x in s, f x - ⨍ a in s, f a ∂μ ∂μ = 0 :=
haveI : Fact (μ s < ∞) := ⟨lt_top_iff_ne_top.2 hs⟩
integral_sub_average _ _
theorem integral_average_sub [IsFiniteMeasure μ] (hf : Integrable f μ) :
∫ x, ⨍ a, f a ∂μ - f x ∂μ = 0 := by
rw [integral_sub (integrable_const _) hf, integral_average, sub_self]
theorem setIntegral_setAverage_sub (hs : μ s ≠ ∞) (hf : IntegrableOn f s μ) :
∫ x in s, ⨍ a in s, f a ∂μ - f x ∂μ = 0 :=
haveI : Fact (μ s < ∞) := ⟨lt_top_iff_ne_top.2 hs⟩
integral_average_sub hf
end NormedAddCommGroup
theorem ofReal_average {f : α → ℝ} (hf : Integrable f μ) (hf₀ : 0 ≤ᵐ[μ] f) :
ENNReal.ofReal (⨍ x, f x ∂μ) = (∫⁻ x, ENNReal.ofReal (f x) ∂μ) / μ univ := by
obtain rfl | hμ := eq_or_ne μ 0
· simp
· rw [average_eq, smul_eq_mul, measureReal_def, ← toReal_inv, ofReal_mul toReal_nonneg,
ofReal_toReal (inv_ne_top.2 <| measure_univ_ne_zero.2 hμ),
ofReal_integral_eq_lintegral_ofReal hf hf₀, ENNReal.div_eq_inv_mul]
theorem ofReal_setAverage {f : α → ℝ} (hf : IntegrableOn f s μ) (hf₀ : 0 ≤ᵐ[μ.restrict s] f) :
ENNReal.ofReal (⨍ x in s, f x ∂μ) = (∫⁻ x in s, ENNReal.ofReal (f x) ∂μ) / μ s := by
simpa using ofReal_average hf hf₀
theorem toReal_laverage {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hf' : ∀ᵐ x ∂μ, f x ≠ ∞) :
(⨍⁻ x, f x ∂μ).toReal = ⨍ x, (f x).toReal ∂μ := by
rw [average_eq, laverage_eq, smul_eq_mul, toReal_div, div_eq_inv_mul, ←
integral_toReal hf (hf'.mono fun _ => lt_top_iff_ne_top.2), measureReal_def]
theorem toReal_setLAverage {f : α → ℝ≥0∞} (hf : AEMeasurable f (μ.restrict s))
(hf' : ∀ᵐ x ∂μ.restrict s, f x ≠ ∞) :
(⨍⁻ x in s, f x ∂μ).toReal = ⨍ x in s, (f x).toReal ∂μ := by
simpa [laverage_eq] using toReal_laverage hf hf'
@[deprecated (since := "2025-04-22")] alias toReal_setLaverage := toReal_setLAverage
/-! ### First moment method -/
section FirstMomentReal
variable {N : Set α} {f : α → ℝ}
/-- **First moment method**. An integrable function is smaller than its mean on a set of positive
measure. -/
theorem measure_le_setAverage_pos (hμ : μ s ≠ 0) (hμ₁ : μ s ≠ ∞) (hf : IntegrableOn f s μ) :
0 < μ ({x ∈ s | f x ≤ ⨍ a in s, f a ∂μ}) := by
refine pos_iff_ne_zero.2 fun H => ?_
replace H : (μ.restrict s) {x | f x ≤ ⨍ a in s, f a ∂μ} = 0 := by
rwa [restrict_apply₀, inter_comm]
exact AEStronglyMeasurable.nullMeasurableSet_le hf.1 aestronglyMeasurable_const
haveI := Fact.mk hμ₁.lt_top
refine (integral_sub_average (μ.restrict s) f).not_gt ?_
refine (setIntegral_pos_iff_support_of_nonneg_ae ?_ ?_).2 ?_
· refine measure_mono_null (fun x hx ↦ ?_) H
simp only [Pi.zero_apply, sub_nonneg, mem_compl_iff, mem_setOf_eq, not_le] at hx
exact hx.le
· exact hf.sub (integrableOn_const hμ₁)
· rwa [pos_iff_ne_zero, inter_comm, ← diff_compl, ← diff_inter_self_eq_diff, measure_diff_null]
refine measure_mono_null ?_ (measure_inter_eq_zero_of_restrict H)
exact inter_subset_inter_left _ fun a ha => (sub_eq_zero.1 <| of_not_not ha).le
/-- **First moment method**. An integrable function is greater than its mean on a set of positive
measure. -/
theorem measure_setAverage_le_pos (hμ : μ s ≠ 0) (hμ₁ : μ s ≠ ∞) (hf : IntegrableOn f s μ) :
0 < μ ({x ∈ s | ⨍ a in s, f a ∂μ ≤ f x}) := by
simpa [integral_neg, neg_div] using measure_le_setAverage_pos hμ hμ₁ hf.neg
/-- **First moment method**. The minimum of an integrable function is smaller than its mean. -/
theorem exists_le_setAverage (hμ : μ s ≠ 0) (hμ₁ : μ s ≠ ∞) (hf : IntegrableOn f s μ) :
∃ x ∈ s, f x ≤ ⨍ a in s, f a ∂μ :=
let ⟨x, hx, h⟩ := nonempty_of_measure_ne_zero (measure_le_setAverage_pos hμ hμ₁ hf).ne'
⟨x, hx, h⟩
/-- **First moment method**. The maximum of an integrable function is greater than its mean. -/
theorem exists_setAverage_le (hμ : μ s ≠ 0) (hμ₁ : μ s ≠ ∞) (hf : IntegrableOn f s μ) :
∃ x ∈ s, ⨍ a in s, f a ∂μ ≤ f x :=
let ⟨x, hx, h⟩ := nonempty_of_measure_ne_zero (measure_setAverage_le_pos hμ hμ₁ hf).ne'
⟨x, hx, h⟩
section FiniteMeasure
variable [IsFiniteMeasure μ]
/-- **First moment method**. An integrable function is smaller than its mean on a set of positive
measure. -/
theorem measure_le_average_pos (hμ : μ ≠ 0) (hf : Integrable f μ) :
0 < μ {x | f x ≤ ⨍ a, f a ∂μ} := by
simpa using measure_le_setAverage_pos (Measure.measure_univ_ne_zero.2 hμ) (measure_ne_top _ _)
hf.integrableOn
/-- **First moment method**. An integrable function is greater than its mean on a set of positive
measure. -/
theorem measure_average_le_pos (hμ : μ ≠ 0) (hf : Integrable f μ) :
0 < μ {x | ⨍ a, f a ∂μ ≤ f x} := by
simpa using measure_setAverage_le_pos (Measure.measure_univ_ne_zero.2 hμ) (measure_ne_top _ _)
hf.integrableOn
/-- **First moment method**. The minimum of an integrable function is smaller than its mean. -/
theorem exists_le_average (hμ : μ ≠ 0) (hf : Integrable f μ) : ∃ x, f x ≤ ⨍ a, f a ∂μ :=
let ⟨x, hx⟩ := nonempty_of_measure_ne_zero (measure_le_average_pos hμ hf).ne'
⟨x, hx⟩
/-- **First moment method**. The maximum of an integrable function is greater than its mean. -/
theorem exists_average_le (hμ : μ ≠ 0) (hf : Integrable f μ) : ∃ x, ⨍ a, f a ∂μ ≤ f x :=
let ⟨x, hx⟩ := nonempty_of_measure_ne_zero (measure_average_le_pos hμ hf).ne'
⟨x, hx⟩
/-- **First moment method**. The minimum of an integrable function is smaller than its mean, while
avoiding a null set. -/
theorem exists_notMem_null_le_average (hμ : μ ≠ 0) (hf : Integrable f μ) (hN : μ N = 0) :
∃ x, x ∉ N ∧ f x ≤ ⨍ a, f a ∂μ := by
have := measure_le_average_pos hμ hf
rw [← measure_diff_null hN] at this
obtain ⟨x, hx, hxN⟩ := nonempty_of_measure_ne_zero this.ne'
exact ⟨x, hxN, hx⟩
@[deprecated (since := "2025-05-23")]
alias exists_not_mem_null_le_average := exists_notMem_null_le_average
/-- **First moment method**. The maximum of an integrable function is greater than its mean, while
avoiding a null set. -/
theorem exists_notMem_null_average_le (hμ : μ ≠ 0) (hf : Integrable f μ) (hN : μ N = 0) :
∃ x, x ∉ N ∧ ⨍ a, f a ∂μ ≤ f x := by
simpa [integral_neg, neg_div] using exists_notMem_null_le_average hμ hf.neg hN
@[deprecated (since := "2025-05-23")]
alias exists_not_mem_null_average_le := exists_notMem_null_average_le
end FiniteMeasure
section ProbabilityMeasure
variable [IsProbabilityMeasure μ]
/-- **First moment method**. An integrable function is smaller than its integral on a set of
positive measure. -/
theorem measure_le_integral_pos (hf : Integrable f μ) : 0 < μ {x | f x ≤ ∫ a, f a ∂μ} := by
simpa only [average_eq_integral] using
measure_le_average_pos (IsProbabilityMeasure.ne_zero μ) hf
/-- **First moment method**. An integrable function is greater than its integral on a set of
positive measure. -/
theorem measure_integral_le_pos (hf : Integrable f μ) : 0 < μ {x | ∫ a, f a ∂μ ≤ f x} := by
simpa only [average_eq_integral] using
measure_average_le_pos (IsProbabilityMeasure.ne_zero μ) hf
/-- **First moment method**. The minimum of an integrable function is smaller than its integral. -/
theorem exists_le_integral (hf : Integrable f μ) : ∃ x, f x ≤ ∫ a, f a ∂μ := by
simpa only [average_eq_integral] using exists_le_average (IsProbabilityMeasure.ne_zero μ) hf
/-- **First moment method**. The maximum of an integrable function is greater than its integral. -/
theorem exists_integral_le (hf : Integrable f μ) : ∃ x, ∫ a, f a ∂μ ≤ f x := by
simpa only [average_eq_integral] using exists_average_le (IsProbabilityMeasure.ne_zero μ) hf
/-- **First moment method**. The minimum of an integrable function is smaller than its integral,
while avoiding a null set. -/
theorem exists_notMem_null_le_integral (hf : Integrable f μ) (hN : μ N = 0) :
∃ x, x ∉ N ∧ f x ≤ ∫ a, f a ∂μ := by
simpa only [average_eq_integral] using
exists_notMem_null_le_average (IsProbabilityMeasure.ne_zero μ) hf hN
@[deprecated (since := "2025-05-23")]
alias exists_not_mem_null_le_integral := exists_notMem_null_le_integral
/-- **First moment method**. The maximum of an integrable function is greater than its integral,
while avoiding a null set. -/
theorem exists_notMem_null_integral_le (hf : Integrable f μ) (hN : μ N = 0) :
∃ x, x ∉ N ∧ ∫ a, f a ∂μ ≤ f x := by
simpa only [average_eq_integral] using
exists_notMem_null_average_le (IsProbabilityMeasure.ne_zero μ) hf hN
@[deprecated (since := "2025-05-23")]
alias exists_not_mem_null_integral_le := exists_notMem_null_integral_le
end ProbabilityMeasure
end FirstMomentReal
section FirstMomentENNReal
variable {N : Set α} {f : α → ℝ≥0∞}
/-- **First moment method**. A measurable function is smaller than its mean on a set of positive
measure. -/
theorem measure_le_setLAverage_pos (hμ : μ s ≠ 0) (hμ₁ : μ s ≠ ∞)
(hf : AEMeasurable f (μ.restrict s)) : 0 < μ {x ∈ s | f x ≤ ⨍⁻ a in s, f a ∂μ} := by
obtain h | h := eq_or_ne (∫⁻ a in s, f a ∂μ) ∞
· simpa [mul_top, hμ₁, laverage, h, top_div_of_ne_top hμ₁, pos_iff_ne_zero] using hμ
have := measure_le_setAverage_pos hμ hμ₁ (integrable_toReal_of_lintegral_ne_top hf h)
rw [← setOf_inter_eq_sep, ← Measure.restrict_apply₀
(hf.aestronglyMeasurable.nullMeasurableSet_le aestronglyMeasurable_const)]
rw [← setOf_inter_eq_sep, ← Measure.restrict_apply₀
(hf.ennreal_toReal.aestronglyMeasurable.nullMeasurableSet_le aestronglyMeasurable_const),
← measure_diff_null (measure_eq_top_of_lintegral_ne_top hf h)] at this
refine this.trans_le (measure_mono ?_)
rintro x ⟨hfx, hx⟩
dsimp at hfx
rwa [← toReal_laverage hf, toReal_le_toReal hx (setLAverage_lt_top h).ne] at hfx
simp_rw [ae_iff, not_ne_iff]
exact measure_eq_top_of_lintegral_ne_top hf h
@[deprecated (since := "2025-04-22")] alias measure_le_setLaverage_pos := measure_le_setLAverage_pos
/-- **First moment method**. A measurable function is greater than its mean on a set of positive
measure. -/
theorem measure_setLAverage_le_pos (hμ : μ s ≠ 0) (hs : NullMeasurableSet s μ)
(hint : ∫⁻ a in s, f a ∂μ ≠ ∞) : 0 < μ {x ∈ s | ⨍⁻ a in s, f a ∂μ ≤ f x} := by
obtain hμ₁ | hμ₁ := eq_or_ne (μ s) ∞
· simp [setLAverage_eq, hμ₁]
obtain ⟨g, hg, hgf, hfg⟩ := exists_measurable_le_lintegral_eq (μ.restrict s) f
have hfg' : ⨍⁻ a in s, f a ∂μ = ⨍⁻ a in s, g a ∂μ := by simp_rw [laverage_eq, hfg]
rw [hfg] at hint
have :=
measure_setAverage_le_pos hμ hμ₁ (integrable_toReal_of_lintegral_ne_top hg.aemeasurable hint)
simp_rw [← setOf_inter_eq_sep, ← Measure.restrict_apply₀' hs, hfg']
rw [← setOf_inter_eq_sep, ← Measure.restrict_apply₀' hs, ←
measure_diff_null (measure_eq_top_of_lintegral_ne_top hg.aemeasurable hint)] at this
refine this.trans_le (measure_mono ?_)
rintro x ⟨hfx, hx⟩
dsimp at hfx
rw [← toReal_laverage hg.aemeasurable, toReal_le_toReal (setLAverage_lt_top hint).ne hx] at hfx
· exact hfx.trans (hgf _)
· simp_rw [ae_iff, not_ne_iff]
exact measure_eq_top_of_lintegral_ne_top hg.aemeasurable hint
@[deprecated (since := "2025-04-22")] alias measure_setLaverage_le_pos := measure_setLAverage_le_pos
/-- **First moment method**. The minimum of a measurable function is smaller than its mean. -/
theorem exists_le_setLAverage (hμ : μ s ≠ 0) (hμ₁ : μ s ≠ ∞) (hf : AEMeasurable f (μ.restrict s)) :
∃ x ∈ s, f x ≤ ⨍⁻ a in s, f a ∂μ :=
let ⟨x, hx, h⟩ := nonempty_of_measure_ne_zero (measure_le_setLAverage_pos hμ hμ₁ hf).ne'
⟨x, hx, h⟩
@[deprecated (since := "2025-04-22")] alias exists_le_setLaverage := exists_le_setLAverage
/-- **First moment method**. The maximum of a measurable function is greater than its mean. -/
theorem exists_setLAverage_le (hμ : μ s ≠ 0) (hs : NullMeasurableSet s μ)
(hint : ∫⁻ a in s, f a ∂μ ≠ ∞) : ∃ x ∈ s, ⨍⁻ a in s, f a ∂μ ≤ f x :=
let ⟨x, hx, h⟩ := nonempty_of_measure_ne_zero (measure_setLAverage_le_pos hμ hs hint).ne'
⟨x, hx, h⟩
@[deprecated (since := "2025-04-22")] alias exists_setLaverage_le := exists_setLAverage_le
/-- **First moment method**. A measurable function is greater than its mean on a set of positive
measure. -/
theorem measure_laverage_le_pos (hμ : μ ≠ 0) (hint : ∫⁻ a, f a ∂μ ≠ ∞) :
0 < μ {x | ⨍⁻ a, f a ∂μ ≤ f x} := by
simpa [hint] using
@measure_setLAverage_le_pos _ _ _ _ f (measure_univ_ne_zero.2 hμ) nullMeasurableSet_univ
/-- **First moment method**. The maximum of a measurable function is greater than its mean. -/
theorem exists_laverage_le (hμ : μ ≠ 0) (hint : ∫⁻ a, f a ∂μ ≠ ∞) : ∃ x, ⨍⁻ a, f a ∂μ ≤ f x :=
let ⟨x, hx⟩ := nonempty_of_measure_ne_zero (measure_laverage_le_pos hμ hint).ne'
⟨x, hx⟩
/-- **First moment method**. The maximum of a measurable function is greater than its mean, while
avoiding a null set. -/
theorem exists_notMem_null_laverage_le (hμ : μ ≠ 0) (hint : ∫⁻ a : α, f a ∂μ ≠ ∞) (hN : μ N = 0) :
∃ x, x ∉ N ∧ ⨍⁻ a, f a ∂μ ≤ f x := by
have := measure_laverage_le_pos hμ hint
rw [← measure_diff_null hN] at this
obtain ⟨x, hx, hxN⟩ := nonempty_of_measure_ne_zero this.ne'
exact ⟨x, hxN, hx⟩
@[deprecated (since := "2025-05-23")]
alias exists_not_mem_null_laverage_le := exists_notMem_null_laverage_le
section FiniteMeasure
variable [IsFiniteMeasure μ]
/-- **First moment method**. A measurable function is smaller than its mean on a set of positive
measure. -/
theorem measure_le_laverage_pos (hμ : μ ≠ 0) (hf : AEMeasurable f μ) :
0 < μ {x | f x ≤ ⨍⁻ a, f a ∂μ} := by
simpa using
measure_le_setLAverage_pos (measure_univ_ne_zero.2 hμ) (measure_ne_top _ _) hf.restrict
/-- **First moment method**. The minimum of a measurable function is smaller than its mean. -/
theorem exists_le_laverage (hμ : μ ≠ 0) (hf : AEMeasurable f μ) : ∃ x, f x ≤ ⨍⁻ a, f a ∂μ :=
let ⟨x, hx⟩ := nonempty_of_measure_ne_zero (measure_le_laverage_pos hμ hf).ne'
⟨x, hx⟩
/-- **First moment method**. The minimum of a measurable function is smaller than its mean, while
avoiding a null set. -/
theorem exists_notMem_null_le_laverage (hμ : μ ≠ 0) (hf : AEMeasurable f μ) (hN : μ N = 0) :
∃ x, x ∉ N ∧ f x ≤ ⨍⁻ a, f a ∂μ := by
have := measure_le_laverage_pos hμ hf
rw [← measure_diff_null hN] at this
obtain ⟨x, hx, hxN⟩ := nonempty_of_measure_ne_zero this.ne'
exact ⟨x, hxN, hx⟩
@[deprecated (since := "2025-05-23")]
alias exists_not_mem_null_le_laverage := exists_notMem_null_le_laverage
end FiniteMeasure
section ProbabilityMeasure
variable [IsProbabilityMeasure μ]
/-- **First moment method**. A measurable function is smaller than its integral on a set f
positive measure. -/
theorem measure_le_lintegral_pos (hf : AEMeasurable f μ) : 0 < μ {x | f x ≤ ∫⁻ a, f a ∂μ} := by
simpa only [laverage_eq_lintegral] using
measure_le_laverage_pos (IsProbabilityMeasure.ne_zero μ) hf
/-- **First moment method**. A measurable function is greater than its integral on a set f
positive measure. -/
theorem measure_lintegral_le_pos (hint : ∫⁻ a, f a ∂μ ≠ ∞) : 0 < μ {x | ∫⁻ a, f a ∂μ ≤ f x} := by
simpa only [laverage_eq_lintegral] using
measure_laverage_le_pos (IsProbabilityMeasure.ne_zero μ) hint
/-- **First moment method**. The minimum of a measurable function is smaller than its integral. -/
theorem exists_le_lintegral (hf : AEMeasurable f μ) : ∃ x, f x ≤ ∫⁻ a, f a ∂μ := by
simpa only [laverage_eq_lintegral] using exists_le_laverage (IsProbabilityMeasure.ne_zero μ) hf
/-- **First moment method**. The maximum of a measurable function is greater than its integral. -/
theorem exists_lintegral_le (hint : ∫⁻ a, f a ∂μ ≠ ∞) : ∃ x, ∫⁻ a, f a ∂μ ≤ f x := by
simpa only [laverage_eq_lintegral] using
exists_laverage_le (IsProbabilityMeasure.ne_zero μ) hint
/-- **First moment method**. The minimum of a measurable function is smaller than its integral,
while avoiding a null set. -/
theorem exists_notMem_null_le_lintegral (hf : AEMeasurable f μ) (hN : μ N = 0) :
∃ x, x ∉ N ∧ f x ≤ ∫⁻ a, f a ∂μ := by
simpa only [laverage_eq_lintegral] using
exists_notMem_null_le_laverage (IsProbabilityMeasure.ne_zero μ) hf hN
@[deprecated (since := "2025-05-23")]
alias exists_not_mem_null_le_lintegral := exists_notMem_null_le_lintegral
/-- **First moment method**. The maximum of a measurable function is greater than its integral,
while avoiding a null set. -/
theorem exists_notMem_null_lintegral_le (hint : ∫⁻ a, f a ∂μ ≠ ∞) (hN : μ N = 0) :
∃ x, x ∉ N ∧ ∫⁻ a, f a ∂μ ≤ f x := by
simpa only [laverage_eq_lintegral] using
exists_notMem_null_laverage_le (IsProbabilityMeasure.ne_zero μ) hint hN
@[deprecated (since := "2025-05-23")]
alias exists_not_mem_null_lintegral_le := exists_notMem_null_lintegral_le
end ProbabilityMeasure
end FirstMomentENNReal
/-- If the average of a function `f` along a sequence of sets `aₙ` converges to `c` (more precisely,
we require that `⨍ y in a i, ‖f y - c‖ ∂μ` tends to `0`), then the integral of `gₙ • f` also tends
to `c` if `gₙ` is supported in `aₙ`, has integral converging to one and supremum at most `K / μ aₙ`.
-/
theorem tendsto_integral_smul_of_tendsto_average_norm_sub
[CompleteSpace E]
{ι : Type*} {a : ι → Set α} {l : Filter ι} {f : α → E} {c : E} {g : ι → α → ℝ} (K : ℝ)
(hf : Tendsto (fun i ↦ ⨍ y in a i, ‖f y - c‖ ∂μ) l (𝓝 0))
(f_int : ∀ᶠ i in l, IntegrableOn f (a i) μ)
(hg : Tendsto (fun i ↦ ∫ y, g i y ∂μ) l (𝓝 1))
(g_supp : ∀ᶠ i in l, Function.support (g i) ⊆ a i)
(g_bound : ∀ᶠ i in l, ∀ x, |g i x| ≤ K / μ.real (a i)) :
Tendsto (fun i ↦ ∫ y, g i y • f y ∂μ) l (𝓝 c) := by
have g_int : ∀ᶠ i in l, Integrable (g i) μ := by
filter_upwards [(tendsto_order.1 hg).1 _ zero_lt_one] with i hi
contrapose hi
simp only [integral_undef hi, lt_self_iff_false, not_false_eq_true]
have I : ∀ᶠ i in l, ∫ y, g i y • (f y - c) ∂μ + (∫ y, g i y ∂μ) • c = ∫ y, g i y • f y ∂μ := by
filter_upwards [f_int, g_int, g_supp, g_bound] with i hif hig hisupp hibound
rw [← integral_smul_const, ← integral_add]
· simp only [smul_sub, sub_add_cancel]
· simp_rw [smul_sub]
apply Integrable.sub _ (hig.smul_const _)
have A : Function.support (fun y ↦ g i y • f y) ⊆ a i := by
apply Subset.trans _ hisupp
exact Function.support_smul_subset_left _ _
rw [← integrableOn_iff_integrable_of_support_subset A]
apply Integrable.smul_of_top_right hif
exact memLp_top_of_bound hig.aestronglyMeasurable.restrict
(K / μ.real (a i)) (Eventually.of_forall hibound)
· exact hig.smul_const _
have L0 : Tendsto (fun i ↦ ∫ y, g i y • (f y - c) ∂μ) l (𝓝 0) := by
have := hf.const_mul K
simp only [mul_zero] at this
refine squeeze_zero_norm' ?_ this
filter_upwards [g_supp, g_bound, f_int, (tendsto_order.1 hg).1 _ zero_lt_one]
with i hi h'i h''i hi_int
have mu_ai : μ (a i) < ∞ := by
rw [lt_top_iff_ne_top]
intro h
simp only [h, ENNReal.toReal_top, _root_.div_zero, abs_nonpos_iff, measureReal_def] at h'i
have : ∫ (y : α), g i y ∂μ = ∫ (y : α), 0 ∂μ := by congr; ext y; exact h'i y
simp [this] at hi_int
apply (norm_integral_le_integral_norm _).trans
simp_rw [average_eq, smul_eq_mul, ← integral_const_mul, norm_smul, ← mul_assoc,
← div_eq_mul_inv]
have : ∀ x, x ∉ a i → ‖g i x‖ * ‖(f x - c)‖ = 0 := by
intro x hx
have : g i x = 0 := by rw [← Function.notMem_support]; exact fun h ↦ hx (hi h)
simp [this]
rw [← setIntegral_eq_integral_of_forall_compl_eq_zero this (μ := μ)]
refine integral_mono_of_nonneg (Eventually.of_forall (fun x ↦ by positivity)) ?_
(Eventually.of_forall (fun x ↦ ?_))
· apply (Integrable.sub h''i _).norm.const_mul
change IntegrableOn (fun _ ↦ c) (a i) μ
simp [mu_ai]
· dsimp; gcongr; simpa using h'i x
have := L0.add (hg.smul_const c)
simp only [one_smul, zero_add] at this
exact Tendsto.congr' I this
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/DominatedConvergence.lean | import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic
import Mathlib.MeasureTheory.Measure.Real
import Mathlib.Order.Filter.IndicatorFunction
/-!
# The dominated convergence theorem
This file collects various results related to the Lebesgue dominated convergence theorem
for the Bochner integral.
## Main results
- `MeasureTheory.tendsto_integral_of_dominated_convergence`:
the Lebesgue dominated convergence theorem for the Bochner integral
- `MeasureTheory.hasSum_integral_of_dominated_convergence`:
the Lebesgue dominated convergence theorem for series
- `MeasureTheory.integral_tsum`, `MeasureTheory.integral_tsum_of_summable_integral_norm`:
the integral and `tsum`s commute, if the norms of the functions form a summable series
- `intervalIntegral.hasSum_integral_of_dominated_convergence`: the Lebesgue dominated convergence
theorem for parametric interval integrals
- `intervalIntegral.continuous_of_dominated_interval`: continuity of the interval integral
w.r.t. a parameter
- `intervalIntegral.continuous_primitive` and friends: primitives of interval integrable
measurable functions are continuous
-/
open MeasureTheory Metric
/-!
## The Lebesgue dominated convergence theorem for the Bochner integral
-/
section DominatedConvergenceTheorem
open Set Filter TopologicalSpace ENNReal
open scoped Topology Interval
namespace MeasureTheory
variable {α E G : Type*}
[NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup G] [NormedSpace ℝ G]
{m : MeasurableSpace α} {μ : Measure α}
/-- **Lebesgue dominated convergence theorem** provides sufficient conditions under which almost
everywhere convergence of a sequence of functions implies the convergence of their integrals.
We could weaken the condition `bound_integrable` to require `HasFiniteIntegral bound μ` instead
(i.e. not requiring that `bound` is measurable), but in all applications proving integrability
is easier. -/
theorem tendsto_integral_of_dominated_convergence {F : ℕ → α → G} {f : α → G} (bound : α → ℝ)
(F_measurable : ∀ n, AEStronglyMeasurable (F n) μ) (bound_integrable : Integrable bound μ)
(h_bound : ∀ n, ∀ᵐ a ∂μ, ‖F n a‖ ≤ bound a)
(h_lim : ∀ᵐ a ∂μ, Tendsto (fun n => F n a) atTop (𝓝 (f a))) :
Tendsto (fun n => ∫ a, F n a ∂μ) atTop (𝓝 <| ∫ a, f a ∂μ) := by
by_cases hG : CompleteSpace G
· simp only [integral, hG, L1.integral]
exact tendsto_setToFun_of_dominated_convergence (dominatedFinMeasAdditive_weightedSMul μ)
bound F_measurable bound_integrable h_bound h_lim
· simp [integral, hG]
/-- Lebesgue dominated convergence theorem for filters with a countable basis -/
theorem tendsto_integral_filter_of_dominated_convergence {ι} {l : Filter ι} [l.IsCountablyGenerated]
{F : ι → α → G} {f : α → G} (bound : α → ℝ) (hF_meas : ∀ᶠ n in l, AEStronglyMeasurable (F n) μ)
(h_bound : ∀ᶠ n in l, ∀ᵐ a ∂μ, ‖F n a‖ ≤ bound a) (bound_integrable : Integrable bound μ)
(h_lim : ∀ᵐ a ∂μ, Tendsto (fun n => F n a) l (𝓝 (f a))) :
Tendsto (fun n => ∫ a, F n a ∂μ) l (𝓝 <| ∫ a, f a ∂μ) := by
by_cases hG : CompleteSpace G
· simp only [integral, hG, L1.integral]
exact tendsto_setToFun_filter_of_dominated_convergence (dominatedFinMeasAdditive_weightedSMul μ)
bound hF_meas h_bound bound_integrable h_lim
· simp [integral, hG, tendsto_const_nhds]
/-- Lebesgue dominated convergence theorem for series. -/
theorem hasSum_integral_of_dominated_convergence {ι} [Countable ι] {F : ι → α → G} {f : α → G}
(bound : ι → α → ℝ) (hF_meas : ∀ n, AEStronglyMeasurable (F n) μ)
(h_bound : ∀ n, ∀ᵐ a ∂μ, ‖F n a‖ ≤ bound n a)
(bound_summable : ∀ᵐ a ∂μ, Summable fun n => bound n a)
(bound_integrable : Integrable (fun a => ∑' n, bound n a) μ)
(h_lim : ∀ᵐ a ∂μ, HasSum (fun n => F n a) (f a)) :
HasSum (fun n => ∫ a, F n a ∂μ) (∫ a, f a ∂μ) := by
have hb_nonneg : ∀ᵐ a ∂μ, ∀ n, 0 ≤ bound n a :=
eventually_countable_forall.2 fun n => (h_bound n).mono fun a => (norm_nonneg _).trans
have hb_le_tsum : ∀ n, bound n ≤ᵐ[μ] fun a => ∑' n, bound n a := by
intro n
filter_upwards [hb_nonneg, bound_summable]
with _ ha0 ha_sum using ha_sum.le_tsum _ fun i _ => ha0 i
have hF_integrable : ∀ n, Integrable (F n) μ := by
refine fun n => bound_integrable.mono' (hF_meas n) ?_
exact EventuallyLE.trans (h_bound n) (hb_le_tsum n)
simp only [HasSum, ← integral_finset_sum _ fun n _ => hF_integrable n]
refine tendsto_integral_filter_of_dominated_convergence
(fun a => ∑' n, bound n a) ?_ ?_ bound_integrable h_lim
· exact Eventually.of_forall fun s => s.aestronglyMeasurable_fun_sum fun n _ => hF_meas n
· filter_upwards with s
filter_upwards [eventually_countable_forall.2 h_bound, hb_nonneg, bound_summable]
with a hFa ha0 has
calc
‖∑ n ∈ s, F n a‖ ≤ ∑ n ∈ s, bound n a := norm_sum_le_of_le _ fun n _ => hFa n
_ ≤ ∑' n, bound n a := has.sum_le_tsum _ (fun n _ => ha0 n)
theorem integral_tsum {ι} [Countable ι] {f : ι → α → G} (hf : ∀ i, AEStronglyMeasurable (f i) μ)
(hf' : ∑' i, ∫⁻ a : α, ‖f i a‖ₑ ∂μ ≠ ∞) :
∫ a : α, ∑' i, f i a ∂μ = ∑' i, ∫ a : α, f i a ∂μ := by
by_cases hG : CompleteSpace G; swap
· simp [integral, hG]
have hf'' i : AEMeasurable (‖f i ·‖ₑ) μ := (hf i).enorm
have hhh : ∀ᵐ a : α ∂μ, Summable fun n => (‖f n a‖₊ : ℝ) := by
rw [← lintegral_tsum hf''] at hf'
refine (ae_lt_top' (AEMeasurable.ennreal_tsum hf'') hf').mono ?_
intro x hx
rw [← ENNReal.tsum_coe_ne_top_iff_summable_coe]
exact hx.ne
convert (MeasureTheory.hasSum_integral_of_dominated_convergence (fun i a => ‖f i a‖₊) hf _ hhh
⟨_, _⟩ _).tsum_eq.symm
· intro n
filter_upwards with x
rfl
· simp_rw [← NNReal.coe_tsum]
rw [aestronglyMeasurable_iff_aemeasurable]
apply AEMeasurable.coe_nnreal_real
apply AEMeasurable.nnreal_tsum
exact fun i => (hf i).nnnorm.aemeasurable
· dsimp [HasFiniteIntegral]
have : ∫⁻ a, ∑' n, ‖f n a‖ₑ ∂μ < ⊤ := by rwa [lintegral_tsum hf'', lt_top_iff_ne_top]
convert this using 1
apply lintegral_congr_ae
simp_rw [← coe_nnnorm, ← NNReal.coe_tsum, enorm_eq_nnnorm, NNReal.nnnorm_eq]
filter_upwards [hhh] with a ha
exact ENNReal.coe_tsum (NNReal.summable_coe.mp ha)
· filter_upwards [hhh] with x hx
exact hx.of_norm.hasSum
lemma hasSum_integral_of_summable_integral_norm {ι} [Countable ι] {F : ι → α → E}
(hF_int : ∀ i : ι, Integrable (F i) μ) (hF_sum : Summable fun i ↦ ∫ a, ‖F i a‖ ∂μ) :
HasSum (∫ a, F · a ∂μ) (∫ a, (∑' i, F i a) ∂μ) := by
by_cases hE : CompleteSpace E; swap
· simp [integral, hE, hasSum_zero]
rw [integral_tsum (fun i ↦ (hF_int i).1)]
· exact (hF_sum.of_norm_bounded fun i ↦ norm_integral_le_integral_norm _).hasSum
have (i : ι) : ∫⁻ a, ‖F i a‖ₑ ∂μ = ‖∫ a, ‖F i a‖ ∂μ‖ₑ := by
dsimp [enorm]
rw [lintegral_coe_eq_integral _ (hF_int i).norm, coe_nnreal_eq, coe_nnnorm,
Real.norm_of_nonneg (integral_nonneg (fun a ↦ norm_nonneg (F i a)))]
simp only [coe_nnnorm]
rw [funext this]
exact ENNReal.tsum_coe_ne_top_iff_summable.2 <| NNReal.summable_coe.1 hF_sum.abs
lemma integral_tsum_of_summable_integral_norm {ι} [Countable ι] {F : ι → α → E}
(hF_int : ∀ i : ι, Integrable (F i) μ) (hF_sum : Summable fun i ↦ ∫ a, ‖F i a‖ ∂μ) :
∑' i, (∫ a, F i a ∂μ) = ∫ a, (∑' i, F i a) ∂μ :=
(hasSum_integral_of_summable_integral_norm hF_int hF_sum).tsum_eq
/-- Corollary of the Lebesgue dominated convergence theorem: If a sequence of functions `F n` is
(eventually) uniformly bounded by a constant and converges (eventually) pointwise to a
function `f`, then the integrals of `F n` with respect to a finite measure `μ` converge
to the integral of `f`. -/
theorem tendsto_integral_filter_of_norm_le_const {ι} {l : Filter ι} [l.IsCountablyGenerated]
{F : ι → α → G} [IsFiniteMeasure μ] {f : α → G}
(h_meas : ∀ᶠ n in l, AEStronglyMeasurable (F n) μ)
(h_bound : ∃ C, ∀ᶠ n in l, (∀ᵐ ω ∂μ, ‖F n ω‖ ≤ C))
(h_lim : ∀ᵐ ω ∂μ, Tendsto (fun n => F n ω) l (𝓝 (f ω))) :
Tendsto (fun n => ∫ ω, F n ω ∂μ) l (nhds (∫ ω, f ω ∂μ)) := by
obtain ⟨c, h_boundc⟩ := h_bound
let C : α → ℝ := (fun _ => c)
exact tendsto_integral_filter_of_dominated_convergence
C h_meas h_boundc (integrable_const c) h_lim
end MeasureTheory
section TendstoMono
variable {α E : Type*} [MeasurableSpace α]
{μ : Measure α} [NormedAddCommGroup E] [NormedSpace ℝ E] {s : ℕ → Set α}
{f : α → E}
theorem _root_.Antitone.tendsto_setIntegral (hsm : ∀ i, MeasurableSet (s i)) (h_anti : Antitone s)
(hfi : IntegrableOn f (s 0) μ) :
Tendsto (fun i => ∫ a in s i, f a ∂μ) atTop (𝓝 (∫ a in ⋂ n, s n, f a ∂μ)) := by
let bound : α → ℝ := indicator (s 0) fun a => ‖f a‖
have h_int_eq : (fun i => ∫ a in s i, f a ∂μ) = fun i => ∫ a, (s i).indicator f a ∂μ :=
funext fun i => (integral_indicator (hsm i)).symm
rw [h_int_eq]
rw [← integral_indicator (MeasurableSet.iInter hsm)]
refine tendsto_integral_of_dominated_convergence bound ?_ ?_ ?_ ?_
· intro n
rw [aestronglyMeasurable_indicator_iff (hsm n)]
exact (IntegrableOn.mono_set hfi (h_anti (zero_le n))).1
· rw [integrable_indicator_iff (hsm 0)]
exact hfi.norm
· simp_rw [norm_indicator_eq_indicator_norm]
refine fun n => Eventually.of_forall fun x => ?_
exact indicator_le_indicator_of_subset (h_anti (zero_le n)) (fun a => norm_nonneg _) _
· filter_upwards [] with a using le_trans (h_anti.tendsto_indicator _ _ _) (pure_le_nhds _)
end TendstoMono
/-!
## The Lebesgue dominated convergence theorem for interval integrals
As an application, we show continuity of parametric integrals.
-/
namespace intervalIntegral
section DCT
variable {ι E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{a b : ℝ} {f : ℝ → E} {μ : Measure ℝ}
/-- Lebesgue dominated convergence theorem for filters with a countable basis -/
nonrec theorem tendsto_integral_filter_of_dominated_convergence {ι} {l : Filter ι}
[l.IsCountablyGenerated] {F : ι → ℝ → E} (bound : ℝ → ℝ)
(hF_meas : ∀ᶠ n in l, AEStronglyMeasurable (F n) (μ.restrict (Ι a b)))
(h_bound : ∀ᶠ n in l, ∀ᵐ x ∂μ, x ∈ Ι a b → ‖F n x‖ ≤ bound x)
(bound_integrable : IntervalIntegrable bound μ a b)
(h_lim : ∀ᵐ x ∂μ, x ∈ Ι a b → Tendsto (fun n => F n x) l (𝓝 (f x))) :
Tendsto (fun n => ∫ x in a..b, F n x ∂μ) l (𝓝 <| ∫ x in a..b, f x ∂μ) := by
simp only [intervalIntegrable_iff, intervalIntegral_eq_integral_uIoc,
← ae_restrict_iff' (α := ℝ) (μ := μ) measurableSet_uIoc] at *
exact tendsto_const_nhds.smul <|
tendsto_integral_filter_of_dominated_convergence bound hF_meas h_bound bound_integrable h_lim
/-- Lebesgue dominated convergence theorem for parametric interval integrals. -/
nonrec theorem hasSum_integral_of_dominated_convergence {ι} [Countable ι] {F : ι → ℝ → E}
(bound : ι → ℝ → ℝ) (hF_meas : ∀ n, AEStronglyMeasurable (F n) (μ.restrict (Ι a b)))
(h_bound : ∀ n, ∀ᵐ t ∂μ, t ∈ Ι a b → ‖F n t‖ ≤ bound n t)
(bound_summable : ∀ᵐ t ∂μ, t ∈ Ι a b → Summable fun n => bound n t)
(bound_integrable : IntervalIntegrable (fun t => ∑' n, bound n t) μ a b)
(h_lim : ∀ᵐ t ∂μ, t ∈ Ι a b → HasSum (fun n => F n t) (f t)) :
HasSum (fun n => ∫ t in a..b, F n t ∂μ) (∫ t in a..b, f t ∂μ) := by
simp only [intervalIntegrable_iff, intervalIntegral_eq_integral_uIoc, ←
ae_restrict_iff' (α := ℝ) (μ := μ) measurableSet_uIoc] at *
exact
(hasSum_integral_of_dominated_convergence bound hF_meas h_bound bound_summable bound_integrable
h_lim).const_smul
_
/-- Interval integrals commute with countable sums, when the supremum norms are summable (a
special case of the dominated convergence theorem). -/
theorem hasSum_intervalIntegral_of_summable_norm [Countable ι] {f : ι → C(ℝ, E)}
(hf_sum : Summable fun i : ι => ‖(f i).restrict (⟨uIcc a b, isCompact_uIcc⟩ : Compacts ℝ)‖) :
HasSum (fun i : ι => ∫ x in a..b, f i x) (∫ x in a..b, ∑' i : ι, f i x) := by
by_cases hE : CompleteSpace E; swap
· simp [intervalIntegral, integral, hE, hasSum_zero]
apply hasSum_integral_of_dominated_convergence
(fun i (x : ℝ) => ‖(f i).restrict ↑(⟨uIcc a b, isCompact_uIcc⟩ : Compacts ℝ)‖)
(fun i => (map_continuous <| f i).aestronglyMeasurable)
· intro i; filter_upwards with x hx
apply ContinuousMap.norm_coe_le_norm ((f i).restrict _) ⟨x, _⟩
exact ⟨hx.1.le, hx.2⟩
· exact ae_of_all _ fun x _ => hf_sum
· exact intervalIntegrable_const
· refine ae_of_all _ fun x hx => Summable.hasSum ?_
let x : (⟨uIcc a b, isCompact_uIcc⟩ : Compacts ℝ) := ⟨x, ⟨hx.1.le, hx.2⟩⟩
have := hf_sum.of_norm
simpa only [Compacts.coe_mk, ContinuousMap.restrict_apply]
using ContinuousMap.summable_apply this x
theorem tsum_intervalIntegral_eq_of_summable_norm [Countable ι] {f : ι → C(ℝ, E)}
(hf_sum : Summable fun i : ι => ‖(f i).restrict (⟨uIcc a b, isCompact_uIcc⟩ : Compacts ℝ)‖) :
∑' i : ι, ∫ x in a..b, f i x = ∫ x in a..b, ∑' i : ι, f i x :=
(hasSum_intervalIntegral_of_summable_norm hf_sum).tsum_eq
variable {X : Type*} [TopologicalSpace X] [FirstCountableTopology X]
/-- Continuity of interval integral with respect to a parameter, at a point within a set.
Given `F : X → ℝ → E`, assume `F x` is ae-measurable on `[a, b]` for `x` in a
neighborhood of `x₀` within `s` and at `x₀`, and assume it is bounded by a function integrable
on `[a, b]` independent of `x` in a neighborhood of `x₀` within `s`. If `(fun x ↦ F x t)`
is continuous at `x₀` within `s` for almost every `t` in `[a, b]`
then the same holds for `(fun x ↦ ∫ t in a..b, F x t ∂μ) s x₀`. -/
theorem continuousWithinAt_of_dominated_interval {F : X → ℝ → E} {x₀ : X} {bound : ℝ → ℝ} {a b : ℝ}
{s : Set X} (hF_meas : ∀ᶠ x in 𝓝[s] x₀, AEStronglyMeasurable (F x) (μ.restrict <| Ι a b))
(h_bound : ∀ᶠ x in 𝓝[s] x₀, ∀ᵐ t ∂μ, t ∈ Ι a b → ‖F x t‖ ≤ bound t)
(bound_integrable : IntervalIntegrable bound μ a b)
(h_cont : ∀ᵐ t ∂μ, t ∈ Ι a b → ContinuousWithinAt (fun x => F x t) s x₀) :
ContinuousWithinAt (fun x => ∫ t in a..b, F x t ∂μ) s x₀ :=
tendsto_integral_filter_of_dominated_convergence bound hF_meas h_bound bound_integrable h_cont
/-- Continuity of interval integral with respect to a parameter at a point.
Given `F : X → ℝ → E`, assume `F x` is ae-measurable on `[a, b]` for `x` in a
neighborhood of `x₀`, and assume it is bounded by a function integrable on
`[a, b]` independent of `x` in a neighborhood of `x₀`. If `(fun x ↦ F x t)`
is continuous at `x₀` for almost every `t` in `[a, b]`
then the same holds for `(fun x ↦ ∫ t in a..b, F x t ∂μ) s x₀`. -/
theorem continuousAt_of_dominated_interval {F : X → ℝ → E} {x₀ : X} {bound : ℝ → ℝ} {a b : ℝ}
(hF_meas : ∀ᶠ x in 𝓝 x₀, AEStronglyMeasurable (F x) (μ.restrict <| Ι a b))
(h_bound : ∀ᶠ x in 𝓝 x₀, ∀ᵐ t ∂μ, t ∈ Ι a b → ‖F x t‖ ≤ bound t)
(bound_integrable : IntervalIntegrable bound μ a b)
(h_cont : ∀ᵐ t ∂μ, t ∈ Ι a b → ContinuousAt (fun x => F x t) x₀) :
ContinuousAt (fun x => ∫ t in a..b, F x t ∂μ) x₀ :=
tendsto_integral_filter_of_dominated_convergence bound hF_meas h_bound bound_integrable h_cont
/-- Continuity of interval integral with respect to a parameter.
Given `F : X → ℝ → E`, assume each `F x` is ae-measurable on `[a, b]`,
and assume it is bounded by a function integrable on `[a, b]` independent of `x`.
If `(fun x ↦ F x t)` is continuous for almost every `t` in `[a, b]`
then the same holds for `(fun x ↦ ∫ t in a..b, F x t ∂μ) s x₀`. -/
theorem continuous_of_dominated_interval {F : X → ℝ → E} {bound : ℝ → ℝ} {a b : ℝ}
(hF_meas : ∀ x, AEStronglyMeasurable (F x) <| μ.restrict <| Ι a b)
(h_bound : ∀ x, ∀ᵐ t ∂μ, t ∈ Ι a b → ‖F x t‖ ≤ bound t)
(bound_integrable : IntervalIntegrable bound μ a b)
(h_cont : ∀ᵐ t ∂μ, t ∈ Ι a b → Continuous fun x => F x t) :
Continuous fun x => ∫ t in a..b, F x t ∂μ :=
continuous_iff_continuousAt.mpr fun _ =>
continuousAt_of_dominated_interval (Eventually.of_forall hF_meas) (Eventually.of_forall h_bound)
bound_integrable <|
h_cont.mono fun _ himp hx => (himp hx).continuousAt
end DCT
section ContinuousPrimitive
open scoped Interval
variable {E X : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [TopologicalSpace X]
{a b b₀ b₁ b₂ : ℝ} {μ : Measure ℝ} {f : ℝ → E}
theorem continuousWithinAt_primitive (hb₀ : μ {b₀} = 0)
(h_int : IntervalIntegrable f μ (min a b₁) (max a b₂)) :
ContinuousWithinAt (fun b => ∫ x in a..b, f x ∂μ) (Icc b₁ b₂) b₀ := by
by_cases h₀ : b₀ ∈ Icc b₁ b₂
· have h₁₂ : b₁ ≤ b₂ := h₀.1.trans h₀.2
have min₁₂ : min b₁ b₂ = b₁ := min_eq_left h₁₂
have h_int' : ∀ {x}, x ∈ Icc b₁ b₂ → IntervalIntegrable f μ b₁ x := by
rintro x ⟨h₁, h₂⟩
apply h_int.mono_set
apply uIcc_subset_uIcc
· exact ⟨min_le_of_left_le (min_le_right a b₁),
h₁.trans (h₂.trans <| le_max_of_le_right <| le_max_right _ _)⟩
· exact ⟨min_le_of_left_le <| (min_le_right _ _).trans h₁,
le_max_of_le_right <| h₂.trans <| le_max_right _ _⟩
have : ∀ b ∈ Icc b₁ b₂,
∫ x in a..b, f x ∂μ = (∫ x in a..b₁, f x ∂μ) + ∫ x in b₁..b, f x ∂μ := by
rintro b ⟨h₁, h₂⟩
rw [← integral_add_adjacent_intervals _ (h_int' ⟨h₁, h₂⟩)]
apply h_int.mono_set
apply uIcc_subset_uIcc
· exact ⟨min_le_of_left_le (min_le_left a b₁), le_max_of_le_right (le_max_left _ _)⟩
· exact ⟨min_le_of_left_le (min_le_right _ _),
le_max_of_le_right (h₁.trans <| h₂.trans (le_max_right a b₂))⟩
apply ContinuousWithinAt.congr _ this (this _ h₀); clear this
refine continuousWithinAt_const.add ?_
have :
(fun b => ∫ x in b₁..b, f x ∂μ) =ᶠ[𝓝[Icc b₁ b₂] b₀] fun b =>
∫ x in b₁..b₂, indicator {x | x ≤ b} f x ∂μ := by
apply eventuallyEq_of_mem self_mem_nhdsWithin
exact fun b b_in => (integral_indicator b_in).symm
apply ContinuousWithinAt.congr_of_eventuallyEq _ this (integral_indicator h₀).symm
have : IntervalIntegrable (fun x => ‖f x‖) μ b₁ b₂ :=
IntervalIntegrable.norm (h_int' <| right_mem_Icc.mpr h₁₂)
refine continuousWithinAt_of_dominated_interval ?_ ?_ this ?_ <;> clear this
· filter_upwards [self_mem_nhdsWithin]
intro x hx
rw [aestronglyMeasurable_indicator_iff, Measure.restrict_restrict, uIoc, Iic_def,
Iic_inter_Ioc_of_le]
· rw [min₁₂]
exact (h_int' hx).1.aestronglyMeasurable
· exact le_max_of_le_right hx.2
exacts [measurableSet_Iic, measurableSet_Iic]
· filter_upwards with x; filter_upwards with t
dsimp [indicator]
split_ifs <;> simp
· have : ∀ᵐ t ∂μ, t < b₀ ∨ b₀ < t := by
filter_upwards [compl_mem_ae_iff.mpr hb₀] with x hx using Ne.lt_or_gt hx
apply this.mono
rintro x₀ (hx₀ | hx₀) -
· have : ∀ᶠ x in 𝓝[Icc b₁ b₂] b₀, {t : ℝ | t ≤ x}.indicator f x₀ = f x₀ := by
apply mem_nhdsWithin_of_mem_nhds
apply Eventually.mono (Ioi_mem_nhds hx₀)
intro x hx
simp [hx.le]
apply continuousWithinAt_const.congr_of_eventuallyEq this
simp [hx₀.le]
· have : ∀ᶠ x in 𝓝[Icc b₁ b₂] b₀, {t : ℝ | t ≤ x}.indicator f x₀ = 0 := by
apply mem_nhdsWithin_of_mem_nhds
apply Eventually.mono (Iio_mem_nhds hx₀)
intro x hx
simp [hx]
apply continuousWithinAt_const.congr_of_eventuallyEq this
simp [hx₀]
· apply continuousWithinAt_of_notMem_closure
rwa [closure_Icc]
theorem continuousAt_parametric_primitive_of_dominated [FirstCountableTopology X]
{F : X → ℝ → E} (bound : ℝ → ℝ) (a b : ℝ)
{a₀ b₀ : ℝ} {x₀ : X} (hF_meas : ∀ x, AEStronglyMeasurable (F x) (μ.restrict <| Ι a b))
(h_bound : ∀ᶠ x in 𝓝 x₀, ∀ᵐ t ∂μ.restrict <| Ι a b, ‖F x t‖ ≤ bound t)
(bound_integrable : IntervalIntegrable bound μ a b)
(h_cont : ∀ᵐ t ∂μ.restrict <| Ι a b, ContinuousAt (fun x ↦ F x t) x₀) (ha₀ : a₀ ∈ Ioo a b)
(hb₀ : b₀ ∈ Ioo a b) (hμb₀ : μ {b₀} = 0) :
ContinuousAt (fun p : X × ℝ ↦ ∫ t : ℝ in a₀..p.2, F p.1 t ∂μ) (x₀, b₀) := by
have hsub : ∀ {a₀ b₀}, a₀ ∈ Ioo a b → b₀ ∈ Ioo a b → Ι a₀ b₀ ⊆ Ι a b := fun ha₀ hb₀ ↦
(ordConnected_Ioo.uIoc_subset ha₀ hb₀).trans (Ioo_subset_Ioc_self.trans Ioc_subset_uIoc)
have Ioo_nhds : Ioo a b ∈ 𝓝 b₀ := Ioo_mem_nhds hb₀.1 hb₀.2
have Icc_nhds : Icc a b ∈ 𝓝 b₀ := Icc_mem_nhds hb₀.1 hb₀.2
have hx₀ : ∀ᵐ t : ℝ ∂μ.restrict (Ι a b), ‖F x₀ t‖ ≤ bound t := h_bound.self_of_nhds
have : ∀ᶠ p : X × ℝ in 𝓝 (x₀, b₀),
∫ s in a₀..p.2, F p.1 s ∂μ =
∫ s in a₀..b₀, F p.1 s ∂μ + ∫ s in b₀..p.2, F x₀ s ∂μ +
∫ s in b₀..p.2, F p.1 s - F x₀ s ∂μ := by
rw [nhds_prod_eq]
refine (h_bound.prod_mk Ioo_nhds).mono ?_
rintro ⟨x, t⟩ ⟨hx : ∀ᵐ t : ℝ ∂μ.restrict (Ι a b), ‖F x t‖ ≤ bound t, ht : t ∈ Ioo a b⟩
dsimp
have hiF : ∀ {x a₀ b₀},
(∀ᵐ t : ℝ ∂μ.restrict (Ι a b), ‖F x t‖ ≤ bound t) → a₀ ∈ Ioo a b → b₀ ∈ Ioo a b →
IntervalIntegrable (F x) μ a₀ b₀ := fun {x a₀ b₀} hx ha₀ hb₀ ↦
(bound_integrable.mono_set_ae <| Eventually.of_forall <| hsub ha₀ hb₀).mono_fun'
((hF_meas x).mono_set <| hsub ha₀ hb₀)
(ae_restrict_of_ae_restrict_of_subset (hsub ha₀ hb₀) hx)
rw [intervalIntegral.integral_sub, add_assoc, add_sub_cancel,
intervalIntegral.integral_add_adjacent_intervals]
· exact hiF hx ha₀ hb₀
· exact hiF hx hb₀ ht
· exact hiF hx hb₀ ht
· exact hiF hx₀ hb₀ ht
rw [continuousAt_congr this]; clear this
refine (ContinuousAt.add ?_ ?_).add ?_
· exact (intervalIntegral.continuousAt_of_dominated_interval
(Eventually.of_forall fun x ↦ (hF_meas x).mono_set <| hsub ha₀ hb₀)
(h_bound.mono fun x hx ↦
ae_imp_of_ae_restrict <| ae_restrict_of_ae_restrict_of_subset (hsub ha₀ hb₀) hx)
(bound_integrable.mono_set_ae <| Eventually.of_forall <| hsub ha₀ hb₀) <|
ae_imp_of_ae_restrict <| ae_restrict_of_ae_restrict_of_subset (hsub ha₀ hb₀) h_cont).fst'
· refine (?_ : ContinuousAt (fun t ↦ ∫ s in b₀..t, F x₀ s ∂μ) b₀).snd'
apply ContinuousWithinAt.continuousAt _ (Icc_mem_nhds hb₀.1 hb₀.2)
apply intervalIntegral.continuousWithinAt_primitive hμb₀
rw [min_eq_right hb₀.1.le, max_eq_right hb₀.2.le]
exact bound_integrable.mono_fun' (hF_meas x₀) hx₀
· suffices Tendsto (fun x : X × ℝ ↦ ∫ s in b₀..x.2, F x.1 s - F x₀ s ∂μ) (𝓝 (x₀, b₀)) (𝓝 0) by
simpa [ContinuousAt]
have : ∀ᶠ p : X × ℝ in 𝓝 (x₀, b₀),
‖∫ s in b₀..p.2, F p.1 s - F x₀ s ∂μ‖ ≤ |∫ s in b₀..p.2, 2 * bound s ∂μ| := by
rw [nhds_prod_eq]
refine (h_bound.prod_mk Ioo_nhds).mono ?_
rintro ⟨x, t⟩ ⟨hx : ∀ᵐ t ∂μ.restrict (Ι a b), ‖F x t‖ ≤ bound t, ht : t ∈ Ioo a b⟩
have H : ∀ᵐ t : ℝ ∂μ.restrict (Ι b₀ t), ‖F x t - F x₀ t‖ ≤ 2 * bound t := by
apply (ae_restrict_of_ae_restrict_of_subset (hsub hb₀ ht) (hx.and hx₀)).mono
rintro s ⟨hs₁, hs₂⟩
calc
‖F x s - F x₀ s‖ ≤ ‖F x s‖ + ‖F x₀ s‖ := norm_sub_le _ _
_ ≤ 2 * bound s := by linarith only [hs₁, hs₂]
exact intervalIntegral.norm_integral_le_abs_of_norm_le H
((bound_integrable.mono_set' <| hsub hb₀ ht).const_mul 2)
apply squeeze_zero_norm' this
have : Tendsto (fun t ↦ ∫ s in b₀..t, 2 * bound s ∂μ) (𝓝 b₀) (𝓝 0) := by
suffices ContinuousAt (fun t ↦ ∫ s in b₀..t, 2 * bound s ∂μ) b₀ by
simpa [ContinuousAt] using this
apply ContinuousWithinAt.continuousAt _ Icc_nhds
apply intervalIntegral.continuousWithinAt_primitive hμb₀
apply IntervalIntegrable.const_mul
apply bound_integrable.mono_set'
rw [min_eq_right hb₀.1.le, max_eq_right hb₀.2.le]
rw [nhds_prod_eq]
exact (continuous_abs.tendsto' _ _ abs_zero).comp (this.comp tendsto_snd)
variable [NoAtoms μ]
theorem continuousOn_primitive (h_int : IntegrableOn f (Icc a b) μ) :
ContinuousOn (fun x => ∫ t in Ioc a x, f t ∂μ) (Icc a b) := by
by_cases h : a ≤ b
· have : ∀ x ∈ Icc a b, ∫ t in Ioc a x, f t ∂μ = ∫ t in a..x, f t ∂μ := by
intro x x_in
simp_rw [integral_of_le x_in.1]
rw [continuousOn_congr this]
intro x₀ _
refine continuousWithinAt_primitive (measure_singleton x₀) ?_
simp only [intervalIntegrable_iff_integrableOn_Ioc_of_le, max_eq_right, h,
min_self]
exact h_int.mono Ioc_subset_Icc_self le_rfl
· rw [Icc_eq_empty h]
exact continuousOn_empty _
theorem continuousOn_primitive_Icc (h_int : IntegrableOn f (Icc a b) μ) :
ContinuousOn (fun x => ∫ t in Icc a x, f t ∂μ) (Icc a b) := by
have aux : (fun x => ∫ t in Icc a x, f t ∂μ) = fun x => ∫ t in Ioc a x, f t ∂μ := by
ext x
exact integral_Icc_eq_integral_Ioc
rw [aux]
exact continuousOn_primitive h_int
/-- Note: this assumes that `f` is `IntervalIntegrable`, in contrast to some other lemmas here. -/
theorem continuousOn_primitive_interval' (h_int : IntervalIntegrable f μ b₁ b₂)
(ha : a ∈ [[b₁, b₂]]) : ContinuousOn (fun b => ∫ x in a..b, f x ∂μ) [[b₁, b₂]] := fun _ _ ↦ by
refine continuousWithinAt_primitive (measure_singleton _) ?_
rw [min_eq_right ha.1, max_eq_right ha.2]
simpa [intervalIntegrable_iff, uIoc] using h_int
theorem continuousOn_primitive_interval (h_int : IntegrableOn f (uIcc a b) μ) :
ContinuousOn (fun x => ∫ t in a..x, f t ∂μ) (uIcc a b) :=
continuousOn_primitive_interval' h_int.intervalIntegrable left_mem_uIcc
theorem continuousOn_primitive_interval_left (h_int : IntegrableOn f (uIcc a b) μ) :
ContinuousOn (fun x => ∫ t in x..b, f t ∂μ) (uIcc a b) := by
rw [uIcc_comm a b] at h_int ⊢
simp only [integral_symm b]
exact (continuousOn_primitive_interval h_int).neg
theorem continuous_primitive (h_int : ∀ a b, IntervalIntegrable f μ a b) (a : ℝ) :
Continuous fun b => ∫ x in a..b, f x ∂μ := by
rw [continuous_iff_continuousAt]
intro b₀
obtain ⟨b₁, hb₁⟩ := exists_lt b₀
obtain ⟨b₂, hb₂⟩ := exists_gt b₀
apply ContinuousWithinAt.continuousAt _ (Icc_mem_nhds hb₁ hb₂)
exact continuousWithinAt_primitive (measure_singleton b₀) (h_int _ _)
nonrec theorem _root_.MeasureTheory.Integrable.continuous_primitive (h_int : Integrable f μ)
(a : ℝ) : Continuous fun b => ∫ x in a..b, f x ∂μ :=
continuous_primitive (fun _ _ => h_int.intervalIntegrable) a
variable [IsLocallyFiniteMeasure μ] {f : X → ℝ → E}
theorem continuous_parametric_primitive_of_continuous
{a₀ : ℝ} (hf : Continuous f.uncurry) :
Continuous fun p : X × ℝ ↦ ∫ t in a₀..p.2, f p.1 t ∂μ := by
-- We will prove continuity at a point `(q, b₀)`.
rw [continuous_iff_continuousAt]
rintro ⟨q, b₀⟩
apply Metric.continuousAt_iff'.2 (fun ε εpos ↦ ?_)
-- choose `a` and `b` such that `(a, b)` contains both `a₀` and `b₀`. We will use uniform
-- estimates on a neighborhood of the compact set `{q} × [a, b]`.
obtain ⟨a, a_lt⟩ := exists_lt (min a₀ b₀)
obtain ⟨b, lt_b⟩ := exists_gt (max a₀ b₀)
rw [lt_min_iff] at a_lt
rw [max_lt_iff] at lt_b
have : IsCompact ({q} ×ˢ (Icc a b)) := isCompact_singleton.prod isCompact_Icc
-- let `M` be a bound for `f` on the compact set `{q} × [a, b]`.
obtain ⟨M, hM⟩ := this.bddAbove_image hf.norm.continuousOn
-- let `δ` be small enough to satisfy several properties that will show up later.
obtain ⟨δ, δpos, hδ, h'δ, h''δ⟩ : ∃ (δ : ℝ), 0 < δ ∧ δ < 1 ∧ Icc (b₀ - δ) (b₀ + δ) ⊆ Icc a b ∧
(M + 1) * μ.real (Icc (b₀ - δ) (b₀ + δ)) + δ * μ.real (Icc a b) < ε := by
have A : ∀ᶠ δ in 𝓝[>] (0 : ℝ), δ ∈ Ioo 0 1 := Ioo_mem_nhdsGT zero_lt_one
have B : ∀ᶠ δ in 𝓝 0, Icc (b₀ - δ) (b₀ + δ) ⊆ Icc a b := by
have I : Tendsto (fun δ ↦ b₀ - δ) (𝓝 0) (𝓝 (b₀ - 0)) := tendsto_const_nhds.sub tendsto_id
have J : Tendsto (fun δ ↦ b₀ + δ) (𝓝 0) (𝓝 (b₀ + 0)) := tendsto_const_nhds.add tendsto_id
simp only [sub_zero, add_zero] at I J
filter_upwards [(tendsto_order.1 I).1 _ a_lt.2, (tendsto_order.1 J).2 _ lt_b.2] with δ hδ h'δ
exact Icc_subset_Icc hδ.le h'δ.le
have C : ∀ᶠ δ in 𝓝 0,
(M + 1) * μ.real (Icc (b₀ - δ) (b₀ + δ)) + δ * μ.real (Icc a b) < ε := by
suffices Tendsto
(fun δ ↦ (M + 1) * μ.real (Icc (b₀ - δ) (b₀ + δ)) + δ * μ.real (Icc a b))
(𝓝 0) (𝓝 ((M + 1) * (0 : ℝ≥0∞).toReal + 0 * μ.real (Icc a b))) by
simp only [toReal_zero, mul_zero, zero_mul, add_zero] at this
exact (tendsto_order.1 this).2 _ εpos
apply Tendsto.add (Tendsto.mul tendsto_const_nhds _)
(Tendsto.mul tendsto_id tendsto_const_nhds)
exact (tendsto_toReal zero_ne_top).comp (tendsto_measure_Icc _ _)
rcases (A.and ((B.and C).filter_mono nhdsWithin_le_nhds)).exists with ⟨δ, hδ, h'δ, h''δ⟩
exact ⟨δ, hδ.1, hδ.2, h'δ, h''δ⟩
-- By compactness of `[a, b]` and continuity of `f` there, if `p` is close enough to `q`
-- then `f p x` is `δ`-close to `f q x`, uniformly in `x ∈ [a, b]`.
-- (Note in particular that this implies a bound `M + δ ≤ M + 1` for `f p x`).
obtain ⟨v, v_mem, hv⟩ : ∃ v ∈ 𝓝[univ] q, ∀ p ∈ v, ∀ x ∈ Icc a b, dist (f p x) (f q x) < δ :=
IsCompact.mem_uniformity_of_prod isCompact_Icc hf.continuousOn (mem_univ _)
(dist_mem_uniformity δpos)
-- for `p` in this neighborhood and `s` which is `δ`-close to `b₀`, we will show that the
-- integrals are `ε`-close.
have : v ×ˢ (Ioo (b₀ - δ) (b₀ + δ)) ∈ 𝓝 (q, b₀) := by
rw [nhdsWithin_univ] at v_mem
simp only [prod_mem_nhds_iff, v_mem, true_and]
apply Ioo_mem_nhds <;> linarith
filter_upwards [this]
rintro ⟨p, s⟩ ⟨hp : p ∈ v, hs : s ∈ Ioo (b₀ - δ) (b₀ + δ)⟩
simp only [dist_eq_norm] at hv ⊢
have J r u v : IntervalIntegrable (f r) μ u v := (hf.uncurry_left _).intervalIntegrable _ _
/- we compute the difference between the integrals by splitting the contribution of the change
from `b₀` to `s` (which gives a contribution controlled by the measure of `(b₀ - δ, b₀ + δ)`,
small enough thanks to our choice of `δ`) and the change from `q` to `p`, which is small as
`f p x` and `f q x` are uniformly close by design. -/
calc
‖∫ t in a₀..s, f p t ∂μ - ∫ t in a₀..b₀, f q t ∂μ‖
= ‖(∫ t in a₀..s, f p t ∂μ - ∫ t in a₀..b₀, f p t ∂μ)
+ (∫ t in a₀..b₀, f p t ∂μ - ∫ t in a₀..b₀, f q t ∂μ)‖ := by congr 1; abel
_ ≤ ‖∫ t in a₀..s, f p t ∂μ - ∫ t in a₀..b₀, f p t ∂μ‖
+ ‖∫ t in a₀..b₀, f p t ∂μ - ∫ t in a₀..b₀, f q t ∂μ‖ := norm_add_le _ _
_ = ‖∫ t in b₀..s, f p t ∂μ‖ + ‖∫ t in a₀..b₀, (f p t - f q t) ∂μ‖ := by
congr 2
· rw [integral_interval_sub_left (J _ _ _) (J _ _ _)]
· rw [integral_sub (J _ _ _) (J _ _ _)]
_ ≤ ∫ t in Ι b₀ s, ‖f p t‖ ∂μ + ∫ t in Ι a₀ b₀, ‖f p t - f q t‖ ∂μ := by
gcongr
· exact norm_integral_le_integral_norm_uIoc
· exact norm_integral_le_integral_norm_uIoc
_ ≤ ∫ t in Icc (b₀ - δ) (b₀ + δ), ‖f p t‖ ∂μ + ∫ t in Icc a b, ‖f p t - f q t‖ ∂μ := by
gcongr
· exact Eventually.of_forall (fun x ↦ norm_nonneg _)
· exact (hf.uncurry_left _).norm.integrableOn_Icc
· apply uIoc_subset_uIcc.trans (uIcc_subset_Icc ?_ ⟨hs.1.le, hs.2.le⟩ )
simp [δpos.le]
· exact Eventually.of_forall (fun x ↦ norm_nonneg _)
· exact ((hf.uncurry_left _).sub (hf.uncurry_left _)).norm.integrableOn_Icc
· exact uIoc_subset_uIcc.trans (uIcc_subset_Icc ⟨a_lt.1.le, lt_b.1.le⟩ ⟨a_lt.2.le, lt_b.2.le⟩)
_ ≤ ∫ t in Icc (b₀ - δ) (b₀ + δ), M + 1 ∂μ + ∫ _t in Icc a b, δ ∂μ := by
gcongr with x hx x hx
· exact (hf.uncurry_left _).norm.integrableOn_Icc
· exact continuous_const.integrableOn_Icc
· exact nullMeasurableSet_Icc
· calc ‖f p x‖ = ‖f q x + (f p x - f q x)‖ := by congr; abel
_ ≤ ‖f q x‖ + ‖f p x - f q x‖ := norm_add_le _ _
_ ≤ M + δ := by
gcongr
· apply hM
change (fun x ↦ ‖Function.uncurry f x‖) (q, x) ∈ _
apply mem_image_of_mem
simp only [singleton_prod, mem_image, Prod.mk.injEq, true_and, exists_eq_right]
exact h'δ hx
· exact le_of_lt (hv _ hp _ (h'δ hx))
_ ≤ M + 1 := by linarith
· exact ((hf.uncurry_left _).sub (hf.uncurry_left _)).norm.integrableOn_Icc
· exact continuous_const.integrableOn_Icc
· exact nullMeasurableSet_Icc
· exact le_of_lt (hv _ hp _ hx)
_ = (M + 1) * μ.real (Icc (b₀ - δ) (b₀ + δ)) + δ * μ.real (Icc a b) := by simp [mul_comm]
_ < ε := h''δ
@[fun_prop]
theorem continuous_parametric_intervalIntegral_of_continuous {a₀ : ℝ}
(hf : Continuous f.uncurry) {s : X → ℝ} (hs : Continuous s) :
Continuous fun x ↦ ∫ t in a₀..s x, f x t ∂μ :=
show Continuous ((fun p : X × ℝ ↦ ∫ t in a₀..p.2, f p.1 t ∂μ) ∘ fun x ↦ (x, s x)) from
(continuous_parametric_primitive_of_continuous hf).comp₂ continuous_id hs
theorem continuous_parametric_intervalIntegral_of_continuous'
(hf : Continuous f.uncurry) (a₀ b₀ : ℝ) :
Continuous fun x ↦ ∫ t in a₀..b₀, f x t ∂μ := by fun_prop
end ContinuousPrimitive
end intervalIntegral
end DominatedConvergenceTheorem |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/Bochner.lean | import Mathlib.MeasureTheory.Integral.Bochner.Basic
import Mathlib.MeasureTheory.Integral.Bochner.L1
import Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory
deprecated_module (since := "2025-04-13") |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/Prod.lean | import Mathlib.MeasureTheory.Function.LpSeminorm.Prod
import Mathlib.MeasureTheory.Integral.DominatedConvergence
import Mathlib.MeasureTheory.Integral.Bochner.Set
import Mathlib.MeasureTheory.Measure.Prod
/-!
# Integration with respect to the product measure
In this file we prove Fubini's theorem.
## Main results
* `MeasureTheory.integrable_prod_iff` states that a binary function is integrable iff both
* `y ↦ f (x, y)` is integrable for almost every `x`, and
* the function `x ↦ ∫ ‖f (x, y)‖ dy` is integrable.
* `MeasureTheory.integral_prod`: Fubini's theorem. It states that for an integrable function
`α × β → E` (where `E` is a second countable Banach space) we have
`∫ z, f z ∂(μ.prod ν) = ∫ x, ∫ y, f (x, y) ∂ν ∂μ`. This theorem has the same variants as
Tonelli's theorem (see `MeasureTheory.lintegral_prod`). The lemma
`MeasureTheory.Integrable.integral_prod_right` states that the inner integral of the right-hand
side is integrable.
* `MeasureTheory.integral_integral_swap_of_hasCompactSupport`: a version of Fubini theorem for
continuous functions with compact support, which does not assume that the measures are σ-finite
contrary to all the usual versions of Fubini.
## Tags
product measure, Fubini's theorem, Fubini-Tonelli theorem
-/
noncomputable section
open scoped Topology ENNReal MeasureTheory
open Set Function Real ENNReal
open MeasureTheory MeasurableSpace MeasureTheory.Measure
open TopologicalSpace
open Filter hiding prod_eq map
variable {α β E : Type*} [MeasurableSpace α] [MeasurableSpace β] {μ : Measure α} {ν : Measure β}
variable [NormedAddCommGroup E]
/-! ### Measurability
Before we define the product measure, we can talk about the measurability of operations on binary
functions. We show that if `f` is a binary measurable function, then the function that integrates
along one of the variables (using either the Lebesgue or Bochner integral) is measurable.
-/
theorem measurableSet_integrable [SFinite ν] ⦃f : α → β → E⦄
(hf : StronglyMeasurable (uncurry f)) : MeasurableSet {x | Integrable (f x) ν} := by
simp_rw [Integrable, hf.of_uncurry_left.aestronglyMeasurable, true_and]
exact measurableSet_lt (Measurable.lintegral_prod_right hf.enorm) measurable_const
section
variable [NormedSpace ℝ E]
/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
Fubini's theorem is measurable.
This version has `f` in curried form. -/
theorem MeasureTheory.StronglyMeasurable.integral_prod_right [SFinite ν] ⦃f : α → β → E⦄
(hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂ν := by
classical
by_cases hE : CompleteSpace E; swap; · simp [integral, hE, stronglyMeasurable_const]
borelize E
haveI : SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
hf.separableSpace_range_union_singleton
let s : ℕ → SimpleFunc (α × β) E :=
SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prodMk_left
let f' : ℕ → α → E := fun n => {x | Integrable (f x) ν}.indicator fun x => (s' n x).integral ν
have hf' : ∀ n, StronglyMeasurable (f' n) := by
intro n; refine StronglyMeasurable.indicator ?_ (measurableSet_integrable hf)
have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
intro x; refine Finset.Subset.trans (Finset.filter_subset _ _) ?_; intro y
simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩
simp only [SimpleFunc.integral_eq_sum_of_subset (this _)]
refine Finset.stronglyMeasurable_fun_sum _ fun x _ => ?_
refine (Measurable.ennreal_toReal ?_).stronglyMeasurable.smul_const _
simp only [s', SimpleFunc.coe_comp, preimage_comp]
apply measurable_measure_prodMk_left
exact (s n).measurableSet_fiber x
have h2f' : Tendsto f' atTop (𝓝 fun x : α => ∫ y : β, f x y ∂ν) := by
rw [tendsto_pi_nhds]; intro x
by_cases hfx : Integrable (f x) ν
· have (n : _) : Integrable (s' n x) ν := by
apply (hfx.norm.add hfx.norm).mono' (s' n x).aestronglyMeasurable
filter_upwards with y
simp_rw [s', SimpleFunc.coe_comp]; exact SimpleFunc.norm_approxOn_zero_le _ _ (x, y) n
simp only [f', hfx, SimpleFunc.integral_eq_integral _ (this _), indicator_of_mem,
mem_setOf_eq]
refine
tendsto_integral_of_dominated_convergence (fun y => ‖f x y‖ + ‖f x y‖)
(fun n => (s' n x).aestronglyMeasurable) (hfx.norm.add hfx.norm) ?_ ?_
· refine fun n => Eventually.of_forall fun y =>
SimpleFunc.norm_approxOn_zero_le ?_ ?_ (x, y) n
· exact hf.measurable
· simp
· refine Eventually.of_forall fun y => SimpleFunc.tendsto_approxOn ?_ ?_ ?_
· exact hf.measurable.of_uncurry_left
· simp
apply subset_closure
simp [-uncurry_apply_pair]
· simp [f', hfx, integral_undef]
exact stronglyMeasurable_of_tendsto _ hf' h2f'
/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
Fubini's theorem is measurable. -/
theorem MeasureTheory.StronglyMeasurable.integral_prod_right' [SFinite ν] ⦃f : α × β → E⦄
(hf : StronglyMeasurable f) : StronglyMeasurable fun x => ∫ y, f (x, y) ∂ν := by
rw [← uncurry_curry f] at hf; exact hf.integral_prod_right
/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
the symmetric version of Fubini's theorem is measurable.
This version has `f` in curried form. -/
theorem MeasureTheory.StronglyMeasurable.integral_prod_left [SFinite μ] ⦃f : α → β → E⦄
(hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun y => ∫ x, f x y ∂μ :=
(hf.comp_measurable measurable_swap).integral_prod_right'
/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
the symmetric version of Fubini's theorem is measurable. -/
theorem MeasureTheory.StronglyMeasurable.integral_prod_left' [SFinite μ] ⦃f : α × β → E⦄
(hf : StronglyMeasurable f) : StronglyMeasurable fun y => ∫ x, f (x, y) ∂μ :=
(hf.comp_measurable measurable_swap).integral_prod_right'
end
/-! ### The product measure -/
namespace MeasureTheory
namespace Measure
variable [SFinite ν]
theorem integrable_measure_prodMk_left {s : Set (α × β)} (hs : MeasurableSet s)
(h2s : (μ.prod ν) s ≠ ∞) : Integrable (fun x => ν.real (Prod.mk x ⁻¹' s)) μ := by
refine ⟨(measurable_measure_prodMk_left hs).ennreal_toReal.aemeasurable.aestronglyMeasurable, ?_⟩
simp_rw [hasFiniteIntegral_iff_enorm, measureReal_def, enorm_eq_ofReal toReal_nonneg]
convert h2s.lt_top using 1
rw [prod_apply hs]
apply lintegral_congr_ae
filter_upwards [ae_measure_lt_top hs h2s] with x hx
rw [lt_top_iff_ne_top] at hx
simp [ofReal_toReal, hx]
end Measure
open Measure
end MeasureTheory
open MeasureTheory.Measure
section
variable {X : Type*} [TopologicalSpace X]
protected theorem MeasureTheory.AEStronglyMeasurable.prod_swap [SFinite μ] [SFinite ν]
{f : β × α → X} (hf : AEStronglyMeasurable f (ν.prod μ)) :
AEStronglyMeasurable (fun z : α × β => f z.swap) (μ.prod ν) := by
rw [← prod_swap] at hf
exact hf.comp_measurable measurable_swap
theorem MeasureTheory.AEStronglyMeasurable.comp_fst {γ} [TopologicalSpace γ] {f : α → γ}
(hf : AEStronglyMeasurable f μ) : AEStronglyMeasurable (fun z : α × β => f z.1) (μ.prod ν) :=
hf.comp_quasiMeasurePreserving quasiMeasurePreserving_fst
theorem MeasureTheory.AEStronglyMeasurable.comp_snd {γ} [TopologicalSpace γ] {f : β → γ}
(hf : AEStronglyMeasurable f ν) : AEStronglyMeasurable (fun z : α × β => f z.2) (μ.prod ν) :=
hf.comp_quasiMeasurePreserving quasiMeasurePreserving_snd
/-- The Bochner integral is a.e.-measurable.
This shows that the integrand of (the right-hand-side of) Fubini's theorem is a.e.-measurable. -/
theorem MeasureTheory.AEStronglyMeasurable.integral_prod_right' [SFinite ν] [NormedSpace ℝ E]
⦃f : α × β → E⦄ (hf : AEStronglyMeasurable f (μ.prod ν)) :
AEStronglyMeasurable (fun x => ∫ y, f (x, y) ∂ν) μ :=
⟨fun x => ∫ y, hf.mk f (x, y) ∂ν, hf.stronglyMeasurable_mk.integral_prod_right', by
filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk] with _ hx using integral_congr_ae hx⟩
theorem MeasureTheory.AEStronglyMeasurable.prodMk_left [SFinite ν] {f : α × β → X}
(hf : AEStronglyMeasurable f (μ.prod ν)) :
∀ᵐ x ∂μ, AEStronglyMeasurable (fun y => f (x, y)) ν := by
filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk] with x hx
exact ⟨fun y ↦ hf.mk f (x, y),
hf.stronglyMeasurable_mk.comp_measurable measurable_prodMk_left, hx⟩
theorem MeasureTheory.AEStronglyMeasurable.prodMk_right [SFinite μ] [SFinite ν] {f : α × β → X}
(hf : AEStronglyMeasurable f (μ.prod ν)) :
∀ᵐ y ∂ν, AEStronglyMeasurable (fun x => f (x, y)) μ :=
hf.prod_swap.prodMk_left
protected theorem MeasureTheory.AEStronglyMeasurable.of_comp_snd {f : β → X} [SFinite ν]
(hf : AEStronglyMeasurable (f ·.2) (μ.prod ν)) (hμ : μ ≠ 0) : AEStronglyMeasurable f ν := by
have := NeZero.mk hμ
obtain ⟨y, hy⟩ := hf.prodMk_left.exists
exact hy
protected theorem MeasureTheory.AEStronglyMeasurable.of_comp_fst {f : α → X} [SFinite μ] [SFinite ν]
(hf : AEStronglyMeasurable (f ·.1) (μ.prod ν)) (hν : ν ≠ 0) : AEStronglyMeasurable f μ :=
hf.prod_swap.of_comp_snd hν
theorem MeasureTheory.AEStronglyMeasurable.comp_fst_iff [SFinite μ] [SFinite ν] {f : α → X}
(hν : ν ≠ 0) : AEStronglyMeasurable (f ·.1) (μ.prod ν) ↔ AEStronglyMeasurable f μ :=
⟨(.of_comp_fst · hν), .comp_fst⟩
theorem MeasureTheory.AEStronglyMeasurable.comp_snd_iff [SFinite ν] {f : β → X}
(hμ : μ ≠ 0) : AEStronglyMeasurable (f ·.2) (μ.prod ν) ↔ AEStronglyMeasurable f ν :=
⟨(.of_comp_snd · hμ), .comp_snd⟩
end
namespace MeasureTheory
variable [SFinite ν]
/-! ### Integrability on a product -/
section
theorem integrable_swap_iff [SFinite μ] {f : α × β → E} :
Integrable (f ∘ Prod.swap) (ν.prod μ) ↔ Integrable f (μ.prod ν) :=
measurePreserving_swap.integrable_comp_emb MeasurableEquiv.prodComm.measurableEmbedding
theorem Integrable.swap [SFinite μ] ⦃f : α × β → E⦄ (hf : Integrable f (μ.prod ν)) :
Integrable (f ∘ Prod.swap) (ν.prod μ) :=
integrable_swap_iff.2 hf
theorem hasFiniteIntegral_prod_iff ⦃f : α × β → E⦄ (h1f : StronglyMeasurable f) :
HasFiniteIntegral f (μ.prod ν) ↔
(∀ᵐ x ∂μ, HasFiniteIntegral (fun y => f (x, y)) ν) ∧
HasFiniteIntegral (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ := by
simp only [hasFiniteIntegral_iff_enorm, lintegral_prod _ h1f.enorm.aemeasurable]
have (x : _) : ∀ᵐ y ∂ν, 0 ≤ ‖f (x, y)‖ := by filter_upwards with y using norm_nonneg _
simp_rw [integral_eq_lintegral_of_nonneg_ae (this _)
(h1f.norm.comp_measurable measurable_prodMk_left).aestronglyMeasurable,
enorm_eq_ofReal toReal_nonneg, ofReal_norm_eq_enorm]
-- this fact is probably too specialized to be its own lemma
have : ∀ {p q r : Prop} (_ : r → p), (r ↔ p ∧ q) ↔ p → (r ↔ q) := fun {p q r} h1 => by
rw [← and_congr_right_iff, and_iff_right_of_imp h1]
rw [this]
· intro h2f; rw [lintegral_congr_ae]
filter_upwards [h2f] with x hx
rw [ofReal_toReal]; rw [← lt_top_iff_ne_top]; exact hx
· intro h2f; refine ae_lt_top ?_ h2f.ne; exact h1f.enorm.lintegral_prod_right'
theorem hasFiniteIntegral_prod_iff' ⦃f : α × β → E⦄ (h1f : AEStronglyMeasurable f (μ.prod ν)) :
HasFiniteIntegral f (μ.prod ν) ↔
(∀ᵐ x ∂μ, HasFiniteIntegral (fun y => f (x, y)) ν) ∧
HasFiniteIntegral (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ := by
rw [hasFiniteIntegral_congr h1f.ae_eq_mk,
hasFiniteIntegral_prod_iff h1f.stronglyMeasurable_mk]
apply and_congr
· apply eventually_congr
filter_upwards [ae_ae_of_ae_prod h1f.ae_eq_mk.symm]
intro x hx
exact hasFiniteIntegral_congr hx
· apply hasFiniteIntegral_congr
filter_upwards [ae_ae_of_ae_prod h1f.ae_eq_mk.symm] with _ hx using
integral_congr_ae (EventuallyEq.fun_comp hx _)
/-- A binary function is integrable if the function `y ↦ f (x, y)` is integrable for almost every
`x` and the function `x ↦ ∫ ‖f (x, y)‖ dy` is integrable. -/
theorem integrable_prod_iff ⦃f : α × β → E⦄ (h1f : AEStronglyMeasurable f (μ.prod ν)) :
Integrable f (μ.prod ν) ↔
(∀ᵐ x ∂μ, Integrable (fun y => f (x, y)) ν) ∧ Integrable (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ := by
simp [Integrable, h1f, hasFiniteIntegral_prod_iff', h1f.norm.integral_prod_right',
h1f.prodMk_left]
/-- A binary function is integrable if the function `x ↦ f (x, y)` is integrable for almost every
`y` and the function `y ↦ ∫ ‖f (x, y)‖ dx` is integrable. -/
theorem integrable_prod_iff' [SFinite μ] ⦃f : α × β → E⦄
(h1f : AEStronglyMeasurable f (μ.prod ν)) :
Integrable f (μ.prod ν) ↔
(∀ᵐ y ∂ν, Integrable (fun x => f (x, y)) μ) ∧ Integrable (fun y => ∫ x, ‖f (x, y)‖ ∂μ) ν := by
convert integrable_prod_iff h1f.prod_swap using 1
rw [funext fun _ => Function.comp_apply.symm, integrable_swap_iff]
theorem Integrable.prod_left_ae [SFinite μ] ⦃f : α × β → E⦄ (hf : Integrable f (μ.prod ν)) :
∀ᵐ y ∂ν, Integrable (fun x => f (x, y)) μ :=
((integrable_prod_iff' hf.aestronglyMeasurable).mp hf).1
theorem Integrable.prod_right_ae [SFinite μ] ⦃f : α × β → E⦄ (hf : Integrable f (μ.prod ν)) :
∀ᵐ x ∂μ, Integrable (fun y => f (x, y)) ν :=
hf.swap.prod_left_ae
theorem Integrable.integral_norm_prod_left ⦃f : α × β → E⦄ (hf : Integrable f (μ.prod ν)) :
Integrable (fun x => ∫ y, ‖f (x, y)‖ ∂ν) μ :=
((integrable_prod_iff hf.aestronglyMeasurable).mp hf).2
theorem Integrable.integral_norm_prod_right [SFinite μ] ⦃f : α × β → E⦄
(hf : Integrable f (μ.prod ν)) : Integrable (fun y => ∫ x, ‖f (x, y)‖ ∂μ) ν :=
hf.swap.integral_norm_prod_left
omit [SFinite ν] in
theorem Integrable.op_fst_snd {F G : Type*} [NormedAddCommGroup F] [NormedAddCommGroup G]
{op : E → F → G} (hop : Continuous op.uncurry) (hop_norm : ∃ C, ∀ x y, ‖op x y‖ ≤ C * ‖x‖ * ‖y‖)
{f : α → E} {g : β → F} (hf : Integrable f μ) (hg : Integrable g ν) :
Integrable (fun z ↦ op (f z.1) (g z.2)) (μ.prod ν) := by
use hop.comp_aestronglyMeasurable₂ hf.1.comp_fst hg.1.comp_snd
rcases hop_norm with ⟨C, hC⟩
calc
∫⁻ z, ‖op (f z.1) (g z.2)‖ₑ ∂μ.prod ν ≤ ∫⁻ z, .ofReal C * ‖f z.1‖ₑ * ‖g z.2‖ₑ ∂μ.prod ν := by
gcongr with z
simp only [enorm_eq_nnnorm, ENNReal.ofReal, ← ENNReal.coe_mul, ENNReal.coe_le_coe,
← NNReal.coe_le_coe, NNReal.coe_mul, coe_nnnorm]
refine (hC _ _).trans ?_
gcongr
apply le_coe_toNNReal
_ ≤ ∫⁻ x, ∫⁻ y, .ofReal C * ‖f x‖ₑ * ‖g y‖ₑ ∂ν ∂μ := lintegral_prod_le _
_ ≤ .ofReal C * (∫⁻ x, ‖f x‖ₑ ∂μ) * ∫⁻ y, ‖g y‖ₑ ∂ν := by
simp [lintegral_const_mul', lintegral_mul_const', hg.2.ne, mul_assoc]
_ < ∞ := by apply_rules [ENNReal.mul_lt_top, hf.2, hg.2, ENNReal.ofReal_lt_top]
lemma Integrable.comp_fst {f : α → E} (hf : Integrable f μ) (ν : Measure β) [IsFiniteMeasure ν] :
Integrable (fun x ↦ f x.1) (μ.prod ν) := by
rw [← memLp_one_iff_integrable] at hf ⊢
exact hf.comp_fst ν
lemma Integrable.comp_snd {f : β → E} (hf : Integrable f ν) (μ : Measure α) [IsFiniteMeasure μ] :
Integrable (fun x ↦ f x.2) (μ.prod ν) := by
rw [← memLp_one_iff_integrable] at hf ⊢
exact hf.comp_snd μ
omit [SFinite ν] in
theorem Integrable.smul_prod {R : Type*} [NormedRing R] [Module R E] [IsBoundedSMul R E]
{f : α → R} {g : β → E} (hf : Integrable f μ) (hg : Integrable g ν) :
Integrable (fun z : α × β => f z.1 • g z.2) (μ.prod ν) :=
hf.op_fst_snd continuous_smul ⟨1, by simpa using norm_smul_le⟩ hg
omit [SFinite ν] in
theorem Integrable.mul_prod {L : Type*} [NormedRing L] {f : α → L} {g : β → L} (hf : Integrable f μ)
(hg : Integrable g ν) : Integrable (fun z : α × β => f z.1 * g z.2) (μ.prod ν) :=
hf.smul_prod hg
theorem IntegrableOn.swap [SFinite μ] {f : α × β → E} {s : Set α} {t : Set β}
(hf : IntegrableOn f (s ×ˢ t) (μ.prod ν)) :
IntegrableOn (f ∘ Prod.swap) (t ×ˢ s) (ν.prod μ) := by
rw [IntegrableOn, ← Measure.prod_restrict] at hf ⊢
exact hf.swap
theorem Integrable.of_comp_snd {f : β → E} (hf : Integrable (f ·.2) (μ.prod ν)) (hμ : μ ≠ 0) :
Integrable f ν := by
rcases hf with ⟨hf_meas, hf_fin⟩
use hf_meas.of_comp_snd hμ
have := hf_meas.enorm
aesop (add simp [HasFiniteIntegral, lintegral_prod, ENNReal.mul_lt_top_iff])
theorem Integrable.of_comp_fst [SFinite μ] {f : α → E} (hf : Integrable (f ·.1) (μ.prod ν))
(hν : ν ≠ 0) : Integrable f μ :=
hf.swap.of_comp_snd hν
theorem Integrable.comp_snd_iff [IsFiniteMeasure μ] {f : β → E} (hμ : μ ≠ 0) :
Integrable (f ·.2) (μ.prod ν) ↔ Integrable f ν :=
⟨(.of_comp_snd · hμ), (.comp_snd · μ)⟩
omit [SFinite ν] in
theorem Integrable.comp_fst_iff [SFinite μ] [IsFiniteMeasure ν] {f : α → E} (hν : ν ≠ 0) :
Integrable (f ·.1) (μ.prod ν) ↔ Integrable f μ :=
⟨(.of_comp_fst · hν), (.comp_fst · ν)⟩
end
variable [NormedSpace ℝ E]
theorem Integrable.integral_prod_left ⦃f : α × β → E⦄ (hf : Integrable f (μ.prod ν)) :
Integrable (fun x => ∫ y, f (x, y) ∂ν) μ :=
Integrable.mono hf.integral_norm_prod_left hf.aestronglyMeasurable.integral_prod_right' <|
Eventually.of_forall fun x =>
(norm_integral_le_integral_norm _).trans_eq <|
(norm_of_nonneg <|
integral_nonneg_of_ae <|
Eventually.of_forall fun y => (norm_nonneg (f (x, y)) :)).symm
theorem Integrable.integral_prod_right [SFinite μ] ⦃f : α × β → E⦄
(hf : Integrable f (μ.prod ν)) : Integrable (fun y => ∫ x, f (x, y) ∂μ) ν :=
hf.swap.integral_prod_left
/-! ### The Bochner integral on a product -/
variable [SFinite μ]
theorem integral_prod_swap (f : α × β → E) :
∫ z, f z.swap ∂ν.prod μ = ∫ z, f z ∂μ.prod ν :=
measurePreserving_swap.integral_comp MeasurableEquiv.prodComm.measurableEmbedding _
theorem setIntegral_prod_swap (s : Set α) (t : Set β) (f : α × β → E) :
∫ (z : β × α) in t ×ˢ s, f z.swap ∂ν.prod μ = ∫ (z : α × β) in s ×ˢ t, f z ∂μ.prod ν := by
rw [← Measure.prod_restrict, ← Measure.prod_restrict, integral_prod_swap]
variable {E' : Type*} [NormedAddCommGroup E'] [NormedSpace ℝ E']
/-! Some rules about the sum/difference of double integrals. They follow from `integral_add`, but
we separate them out as separate lemmas, because they involve quite some steps. -/
/-- Integrals commute with addition inside another integral. `F` can be any function. -/
theorem integral_fn_integral_add ⦃f g : α × β → E⦄ (F : E → E') (hf : Integrable f (μ.prod ν))
(hg : Integrable g (μ.prod ν)) :
(∫ x, F (∫ y, f (x, y) + g (x, y) ∂ν) ∂μ) =
∫ x, F ((∫ y, f (x, y) ∂ν) + ∫ y, g (x, y) ∂ν) ∂μ := by
refine integral_congr_ae ?_
filter_upwards [hf.prod_right_ae, hg.prod_right_ae] with _ h2f h2g
simp [integral_add h2f h2g]
/-- Integrals commute with subtraction inside another integral.
`F` can be any measurable function. -/
theorem integral_fn_integral_sub ⦃f g : α × β → E⦄ (F : E → E') (hf : Integrable f (μ.prod ν))
(hg : Integrable g (μ.prod ν)) :
(∫ x, F (∫ y, f (x, y) - g (x, y) ∂ν) ∂μ) =
∫ x, F ((∫ y, f (x, y) ∂ν) - ∫ y, g (x, y) ∂ν) ∂μ := by
refine integral_congr_ae ?_
filter_upwards [hf.prod_right_ae, hg.prod_right_ae] with _ h2f h2g
simp [integral_sub h2f h2g]
/-- Integrals commute with subtraction inside a lower Lebesgue integral.
`F` can be any function. -/
theorem lintegral_fn_integral_sub ⦃f g : α × β → E⦄ (F : E → ℝ≥0∞) (hf : Integrable f (μ.prod ν))
(hg : Integrable g (μ.prod ν)) :
(∫⁻ x, F (∫ y, f (x, y) - g (x, y) ∂ν) ∂μ) =
∫⁻ x, F ((∫ y, f (x, y) ∂ν) - ∫ y, g (x, y) ∂ν) ∂μ := by
refine lintegral_congr_ae ?_
filter_upwards [hf.prod_right_ae, hg.prod_right_ae] with _ h2f h2g
simp [integral_sub h2f h2g]
/-- Double integrals commute with addition. -/
theorem integral_integral_add ⦃f g : α × β → E⦄ (hf : Integrable f (μ.prod ν))
(hg : Integrable g (μ.prod ν)) :
(∫ x, ∫ y, f (x, y) + g (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) + ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
(integral_fn_integral_add id hf hg).trans <|
integral_add hf.integral_prod_left hg.integral_prod_left
/-- Double integrals commute with addition. This is the version with `(f + g) (x, y)`
(instead of `f (x, y) + g (x, y)`) in the LHS. -/
theorem integral_integral_add' ⦃f g : α × β → E⦄ (hf : Integrable f (μ.prod ν))
(hg : Integrable g (μ.prod ν)) :
(∫ x, ∫ y, (f + g) (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) + ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
integral_integral_add hf hg
/-- Double integrals commute with subtraction. -/
theorem integral_integral_sub ⦃f g : α × β → E⦄ (hf : Integrable f (μ.prod ν))
(hg : Integrable g (μ.prod ν)) :
(∫ x, ∫ y, f (x, y) - g (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) - ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
(integral_fn_integral_sub id hf hg).trans <|
integral_sub hf.integral_prod_left hg.integral_prod_left
/-- Double integrals commute with subtraction. This is the version with `(f - g) (x, y)`
(instead of `f (x, y) - g (x, y)`) in the LHS. -/
theorem integral_integral_sub' ⦃f g : α × β → E⦄ (hf : Integrable f (μ.prod ν))
(hg : Integrable g (μ.prod ν)) :
(∫ x, ∫ y, (f - g) (x, y) ∂ν ∂μ) = (∫ x, ∫ y, f (x, y) ∂ν ∂μ) - ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
integral_integral_sub hf hg
/-- The map that sends an L¹-function `f : α × β → E` to `∫∫f` is continuous. -/
theorem continuous_integral_integral :
Continuous fun f : α × β →₁[μ.prod ν] E => ∫ x, ∫ y, f (x, y) ∂ν ∂μ := by
rw [continuous_iff_continuousAt]; intro g
refine
tendsto_integral_of_L1 _ (L1.integrable_coeFn g).integral_prod_left
(Eventually.of_forall fun h => (L1.integrable_coeFn h).integral_prod_left) ?_
simp_rw [← lintegral_fn_integral_sub _ (L1.integrable_coeFn _) (L1.integrable_coeFn g)]
apply tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds _ (fun i => zero_le _) _
· exact fun i => ∫⁻ x, ∫⁻ y, ‖i (x, y) - g (x, y)‖ₑ ∂ν ∂μ
swap; · exact fun i => lintegral_mono fun x => enorm_integral_le_lintegral_enorm _
change
Tendsto (fun i : α × β →₁[μ.prod ν] E => ∫⁻ x, ∫⁻ y : β, ‖i (x, y) - g (x, y)‖ₑ ∂ν ∂μ) (𝓝 g)
(𝓝 0)
have this (i : α × β →₁[μ.prod ν] E) : Measurable fun z => ‖i z - g z‖ₑ :=
((Lp.stronglyMeasurable i).sub (Lp.stronglyMeasurable g)).enorm
simp_rw [← lintegral_prod _ (this _).aemeasurable, ← L1.ofReal_norm_sub_eq_lintegral,
← ofReal_zero]
refine (continuous_ofReal.tendsto 0).comp ?_
rw [← tendsto_iff_norm_sub_tendsto_zero]; exact tendsto_id
/-- **Fubini's Theorem**: For integrable functions on `α × β`,
the Bochner integral of `f` is equal to the iterated Bochner integral.
`integrable_prod_iff` can be useful to show that the function in question in integrable.
`MeasureTheory.Integrable.integral_prod_right` is useful to show that the inner integral
of the right-hand side is integrable. -/
theorem integral_prod (f : α × β → E) (hf : Integrable f (μ.prod ν)) :
∫ z, f z ∂μ.prod ν = ∫ x, ∫ y, f (x, y) ∂ν ∂μ := by
by_cases hE : CompleteSpace E; swap; · simp only [integral, dif_neg hE]
revert f
apply Integrable.induction
· intro c s hs h2s
simp_rw [integral_indicator hs, ← indicator_comp_right, Function.comp_def,
integral_indicator (measurable_prodMk_left hs), setIntegral_const, integral_smul_const,
measureReal_def,
integral_toReal (measurable_measure_prodMk_left hs).aemeasurable
(ae_measure_lt_top hs h2s.ne)]
rw [prod_apply hs]
· rintro f g - i_f i_g hf hg
simp_rw [integral_add' i_f i_g, integral_integral_add' i_f i_g, hf, hg]
· exact isClosed_eq continuous_integral continuous_integral_integral
· rintro f g hfg - hf; convert hf using 1
· exact integral_congr_ae hfg.symm
· apply integral_congr_ae
filter_upwards [ae_ae_of_ae_prod hfg] with x hfgx using integral_congr_ae (ae_eq_symm hfgx)
/-- Symmetric version of **Fubini's Theorem**: For integrable functions on `α × β`,
the Bochner integral of `f` is equal to the iterated Bochner integral.
This version has the integrals on the right-hand side in the other order. -/
theorem integral_prod_symm (f : α × β → E) (hf : Integrable f (μ.prod ν)) :
∫ z, f z ∂μ.prod ν = ∫ y, ∫ x, f (x, y) ∂μ ∂ν := by
rw [← integral_prod_swap f]; exact integral_prod _ hf.swap
/-- Reversed version of **Fubini's Theorem**. -/
theorem integral_integral {f : α → β → E} (hf : Integrable (uncurry f) (μ.prod ν)) :
∫ x, ∫ y, f x y ∂ν ∂μ = ∫ z, f z.1 z.2 ∂μ.prod ν :=
(integral_prod _ hf).symm
/-- Reversed version of **Fubini's Theorem** (symmetric version). -/
theorem integral_integral_symm {f : α → β → E} (hf : Integrable (uncurry f) (μ.prod ν)) :
∫ x, ∫ y, f x y ∂ν ∂μ = ∫ z, f z.2 z.1 ∂ν.prod μ :=
(integral_prod_symm _ hf.swap).symm
/-- Change the order of Bochner integration. -/
theorem integral_integral_swap ⦃f : α → β → E⦄ (hf : Integrable (uncurry f) (μ.prod ν)) :
∫ x, ∫ y, f x y ∂ν ∂μ = ∫ y, ∫ x, f x y ∂μ ∂ν :=
(integral_integral hf).trans (integral_prod_symm _ hf)
/-- Change the order of integration, when one of the integrals is an interval integral. -/
lemma intervalIntegral_integral_swap {a b : ℝ} {f : ℝ → α → E}
(h_int : Integrable (uncurry f) ((volume.restrict (Set.uIoc a b)).prod μ)) :
∫ x in a..b, ∫ y, f x y ∂μ = ∫ y, (∫ x in a..b, f x y) ∂μ := by
rcases le_total a b with (hab | hab)
· simp_rw [intervalIntegral.integral_of_le hab]
simp only [hab, Set.uIoc_of_le] at h_int
exact integral_integral_swap h_int
· simp_rw [intervalIntegral.integral_of_ge hab]
simp only [hab, Set.uIoc_of_ge] at h_int
rw [integral_integral_swap h_int, integral_neg]
/-- **Fubini's Theorem** for set integrals. -/
theorem setIntegral_prod (f : α × β → E) {s : Set α} {t : Set β}
(hf : IntegrableOn f (s ×ˢ t) (μ.prod ν)) :
∫ z in s ×ˢ t, f z ∂μ.prod ν = ∫ x in s, ∫ y in t, f (x, y) ∂ν ∂μ := by
simp only [← Measure.prod_restrict s t, IntegrableOn] at hf ⊢
exact integral_prod f hf
theorem integral_prod_smul {𝕜 : Type*} [RCLike 𝕜] [NormedSpace 𝕜 E] (f : α → 𝕜) (g : β → E) :
∫ z, f z.1 • g z.2 ∂μ.prod ν = (∫ x, f x ∂μ) • ∫ y, g y ∂ν := by
by_cases hE : CompleteSpace E; swap; · simp [integral, hE]
by_cases h : Integrable (fun z : α × β => f z.1 • g z.2) (μ.prod ν)
· rw [integral_prod _ h]
simp_rw [integral_smul, integral_smul_const]
have H : ¬Integrable f μ ∨ ¬Integrable g ν := by
contrapose! h
exact h.1.smul_prod h.2
rcases H with H | H <;> simp [integral_undef h, integral_undef H]
theorem integral_prod_mul {L : Type*} [RCLike L] (f : α → L) (g : β → L) :
∫ z, f z.1 * g z.2 ∂μ.prod ν = (∫ x, f x ∂μ) * ∫ y, g y ∂ν :=
integral_prod_smul f g
theorem setIntegral_prod_mul {L : Type*} [RCLike L] (f : α → L) (g : β → L) (s : Set α)
(t : Set β) :
∫ z in s ×ˢ t, f z.1 * g z.2 ∂μ.prod ν = (∫ x in s, f x ∂μ) * ∫ y in t, g y ∂ν := by
rw [← Measure.prod_restrict s t]
apply integral_prod_mul
theorem integral_fun_snd (f : β → E) : ∫ z, f z.2 ∂μ.prod ν = μ.real univ • ∫ y, f y ∂ν := by
simpa using integral_prod_smul (1 : α → ℝ) f
theorem integral_fun_fst (f : α → E) : ∫ z, f z.1 ∂μ.prod ν = ν.real univ • ∫ x, f x ∂μ := by
rw [← integral_prod_swap]
apply integral_fun_snd
section ContinuousLinearMap
variable {E F G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {mE : MeasurableSpace E}
[NormedAddCommGroup F] [NormedSpace ℝ F] {mF : MeasurableSpace F}
[NormedAddCommGroup G] [NormedSpace ℝ G] {mG : MeasurableSpace G}
{μ : Measure E} [IsProbabilityMeasure μ] {ν : Measure F} [IsProbabilityMeasure ν]
{L : E × F →L[ℝ] G}
lemma integrable_continuousLinearMap_prod'
(hLμ : Integrable (L.comp (.inl ℝ E F)) μ) (hLν : Integrable (L.comp (.inr ℝ E F)) ν) :
Integrable L (μ.prod ν) := by
change Integrable (fun v ↦ L v) (μ.prod ν)
simp_rw [← L.comp_inl_add_comp_inr]
exact (hLμ.comp_fst ν).add (hLν.comp_snd μ)
lemma integrable_continuousLinearMap_prod (hμ : Integrable id μ) (hν : Integrable id ν) :
Integrable L (μ.prod ν) :=
integrable_continuousLinearMap_prod' (ContinuousLinearMap.integrable_comp _ hμ)
(ContinuousLinearMap.integrable_comp _ hν)
variable [CompleteSpace G]
lemma integral_continuousLinearMap_prod'
(hLμ : Integrable (L.comp (.inl ℝ E F)) μ) (hLν : Integrable (L.comp (.inr ℝ E F)) ν) :
∫ p, L p ∂(μ.prod ν) = ∫ x, L.comp (.inl ℝ E F) x ∂μ + ∫ y, L.comp (.inr ℝ E F) y ∂ν := by
simp_rw [← L.comp_inl_add_comp_inr]
replace hLμ := ((memLp_one_iff_integrable.mpr hLμ).comp_fst ν).integrable le_rfl
replace hLν := ((memLp_one_iff_integrable.mpr hLν).comp_snd μ).integrable le_rfl
rw [integral_add hLμ hLν, integral_prod _ hLμ, integral_prod _ hLν]
simp
lemma integral_continuousLinearMap_prod (hμ : Integrable id μ) (hν : Integrable id ν) :
∫ p, L p ∂(μ.prod ν) = ∫ x, L.comp (.inl ℝ E F) x ∂μ + ∫ y, L.comp (.inr ℝ E F) y ∂ν :=
integral_continuousLinearMap_prod' (ContinuousLinearMap.integrable_comp _ hμ)
(ContinuousLinearMap.integrable_comp _ hν)
end ContinuousLinearMap
section
variable {X Y : Type*}
[TopologicalSpace X] [TopologicalSpace Y] [MeasurableSpace X] [MeasurableSpace Y]
[OpensMeasurableSpace X] [OpensMeasurableSpace Y]
/-- A version of *Fubini theorem* for continuous functions with compact support: one may swap
the order of integration with respect to locally finite measures. One does not assume that the
measures are σ-finite, contrary to the usual Fubini theorem. -/
lemma integral_integral_swap_of_hasCompactSupport
{f : X → Y → E} (hf : Continuous f.uncurry) (h'f : HasCompactSupport f.uncurry)
{μ : Measure X} {ν : Measure Y} [IsFiniteMeasureOnCompacts μ] [IsFiniteMeasureOnCompacts ν] :
∫ x, (∫ y, f x y ∂ν) ∂μ = ∫ y, (∫ x, f x y ∂μ) ∂ν := by
let U := Prod.fst '' (tsupport f.uncurry)
have : Fact (μ U < ∞) := ⟨(IsCompact.image h'f continuous_fst).measure_lt_top⟩
let V := Prod.snd '' (tsupport f.uncurry)
have : Fact (ν V < ∞) := ⟨(IsCompact.image h'f continuous_snd).measure_lt_top⟩
calc
∫ x, (∫ y, f x y ∂ν) ∂μ = ∫ x, (∫ y in V, f x y ∂ν) ∂μ := by
congr 1 with x
apply (setIntegral_eq_integral_of_forall_compl_eq_zero (fun y hy ↦ ?_)).symm
contrapose! hy
have : (x, y) ∈ Function.support f.uncurry := hy
exact mem_image_of_mem _ (subset_tsupport _ this)
_ = ∫ x in U, (∫ y in V, f x y ∂ν) ∂μ := by
apply (setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx ↦ ?_)).symm
have : ∀ y, f x y = 0 := by
intro y
contrapose! hx
have : (x, y) ∈ Function.support f.uncurry := hx
exact mem_image_of_mem _ (subset_tsupport _ this)
simp [this]
_ = ∫ y in V, (∫ x in U, f x y ∂μ) ∂ν := by
apply integral_integral_swap
apply (integrableOn_iff_integrable_of_support_subset (subset_tsupport f.uncurry)).mp
refine ⟨(h'f.stronglyMeasurable_of_prod hf).aestronglyMeasurable, ?_⟩
obtain ⟨C, hC⟩ : ∃ C, ∀ p, ‖f.uncurry p‖ ≤ C := hf.bounded_above_of_compact_support h'f
exact .of_bounded (C := C) (.of_forall hC)
_ = ∫ y, (∫ x in U, f x y ∂μ) ∂ν := by
apply setIntegral_eq_integral_of_forall_compl_eq_zero (fun y hy ↦ ?_)
have : ∀ x, f x y = 0 := by
intro x
contrapose! hy
have : (x, y) ∈ Function.support f.uncurry := hy
exact mem_image_of_mem _ (subset_tsupport _ this)
simp [this]
_ = ∫ y, (∫ x, f x y ∂μ) ∂ν := by
congr 1 with y
apply setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx ↦ ?_)
contrapose! hx
have : (x, y) ∈ Function.support f.uncurry := hx
exact mem_image_of_mem _ (subset_tsupport _ this)
end
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/SetIntegral.lean | import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap
import Mathlib.MeasureTheory.Integral.Bochner.FundThmCalculus
import Mathlib.MeasureTheory.Integral.Bochner.Set
deprecated_module (since := "2025-04-15") |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/Pi.lean | import Mathlib.MeasureTheory.Integral.Prod
/-!
# Integration with respect to a finite product of measures
On a finite product of measure spaces, we show that a product of integrable functions each
depending on a single coordinate is integrable, in `MeasureTheory.integrable_fintype_prod`, and
that its integral is the product of the individual integrals,
in `MeasureTheory.integral_fintype_prod_eq_prod`.
-/
open Fintype MeasureTheory MeasureTheory.Measure
namespace MeasureTheory
variable {𝕜 ι : Type*} [Fintype ι]
namespace Integrable
variable [NormedCommRing 𝕜]
/-- On a finite product space in `n` variables, for a natural number `n`, a product of integrable
functions depending on each coordinate is integrable. -/
theorem fin_nat_prod {n : ℕ} {E : Fin n → Type*}
{mE : ∀ i, MeasurableSpace (E i)} {μ : (i : Fin n) → Measure (E i)} [∀ i, SigmaFinite (μ i)]
{f : (i : Fin n) → E i → 𝕜} (hf : ∀ i, Integrable (f i) (μ i)) :
Integrable (fun (x : (i : Fin n) → E i) ↦ ∏ i, f i (x i)) (Measure.pi μ) := by
induction n with
| zero => simp only [Finset.univ_eq_empty, Finset.prod_empty, isFiniteMeasure_iff,
integrable_const_iff, pi_empty_univ, ENNReal.one_lt_top, or_true]
| succ n n_ih =>
have := ((measurePreserving_piFinSuccAbove μ 0).symm)
rw [← this.integrable_comp_emb (MeasurableEquiv.measurableEmbedding _)]
simp_rw [MeasurableEquiv.piFinSuccAbove_symm_apply, Fin.insertNthEquiv,
Fin.prod_univ_succ, Fin.insertNth_zero]
simp only [Fin.zero_succAbove, cast_eq, Function.comp_def]
have : Integrable (fun (x : (j : Fin n) → E (Fin.succ j)) ↦ ∏ j, f (Fin.succ j) (x j))
(Measure.pi (fun i ↦ μ i.succ)) :=
n_ih (fun i ↦ hf _)
exact Integrable.mul_prod (hf 0) this
/-- On a finite product space, a product of integrable functions depending on each coordinate is
integrable. Version with dependent target. -/
theorem fintype_prod_dep {E : ι → Type*}
{f : (i : ι) → E i → 𝕜} {mE : ∀ i, MeasurableSpace (E i)} {μ : (i : ι) → Measure (E i)}
[∀ i, SigmaFinite (μ i)]
(hf : ∀ i, Integrable (f i) (μ i)) :
Integrable (fun (x : (i : ι) → E i) ↦ ∏ i, f i (x i)) (Measure.pi μ) := by
let e := (equivFin ι).symm
simp_rw [← (measurePreserving_piCongrLeft _ e).integrable_comp_emb
(MeasurableEquiv.measurableEmbedding _),
← e.prod_comp, MeasurableEquiv.coe_piCongrLeft, Function.comp_def,
Equiv.piCongrLeft_apply_apply]
exact .fin_nat_prod (fun i ↦ hf _)
/-- On a finite product space, a product of integrable functions depending on each coordinate is
integrable. -/
theorem fintype_prod {E : Type*}
{f : ι → E → 𝕜} {mE : MeasurableSpace E} {μ : ι → Measure E} [∀ i, SigmaFinite (μ i)]
(hf : ∀ i, Integrable (f i) (μ i)) :
Integrable (fun (x : ι → E) ↦ ∏ i, f i (x i)) (Measure.pi μ) :=
Integrable.fintype_prod_dep hf
end Integrable
variable [RCLike 𝕜]
/-- A version of **Fubini's theorem** in `n` variables, for a natural number `n`. -/
theorem integral_fin_nat_prod_eq_prod {n : ℕ} {E : Fin n → Type*}
{mE : ∀ i, MeasurableSpace (E i)} {μ : (i : Fin n) → Measure (E i)} [∀ i, SigmaFinite (μ i)]
(f : (i : Fin n) → E i → 𝕜) :
∫ x : (i : Fin n) → E i, ∏ i, f i (x i) ∂(Measure.pi μ) = ∏ i, ∫ x, f i x ∂(μ i) := by
induction n with
| zero => simp [measureReal_def]
| succ n n_ih =>
calc
_ = ∫ x : E 0 × ((i : Fin n) → E (Fin.succ i)),
f 0 x.1 * ∏ i : Fin n, f (Fin.succ i) (x.2 i)
∂((μ 0).prod (Measure.pi (fun i ↦ μ i.succ))) := by
rw [← ((measurePreserving_piFinSuccAbove μ 0).symm).integral_comp']
simp_rw [MeasurableEquiv.piFinSuccAbove_symm_apply, Fin.insertNthEquiv,
Fin.prod_univ_succ, Fin.insertNth_zero, Equiv.coe_fn_mk, Fin.cons_succ,
Fin.zero_succAbove, cast_eq, Fin.cons_zero]
_ = (∫ x, f 0 x ∂μ 0)
* ∏ i : Fin n, ∫ (x : E (Fin.succ i)), f (Fin.succ i) x ∂(μ i.succ) := by
rw [← n_ih, ← integral_prod_mul]
_ = ∏ i, ∫ x, f i x ∂(μ i) := by rw [Fin.prod_univ_succ]
/-- A version of **Fubini's theorem** in `n` variables, for a natural number `n`. -/
theorem integral_fin_nat_prod_volume_eq_prod {n : ℕ} {E : Fin n → Type*}
[∀ i, MeasureSpace (E i)] [∀ i, SigmaFinite (volume : Measure (E i))]
(f : (i : Fin n) → E i → 𝕜) :
∫ x : (i : Fin n) → E i, ∏ i, f i (x i) = ∏ i, ∫ x, f i x := integral_fin_nat_prod_eq_prod _
/-- A version of **Fubini's theorem** with the variables indexed by a general finite type. -/
theorem integral_fintype_prod_eq_prod {E : ι → Type*} (f : (i : ι) → E i → 𝕜)
{mE : ∀ i, MeasurableSpace (E i)} {μ : (i : ι) → Measure (E i)} [∀ i, SigmaFinite (μ i)] :
∫ x : (i : ι) → E i, ∏ i, f i (x i) ∂(Measure.pi μ) = ∏ i, ∫ x, f i x ∂(μ i) := by
let e := (equivFin ι).symm
rw [← (measurePreserving_piCongrLeft _ e).integral_comp']
simp_rw [← e.prod_comp, MeasurableEquiv.coe_piCongrLeft, Equiv.piCongrLeft_apply_apply,
MeasureTheory.integral_fin_nat_prod_eq_prod]
/-- A version of **Fubini's theorem** with the variables indexed by a general finite type. -/
theorem integral_fintype_prod_volume_eq_prod {E : ι → Type*} (f : (i : ι) → E i → 𝕜)
[∀ i, MeasureSpace (E i)] [∀ i, SigmaFinite (volume : Measure (E i))] :
∫ x : (i : ι) → E i, ∏ i, f i (x i) = ∏ i, ∫ x, f i x := integral_fintype_prod_eq_prod _
theorem integral_fintype_prod_eq_pow {E : Type*} (f : E → 𝕜) {mE : MeasurableSpace E}
{μ : Measure E} [SigmaFinite μ] :
∫ x : ι → E, ∏ i, f (x i) ∂(Measure.pi (fun _ ↦ μ)) = (∫ x, f x ∂μ) ^ (card ι) := by
rw [integral_fintype_prod_eq_prod, Finset.prod_const, card]
theorem integral_fintype_prod_volume_eq_pow {E : Type*} (f : E → 𝕜)
[MeasureSpace E] [SigmaFinite (volume : Measure E)] :
∫ x : ι → E, ∏ i, f (x i) = (∫ x, f x) ^ (card ι) := integral_fintype_prod_eq_pow _
variable {X : ι → Type*} {mX : ∀ i, MeasurableSpace (X i)} {μ : (i : ι) → Measure (X i)}
{E : Type*} [NormedAddCommGroup E]
lemma integrable_comp_eval [∀ i, IsFiniteMeasure (μ i)] {i : ι} {f : X i → E}
(hf : Integrable f (μ i)) :
Integrable (fun x ↦ f (x i)) (Measure.pi μ) := by
refine Integrable.comp_measurable ?_ (by fun_prop)
classical
rw [Measure.pi_map_eval]
exact hf.smul_measure <| ENNReal.prod_ne_top (by finiteness)
lemma integral_comp_eval [NormedSpace ℝ E] [∀ i, IsProbabilityMeasure (μ i)] {i : ι} {f : X i → E}
(hf : AEStronglyMeasurable f (μ i)) :
∫ x : Π i, X i, f (x i) ∂Measure.pi μ = ∫ x, f x ∂μ i := by
rw [← (measurePreserving_eval μ i).map_eq, integral_map]
· exact Measurable.aemeasurable (by fun_prop)
· rwa [(measurePreserving_eval μ i).map_eq]
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/CompactlySupported.lean | import Mathlib.MeasureTheory.Function.LocallyIntegrable
import Mathlib.MeasureTheory.Integral.Bochner.Basic
import Mathlib.Topology.ContinuousMap.CompactlySupported
/-!
# Integrating compactly supported continuous functions
This file contains definitions and lemmas related to integrals of compactly supported continuous
functions.
-/
open scoped ENNReal NNReal
open CompactlySupported MeasureTheory
variable {X : Type*}
namespace CompactlySupportedContinuousMap
variable [TopologicalSpace X] [MeasurableSpace X] [OpensMeasurableSpace X]
lemma integrable {E : Type*} [NormedAddCommGroup E] (f : C_c(X, E))
{μ : Measure X} [IsFiniteMeasureOnCompacts μ] :
Integrable f μ :=
f.continuous.integrable_of_hasCompactSupport f.hasCompactSupport
variable [T2Space X] [LocallyCompactSpace X] (Λ : C_c(X, ℝ) →ₚ[ℝ] ℝ)
/-- Integral as a positive linear functional on `C_c(X, ℝ)`. -/
@[simps!]
noncomputable def integralPositiveLinearMap (μ : Measure X)
[IsFiniteMeasureOnCompacts μ] : C_c(X, ℝ) →ₚ[ℝ] ℝ :=
PositiveLinearMap.mk₀
{ toFun f := ∫ x, f x ∂μ,
map_add' f g := integral_add' f.integrable g.integrable
map_smul' c f := integral_smul c f }
fun _ ↦ integral_nonneg
/-- Integration as a positive linear functional on `C_c(X, ℝ≥0)`. -/
-- Note: the default generated `simps` lemma uses `Subtype.val` instead of `NNReal.toReal`.
@[simps! apply]
noncomputable def integralLinearMap (μ : Measure X)
[IsFiniteMeasureOnCompacts μ] :
C_c(X, ℝ≥0) →ₗ[ℝ≥0] ℝ≥0 :=
CompactlySupportedContinuousMap.toNNRealLinear (integralPositiveLinearMap μ)
end CompactlySupportedContinuousMap |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/BochnerL1.lean | import Mathlib.MeasureTheory.Integral.Bochner.L1
deprecated_module (since := "2025-04-06") |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/IntervalAverage.lean | import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic
import Mathlib.MeasureTheory.Integral.Average
/-!
# Integral average over an interval
In this file we introduce notation `⨍ x in a..b, f x` for the average `⨍ x in Ι a b, f x` of `f`
over the interval `Ι a b = Set.Ioc (min a b) (max a b)` w.r.t. the Lebesgue measure, then prove
formulas for this average:
* `interval_average_eq`: `⨍ x in a..b, f x = (b - a)⁻¹ • ∫ x in a..b, f x`;
* `interval_average_eq_div`: `⨍ x in a..b, f x = (∫ x in a..b, f x) / (b - a)`;
* `exists_eq_interval_average`: `∃ c, f c = ⨍ (x : ℝ) in a..b, f x`.
We also prove that `⨍ x in a..b, f x = ⨍ x in b..a, f x`, see `interval_average_symm`.
## Notation
`⨍ x in a..b, f x`: average of `f` over the interval `Ι a b` w.r.t. the Lebesgue measure.
-/
open MeasureTheory Set TopologicalSpace
open scoped Interval
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
/-- `⨍ x in a..b, f x` is the average of `f` over the interval `Ι a b` w.r.t. the Lebesgue
measure. -/
notation3 "⨍ "(...)" in "a".."b",
"r:60:(scoped f => average (Measure.restrict volume (uIoc a b)) f) => r
theorem interval_average_symm (f : ℝ → E) (a b : ℝ) : (⨍ x in a..b, f x) = ⨍ x in b..a, f x := by
rw [setAverage_eq, setAverage_eq, uIoc_comm]
theorem interval_average_eq (f : ℝ → E) (a b : ℝ) :
(⨍ x in a..b, f x) = (b - a)⁻¹ • ∫ x in a..b, f x := by
rcases le_or_gt a b with h | h
· rw [setAverage_eq, uIoc_of_le h, Real.volume_real_Ioc_of_le h,
intervalIntegral.integral_of_le h]
· rw [setAverage_eq, uIoc_of_ge h.le, Real.volume_real_Ioc_of_le h.le,
intervalIntegral.integral_of_ge h.le, smul_neg, ← neg_smul, ← inv_neg, neg_sub]
theorem interval_average_eq_div (f : ℝ → ℝ) (a b : ℝ) :
(⨍ x in a..b, f x) = (∫ x in a..b, f x) / (b - a) := by
rw [interval_average_eq, smul_eq_mul, div_eq_inv_mul]
/-- Interval averages are invariant when functions change along discrete sets. -/
theorem intervalAverage_congr_codiscreteWithin {a b : ℝ} {f₁ f₂ : ℝ → ℝ}
(hf : f₁ =ᶠ[Filter.codiscreteWithin (Ι a b)] f₂) :
⨍ (x : ℝ) in a..b, f₁ x = ⨍ (x : ℝ) in a..b, f₂ x := by
rw [interval_average_eq, intervalIntegral.integral_congr_codiscreteWithin hf,
← interval_average_eq]
/-- The mean value theorem for integrals:
There exists a point in an interval such that the mean of a continuous function over the interval
equals the value of the function at the point. -/
theorem exists_eq_interval_average
{f : ℝ → ℝ} {a b : ℝ} (hab : a ≠ b) (hf : ContinuousOn f (uIcc a b)) :
∃ c ∈ uIoo a b, f c = ⨍ (x : ℝ) in a..b, f x := by
wlog h : a < b generalizing a b
· rw [uIcc_comm] at hf
have := this hab.symm hf (lt_of_le_of_ne (le_of_not_gt h) (Ne.symm hab))
rwa [uIoo_comm, interval_average_symm] at this
let ave := ⨍ (x : ℝ) in a..b, f x
have h_vol_fin1 : volume (uIoc a b) ≠ 0 := by simpa [h.le] using h
have h_vol_fin2 : volume (uIoc a b) ≠ ⊤ := by simp [h.le]
have h_intble : IntegrableOn f (uIoc a b) := by
have : IntegrableOn f (uIcc a b) := hf.integrableOn_uIcc
rwa [uIcc_of_lt h,integrableOn_Icc_iff_integrableOn_Ioc, ←uIoc_of_le (le_of_lt h)] at this
let S1 := {x | x ∈ uIoc a b ∧ f x ≤ ave}
let S2 := {x | x ∈ uIoc a b ∧ ave ≤ f x}
have h_meas1 : volume (S1 \ {b}) ≠ 0 := by
rw [measure_diff_null Real.volume_singleton]
exact (measure_le_setAverage_pos h_vol_fin1 h_vol_fin2 h_intble).ne'
have h_meas2 : volume (S2 \ {b}) ≠ 0 := by
rw [measure_diff_null Real.volume_singleton]
exact (measure_setAverage_le_pos h_vol_fin1 h_vol_fin2 h_intble).ne'
obtain ⟨c1, ⟨hc1_mem, hc1_le⟩, hc1'⟩ := nonempty_of_measure_ne_zero h_meas1
have hc1' : c1 ∈ Ioo a b := by
rw [Set.uIoc_of_le (le_of_lt h)] at hc1_mem
rw [notMem_singleton_iff] at hc1'
exact ⟨hc1_mem.1, lt_of_le_of_ne hc1_mem.2 hc1'⟩
obtain ⟨c2, ⟨hc2_mem, hc2_ge⟩, hc2'⟩ := nonempty_of_measure_ne_zero h_meas2
have hc2' : c2 ∈ Ioo a b := by
rw [Set.uIoc_of_le (le_of_lt h)] at hc2_mem
rw [notMem_singleton_iff] at hc2'
exact ⟨hc2_mem.1, lt_of_le_of_ne hc2_mem.2 hc2'⟩
have h_interval : uIcc c1 c2 ⊆ uIoo a b := by
rw [uIoo_of_lt h]
intro x hx
rw [mem_uIcc] at hx
simp only [mem_Ioo]
rcases hx with h1 | h2
· exact ⟨lt_of_lt_of_le hc1'.1 h1.1, lt_of_le_of_lt h1.2 hc2'.2⟩
· exact ⟨lt_of_lt_of_le hc2'.1 h2.1, lt_of_le_of_lt h2.2 hc1'.2⟩
have h_interval' : uIcc c1 c2 ⊆ uIcc a b := fun x hx => Ioo_subset_Icc_self (h_interval hx)
have h_ave : ave ∈ Icc (f c1) (f c2) := ⟨hc1_le,hc2_ge⟩
have h_image := intermediate_value_uIcc (hf.mono h_interval') (Icc_subset_uIcc h_ave)
exact ((mem_image f (uIcc c1 c2) ave).mp (h_image)).imp (fun c hc => ⟨h_interval hc.1, hc.2⟩) |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/MeanInequalities.lean | import Mathlib.Analysis.MeanInequalities
import Mathlib.Analysis.MeanInequalitiesPow
import Mathlib.MeasureTheory.Function.SpecialFunctions.Basic
import Mathlib.MeasureTheory.Integral.Lebesgue.Add
/-!
# Mean value inequalities for integrals
In this file we prove several inequalities on integrals, notably the Hölder inequality and
the Minkowski inequality. The versions for finite sums are in `Analysis.MeanInequalities`.
## Main results
Hölder's inequality for the Lebesgue integral of `ℝ≥0∞` and `ℝ≥0` functions: we prove
`∫ (f * g) ∂μ ≤ (∫ f^p ∂μ) ^ (1/p) * (∫ g^q ∂μ) ^ (1/q)` for `p`, `q` conjugate real exponents
and `α → (E)NNReal` functions in two cases,
* `ENNReal.lintegral_mul_le_Lp_mul_Lq` : ℝ≥0∞ functions,
* `NNReal.lintegral_mul_le_Lp_mul_Lq` : ℝ≥0 functions.
`ENNReal.lintegral_mul_norm_pow_le` is a variant where the exponents are not reciprocals:
`∫ (f ^ p * g ^ q) ∂μ ≤ (∫ f ∂μ) ^ p * (∫ g ∂μ) ^ q` where `p, q ≥ 0` and `p + q = 1`.
`ENNReal.lintegral_prod_norm_pow_le` generalizes this to a finite family of functions:
`∫ (∏ i, f i ^ p i) ∂μ ≤ ∏ i, (∫ f i ∂μ) ^ p i` when the `p` is a collection
of nonnegative weights with sum 1.
Minkowski's inequality for the Lebesgue integral of measurable functions with `ℝ≥0∞` values:
we prove `(∫ (f + g)^p ∂μ) ^ (1/p) ≤ (∫ f^p ∂μ) ^ (1/p) + (∫ g^p ∂μ) ^ (1/p)` for `1 ≤ p`.
-/
section LIntegral
/-!
### Hölder's inequality for the Lebesgue integral of ℝ≥0∞ and ℝ≥0 functions
We prove `∫ (f * g) ∂μ ≤ (∫ f^p ∂μ) ^ (1/p) * (∫ g^q ∂μ) ^ (1/q)` for `p`, `q`
conjugate real exponents and `α → (E)NNReal` functions in several cases, the first two being useful
only to prove the more general results:
* `ENNReal.lintegral_mul_le_one_of_lintegral_rpow_eq_one` : ℝ≥0∞ functions for which the
integrals on the right are equal to 1,
* `ENNReal.lintegral_mul_le_Lp_mul_Lq_of_ne_zero_of_ne_top` : ℝ≥0∞ functions for which the
integrals on the right are neither ⊤ nor 0,
* `ENNReal.lintegral_mul_le_Lp_mul_Lq` : ℝ≥0∞ functions,
* `NNReal.lintegral_mul_le_Lp_mul_Lq` : ℝ≥0 functions.
-/
noncomputable section
open NNReal ENNReal MeasureTheory Finset
variable {α : Type*} [MeasurableSpace α] {μ : Measure α}
namespace ENNReal
theorem lintegral_mul_le_one_of_lintegral_rpow_eq_one {p q : ℝ} (hpq : p.HolderConjugate q)
{f g : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hf_norm : ∫⁻ a, f a ^ p ∂μ = 1)
(hg_norm : ∫⁻ a, g a ^ q ∂μ = 1) : (∫⁻ a, (f * g) a ∂μ) ≤ 1 := by
calc
(∫⁻ a : α, (f * g) a ∂μ) ≤
∫⁻ a : α, f a ^ p / ENNReal.ofReal p + g a ^ q / ENNReal.ofReal q ∂μ :=
lintegral_mono fun a => young_inequality (f a) (g a) hpq
_ = 1 := by
simp only [div_eq_mul_inv]
rw [lintegral_add_left']
· rw [lintegral_mul_const'' _ (hf.pow_const p), lintegral_mul_const', hf_norm, hg_norm,
one_mul, one_mul, hpq.inv_add_inv_ennreal]
simp [hpq.symm.pos]
· exact (hf.pow_const _).mul_const _
/-- Function multiplied by the inverse of its p-seminorm `(∫⁻ f^p ∂μ) ^ 1/p` -/
def funMulInvSnorm (f : α → ℝ≥0∞) (p : ℝ) (μ : Measure α) : α → ℝ≥0∞ := fun a =>
f a * ((∫⁻ c, f c ^ p ∂μ) ^ (1 / p))⁻¹
theorem fun_eq_funMulInvSnorm_mul_eLpNorm {p : ℝ} (f : α → ℝ≥0∞)
(hf_nonzero : (∫⁻ a, f a ^ p ∂μ) ≠ 0) (hf_top : (∫⁻ a, f a ^ p ∂μ) ≠ ⊤) {a : α} :
f a = funMulInvSnorm f p μ a * (∫⁻ c, f c ^ p ∂μ) ^ (1 / p) := by
simp [funMulInvSnorm, mul_assoc, ENNReal.inv_mul_cancel, hf_nonzero, hf_top]
theorem funMulInvSnorm_rpow {p : ℝ} (hp0 : 0 < p) {f : α → ℝ≥0∞} {a : α} :
funMulInvSnorm f p μ a ^ p = f a ^ p * (∫⁻ c, f c ^ p ∂μ)⁻¹ := by
rw [funMulInvSnorm, mul_rpow_of_nonneg _ _ (le_of_lt hp0)]
suffices h_inv_rpow : ((∫⁻ c : α, f c ^ p ∂μ) ^ (1 / p))⁻¹ ^ p = (∫⁻ c : α, f c ^ p ∂μ)⁻¹ by
rw [h_inv_rpow]
rw [inv_rpow, ← rpow_mul, one_div_mul_cancel hp0.ne', rpow_one]
theorem lintegral_rpow_funMulInvSnorm_eq_one {p : ℝ} (hp0_lt : 0 < p) {f : α → ℝ≥0∞}
(hf_nonzero : (∫⁻ a, f a ^ p ∂μ) ≠ 0) (hf_top : (∫⁻ a, f a ^ p ∂μ) ≠ ⊤) :
∫⁻ c, funMulInvSnorm f p μ c ^ p ∂μ = 1 := by
simp_rw [funMulInvSnorm_rpow hp0_lt]
rw [lintegral_mul_const', ENNReal.mul_inv_cancel hf_nonzero hf_top]
rwa [inv_ne_top]
/-- Hölder's inequality in case of finite non-zero integrals -/
theorem lintegral_mul_le_Lp_mul_Lq_of_ne_zero_of_ne_top {p q : ℝ} (hpq : p.HolderConjugate q)
{f g : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hf_nontop : (∫⁻ a, f a ^ p ∂μ) ≠ ⊤)
(hg_nontop : (∫⁻ a, g a ^ q ∂μ) ≠ ⊤) (hf_nonzero : (∫⁻ a, f a ^ p ∂μ) ≠ 0)
(hg_nonzero : (∫⁻ a, g a ^ q ∂μ) ≠ 0) :
(∫⁻ a, (f * g) a ∂μ) ≤ (∫⁻ a, f a ^ p ∂μ) ^ (1 / p) * (∫⁻ a, g a ^ q ∂μ) ^ (1 / q) := by
let npf := (∫⁻ c : α, f c ^ p ∂μ) ^ (1 / p)
let nqg := (∫⁻ c : α, g c ^ q ∂μ) ^ (1 / q)
calc
(∫⁻ a : α, (f * g) a ∂μ) =
∫⁻ a : α, (funMulInvSnorm f p μ * funMulInvSnorm g q μ) a * (npf * nqg) ∂μ := by
refine lintegral_congr fun a => ?_
rw [Pi.mul_apply, fun_eq_funMulInvSnorm_mul_eLpNorm f hf_nonzero hf_nontop,
fun_eq_funMulInvSnorm_mul_eLpNorm g hg_nonzero hg_nontop, Pi.mul_apply]
ring
_ ≤ npf * nqg := by
rw [lintegral_mul_const' (npf * nqg) _
(by simp [npf, nqg, hf_nontop, hg_nontop, hf_nonzero, hg_nonzero, ENNReal.mul_eq_top])]
refine mul_le_of_le_one_left' ?_
have hf1 := lintegral_rpow_funMulInvSnorm_eq_one hpq.pos hf_nonzero hf_nontop
have hg1 := lintegral_rpow_funMulInvSnorm_eq_one hpq.symm.pos hg_nonzero hg_nontop
exact lintegral_mul_le_one_of_lintegral_rpow_eq_one hpq (hf.mul_const _) hf1 hg1
theorem ae_eq_zero_of_lintegral_rpow_eq_zero {p : ℝ} (hp0 : 0 ≤ p) {f : α → ℝ≥0∞}
(hf : AEMeasurable f μ) (hf_zero : ∫⁻ a, f a ^ p ∂μ = 0) : f =ᵐ[μ] 0 := by
rw [lintegral_eq_zero_iff' (hf.pow_const p)] at hf_zero
filter_upwards [hf_zero] with x
rw [Pi.zero_apply, ← not_imp_not]
exact fun hx => (rpow_pos_of_nonneg (pos_iff_ne_zero.2 hx) hp0).ne'
theorem lintegral_mul_eq_zero_of_lintegral_rpow_eq_zero {p : ℝ} (hp0 : 0 ≤ p) {f g : α → ℝ≥0∞}
(hf : AEMeasurable f μ) (hf_zero : ∫⁻ a, f a ^ p ∂μ = 0) : (∫⁻ a, (f * g) a ∂μ) = 0 := by
rw [← @lintegral_zero_fun α _ μ]
refine lintegral_congr_ae ?_
suffices h_mul_zero : f * g =ᵐ[μ] 0 * g by rwa [zero_mul] at h_mul_zero
have hf_eq_zero : f =ᵐ[μ] 0 := ae_eq_zero_of_lintegral_rpow_eq_zero hp0 hf hf_zero
exact hf_eq_zero.mul (ae_eq_refl g)
theorem lintegral_mul_le_Lp_mul_Lq_of_ne_zero_of_eq_top {p q : ℝ} (hp0_lt : 0 < p) (hq0 : 0 ≤ q)
{f g : α → ℝ≥0∞} (hf_top : ∫⁻ a, f a ^ p ∂μ = ⊤) (hg_nonzero : (∫⁻ a, g a ^ q ∂μ) ≠ 0) :
(∫⁻ a, (f * g) a ∂μ) ≤ (∫⁻ a, f a ^ p ∂μ) ^ (1 / p) * (∫⁻ a, g a ^ q ∂μ) ^ (1 / q) := by
simp [*]
/-- Hölder's inequality for functions `α → ℝ≥0∞`. The integral of the product of two functions
is bounded by the product of their `ℒp` and `ℒq` seminorms when `p` and `q` are conjugate
exponents. -/
theorem lintegral_mul_le_Lp_mul_Lq (μ : Measure α) {p q : ℝ} (hpq : p.HolderConjugate q)
{f g : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
(∫⁻ a, (f * g) a ∂μ) ≤ (∫⁻ a, f a ^ p ∂μ) ^ (1 / p) * (∫⁻ a, g a ^ q ∂μ) ^ (1 / q) := by
by_cases hf_zero : ∫⁻ a, f a ^ p ∂μ = 0
· refine Eq.trans_le ?_ (zero_le _)
exact lintegral_mul_eq_zero_of_lintegral_rpow_eq_zero hpq.nonneg hf hf_zero
by_cases hg_zero : ∫⁻ a, g a ^ q ∂μ = 0
· refine Eq.trans_le ?_ (zero_le _)
rw [mul_comm]
exact lintegral_mul_eq_zero_of_lintegral_rpow_eq_zero hpq.symm.nonneg hg hg_zero
by_cases hf_top : ∫⁻ a, f a ^ p ∂μ = ⊤
· exact lintegral_mul_le_Lp_mul_Lq_of_ne_zero_of_eq_top hpq.pos hpq.symm.nonneg hf_top hg_zero
by_cases hg_top : ∫⁻ a, g a ^ q ∂μ = ⊤
· rw [mul_comm, mul_comm ((∫⁻ a : α, f a ^ p ∂μ) ^ (1 / p))]
exact lintegral_mul_le_Lp_mul_Lq_of_ne_zero_of_eq_top hpq.symm.pos hpq.nonneg hg_top hf_zero
-- non-⊤ non-zero case
exact ENNReal.lintegral_mul_le_Lp_mul_Lq_of_ne_zero_of_ne_top hpq hf hf_top hg_top hf_zero hg_zero
/-- A different formulation of Hölder's inequality for two functions, with two exponents that sum to
1, instead of reciprocals of -/
theorem lintegral_mul_norm_pow_le {α} [MeasurableSpace α] {μ : Measure α}
{f g : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hg : AEMeasurable g μ)
{p q : ℝ} (hp : 0 ≤ p) (hq : 0 ≤ q) (hpq : p + q = 1) :
∫⁻ a, f a ^ p * g a ^ q ∂μ ≤ (∫⁻ a, f a ∂μ) ^ p * (∫⁻ a, g a ∂μ) ^ q := by
rcases hp.eq_or_lt with rfl | hp
· rw [zero_add] at hpq
simp [hpq]
rcases hq.eq_or_lt with rfl | hq
· rw [add_zero] at hpq
simp [hpq]
have h2p : 1 < 1 / p := by
rw [one_div, one_lt_inv₀ hp]
linarith
have h2pq : (1 / p)⁻¹ + (1 / q)⁻¹ = 1 := by simp [hpq]
have := ENNReal.lintegral_mul_le_Lp_mul_Lq μ (Real.holderConjugate_iff.mpr ⟨h2p, h2pq⟩)
(hf.pow_const p) (hg.pow_const q)
simpa [← ENNReal.rpow_mul, hp.ne', hq.ne'] using this
/-- A version of Hölder with multiple arguments -/
theorem lintegral_prod_norm_pow_le {α ι : Type*} [MeasurableSpace α] {μ : Measure α}
(s : Finset ι) {f : ι → α → ℝ≥0∞} (hf : ∀ i ∈ s, AEMeasurable (f i) μ)
{p : ι → ℝ} (hp : ∑ i ∈ s, p i = 1) (h2p : ∀ i ∈ s, 0 ≤ p i) :
∫⁻ a, ∏ i ∈ s, f i a ^ p i ∂μ ≤ ∏ i ∈ s, (∫⁻ a, f i a ∂μ) ^ p i := by
classical
induction s using Finset.induction generalizing p with
| empty =>
simp at hp
| insert i₀ s hi₀ ih =>
rcases eq_or_ne (p i₀) 1 with h2i₀|h2i₀
· simp only [hi₀, not_false_eq_true, prod_insert]
have h2p : ∀ i ∈ s, p i = 0 := by
simpa [hi₀, h2i₀, sum_eq_zero_iff_of_nonneg (fun i hi ↦ h2p i <| mem_insert_of_mem hi)]
using hp
calc ∫⁻ a, f i₀ a ^ p i₀ * ∏ i ∈ s, f i a ^ p i ∂μ
= ∫⁻ a, f i₀ a ^ p i₀ * ∏ i ∈ s, 1 ∂μ := by
congr! 3 with x
apply prod_congr rfl fun i hi ↦ by rw [h2p i hi, ENNReal.rpow_zero]
_ ≤ (∫⁻ a, f i₀ a ∂μ) ^ p i₀ * ∏ i ∈ s, 1 := by simp [h2i₀]
_ = (∫⁻ a, f i₀ a ∂μ) ^ p i₀ * ∏ i ∈ s, (∫⁻ a, f i a ∂μ) ^ p i := by
congr 1
apply prod_congr rfl fun i hi ↦ by rw [h2p i hi, ENNReal.rpow_zero]
· have hpi₀ : 0 ≤ 1 - p i₀ := by
simp_rw [sub_nonneg, ← hp, single_le_sum h2p (mem_insert_self ..)]
have h2pi₀ : 1 - p i₀ ≠ 0 := by
rwa [sub_ne_zero, ne_comm]
let q := fun i ↦ p i / (1 - p i₀)
have hq : ∑ i ∈ s, q i = 1 := by
rw [← Finset.sum_div, ← sum_insert_sub hi₀, hp, div_self h2pi₀]
have h2q : ∀ i ∈ s, 0 ≤ q i :=
fun i hi ↦ div_nonneg (h2p i <| mem_insert_of_mem hi) hpi₀
calc ∫⁻ a, ∏ i ∈ insert i₀ s, f i a ^ p i ∂μ
= ∫⁻ a, f i₀ a ^ p i₀ * ∏ i ∈ s, f i a ^ p i ∂μ := by simp [hi₀]
_ = ∫⁻ a, f i₀ a ^ p i₀ * (∏ i ∈ s, f i a ^ q i) ^ (1 - p i₀) ∂μ := by
simp [q, ← ENNReal.prod_rpow_of_nonneg hpi₀, ← ENNReal.rpow_mul,
div_mul_cancel₀ (h := h2pi₀)]
_ ≤ (∫⁻ a, f i₀ a ∂μ) ^ p i₀ * (∫⁻ a, ∏ i ∈ s, f i a ^ q i ∂μ) ^ (1 - p i₀) := by
apply ENNReal.lintegral_mul_norm_pow_le
· exact hf i₀ <| mem_insert_self ..
· exact s.aemeasurable_fun_prod fun i hi ↦ (hf i <| mem_insert_of_mem hi).pow_const _
· exact h2p i₀ <| mem_insert_self ..
· exact hpi₀
· apply add_sub_cancel
_ ≤ (∫⁻ a, f i₀ a ∂μ) ^ p i₀ * (∏ i ∈ s, (∫⁻ a, f i a ∂μ) ^ q i) ^ (1 - p i₀) := by
gcongr -- behavior of gcongr is heartbeat-dependent, which makes code really fragile...
exact ih (fun i hi ↦ hf i <| mem_insert_of_mem hi) hq h2q
_ = (∫⁻ a, f i₀ a ∂μ) ^ p i₀ * ∏ i ∈ s, (∫⁻ a, f i a ∂μ) ^ p i := by
simp [q, ← ENNReal.prod_rpow_of_nonneg hpi₀, ← ENNReal.rpow_mul,
div_mul_cancel₀ (h := h2pi₀)]
_ = ∏ i ∈ insert i₀ s, (∫⁻ a, f i a ∂μ) ^ p i := by simp [hi₀]
/-- A version of Hölder with multiple arguments, one of which plays a distinguished role. -/
theorem lintegral_mul_prod_norm_pow_le {α ι : Type*} [MeasurableSpace α] {μ : Measure α}
(s : Finset ι) {g : α → ℝ≥0∞} {f : ι → α → ℝ≥0∞} (hg : AEMeasurable g μ)
(hf : ∀ i ∈ s, AEMeasurable (f i) μ) (q : ℝ) {p : ι → ℝ} (hpq : q + ∑ i ∈ s, p i = 1)
(hq : 0 ≤ q) (hp : ∀ i ∈ s, 0 ≤ p i) :
∫⁻ a, g a ^ q * ∏ i ∈ s, f i a ^ p i ∂μ ≤
(∫⁻ a, g a ∂μ) ^ q * ∏ i ∈ s, (∫⁻ a, f i a ∂μ) ^ p i := by
suffices
∫⁻ t, ∏ j ∈ insertNone s, Option.elim j (g t) (fun j ↦ f j t) ^ Option.elim j q p ∂μ
≤ ∏ j ∈ insertNone s, (∫⁻ t, Option.elim j (g t) (fun j ↦ f j t) ∂μ) ^ Option.elim j q p by
simpa using this
refine ENNReal.lintegral_prod_norm_pow_le _ ?_ ?_ ?_
· rintro (_ | i) hi
· exact hg
· refine hf i ?_
simpa using hi
· simp_rw [sum_insertNone, Option.elim]
exact hpq
· rintro (_ | i) hi
· exact hq
· refine hp i ?_
simpa using hi
theorem lintegral_rpow_add_lt_top_of_lintegral_rpow_lt_top {p : ℝ} {f g : α → ℝ≥0∞}
(hf : AEMeasurable f μ) (hf_top : (∫⁻ a, f a ^ p ∂μ) < ⊤) (hg_top : (∫⁻ a, g a ^ p ∂μ) < ⊤)
(hp1 : 1 ≤ p) : (∫⁻ a, (f + g) a ^ p ∂μ) < ⊤ := by
have hp0_lt : 0 < p := lt_of_lt_of_le zero_lt_one hp1
have hp0 : 0 ≤ p := le_of_lt hp0_lt
calc
(∫⁻ a : α, (f a + g a) ^ p ∂μ) ≤
∫⁻ a, (2 : ℝ≥0∞) ^ (p - 1) * f a ^ p + (2 : ℝ≥0∞) ^ (p - 1) * g a ^ p ∂μ := by
refine lintegral_mono fun a => ?_
dsimp only
have h_zero_lt_half_rpow : (0 : ℝ≥0∞) < (1 / 2 : ℝ≥0∞) ^ p := by
rw [← ENNReal.zero_rpow_of_pos hp0_lt]
exact ENNReal.rpow_lt_rpow (by simp) hp0_lt
have h_rw : (1 / 2 : ℝ≥0∞) ^ p * (2 : ℝ≥0∞) ^ (p - 1) = 1 / 2 := by
rw [sub_eq_add_neg, ENNReal.rpow_add _ _ two_ne_zero ENNReal.coe_ne_top, ← mul_assoc, ←
ENNReal.mul_rpow_of_nonneg _ _ hp0, one_div,
ENNReal.inv_mul_cancel two_ne_zero ENNReal.coe_ne_top, ENNReal.one_rpow, one_mul,
ENNReal.rpow_neg_one]
rw [← ENNReal.mul_le_mul_left (ne_of_lt h_zero_lt_half_rpow).symm _]
· rw [mul_add, ← mul_assoc, ← mul_assoc, h_rw, ← ENNReal.mul_rpow_of_nonneg _ _ hp0, mul_add]
refine
ENNReal.rpow_arith_mean_le_arith_mean2_rpow (1 / 2 : ℝ≥0∞) (1 / 2 : ℝ≥0∞) (f a) (g a) ?_
hp1
rw [ENNReal.div_add_div_same, one_add_one_eq_two,
ENNReal.div_self two_ne_zero ENNReal.coe_ne_top]
· finiteness
_ < ⊤ := by
rw [lintegral_add_left', lintegral_const_mul'' _ (hf.pow_const p),
lintegral_const_mul' _ _ (by finiteness), ENNReal.add_lt_top]
· constructor <;> finiteness
· fun_prop
theorem lintegral_Lp_mul_le_Lq_mul_Lr {α} [MeasurableSpace α] {p q r : ℝ} (hp0_lt : 0 < p)
(hpq : p < q) (hpqr : 1 / p = 1 / q + 1 / r) (μ : Measure α) {f g : α → ℝ≥0∞}
(hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
(∫⁻ a, (f * g) a ^ p ∂μ) ^ (1 / p) ≤
(∫⁻ a, f a ^ q ∂μ) ^ (1 / q) * (∫⁻ a, g a ^ r ∂μ) ^ (1 / r) := by
have hp0_ne : p ≠ 0 := (ne_of_lt hp0_lt).symm
have hp0 : 0 ≤ p := le_of_lt hp0_lt
have hq0_lt : 0 < q := lt_of_le_of_lt hp0 hpq
have hq0_ne : q ≠ 0 := (ne_of_lt hq0_lt).symm
have h_one_div_r : 1 / r = 1 / p - 1 / q := by rw [hpqr]; simp
let p2 := q / p
let q2 := p2.conjExponent
have hp2q2 : p2.HolderConjugate q2 :=
.conjExponent (by simp [p2, _root_.lt_div_iff₀, hpq, hp0_lt])
calc
(∫⁻ a : α, (f * g) a ^ p ∂μ) ^ (1 / p) = (∫⁻ a : α, f a ^ p * g a ^ p ∂μ) ^ (1 / p) := by
simp_rw [Pi.mul_apply, ENNReal.mul_rpow_of_nonneg _ _ hp0]
_ ≤ ((∫⁻ a, f a ^ (p * p2) ∂μ) ^ (1 / p2) *
(∫⁻ a, g a ^ (p * q2) ∂μ) ^ (1 / q2)) ^ (1 / p) := by
gcongr
simp_rw [ENNReal.rpow_mul]
exact ENNReal.lintegral_mul_le_Lp_mul_Lq μ hp2q2 (hf.pow_const _) (hg.pow_const _)
_ = (∫⁻ a : α, f a ^ q ∂μ) ^ (1 / q) * (∫⁻ a : α, g a ^ r ∂μ) ^ (1 / r) := by
rw [@ENNReal.mul_rpow_of_nonneg _ _ (1 / p) (by simp [hp0]), ← ENNReal.rpow_mul, ←
ENNReal.rpow_mul]
have hpp2 : p * p2 = q := by
symm
rw [mul_comm, ← div_eq_iff hp0_ne]
have hpq2 : p * q2 = r := by
rw [← inv_inv r, ← one_div, ← one_div, h_one_div_r]
simp [field, p2, q2, Real.conjExponent]
simp_rw [div_mul_div_comm, mul_one, mul_comm p2, mul_comm q2, hpp2, hpq2]
theorem lintegral_mul_rpow_le_lintegral_rpow_mul_lintegral_rpow {p q : ℝ}
(hpq : p.HolderConjugate q) {f g : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hg : AEMeasurable g μ)
(hf_top : (∫⁻ a, f a ^ p ∂μ) ≠ ⊤) :
(∫⁻ a, f a * g a ^ (p - 1) ∂μ) ≤
(∫⁻ a, f a ^ p ∂μ) ^ (1 / p) * (∫⁻ a, g a ^ p ∂μ) ^ (1 / q) := by
refine le_trans (ENNReal.lintegral_mul_le_Lp_mul_Lq μ hpq hf (hg.pow_const _)) ?_
by_cases hf_zero_rpow : (∫⁻ a : α, f a ^ p ∂μ) ^ (1 / p) = 0
· rw [hf_zero_rpow, zero_mul]
exact zero_le _
have hf_top_rpow : (∫⁻ a : α, f a ^ p ∂μ) ^ (1 / p) ≠ ⊤ := by
by_contra h
refine hf_top ?_
have hp_not_neg : ¬p < 0 := by simp [hpq.nonneg]
simpa [hpq.pos, hp_not_neg] using h
refine (ENNReal.mul_le_mul_left hf_zero_rpow hf_top_rpow).mpr (le_of_eq ?_)
congr
ext1 a
rw [← ENNReal.rpow_mul, hpq.sub_one_mul_conj]
theorem lintegral_rpow_add_le_add_eLpNorm_mul_lintegral_rpow_add {p q : ℝ}
(hpq : p.HolderConjugate q) {f g : α → ℝ≥0∞} (hf : AEMeasurable f μ)
(hf_top : (∫⁻ a, f a ^ p ∂μ) ≠ ⊤) (hg : AEMeasurable g μ) (hg_top : (∫⁻ a, g a ^ p ∂μ) ≠ ⊤) :
(∫⁻ a, (f + g) a ^ p ∂μ) ≤
((∫⁻ a, f a ^ p ∂μ) ^ (1 / p) + (∫⁻ a, g a ^ p ∂μ) ^ (1 / p)) *
(∫⁻ a, (f a + g a) ^ p ∂μ) ^ (1 / q) := by
calc
(∫⁻ a, (f + g) a ^ p ∂μ) ≤ ∫⁻ a, (f + g) a * (f + g) a ^ (p - 1) ∂μ := by
gcongr with a
by_cases h_zero : (f + g) a = 0
· rw [h_zero, ENNReal.zero_rpow_of_pos hpq.pos]
exact zero_le _
by_cases h_top : (f + g) a = ⊤
· rw [h_top, ENNReal.top_rpow_of_pos hpq.sub_one_pos, ENNReal.top_mul_top]
exact le_top
refine le_of_eq ?_
nth_rw 2 [← ENNReal.rpow_one ((f + g) a)]
rw [← ENNReal.rpow_add _ _ h_zero h_top, add_sub_cancel]
_ = (∫⁻ a : α, f a * (f + g) a ^ (p - 1) ∂μ) + ∫⁻ a : α, g a * (f + g) a ^ (p - 1) ∂μ := by
have h_add_m : AEMeasurable (fun a : α => (f + g) a ^ (p - 1 : ℝ)) μ :=
(hf.add hg).pow_const _
have h_add_apply :
(∫⁻ a : α, (f + g) a * (f + g) a ^ (p - 1) ∂μ) =
∫⁻ a : α, (f a + g a) * (f + g) a ^ (p - 1) ∂μ :=
rfl
simp_rw [h_add_apply, add_mul]
rw [lintegral_add_left' (hf.mul h_add_m)]
_ ≤
((∫⁻ a, f a ^ p ∂μ) ^ (1 / p) + (∫⁻ a, g a ^ p ∂μ) ^ (1 / p)) *
(∫⁻ a, (f a + g a) ^ p ∂μ) ^ (1 / q) := by
rw [add_mul]
gcongr
· exact lintegral_mul_rpow_le_lintegral_rpow_mul_lintegral_rpow hpq hf (hf.add hg) hf_top
· exact lintegral_mul_rpow_le_lintegral_rpow_mul_lintegral_rpow hpq hg (hf.add hg) hg_top
private theorem lintegral_Lp_add_le_aux {p q : ℝ} (hpq : p.HolderConjugate q) {f g : α → ℝ≥0∞}
(hf : AEMeasurable f μ) (hf_top : (∫⁻ a, f a ^ p ∂μ) ≠ ⊤) (hg : AEMeasurable g μ)
(hg_top : (∫⁻ a, g a ^ p ∂μ) ≠ ⊤) (h_add_zero : (∫⁻ a, (f + g) a ^ p ∂μ) ≠ 0)
(h_add_top : (∫⁻ a, (f + g) a ^ p ∂μ) ≠ ⊤) :
(∫⁻ a, (f + g) a ^ p ∂μ) ^ (1 / p) ≤
(∫⁻ a, f a ^ p ∂μ) ^ (1 / p) + (∫⁻ a, g a ^ p ∂μ) ^ (1 / p) := by
have h0_rpow : (∫⁻ a, (f + g) a ^ p ∂μ) ^ (1 / p) ≠ 0 := by
simp [h_add_zero, h_add_top, -Pi.add_apply]
suffices h :
1 ≤
(∫⁻ a : α, (f + g) a ^ p ∂μ) ^ (-(1 / p)) *
((∫⁻ a : α, f a ^ p ∂μ) ^ (1 / p) + (∫⁻ a : α, g a ^ p ∂μ) ^ (1 / p)) by
rwa [← mul_le_mul_left h0_rpow (by finiteness),
← mul_assoc, ← rpow_add _ _ h_add_zero h_add_top, ←
sub_eq_add_neg, _root_.sub_self, rpow_zero, one_mul, mul_one] at h
have h :
(∫⁻ a : α, (f + g) a ^ p ∂μ) ≤
((∫⁻ a : α, f a ^ p ∂μ) ^ (1 / p) + (∫⁻ a : α, g a ^ p ∂μ) ^ (1 / p)) *
(∫⁻ a : α, (f + g) a ^ p ∂μ) ^ (1 / q) :=
lintegral_rpow_add_le_add_eLpNorm_mul_lintegral_rpow_add hpq hf hf_top hg hg_top
have h_one_div_q : 1 / q = 1 - 1 / p := by
nth_rw 2 [← hpq.inv_add_inv_eq_one]
ring
simp_rw [h_one_div_q, sub_eq_add_neg 1 (1 / p), ENNReal.rpow_add _ _ h_add_zero h_add_top,
rpow_one] at h
conv_rhs at h => enter [2]; rw [mul_comm]
conv_lhs at h => rw [← one_mul (∫⁻ a : α, (f + g) a ^ p ∂μ)]
rwa [← mul_assoc, ENNReal.mul_le_mul_right h_add_zero h_add_top, mul_comm] at h
/-- **Minkowski's inequality for functions** `α → ℝ≥0∞`: the `ℒp` seminorm of the sum of two
functions is bounded by the sum of their `ℒp` seminorms. -/
theorem lintegral_Lp_add_le {p : ℝ} {f g : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hg : AEMeasurable g μ)
(hp1 : 1 ≤ p) :
(∫⁻ a, (f + g) a ^ p ∂μ) ^ (1 / p) ≤
(∫⁻ a, f a ^ p ∂μ) ^ (1 / p) + (∫⁻ a, g a ^ p ∂μ) ^ (1 / p) := by
have hp_pos : 0 < p := lt_of_lt_of_le zero_lt_one hp1
by_cases hf_top : ∫⁻ a, f a ^ p ∂μ = ⊤
· simp [hf_top, hp_pos]
by_cases hg_top : ∫⁻ a, g a ^ p ∂μ = ⊤
· simp [hg_top, hp_pos]
by_cases h1 : p = 1
· refine le_of_eq ?_
simp_rw [h1, one_div_one, ENNReal.rpow_one]
exact lintegral_add_left' hf _
have hp1_lt : 1 < p := by
refine lt_of_le_of_ne hp1 ?_
symm
exact h1
have hpq := Real.HolderConjugate.conjExponent hp1_lt
by_cases h0 : (∫⁻ a, (f + g) a ^ p ∂μ) = 0
· rw [h0, @ENNReal.zero_rpow_of_pos (1 / p) (by simp [lt_of_lt_of_le zero_lt_one hp1])]
exact zero_le _
have htop : (∫⁻ a, (f + g) a ^ p ∂μ) ≠ ⊤ := by
rw [← Ne] at hf_top hg_top
rw [← lt_top_iff_ne_top] at hf_top hg_top ⊢
exact lintegral_rpow_add_lt_top_of_lintegral_rpow_lt_top hf hf_top hg_top hp1
exact lintegral_Lp_add_le_aux hpq hf hf_top hg hg_top h0 htop
/-- Variant of Minkowski's inequality for functions `α → ℝ≥0∞` in `ℒp` with `p ≤ 1`: the `ℒp`
seminorm of the sum of two functions is bounded by a constant multiple of the sum
of their `ℒp` seminorms. -/
theorem lintegral_Lp_add_le_of_le_one {p : ℝ} {f g : α → ℝ≥0∞} (hf : AEMeasurable f μ) (hp0 : 0 ≤ p)
(hp1 : p ≤ 1) :
(∫⁻ a, (f + g) a ^ p ∂μ) ^ (1 / p) ≤
(2 : ℝ≥0∞) ^ (1 / p - 1) * ((∫⁻ a, f a ^ p ∂μ) ^ (1 / p) + (∫⁻ a, g a ^ p ∂μ) ^ (1 / p)) := by
rcases eq_or_lt_of_le hp0 with (rfl | hp)
· simp only [Pi.add_apply, rpow_zero, lintegral_one, _root_.div_zero, zero_sub]
norm_num
rw [rpow_neg, rpow_one, ENNReal.inv_mul_cancel two_ne_zero ofNat_ne_top]
calc
(∫⁻ a, (f + g) a ^ p ∂μ) ^ (1 / p) ≤ ((∫⁻ a, f a ^ p ∂μ) + ∫⁻ a, g a ^ p ∂μ) ^ (1 / p) := by
rw [← lintegral_add_left' (hf.pow_const p)]
gcongr with a
exact rpow_add_le_add_rpow _ _ hp0 hp1
_ ≤ (2 : ℝ≥0∞) ^ (1 / p - 1) * ((∫⁻ a, f a ^ p ∂μ) ^ (1 / p) + (∫⁻ a, g a ^ p ∂μ) ^ (1 / p)) :=
rpow_add_le_mul_rpow_add_rpow _ _ ((one_le_div hp).2 hp1)
end ENNReal
/-- Hölder's inequality for functions `α → ℝ≥0`. The integral of the product of two functions
is bounded by the product of their `ℒp` and `ℒq` seminorms when `p` and `q` are conjugate
exponents. -/
theorem NNReal.lintegral_mul_le_Lp_mul_Lq {p q : ℝ} (hpq : p.HolderConjugate q) {f g : α → ℝ≥0}
(hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
(∫⁻ a, (f * g) a ∂μ) ≤
(∫⁻ a, (f a : ℝ≥0∞) ^ p ∂μ) ^ (1 / p) * (∫⁻ a, (g a : ℝ≥0∞) ^ q ∂μ) ^ (1 / q) := by
simp_rw [Pi.mul_apply, ENNReal.coe_mul]
exact ENNReal.lintegral_mul_le_Lp_mul_Lq μ hpq hf.coe_nnreal_ennreal hg.coe_nnreal_ennreal
end
end LIntegral |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/FundThmCalculus.lean | import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus
deprecated_module (since := "2025-04-06") |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/IntegralEqImproper.lean | import Mathlib.Analysis.Calculus.Deriv.Support
import Mathlib.Analysis.SpecialFunctions.Pow.Deriv
import Mathlib.MeasureTheory.Function.JacobianOneDim
import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts
import Mathlib.MeasureTheory.Measure.Haar.NormedSpace
import Mathlib.MeasureTheory.Measure.Haar.Unique
/-!
# Links between an integral and its "improper" version
In its current state, mathlib only knows how to talk about definite ("proper") integrals,
in the sense that it treats integrals over `[x, +∞)` the same as it treats integrals over
`[y, z]`. For example, the integral over `[1, +∞)` is **not** defined to be the limit of
the integral over `[1, x]` as `x` tends to `+∞`, which is known as an **improper integral**.
Indeed, the "proper" definition is stronger than the "improper" one. The usual counterexample
is `x ↦ sin(x)/x`, which has an improper integral over `[1, +∞)` but no definite integral.
Although definite integrals have better properties, they are hardly usable when it comes to
computing integrals on unbounded sets, which is much easier using limits. Thus, in this file,
we prove various ways of studying the proper integral by studying the improper one.
## Definitions
The main definition of this file is `MeasureTheory.AECover`. It is a rather technical definition
whose sole purpose is generalizing and factoring proofs. Given an index type `ι`, a countably
generated filter `l` over `ι`, and an `ι`-indexed family `φ` of subsets of a measurable space `α`
equipped with a measure `μ`, one should think of a hypothesis `hφ : MeasureTheory.AECover μ l φ` as
a sufficient condition for being able to interpret `∫ x, f x ∂μ` (if it exists) as the limit of `∫ x
in φ i, f x ∂μ` as `i` tends to `l`.
When using this definition with a measure restricted to a set `s`, which happens fairly often, one
should not try too hard to use a `MeasureTheory.AECover` of subsets of `s`, as it often makes proofs
more complicated than necessary. See for example the proof of
`MeasureTheory.integrableOn_Iic_of_intervalIntegral_norm_tendsto` where we use `(fun x ↦ oi x)` as a
`MeasureTheory.AECover` w.r.t. `μ.restrict (Iic b)`, instead of using `(fun x ↦ Ioc x b)`.
## Main statements
- `MeasureTheory.AECover.lintegral_tendsto_of_countably_generated` : if `φ` is a
`MeasureTheory.AECover μ l`, where `l` is a countably generated filter, and if `f` is a measurable
`ENNReal`-valued function, then `∫⁻ x in φ n, f x ∂μ` tends to `∫⁻ x, f x ∂μ` as `n` tends to `l`
- `MeasureTheory.AECover.integrable_of_integral_norm_tendsto` : if `φ` is a
`MeasureTheory.AECover μ l`, where `l` is a countably generated filter, if `f` is measurable and
integrable on each `φ n`, and if `∫ x in φ n, ‖f x‖ ∂μ` tends to some `I : ℝ` as n tends to `l`,
then `f` is integrable
- `MeasureTheory.AECover.integral_tendsto_of_countably_generated` : if `φ` is a
`MeasureTheory.AECover μ l`, where `l` is a countably generated filter, and if `f` is measurable
and integrable (globally), then `∫ x in φ n, f x ∂μ` tends to `∫ x, f x ∂μ` as `n` tends to `+∞`.
We then specialize these lemmas to various use cases involving intervals, which are frequent
in analysis. In particular,
- `MeasureTheory.integral_Ioi_of_hasDerivAt_of_tendsto` is a version of FTC-2 on the interval
`(a, +∞)`, giving the formula `∫ x in (a, +∞), g' x = l - g a` if `g'` is integrable and
`g` tends to `l` at `+∞`.
- `MeasureTheory.integral_Ioi_of_hasDerivAt_of_nonneg` gives the same result assuming that
`g'` is nonnegative instead of integrable. Its automatic integrability in this context is proved
in `MeasureTheory.integrableOn_Ioi_deriv_of_nonneg`.
- `MeasureTheory.integral_comp_smul_deriv_Ioi` is a version of the change of variables formula
on semi-infinite intervals.
- `MeasureTheory.tendsto_limUnder_of_hasDerivAt_of_integrableOn_Ioi` shows that a function whose
derivative is integrable on `(a, +∞)` has a limit at `+∞`.
- `MeasureTheory.tendsto_zero_of_hasDerivAt_of_integrableOn_Ioi` shows that an integrable function
whose derivative is integrable on `(a, +∞)` tends to `0` at `+∞`.
Versions of these results are also given on the intervals `(-∞, a]` and `(-∞, +∞)`, as well as
the corresponding versions of integration by parts.
-/
open MeasureTheory Filter Set TopologicalSpace Topology
open scoped ENNReal NNReal
namespace MeasureTheory
section AECover
variable {α ι : Type*} [MeasurableSpace α] (μ : Measure α) (l : Filter ι)
/-- A sequence `φ` of subsets of `α` is a `MeasureTheory.AECover` w.r.t. a measure `μ` and a filter
`l` if almost every point (w.r.t. `μ`) of `α` eventually belongs to `φ n` (w.r.t. `l`), and if
each `φ n` is measurable. This definition is a technical way to avoid duplicating a lot of
proofs. It should be thought of as a sufficient condition for being able to interpret
`∫ x, f x ∂μ` (if it exists) as the limit of `∫ x in φ n, f x ∂μ` as `n` tends to `l`.
See for example `MeasureTheory.AECover.lintegral_tendsto_of_countably_generated`,
`MeasureTheory.AECover.integrable_of_integral_norm_tendsto` and
`MeasureTheory.AECover.integral_tendsto_of_countably_generated`. -/
structure AECover (φ : ι → Set α) : Prop where
ae_eventually_mem : ∀ᵐ x ∂μ, ∀ᶠ i in l, x ∈ φ i
protected measurableSet : ∀ i, MeasurableSet <| φ i
variable {μ} {l}
namespace AECover
/-!
## Operations on `AECover`s
-/
/-- Elementwise intersection of two `AECover`s is an `AECover`. -/
theorem inter {φ ψ : ι → Set α} (hφ : AECover μ l φ) (hψ : AECover μ l ψ) :
AECover μ l (fun i ↦ φ i ∩ ψ i) where
ae_eventually_mem := hψ.1.mp <| hφ.1.mono fun _ ↦ Eventually.and
measurableSet _ := (hφ.2 _).inter (hψ.2 _)
theorem superset {φ ψ : ι → Set α} (hφ : AECover μ l φ) (hsub : ∀ i, φ i ⊆ ψ i)
(hmeas : ∀ i, MeasurableSet (ψ i)) : AECover μ l ψ :=
⟨hφ.1.mono fun _x hx ↦ hx.mono fun i hi ↦ hsub i hi, hmeas⟩
theorem mono_ac {ν : Measure α} {φ : ι → Set α} (hφ : AECover μ l φ) (hle : ν ≪ μ) :
AECover ν l φ := ⟨hle hφ.1, hφ.2⟩
theorem mono {ν : Measure α} {φ : ι → Set α} (hφ : AECover μ l φ) (hle : ν ≤ μ) :
AECover ν l φ := hφ.mono_ac hle.absolutelyContinuous
end AECover
section MetricSpace
variable [PseudoMetricSpace α] [OpensMeasurableSpace α]
theorem aecover_ball {x : α} {r : ι → ℝ} (hr : Tendsto r l atTop) :
AECover μ l (fun i ↦ Metric.ball x (r i)) where
measurableSet _ := Metric.isOpen_ball.measurableSet
ae_eventually_mem := by
filter_upwards with y
filter_upwards [hr (Ioi_mem_atTop (dist x y))] with a ha using by simpa [dist_comm] using ha
theorem aecover_closedBall {x : α} {r : ι → ℝ} (hr : Tendsto r l atTop) :
AECover μ l (fun i ↦ Metric.closedBall x (r i)) where
measurableSet _ := Metric.isClosed_closedBall.measurableSet
ae_eventually_mem := by
filter_upwards with y
filter_upwards [hr (Ici_mem_atTop (dist x y))] with a ha using by simpa [dist_comm] using ha
end MetricSpace
section Preorderα
variable [Preorder α] [TopologicalSpace α] [OrderClosedTopology α] [OpensMeasurableSpace α]
{a b : ι → α}
theorem aecover_Ici (ha : Tendsto a l atBot) : AECover μ l fun i => Ici (a i) where
ae_eventually_mem := ae_of_all μ ha.eventually_le_atBot
measurableSet _ := measurableSet_Ici
theorem aecover_Iic (hb : Tendsto b l atTop) : AECover μ l fun i => Iic <| b i :=
aecover_Ici (α := αᵒᵈ) hb
theorem aecover_Icc (ha : Tendsto a l atBot) (hb : Tendsto b l atTop) :
AECover μ l fun i => Icc (a i) (b i) :=
(aecover_Ici ha).inter (aecover_Iic hb)
end Preorderα
section LinearOrderα
variable [LinearOrder α] [TopologicalSpace α] [OrderClosedTopology α] [OpensMeasurableSpace α]
{a b : ι → α} (ha : Tendsto a l atBot) (hb : Tendsto b l atTop)
include ha in
theorem aecover_Ioi [NoMinOrder α] : AECover μ l fun i => Ioi (a i) where
ae_eventually_mem := ae_of_all μ ha.eventually_lt_atBot
measurableSet _ := measurableSet_Ioi
include hb in
theorem aecover_Iio [NoMaxOrder α] : AECover μ l fun i => Iio (b i) := aecover_Ioi (α := αᵒᵈ) hb
include ha hb
theorem aecover_Ioo [NoMinOrder α] [NoMaxOrder α] : AECover μ l fun i => Ioo (a i) (b i) :=
(aecover_Ioi ha).inter (aecover_Iio hb)
theorem aecover_Ioc [NoMinOrder α] : AECover μ l fun i => Ioc (a i) (b i) :=
(aecover_Ioi ha).inter (aecover_Iic hb)
theorem aecover_Ico [NoMaxOrder α] : AECover μ l fun i => Ico (a i) (b i) :=
(aecover_Ici ha).inter (aecover_Iio hb)
end LinearOrderα
section FiniteIntervals
variable [LinearOrder α] [TopologicalSpace α] [OrderClosedTopology α] [OpensMeasurableSpace α]
{a b : ι → α} {A B : α} (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B))
include ha in
theorem aecover_Ioi_of_Ioi : AECover (μ.restrict (Ioi A)) l fun i ↦ Ioi (a i) where
ae_eventually_mem := (ae_restrict_mem measurableSet_Ioi).mono fun _x hx ↦ ha.eventually <|
eventually_lt_nhds hx
measurableSet _ := measurableSet_Ioi
include hb in
theorem aecover_Iio_of_Iio : AECover (μ.restrict (Iio B)) l fun i ↦ Iio (b i) :=
aecover_Ioi_of_Ioi (α := αᵒᵈ) hb
include ha in
theorem aecover_Ioi_of_Ici : AECover (μ.restrict (Ioi A)) l fun i ↦ Ici (a i) :=
(aecover_Ioi_of_Ioi ha).superset (fun _ ↦ Ioi_subset_Ici_self) fun _ ↦ measurableSet_Ici
include hb in
theorem aecover_Iio_of_Iic : AECover (μ.restrict (Iio B)) l fun i ↦ Iic (b i) :=
aecover_Ioi_of_Ici (α := αᵒᵈ) hb
include ha hb in
theorem aecover_Ioo_of_Ioo : AECover (μ.restrict <| Ioo A B) l fun i => Ioo (a i) (b i) :=
((aecover_Ioi_of_Ioi ha).mono <| Measure.restrict_mono Ioo_subset_Ioi_self le_rfl).inter
((aecover_Iio_of_Iio hb).mono <| Measure.restrict_mono Ioo_subset_Iio_self le_rfl)
include ha hb in
theorem aecover_Ioo_of_Icc : AECover (μ.restrict <| Ioo A B) l fun i => Icc (a i) (b i) :=
(aecover_Ioo_of_Ioo ha hb).superset (fun _ ↦ Ioo_subset_Icc_self) fun _ ↦ measurableSet_Icc
include ha hb in
theorem aecover_Ioo_of_Ico : AECover (μ.restrict <| Ioo A B) l fun i => Ico (a i) (b i) :=
(aecover_Ioo_of_Ioo ha hb).superset (fun _ ↦ Ioo_subset_Ico_self) fun _ ↦ measurableSet_Ico
include ha hb in
theorem aecover_Ioo_of_Ioc : AECover (μ.restrict <| Ioo A B) l fun i => Ioc (a i) (b i) :=
(aecover_Ioo_of_Ioo ha hb).superset (fun _ ↦ Ioo_subset_Ioc_self) fun _ ↦ measurableSet_Ioc
variable [NoAtoms μ]
theorem aecover_Ioc_of_Icc (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Ioc A B) l fun i => Icc (a i) (b i) :=
(aecover_Ioo_of_Icc ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Ioc).ge
theorem aecover_Ioc_of_Ico (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Ioc A B) l fun i => Ico (a i) (b i) :=
(aecover_Ioo_of_Ico ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Ioc).ge
theorem aecover_Ioc_of_Ioc (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Ioc A B) l fun i => Ioc (a i) (b i) :=
(aecover_Ioo_of_Ioc ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Ioc).ge
theorem aecover_Ioc_of_Ioo (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Ioc A B) l fun i => Ioo (a i) (b i) :=
(aecover_Ioo_of_Ioo ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Ioc).ge
theorem aecover_Ico_of_Icc (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Ico A B) l fun i => Icc (a i) (b i) :=
(aecover_Ioo_of_Icc ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Ico).ge
theorem aecover_Ico_of_Ico (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Ico A B) l fun i => Ico (a i) (b i) :=
(aecover_Ioo_of_Ico ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Ico).ge
theorem aecover_Ico_of_Ioc (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Ico A B) l fun i => Ioc (a i) (b i) :=
(aecover_Ioo_of_Ioc ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Ico).ge
theorem aecover_Ico_of_Ioo (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Ico A B) l fun i => Ioo (a i) (b i) :=
(aecover_Ioo_of_Ioo ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Ico).ge
theorem aecover_Icc_of_Icc (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Icc A B) l fun i => Icc (a i) (b i) :=
(aecover_Ioo_of_Icc ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Icc).ge
theorem aecover_Icc_of_Ico (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Icc A B) l fun i => Ico (a i) (b i) :=
(aecover_Ioo_of_Ico ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Icc).ge
theorem aecover_Icc_of_Ioc (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Icc A B) l fun i => Ioc (a i) (b i) :=
(aecover_Ioo_of_Ioc ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Icc).ge
theorem aecover_Icc_of_Ioo (ha : Tendsto a l (𝓝 A)) (hb : Tendsto b l (𝓝 B)) :
AECover (μ.restrict <| Icc A B) l fun i => Ioo (a i) (b i) :=
(aecover_Ioo_of_Ioo ha hb).mono (Measure.restrict_congr_set Ioo_ae_eq_Icc).ge
end FiniteIntervals
protected theorem AECover.restrict {φ : ι → Set α} (hφ : AECover μ l φ) {s : Set α} :
AECover (μ.restrict s) l φ :=
hφ.mono Measure.restrict_le_self
theorem aecover_restrict_of_ae_imp {s : Set α} {φ : ι → Set α} (hs : MeasurableSet s)
(ae_eventually_mem : ∀ᵐ x ∂μ, x ∈ s → ∀ᶠ n in l, x ∈ φ n)
(measurable : ∀ n, MeasurableSet <| φ n) : AECover (μ.restrict s) l φ where
ae_eventually_mem := by rwa [ae_restrict_iff' hs]
measurableSet := measurable
theorem AECover.inter_restrict {φ : ι → Set α} (hφ : AECover μ l φ) {s : Set α}
(hs : MeasurableSet s) : AECover (μ.restrict s) l fun i => φ i ∩ s :=
aecover_restrict_of_ae_imp hs
(hφ.ae_eventually_mem.mono fun _x hx hxs => hx.mono fun _i hi => ⟨hi, hxs⟩) fun i =>
(hφ.measurableSet i).inter hs
theorem AECover.ae_tendsto_indicator {β : Type*} [Zero β] [TopologicalSpace β] (f : α → β)
{φ : ι → Set α} (hφ : AECover μ l φ) :
∀ᵐ x ∂μ, Tendsto (fun i => (φ i).indicator f x) l (𝓝 <| f x) :=
hφ.ae_eventually_mem.mono fun _x hx =>
tendsto_const_nhds.congr' <| hx.mono fun _n hn => (indicator_of_mem hn _).symm
theorem AECover.aemeasurable {β : Type*} [MeasurableSpace β] [l.IsCountablyGenerated] [l.NeBot]
{f : α → β} {φ : ι → Set α} (hφ : AECover μ l φ)
(hfm : ∀ i, AEMeasurable f (μ.restrict <| φ i)) : AEMeasurable f μ := by
obtain ⟨u, hu⟩ := l.exists_seq_tendsto
have := aemeasurable_iUnion_iff.mpr fun n : ℕ => hfm (u n)
rwa [Measure.restrict_eq_self_of_ae_mem] at this
filter_upwards [hφ.ae_eventually_mem] with x hx using
mem_iUnion.mpr (hu.eventually hx).exists
theorem AECover.aestronglyMeasurable {β : Type*} [TopologicalSpace β] [PseudoMetrizableSpace β]
[l.IsCountablyGenerated] [l.NeBot] {f : α → β} {φ : ι → Set α} (hφ : AECover μ l φ)
(hfm : ∀ i, AEStronglyMeasurable f (μ.restrict <| φ i)) : AEStronglyMeasurable f μ := by
obtain ⟨u, hu⟩ := l.exists_seq_tendsto
have := aestronglyMeasurable_iUnion_iff.mpr fun n : ℕ => hfm (u n)
rwa [Measure.restrict_eq_self_of_ae_mem] at this
filter_upwards [hφ.ae_eventually_mem] with x hx using mem_iUnion.mpr (hu.eventually hx).exists
end AECover
theorem AECover.comp_tendsto {α ι ι' : Type*} [MeasurableSpace α] {μ : Measure α} {l : Filter ι}
{l' : Filter ι'} {φ : ι → Set α} (hφ : AECover μ l φ) {u : ι' → ι} (hu : Tendsto u l' l) :
AECover μ l' (φ ∘ u) where
ae_eventually_mem := hφ.ae_eventually_mem.mono fun _x hx => hu.eventually hx
measurableSet i := hφ.measurableSet (u i)
section AECoverUnionInterCountable
variable {α ι : Type*} [Countable ι] [MeasurableSpace α] {μ : Measure α}
theorem AECover.biUnion_Iic_aecover [Preorder ι] {φ : ι → Set α} (hφ : AECover μ atTop φ) :
AECover μ atTop fun n : ι => ⋃ (k) (_h : k ∈ Iic n), φ k :=
hφ.superset (fun _ ↦ subset_biUnion_of_mem right_mem_Iic) fun _ ↦ .biUnion (to_countable _)
fun _ _ ↦ (hφ.2 _)
theorem AECover.biInter_Ici_aecover [Preorder ι] {φ : ι → Set α}
(hφ : AECover μ atTop φ) : AECover μ atTop fun n : ι => ⋂ (k) (_h : k ∈ Ici n), φ k where
ae_eventually_mem := hφ.ae_eventually_mem.mono fun x h ↦ by
simpa only [mem_iInter, mem_Ici, eventually_forall_ge_atTop]
measurableSet _ := .biInter (to_countable _) fun n _ => hφ.measurableSet n
end AECoverUnionInterCountable
section Lintegral
variable {α ι : Type*} [MeasurableSpace α] {μ : Measure α} {l : Filter ι}
private theorem lintegral_tendsto_of_monotone_of_nat {φ : ℕ → Set α} (hφ : AECover μ atTop φ)
(hmono : Monotone φ) {f : α → ℝ≥0∞} (hfm : AEMeasurable f μ) :
Tendsto (fun i => ∫⁻ x in φ i, f x ∂μ) atTop (𝓝 <| ∫⁻ x, f x ∂μ) :=
let F n := (φ n).indicator f
have key₁ : ∀ n, AEMeasurable (F n) μ := fun n => hfm.indicator (hφ.measurableSet n)
have key₂ : ∀ᵐ x : α ∂μ, Monotone fun n => F n x := ae_of_all _ fun x _i _j hij =>
indicator_le_indicator_of_subset (hmono hij) (fun x => zero_le <| f x) x
have key₃ : ∀ᵐ x : α ∂μ, Tendsto (fun n => F n x) atTop (𝓝 (f x)) := hφ.ae_tendsto_indicator f
(lintegral_tendsto_of_tendsto_of_monotone key₁ key₂ key₃).congr fun n =>
lintegral_indicator (hφ.measurableSet n) _
theorem AECover.lintegral_tendsto_of_nat {φ : ℕ → Set α} (hφ : AECover μ atTop φ) {f : α → ℝ≥0∞}
(hfm : AEMeasurable f μ) : Tendsto (∫⁻ x in φ ·, f x ∂μ) atTop (𝓝 <| ∫⁻ x, f x ∂μ) := by
have lim₁ := lintegral_tendsto_of_monotone_of_nat hφ.biInter_Ici_aecover
(fun i j hij => biInter_subset_biInter_left (Ici_subset_Ici.mpr hij)) hfm
have lim₂ := lintegral_tendsto_of_monotone_of_nat hφ.biUnion_Iic_aecover
(fun i j hij => biUnion_subset_biUnion_left (Iic_subset_Iic.mpr hij)) hfm
refine tendsto_of_tendsto_of_tendsto_of_le_of_le lim₁ lim₂ (fun n ↦ ?_) fun n ↦ ?_
exacts [lintegral_mono_set (biInter_subset_of_mem left_mem_Ici),
lintegral_mono_set (subset_biUnion_of_mem right_mem_Iic)]
theorem AECover.lintegral_tendsto_of_countably_generated [l.IsCountablyGenerated] {φ : ι → Set α}
(hφ : AECover μ l φ) {f : α → ℝ≥0∞} (hfm : AEMeasurable f μ) :
Tendsto (fun i => ∫⁻ x in φ i, f x ∂μ) l (𝓝 <| ∫⁻ x, f x ∂μ) :=
tendsto_of_seq_tendsto fun _u hu => (hφ.comp_tendsto hu).lintegral_tendsto_of_nat hfm
theorem AECover.lintegral_eq_of_tendsto [l.NeBot] [l.IsCountablyGenerated] {φ : ι → Set α}
(hφ : AECover μ l φ) {f : α → ℝ≥0∞} (I : ℝ≥0∞) (hfm : AEMeasurable f μ)
(htendsto : Tendsto (fun i => ∫⁻ x in φ i, f x ∂μ) l (𝓝 I)) : ∫⁻ x, f x ∂μ = I :=
tendsto_nhds_unique (hφ.lintegral_tendsto_of_countably_generated hfm) htendsto
theorem AECover.iSup_lintegral_eq_of_countably_generated [Nonempty ι] [l.NeBot]
[l.IsCountablyGenerated] {φ : ι → Set α} (hφ : AECover μ l φ) {f : α → ℝ≥0∞}
(hfm : AEMeasurable f μ) : ⨆ i : ι, ∫⁻ x in φ i, f x ∂μ = ∫⁻ x, f x ∂μ := by
have := hφ.lintegral_tendsto_of_countably_generated hfm
refine ciSup_eq_of_forall_le_of_forall_lt_exists_gt
(fun i => lintegral_mono' Measure.restrict_le_self le_rfl) fun w hw => ?_
exact (this.eventually_const_lt hw).exists
end Lintegral
section Integrable
variable {α ι E : Type*} [MeasurableSpace α] {μ : Measure α} {l : Filter ι} [NormedAddCommGroup E]
theorem AECover.integrable_of_lintegral_enorm_bounded [l.NeBot] [l.IsCountablyGenerated]
{φ : ι → Set α} (hφ : AECover μ l φ) {f : α → E} (I : ℝ) (hfm : AEStronglyMeasurable f μ)
(hbounded : ∀ᶠ i in l, ∫⁻ x in φ i, ‖f x‖ₑ ∂μ ≤ ENNReal.ofReal I) : Integrable f μ := by
refine ⟨hfm, (le_of_tendsto ?_ hbounded).trans_lt ENNReal.ofReal_lt_top⟩
exact hφ.lintegral_tendsto_of_countably_generated hfm.enorm
theorem AECover.integrable_of_lintegral_enorm_tendsto [l.NeBot] [l.IsCountablyGenerated]
{φ : ι → Set α} (hφ : AECover μ l φ) {f : α → E} (I : ℝ) (hfm : AEStronglyMeasurable f μ)
(htendsto : Tendsto (fun i => ∫⁻ x in φ i, ‖f x‖ₑ ∂μ) l (𝓝 <| .ofReal I)) :
Integrable f μ := by
refine hφ.integrable_of_lintegral_enorm_bounded (max 1 (I + 1)) hfm ?_
refine htendsto.eventually (ge_mem_nhds ?_)
refine (ENNReal.ofReal_lt_ofReal_iff (lt_max_of_lt_left zero_lt_one)).2 ?_
exact lt_max_of_lt_right (lt_add_one I)
theorem AECover.integrable_of_lintegral_enorm_bounded' [l.NeBot] [l.IsCountablyGenerated]
{φ : ι → Set α} (hφ : AECover μ l φ) {f : α → E} (I : ℝ≥0) (hfm : AEStronglyMeasurable f μ)
(hbounded : ∀ᶠ i in l, ∫⁻ x in φ i, ‖f x‖ₑ ∂μ ≤ I) : Integrable f μ :=
hφ.integrable_of_lintegral_enorm_bounded I hfm
(by simpa only [ENNReal.ofReal_coe_nnreal] using hbounded)
theorem AECover.integrable_of_lintegral_enorm_tendsto' [l.NeBot] [l.IsCountablyGenerated]
{φ : ι → Set α} (hφ : AECover μ l φ) {f : α → E} (I : ℝ≥0) (hfm : AEStronglyMeasurable f μ)
(htendsto : Tendsto (fun i => ∫⁻ x in φ i, ‖f x‖ₑ ∂μ) l (𝓝 I)) : Integrable f μ :=
hφ.integrable_of_lintegral_enorm_tendsto I hfm
(by simpa only [ENNReal.ofReal_coe_nnreal] using htendsto)
theorem AECover.integrable_of_integral_norm_bounded [l.NeBot] [l.IsCountablyGenerated]
{φ : ι → Set α} (hφ : AECover μ l φ) {f : α → E} (I : ℝ) (hfi : ∀ i, IntegrableOn f (φ i) μ)
(hbounded : ∀ᶠ i in l, (∫ x in φ i, ‖f x‖ ∂μ) ≤ I) : Integrable f μ := by
have hfm : AEStronglyMeasurable f μ :=
hφ.aestronglyMeasurable fun i => (hfi i).aestronglyMeasurable
refine hφ.integrable_of_lintegral_enorm_bounded I hfm ?_
conv at hbounded in integral _ _ =>
rw [integral_eq_lintegral_of_nonneg_ae (ae_of_all _ fun x => @norm_nonneg E _ (f x))
hfm.norm.restrict]
conv at hbounded in ENNReal.ofReal _ =>
rw [← coe_nnnorm, ENNReal.ofReal_coe_nnreal]
refine hbounded.mono fun i hi => ?_
rw [← ENNReal.ofReal_toReal <| ne_top_of_lt <| hasFiniteIntegral_iff_enorm.mp (hfi i).2]
apply ENNReal.ofReal_le_ofReal hi
theorem AECover.integrable_of_integral_norm_tendsto [l.NeBot] [l.IsCountablyGenerated]
{φ : ι → Set α} (hφ : AECover μ l φ) {f : α → E} (I : ℝ) (hfi : ∀ i, IntegrableOn f (φ i) μ)
(htendsto : Tendsto (fun i => ∫ x in φ i, ‖f x‖ ∂μ) l (𝓝 I)) : Integrable f μ :=
let ⟨I', hI'⟩ := htendsto.isBoundedUnder_le
hφ.integrable_of_integral_norm_bounded I' hfi hI'
theorem AECover.integrable_of_integral_bounded_of_nonneg_ae [l.NeBot] [l.IsCountablyGenerated]
{φ : ι → Set α} (hφ : AECover μ l φ) {f : α → ℝ} (I : ℝ) (hfi : ∀ i, IntegrableOn f (φ i) μ)
(hnng : ∀ᵐ x ∂μ, 0 ≤ f x) (hbounded : ∀ᶠ i in l, (∫ x in φ i, f x ∂μ) ≤ I) : Integrable f μ :=
hφ.integrable_of_integral_norm_bounded I hfi <| hbounded.mono fun _i hi =>
(integral_congr_ae <| ae_restrict_of_ae <| hnng.mono fun _ => Real.norm_of_nonneg).le.trans hi
theorem AECover.integrable_of_integral_tendsto_of_nonneg_ae [l.NeBot] [l.IsCountablyGenerated]
{φ : ι → Set α} (hφ : AECover μ l φ) {f : α → ℝ} (I : ℝ) (hfi : ∀ i, IntegrableOn f (φ i) μ)
(hnng : ∀ᵐ x ∂μ, 0 ≤ f x) (htendsto : Tendsto (fun i => ∫ x in φ i, f x ∂μ) l (𝓝 I)) :
Integrable f μ :=
let ⟨I', hI'⟩ := htendsto.isBoundedUnder_le
hφ.integrable_of_integral_bounded_of_nonneg_ae I' hfi hnng hI'
end Integrable
section Integral
variable {α ι E : Type*} [MeasurableSpace α] {μ : Measure α} {l : Filter ι} [NormedAddCommGroup E]
[NormedSpace ℝ E]
theorem AECover.integral_tendsto_of_countably_generated [l.IsCountablyGenerated] {φ : ι → Set α}
(hφ : AECover μ l φ) {f : α → E} (hfi : Integrable f μ) :
Tendsto (fun i => ∫ x in φ i, f x ∂μ) l (𝓝 <| ∫ x, f x ∂μ) :=
suffices h : Tendsto (fun i => ∫ x : α, (φ i).indicator f x ∂μ) l (𝓝 (∫ x : α, f x ∂μ)) from by
convert h using 2; rw [integral_indicator (hφ.measurableSet _)]
tendsto_integral_filter_of_dominated_convergence (fun x => ‖f x‖)
(Eventually.of_forall fun i => hfi.aestronglyMeasurable.indicator <| hφ.measurableSet i)
(Eventually.of_forall fun _ => ae_of_all _ fun _ => norm_indicator_le_norm_self _ _) hfi.norm
(hφ.ae_tendsto_indicator f)
/-- Slight reformulation of `MeasureTheory.AECover.integral_tendsto_of_countably_generated`. -/
theorem AECover.integral_eq_of_tendsto [l.NeBot] [l.IsCountablyGenerated] {φ : ι → Set α}
(hφ : AECover μ l φ) {f : α → E} (I : E) (hfi : Integrable f μ)
(h : Tendsto (fun n => ∫ x in φ n, f x ∂μ) l (𝓝 I)) : ∫ x, f x ∂μ = I :=
tendsto_nhds_unique (hφ.integral_tendsto_of_countably_generated hfi) h
theorem AECover.integral_eq_of_tendsto_of_nonneg_ae [l.NeBot] [l.IsCountablyGenerated]
{φ : ι → Set α} (hφ : AECover μ l φ) {f : α → ℝ} (I : ℝ) (hnng : 0 ≤ᵐ[μ] f)
(hfi : ∀ n, IntegrableOn f (φ n) μ) (htendsto : Tendsto (fun n => ∫ x in φ n, f x ∂μ) l (𝓝 I)) :
∫ x, f x ∂μ = I :=
have hfi' : Integrable f μ := hφ.integrable_of_integral_tendsto_of_nonneg_ae I hfi hnng htendsto
hφ.integral_eq_of_tendsto I hfi' htendsto
end Integral
section IntegrableOfIntervalIntegral
variable {ι E : Type*} {μ : Measure ℝ} {l : Filter ι} [Filter.NeBot l] [IsCountablyGenerated l]
[NormedAddCommGroup E] {a b : ι → ℝ} {f : ℝ → E}
theorem integrable_of_intervalIntegral_norm_bounded (I : ℝ)
(hfi : ∀ i, IntegrableOn f (Ioc (a i) (b i)) μ) (ha : Tendsto a l atBot)
(hb : Tendsto b l atTop) (h : ∀ᶠ i in l, (∫ x in a i..b i, ‖f x‖ ∂μ) ≤ I) : Integrable f μ := by
have hφ : AECover μ l _ := aecover_Ioc ha hb
refine hφ.integrable_of_integral_norm_bounded I hfi (h.mp ?_)
filter_upwards [ha.eventually (eventually_le_atBot 0),
hb.eventually (eventually_ge_atTop 0)] with i hai hbi ht
rwa [← intervalIntegral.integral_of_le (hai.trans hbi)]
/-- If `f` is integrable on intervals `Ioc (a i) (b i)`,
where `a i` tends to -∞ and `b i` tends to ∞, and
`∫ x in a i .. b i, ‖f x‖ ∂μ` converges to `I : ℝ` along a filter `l`,
then `f` is integrable on the interval (-∞, ∞) -/
theorem integrable_of_intervalIntegral_norm_tendsto (I : ℝ)
(hfi : ∀ i, IntegrableOn f (Ioc (a i) (b i)) μ) (ha : Tendsto a l atBot)
(hb : Tendsto b l atTop) (h : Tendsto (fun i => ∫ x in a i..b i, ‖f x‖ ∂μ) l (𝓝 I)) :
Integrable f μ :=
let ⟨I', hI'⟩ := h.isBoundedUnder_le
integrable_of_intervalIntegral_norm_bounded I' hfi ha hb hI'
theorem integrableOn_Iic_of_intervalIntegral_norm_bounded (I b : ℝ)
(hfi : ∀ i, IntegrableOn f (Ioc (a i) b) μ) (ha : Tendsto a l atBot)
(h : ∀ᶠ i in l, (∫ x in a i..b, ‖f x‖ ∂μ) ≤ I) : IntegrableOn f (Iic b) μ := by
have hφ : AECover (μ.restrict <| Iic b) l _ := aecover_Ioi ha
have hfi : ∀ i, IntegrableOn f (Ioi (a i)) (μ.restrict <| Iic b) := by
intro i
rw [IntegrableOn, Measure.restrict_restrict (hφ.measurableSet i)]
exact hfi i
refine hφ.integrable_of_integral_norm_bounded I hfi (h.mp ?_)
filter_upwards [ha.eventually (eventually_le_atBot b)] with i hai
rw [intervalIntegral.integral_of_le hai, Measure.restrict_restrict (hφ.measurableSet i)]
exact id
/-- If `f` is integrable on intervals `Ioc (a i) b`,
where `a i` tends to -∞, and
`∫ x in a i .. b, ‖f x‖ ∂μ` converges to `I : ℝ` along a filter `l`,
then `f` is integrable on the interval (-∞, b) -/
theorem integrableOn_Iic_of_intervalIntegral_norm_tendsto (I b : ℝ)
(hfi : ∀ i, IntegrableOn f (Ioc (a i) b) μ) (ha : Tendsto a l atBot)
(h : Tendsto (fun i => ∫ x in a i..b, ‖f x‖ ∂μ) l (𝓝 I)) : IntegrableOn f (Iic b) μ :=
let ⟨I', hI'⟩ := h.isBoundedUnder_le
integrableOn_Iic_of_intervalIntegral_norm_bounded I' b hfi ha hI'
theorem integrableOn_Ioi_of_intervalIntegral_norm_bounded (I a : ℝ)
(hfi : ∀ i, IntegrableOn f (Ioc a (b i)) μ) (hb : Tendsto b l atTop)
(h : ∀ᶠ i in l, (∫ x in a..b i, ‖f x‖ ∂μ) ≤ I) : IntegrableOn f (Ioi a) μ := by
have hφ : AECover (μ.restrict <| Ioi a) l _ := aecover_Iic hb
have hfi : ∀ i, IntegrableOn f (Iic (b i)) (μ.restrict <| Ioi a) := by
intro i
rw [IntegrableOn, Measure.restrict_restrict (hφ.measurableSet i), inter_comm]
exact hfi i
refine hφ.integrable_of_integral_norm_bounded I hfi (h.mp ?_)
filter_upwards [hb.eventually (eventually_ge_atTop a)] with i hbi
rw [intervalIntegral.integral_of_le hbi, Measure.restrict_restrict (hφ.measurableSet i),
inter_comm]
exact id
/-- If `f` is integrable on intervals `Ioc a (b i)`,
where `b i` tends to ∞, and
`∫ x in a .. b i, ‖f x‖ ∂μ` converges to `I : ℝ` along a filter `l`,
then `f` is integrable on the interval (a, ∞) -/
theorem integrableOn_Ioi_of_intervalIntegral_norm_tendsto (I a : ℝ)
(hfi : ∀ i, IntegrableOn f (Ioc a (b i)) μ) (hb : Tendsto b l atTop)
(h : Tendsto (fun i => ∫ x in a..b i, ‖f x‖ ∂μ) l (𝓝 <| I)) : IntegrableOn f (Ioi a) μ :=
let ⟨I', hI'⟩ := h.isBoundedUnder_le
integrableOn_Ioi_of_intervalIntegral_norm_bounded I' a hfi hb hI'
theorem integrableOn_Ioc_of_intervalIntegral_norm_bounded {I a₀ b₀ : ℝ}
(hfi : ∀ i, IntegrableOn 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) :
IntegrableOn f (Ioc a₀ b₀) := by
refine (aecover_Ioc_of_Ioc ha hb).integrable_of_integral_norm_bounded I
(fun i => (hfi i).restrict) (h.mono fun i hi ↦ ?_)
rw [Measure.restrict_restrict measurableSet_Ioc]
grw [← hi]
gcongr
· apply ae_of_all
simp
· exact (hfi i).norm
· exact inter_subset_left
theorem integrableOn_Ioc_of_intervalIntegral_norm_bounded_left {I a₀ b : ℝ}
(hfi : ∀ i, IntegrableOn f <| Ioc (a i) b) (ha : Tendsto a l <| 𝓝 a₀)
(h : ∀ᶠ i in l, (∫ x in Ioc (a i) b, ‖f x‖) ≤ I) : IntegrableOn f (Ioc a₀ b) :=
integrableOn_Ioc_of_intervalIntegral_norm_bounded hfi ha tendsto_const_nhds h
theorem integrableOn_Ioc_of_intervalIntegral_norm_bounded_right {I a b₀ : ℝ}
(hfi : ∀ i, IntegrableOn f <| Ioc a (b i)) (hb : Tendsto b l <| 𝓝 b₀)
(h : ∀ᶠ i in l, (∫ x in Ioc a (b i), ‖f x‖) ≤ I) : IntegrableOn f (Ioc a b₀) :=
integrableOn_Ioc_of_intervalIntegral_norm_bounded hfi tendsto_const_nhds hb h
end IntegrableOfIntervalIntegral
section IntegralOfIntervalIntegral
variable {ι E : Type*} {μ : Measure ℝ} {l : Filter ι} [IsCountablyGenerated l]
[NormedAddCommGroup E] [NormedSpace ℝ E] {a b : ι → ℝ} {f : ℝ → E}
theorem intervalIntegral_tendsto_integral (hfi : Integrable f μ) (ha : Tendsto a l atBot)
(hb : Tendsto b l atTop) : Tendsto (fun i => ∫ x in a i..b i, f x ∂μ) l (𝓝 <| ∫ x, f x ∂μ) := by
let φ i := Ioc (a i) (b i)
have hφ : AECover μ l φ := aecover_Ioc ha hb
refine (hφ.integral_tendsto_of_countably_generated hfi).congr' ?_
filter_upwards [ha.eventually (eventually_le_atBot 0),
hb.eventually (eventually_ge_atTop 0)] with i hai hbi
exact (intervalIntegral.integral_of_le (hai.trans hbi)).symm
theorem intervalIntegral_tendsto_integral_Iic (b : ℝ) (hfi : IntegrableOn f (Iic b) μ)
(ha : Tendsto a l atBot) :
Tendsto (fun i => ∫ x in a i..b, f x ∂μ) l (𝓝 <| ∫ x in Iic b, f x ∂μ) := by
let φ i := Ioi (a i)
have hφ : AECover (μ.restrict <| Iic b) l φ := aecover_Ioi ha
refine (hφ.integral_tendsto_of_countably_generated hfi).congr' ?_
filter_upwards [ha.eventually (eventually_le_atBot <| b)] with i hai
rw [intervalIntegral.integral_of_le hai, Measure.restrict_restrict (hφ.measurableSet i)]
rfl
theorem intervalIntegral_tendsto_integral_Ioi (a : ℝ) (hfi : IntegrableOn f (Ioi a) μ)
(hb : Tendsto b l atTop) :
Tendsto (fun i => ∫ x in a..b i, f x ∂μ) l (𝓝 <| ∫ x in Ioi a, f x ∂μ) := by
let φ i := Iic (b i)
have hφ : AECover (μ.restrict <| Ioi a) l φ := aecover_Iic hb
refine (hφ.integral_tendsto_of_countably_generated hfi).congr' ?_
filter_upwards [hb.eventually (eventually_ge_atTop <| a)] with i hbi
rw [intervalIntegral.integral_of_le hbi, Measure.restrict_restrict (hφ.measurableSet i),
inter_comm]
rfl
end IntegralOfIntervalIntegral
open Real
open scoped Interval
section IoiFTC
variable {E : Type*} {f f' : ℝ → E} {g g' : ℝ → ℝ} {a l : ℝ} {m : E} [NormedAddCommGroup E]
[NormedSpace ℝ E]
/-- If the derivative of a function defined on the real line is integrable close to `+∞`, then
the function has a limit at `+∞`. -/
theorem tendsto_limUnder_of_hasDerivAt_of_integrableOn_Ioi [CompleteSpace E]
(hderiv : ∀ x ∈ Ioi a, HasDerivAt f (f' x) x) (f'int : IntegrableOn f' (Ioi a)) :
Tendsto f atTop (𝓝 (limUnder atTop f)) := by
suffices ∃ a, Tendsto f atTop (𝓝 a) from tendsto_nhds_limUnder this
suffices CauchySeq f from cauchySeq_tendsto_of_complete this
apply Metric.cauchySeq_iff'.2 (fun ε εpos ↦ ?_)
have A : ∀ᶠ (n : ℕ) in atTop, ∫ (x : ℝ) in Ici ↑n, ‖f' x‖ < ε := by
have L : Tendsto (fun (n : ℕ) ↦ ∫ x in Ici (n : ℝ), ‖f' x‖) atTop
(𝓝 (∫ x in ⋂ (n : ℕ), Ici (n : ℝ), ‖f' x‖)) := by
apply tendsto_setIntegral_of_antitone (fun n ↦ measurableSet_Ici)
· intro m n hmn
exact Ici_subset_Ici.2 (Nat.cast_le.mpr hmn)
· rcases exists_nat_gt a with ⟨n, hn⟩
exact ⟨n, IntegrableOn.mono_set f'int.norm (Ici_subset_Ioi.2 hn)⟩
have B : ⋂ (n : ℕ), Ici (n : ℝ) = ∅ := by
apply eq_empty_of_forall_notMem (fun x ↦ ?_)
simpa only [mem_iInter, mem_Ici, not_forall, not_le] using exists_nat_gt x
simp only [B, Measure.restrict_empty, integral_zero_measure] at L
exact (tendsto_order.1 L).2 _ εpos
have B : ∀ᶠ (n : ℕ) in atTop, a < n := by
rcases exists_nat_gt a with ⟨n, hn⟩
filter_upwards [Ioi_mem_atTop n] with m (hm : n < m) using hn.trans (Nat.cast_lt.mpr hm)
rcases (A.and B).exists with ⟨N, hN, h'N⟩
refine ⟨N, fun x hx ↦ ?_⟩
calc
dist (f x) (f ↑N)
= ‖f x - f N‖ := dist_eq_norm _ _
_ = ‖∫ t in Ioc ↑N x, f' t‖ := by
rw [← intervalIntegral.integral_of_le hx, intervalIntegral.integral_eq_sub_of_hasDerivAt]
· intro y hy
simp only [hx, uIcc_of_le, mem_Icc] at hy
exact hderiv _ (h'N.trans_le hy.1)
· rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hx]
exact f'int.mono_set (Ioc_subset_Ioi_self.trans (Ioi_subset_Ioi h'N.le))
_ ≤ ∫ t in Ioc ↑N x, ‖f' t‖ := norm_integral_le_integral_norm fun a ↦ f' a
_ ≤ ∫ t in Ici ↑N, ‖f' t‖ := by
apply setIntegral_mono_set
· apply IntegrableOn.mono_set f'int.norm (Ici_subset_Ioi.2 h'N)
· filter_upwards with x using norm_nonneg _
· have : Ioc (↑N) x ⊆ Ici ↑N := Ioc_subset_Ioi_self.trans Ioi_subset_Ici_self
exact this.eventuallyLE
_ < ε := hN
open UniformSpace in
/-- If a function and its derivative are integrable on `(a, +∞)`, then the function tends to zero
at `+∞`. -/
theorem tendsto_zero_of_hasDerivAt_of_integrableOn_Ioi
(hderiv : ∀ x ∈ Ioi a, HasDerivAt f (f' x) x)
(f'int : IntegrableOn f' (Ioi a)) (fint : IntegrableOn f (Ioi a)) :
Tendsto f atTop (𝓝 0) := by
let F : E →L[ℝ] Completion E := Completion.toComplL
have Fderiv : ∀ x ∈ Ioi a, HasDerivAt (F ∘ f) (F (f' x)) x :=
fun x hx ↦ F.hasFDerivAt.comp_hasDerivAt _ (hderiv x hx)
have Fint : IntegrableOn (F ∘ f) (Ioi a) := by apply F.integrable_comp fint
have F'int : IntegrableOn (F ∘ f') (Ioi a) := by apply F.integrable_comp f'int
have A : Tendsto (F ∘ f) atTop (𝓝 (limUnder atTop (F ∘ f))) := by
apply tendsto_limUnder_of_hasDerivAt_of_integrableOn_Ioi Fderiv F'int
have B : limUnder atTop (F ∘ f) = F 0 := by
have : IntegrableAtFilter (F ∘ f) atTop := by exact ⟨Ioi a, Ioi_mem_atTop _, Fint⟩
apply IntegrableAtFilter.eq_zero_of_tendsto this ?_ A
intro s hs
rcases mem_atTop_sets.1 hs with ⟨b, hb⟩
rw [← top_le_iff, ← volume_Ici (a := b)]
exact measure_mono hb
rwa [B, ← IsEmbedding.tendsto_nhds_iff] at A
exact (Completion.isUniformEmbedding_coe E).isEmbedding
variable [CompleteSpace E]
/-- **Fundamental theorem of calculus-2**, on semi-infinite intervals `(a, +∞)`.
When a function has a limit at infinity `m`, and its derivative is integrable, then the
integral of the derivative on `(a, +∞)` is `m - f a`. Version assuming differentiability
on `(a, +∞)` and continuity at `a⁺`.
Note that such a function always has a limit at infinity,
see `tendsto_limUnder_of_hasDerivAt_of_integrableOn_Ioi`. -/
theorem integral_Ioi_of_hasDerivAt_of_tendsto (hcont : ContinuousWithinAt f (Ici a) a)
(hderiv : ∀ x ∈ Ioi a, HasDerivAt f (f' x) x) (f'int : IntegrableOn f' (Ioi a))
(hf : Tendsto f atTop (𝓝 m)) : ∫ x in Ioi a, f' x = m - f a := by
have hcont : ContinuousOn f (Ici a) := by
intro x hx
rcases hx.out.eq_or_lt with rfl | hx
· exact hcont
· exact (hderiv x hx).continuousAt.continuousWithinAt
refine tendsto_nhds_unique (intervalIntegral_tendsto_integral_Ioi a f'int tendsto_id) ?_
apply Tendsto.congr' _ (hf.sub_const _)
filter_upwards [Ioi_mem_atTop a] with x hx
have h'x : a ≤ id x := le_of_lt hx
symm
apply
intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le h'x (hcont.mono Icc_subset_Ici_self)
fun y hy => hderiv y hy.1
rw [intervalIntegrable_iff_integrableOn_Ioc_of_le h'x]
exact f'int.mono (fun y hy => hy.1) le_rfl
/-- **Fundamental theorem of calculus-2**, on semi-infinite intervals `(a, +∞)`.
When a function has a limit at infinity `m`, and its derivative is integrable, then the
integral of the derivative on `(a, +∞)` is `m - f a`. Version assuming differentiability
on `[a, +∞)`.
Note that such a function always has a limit at infinity,
see `tendsto_limUnder_of_hasDerivAt_of_integrableOn_Ioi`. -/
theorem integral_Ioi_of_hasDerivAt_of_tendsto' (hderiv : ∀ x ∈ Ici a, HasDerivAt f (f' x) x)
(f'int : IntegrableOn f' (Ioi a)) (hf : Tendsto f atTop (𝓝 m)) :
∫ x in Ioi a, f' x = m - f a := by
refine integral_Ioi_of_hasDerivAt_of_tendsto ?_ (fun x hx => hderiv x hx.out.le)
f'int hf
exact (hderiv a left_mem_Ici).continuousAt.continuousWithinAt
/-- A special case of `integral_Ioi_of_hasDerivAt_of_tendsto` where we assume that `f` is C^1 with
compact support. -/
theorem _root_.HasCompactSupport.integral_Ioi_deriv_eq (hf : ContDiff ℝ 1 f)
(h2f : HasCompactSupport f) (b : ℝ) : ∫ x in Ioi b, deriv f x = - f b := by
have := fun x (_ : x ∈ Ioi b) ↦ hf.differentiable le_rfl x |>.hasDerivAt
rw [integral_Ioi_of_hasDerivAt_of_tendsto hf.continuous.continuousWithinAt this, zero_sub]
· refine hf.continuous_deriv le_rfl |>.integrable_of_hasCompactSupport h2f.deriv |>.integrableOn
rw [hasCompactSupport_iff_eventuallyEq, Filter.coclosedCompact_eq_cocompact] at h2f
exact h2f.filter_mono _root_.atTop_le_cocompact |>.tendsto
/-- When a function has a limit at infinity, and its derivative is nonnegative, then the derivative
is automatically integrable on `(a, +∞)`. Version assuming differentiability
on `(a, +∞)` and continuity at `a⁺`. -/
theorem integrableOn_Ioi_deriv_of_nonneg (hcont : ContinuousWithinAt g (Ici a) a)
(hderiv : ∀ x ∈ Ioi a, HasDerivAt g (g' x) x) (g'pos : ∀ x ∈ Ioi a, 0 ≤ g' x)
(hg : Tendsto g atTop (𝓝 l)) : IntegrableOn g' (Ioi a) := by
have hcont : ContinuousOn g (Ici a) := by
intro x hx
rcases hx.out.eq_or_lt with rfl | hx
· exact hcont
· exact (hderiv x hx).continuousAt.continuousWithinAt
refine integrableOn_Ioi_of_intervalIntegral_norm_tendsto (l - g a) a (fun x => ?_) tendsto_id ?_
· exact intervalIntegral.integrableOn_deriv_of_nonneg (hcont.mono Icc_subset_Ici_self)
(fun y hy => hderiv y hy.1) fun y hy => g'pos y hy.1
apply Tendsto.congr' _ (hg.sub_const _)
filter_upwards [Ioi_mem_atTop a] with x hx
have h'x : a ≤ id x := le_of_lt hx
calc
g x - g a = ∫ y in a..id x, g' y := by
symm
apply intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le h'x
(hcont.mono Icc_subset_Ici_self) fun y hy => hderiv y hy.1
rw [intervalIntegrable_iff_integrableOn_Ioc_of_le h'x]
exact intervalIntegral.integrableOn_deriv_of_nonneg (hcont.mono Icc_subset_Ici_self)
(fun y hy => hderiv y hy.1) fun y hy => g'pos y hy.1
_ = ∫ y in a..id x, ‖g' y‖ := by
simp_rw [intervalIntegral.integral_of_le h'x]
refine setIntegral_congr_fun measurableSet_Ioc fun y hy => ?_
dsimp
rw [abs_of_nonneg]
exact g'pos _ hy.1
/-- When a function has a limit at infinity, and its derivative is nonnegative, then the derivative
is automatically integrable on `(a, +∞)`. Version assuming differentiability
on `[a, +∞)`. -/
theorem integrableOn_Ioi_deriv_of_nonneg' (hderiv : ∀ x ∈ Ici a, HasDerivAt g (g' x) x)
(g'pos : ∀ x ∈ Ioi a, 0 ≤ g' x) (hg : Tendsto g atTop (𝓝 l)) : IntegrableOn g' (Ioi a) := by
refine integrableOn_Ioi_deriv_of_nonneg ?_ (fun x hx => hderiv x hx.out.le) g'pos hg
exact (hderiv a left_mem_Ici).continuousAt.continuousWithinAt
/-- When a function has a limit at infinity `l`, and its derivative is nonnegative, then the
integral of the derivative on `(a, +∞)` is `l - g a` (and the derivative is integrable, see
`integrable_on_Ioi_deriv_of_nonneg`). Version assuming differentiability on `(a, +∞)` and
continuity at `a⁺`. -/
theorem integral_Ioi_of_hasDerivAt_of_nonneg (hcont : ContinuousWithinAt g (Ici a) a)
(hderiv : ∀ x ∈ Ioi a, HasDerivAt g (g' x) x) (g'pos : ∀ x ∈ Ioi a, 0 ≤ g' x)
(hg : Tendsto g atTop (𝓝 l)) : ∫ x in Ioi a, g' x = l - g a :=
integral_Ioi_of_hasDerivAt_of_tendsto hcont hderiv
(integrableOn_Ioi_deriv_of_nonneg hcont hderiv g'pos hg) hg
/-- When a function has a limit at infinity `l`, and its derivative is nonnegative, then the
integral of the derivative on `(a, +∞)` is `l - g a` (and the derivative is integrable, see
`integrable_on_Ioi_deriv_of_nonneg'`). Version assuming differentiability on `[a, +∞)`. -/
theorem integral_Ioi_of_hasDerivAt_of_nonneg' (hderiv : ∀ x ∈ Ici a, HasDerivAt g (g' x) x)
(g'pos : ∀ x ∈ Ioi a, 0 ≤ g' x) (hg : Tendsto g atTop (𝓝 l)) : ∫ x in Ioi a, g' x = l - g a :=
integral_Ioi_of_hasDerivAt_of_tendsto' hderiv (integrableOn_Ioi_deriv_of_nonneg' hderiv g'pos hg)
hg
/-- When a function has a limit at infinity, and its derivative is nonpositive, then the derivative
is automatically integrable on `(a, +∞)`. Version assuming differentiability
on `(a, +∞)` and continuity at `a⁺`. -/
theorem integrableOn_Ioi_deriv_of_nonpos (hcont : ContinuousWithinAt g (Ici a) a)
(hderiv : ∀ x ∈ Ioi a, HasDerivAt g (g' x) x) (g'neg : ∀ x ∈ Ioi a, g' x ≤ 0)
(hg : Tendsto g atTop (𝓝 l)) : IntegrableOn g' (Ioi a) := by
apply integrable_neg_iff.1
exact integrableOn_Ioi_deriv_of_nonneg hcont.neg (fun x hx => (hderiv x hx).neg)
(fun x hx => neg_nonneg_of_nonpos (g'neg x hx)) hg.neg
/-- When a function has a limit at infinity, and its derivative is nonpositive, then the derivative
is automatically integrable on `(a, +∞)`. Version assuming differentiability
on `[a, +∞)`. -/
theorem integrableOn_Ioi_deriv_of_nonpos' (hderiv : ∀ x ∈ Ici a, HasDerivAt g (g' x) x)
(g'neg : ∀ x ∈ Ioi a, g' x ≤ 0) (hg : Tendsto g atTop (𝓝 l)) : IntegrableOn g' (Ioi a) := by
refine integrableOn_Ioi_deriv_of_nonpos ?_ (fun x hx ↦ hderiv x hx.out.le) g'neg hg
exact (hderiv a left_mem_Ici).continuousAt.continuousWithinAt
/-- When a function has a limit at infinity `l`, and its derivative is nonpositive, then the
integral of the derivative on `(a, +∞)` is `l - g a` (and the derivative is integrable, see
`integrable_on_Ioi_deriv_of_nonneg`). Version assuming differentiability on `(a, +∞)` and
continuity at `a⁺`. -/
theorem integral_Ioi_of_hasDerivAt_of_nonpos (hcont : ContinuousWithinAt g (Ici a) a)
(hderiv : ∀ x ∈ Ioi a, HasDerivAt g (g' x) x) (g'neg : ∀ x ∈ Ioi a, g' x ≤ 0)
(hg : Tendsto g atTop (𝓝 l)) : ∫ x in Ioi a, g' x = l - g a :=
integral_Ioi_of_hasDerivAt_of_tendsto hcont hderiv
(integrableOn_Ioi_deriv_of_nonpos hcont hderiv g'neg hg) hg
/-- When a function has a limit at infinity `l`, and its derivative is nonpositive, then the
integral of the derivative on `(a, +∞)` is `l - g a` (and the derivative is integrable, see
`integrable_on_Ioi_deriv_of_nonneg'`). Version assuming differentiability on `[a, +∞)`. -/
theorem integral_Ioi_of_hasDerivAt_of_nonpos' (hderiv : ∀ x ∈ Ici a, HasDerivAt g (g' x) x)
(g'neg : ∀ x ∈ Ioi a, g' x ≤ 0) (hg : Tendsto g atTop (𝓝 l)) : ∫ x in Ioi a, g' x = l - g a :=
integral_Ioi_of_hasDerivAt_of_tendsto' hderiv (integrableOn_Ioi_deriv_of_nonpos' hderiv g'neg hg)
hg
end IoiFTC
section IicFTC
variable {E : Type*} {f f' : ℝ → E} {a : ℝ} {m : E} [NormedAddCommGroup E]
[NormedSpace ℝ E]
/-- If the derivative of a function defined on the real line is integrable close to `-∞`, then
the function has a limit at `-∞`. -/
theorem tendsto_limUnder_of_hasDerivAt_of_integrableOn_Iic [CompleteSpace E]
(hderiv : ∀ x ∈ Iic a, HasDerivAt f (f' x) x) (f'int : IntegrableOn f' (Iic a)) :
Tendsto f atBot (𝓝 (limUnder atBot f)) := by
suffices ∃ a, Tendsto f atBot (𝓝 a) from tendsto_nhds_limUnder this
let g := f ∘ (fun x ↦ -x)
have hdg : ∀ x ∈ Ioi (-a), HasDerivAt g (-f' (-x)) x := by
intro x hx
have : -x ∈ Iic a := by simp only [mem_Iic, mem_Ioi, neg_le] at *; exact hx.le
simpa using HasDerivAt.scomp x (hderiv (-x) this) (hasDerivAt_neg' x)
have L : Tendsto g atTop (𝓝 (limUnder atTop g)) := by
apply tendsto_limUnder_of_hasDerivAt_of_integrableOn_Ioi hdg
exact ((MeasurePreserving.integrableOn_comp_preimage (Measure.measurePreserving_neg _)
(Homeomorph.neg ℝ).measurableEmbedding).2 f'int.neg).mono_set (by simp)
refine ⟨limUnder atTop g, ?_⟩
have : Tendsto (fun x ↦ g (-x)) atBot (𝓝 (limUnder atTop g)) := L.comp tendsto_neg_atBot_atTop
simpa [g] using this
open UniformSpace in
/-- If a function and its derivative are integrable on `(-∞, a]`, then the function tends to zero
at `-∞`. -/
theorem tendsto_zero_of_hasDerivAt_of_integrableOn_Iic
(hderiv : ∀ x ∈ Iic a, HasDerivAt f (f' x) x)
(f'int : IntegrableOn f' (Iic a)) (fint : IntegrableOn f (Iic a)) :
Tendsto f atBot (𝓝 0) := by
let F : E →L[ℝ] Completion E := Completion.toComplL
have Fderiv : ∀ x ∈ Iic a, HasDerivAt (F ∘ f) (F (f' x)) x :=
fun x hx ↦ F.hasFDerivAt.comp_hasDerivAt _ (hderiv x hx)
have Fint : IntegrableOn (F ∘ f) (Iic a) := by apply F.integrable_comp fint
have F'int : IntegrableOn (F ∘ f') (Iic a) := by apply F.integrable_comp f'int
have A : Tendsto (F ∘ f) atBot (𝓝 (limUnder atBot (F ∘ f))) := by
apply tendsto_limUnder_of_hasDerivAt_of_integrableOn_Iic Fderiv F'int
have B : limUnder atBot (F ∘ f) = F 0 := by
have : IntegrableAtFilter (F ∘ f) atBot := by exact ⟨Iic a, Iic_mem_atBot _, Fint⟩
apply IntegrableAtFilter.eq_zero_of_tendsto this ?_ A
intro s hs
rcases mem_atBot_sets.1 hs with ⟨b, hb⟩
apply le_antisymm (le_top)
rw [← volume_Iic (a := b)]
exact measure_mono hb
rwa [B, ← IsEmbedding.tendsto_nhds_iff] at A
exact (Completion.isUniformEmbedding_coe E).isEmbedding
variable [CompleteSpace E]
/-- **Fundamental theorem of calculus-2**, on semi-infinite intervals `(-∞, a)`.
When a function has a limit `m` at `-∞`, and its derivative is integrable, then the
integral of the derivative on `(-∞, a)` is `f a - m`. Version assuming differentiability
on `(-∞, a)` and continuity at `a⁻`.
Note that such a function always has a limit at minus infinity,
see `tendsto_limUnder_of_hasDerivAt_of_integrableOn_Iic`. -/
theorem integral_Iic_of_hasDerivAt_of_tendsto (hcont : ContinuousWithinAt f (Iic a) a)
(hderiv : ∀ x ∈ Iio a, HasDerivAt f (f' x) x) (f'int : IntegrableOn f' (Iic a))
(hf : Tendsto f atBot (𝓝 m)) : ∫ x in Iic a, f' x = f a - m := by
have hcont : ContinuousOn f (Iic a) := by
intro x hx
rcases hx.out.eq_or_lt with rfl | hx
· exact hcont
· exact (hderiv x hx).continuousAt.continuousWithinAt
refine tendsto_nhds_unique (intervalIntegral_tendsto_integral_Iic a f'int tendsto_id) ?_
apply Tendsto.congr' _ (hf.const_sub _)
filter_upwards [Iic_mem_atBot a] with x hx
symm
apply intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le hx
(hcont.mono Icc_subset_Iic_self) fun y hy => hderiv y hy.2
rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hx]
exact f'int.mono (fun y hy => hy.2) le_rfl
/-- **Fundamental theorem of calculus-2**, on semi-infinite intervals `(-∞, a)`.
When a function has a limit `m` at `-∞`, and its derivative is integrable, then the
integral of the derivative on `(-∞, a)` is `f a - m`. Version assuming differentiability
on `(-∞, a]`.
Note that such a function always has a limit at minus infinity,
see `tendsto_limUnder_of_hasDerivAt_of_integrableOn_Iic`. -/
theorem integral_Iic_of_hasDerivAt_of_tendsto'
(hderiv : ∀ x ∈ Iic a, HasDerivAt f (f' x) x) (f'int : IntegrableOn f' (Iic a))
(hf : Tendsto f atBot (𝓝 m)) : ∫ x in Iic a, f' x = f a - m := by
refine integral_Iic_of_hasDerivAt_of_tendsto ?_ (fun x hx => hderiv x hx.out.le)
f'int hf
exact (hderiv a right_mem_Iic).continuousAt.continuousWithinAt
/-- A special case of `integral_Iic_of_hasDerivAt_of_tendsto` where we assume that `f` is C^1 with
compact support. -/
theorem _root_.HasCompactSupport.integral_Iic_deriv_eq (hf : ContDiff ℝ 1 f)
(h2f : HasCompactSupport f) (b : ℝ) : ∫ x in Iic b, deriv f x = f b := by
have := fun x (_ : x ∈ Iio b) ↦ hf.differentiable le_rfl x |>.hasDerivAt
rw [integral_Iic_of_hasDerivAt_of_tendsto hf.continuous.continuousWithinAt this, sub_zero]
· refine hf.continuous_deriv le_rfl |>.integrable_of_hasCompactSupport h2f.deriv |>.integrableOn
rw [hasCompactSupport_iff_eventuallyEq, Filter.coclosedCompact_eq_cocompact] at h2f
exact h2f.filter_mono _root_.atBot_le_cocompact |>.tendsto
open UniformSpace in
lemma _root_.HasCompactSupport.enorm_le_lintegral_Ici_deriv
{F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F]
{f : ℝ → F} (hf : ContDiff ℝ 1 f) (h'f : HasCompactSupport f) (x : ℝ) :
‖f x‖ₑ ≤ ∫⁻ y in Iic x, ‖deriv f y‖ₑ := by
let I : F →L[ℝ] Completion F := Completion.toComplL
let f' : ℝ → Completion F := I ∘ f
have hf' : ContDiff ℝ 1 f' := hf.continuousLinearMap_comp I
have h'f' : HasCompactSupport f' := h'f.comp_left rfl
have : ‖f' x‖ₑ ≤ ∫⁻ y in Iic x, ‖deriv f' y‖ₑ := by
rw [← HasCompactSupport.integral_Iic_deriv_eq hf' h'f' x]
exact enorm_integral_le_lintegral_enorm _
convert this with y
· simp [f', I, Completion.enorm_coe]
· rw [fderiv_comp_deriv _ I.differentiableAt (hf.differentiable le_rfl _)]
simp only [ContinuousLinearMap.fderiv]
simp [I]
end IicFTC
section UnivFTC
variable {E : Type*} {f f' : ℝ → E} {m n : E} [NormedAddCommGroup E]
[NormedSpace ℝ E]
/-- **Fundamental theorem of calculus-2**, on the whole real line
When a function has a limit `m` at `-∞` and `n` at `+∞`, and its derivative is integrable, then the
integral of the derivative is `n - m`.
Note that such a function always has a limit at `-∞` and `+∞`,
see `tendsto_limUnder_of_hasDerivAt_of_integrableOn_Iic` and
`tendsto_limUnder_of_hasDerivAt_of_integrableOn_Ioi`. -/
theorem integral_of_hasDerivAt_of_tendsto [CompleteSpace E]
(hderiv : ∀ x, HasDerivAt f (f' x) x) (hf' : Integrable f')
(hbot : Tendsto f atBot (𝓝 m)) (htop : Tendsto f atTop (𝓝 n)) : ∫ x, f' x = n - m := by
rw [← setIntegral_univ, ← Set.Iic_union_Ioi (a := 0),
setIntegral_union (Iic_disjoint_Ioi le_rfl) measurableSet_Ioi hf'.integrableOn hf'.integrableOn,
integral_Iic_of_hasDerivAt_of_tendsto' (fun x _ ↦ hderiv x) hf'.integrableOn hbot,
integral_Ioi_of_hasDerivAt_of_tendsto' (fun x _ ↦ hderiv x) hf'.integrableOn htop]
abel
/-- If a function and its derivative are integrable on the real line, then the integral of the
derivative is zero. -/
theorem integral_eq_zero_of_hasDerivAt_of_integrable
(hderiv : ∀ x, HasDerivAt f (f' x) x) (hf' : Integrable f') (hf : Integrable f) :
∫ x, f' x = 0 := by
by_cases hE : CompleteSpace E; swap
· simp [integral, hE]
have A : Tendsto f atBot (𝓝 0) :=
tendsto_zero_of_hasDerivAt_of_integrableOn_Iic (a := 0) (fun x _hx ↦ hderiv x)
hf'.integrableOn hf.integrableOn
have B : Tendsto f atTop (𝓝 0) :=
tendsto_zero_of_hasDerivAt_of_integrableOn_Ioi (a := 0) (fun x _hx ↦ hderiv x)
hf'.integrableOn hf.integrableOn
simpa using integral_of_hasDerivAt_of_tendsto hderiv hf' A B
end UnivFTC
section IoiChangeVariables
open Real
open scoped Interval
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
/-- Change-of-variables formula for `Ioi` integrals of vector-valued functions, proved by taking
limits from the result for finite intervals. -/
theorem integral_comp_smul_deriv_Ioi {f f' : ℝ → ℝ} {g : ℝ → E} {a : ℝ}
(hf : ContinuousOn f <| Ici a) (hft : Tendsto f atTop atTop)
(hff' : ∀ x ∈ Ioi a, HasDerivWithinAt f (f' x) (Ioi x) x)
(hg_cont : ContinuousOn g <| f '' Ioi a) (hg1 : IntegrableOn g <| f '' Ici a)
(hg2 : IntegrableOn (fun x => f' x • (g ∘ f) x) (Ici a)) :
(∫ x in Ioi a, f' x • (g ∘ f) x) = ∫ u in Ioi (f a), g u := by
have eq : ∀ b : ℝ, a < b → (∫ x in a..b, f' x • (g ∘ f) x) = ∫ u in f a..f b, g u := fun b hb ↦ by
have i1 : Ioo (min a b) (max a b) ⊆ Ioi a := by
rw [min_eq_left hb.le]
exact Ioo_subset_Ioi_self
have i2 : [[a, b]] ⊆ Ici a := by rw [uIcc_of_le hb.le]; exact Icc_subset_Ici_self
refine
intervalIntegral.integral_comp_smul_deriv''' (hf.mono i2)
(fun x hx => hff' x <| mem_of_mem_of_subset hx i1) (hg_cont.mono <| image_mono ?_)
(hg1.mono_set <| image_mono ?_) (hg2.mono_set i2) <;> assumption
rw [integrableOn_Ici_iff_integrableOn_Ioi] at hg2
have t2 := intervalIntegral_tendsto_integral_Ioi _ hg2 tendsto_id
have : Ioi (f a) ⊆ f '' Ici a :=
Ioi_subset_Ici_self.trans <|
IsPreconnected.intermediate_value_Ici isPreconnected_Ici left_mem_Ici
(le_principal_iff.mpr <| Ici_mem_atTop _) hf hft
have t1 := (intervalIntegral_tendsto_integral_Ioi _ (hg1.mono_set this) tendsto_id).comp hft
exact tendsto_nhds_unique (Tendsto.congr' (eventuallyEq_of_mem (Ioi_mem_atTop a) eq) t2) t1
/-- Change-of-variables formula for `Ioi` integrals of scalar-valued functions -/
theorem integral_comp_mul_deriv_Ioi {f f' : ℝ → ℝ} {g : ℝ → ℝ} {a : ℝ}
(hf : ContinuousOn f <| Ici a) (hft : Tendsto f atTop atTop)
(hff' : ∀ x ∈ Ioi a, HasDerivWithinAt f (f' x) (Ioi x) x)
(hg_cont : ContinuousOn g <| f '' Ioi a) (hg1 : IntegrableOn g <| f '' Ici a)
(hg2 : IntegrableOn (fun x => (g ∘ f) x * f' x) (Ici a)) :
(∫ x in Ioi a, (g ∘ f) x * f' x) = ∫ u in Ioi (f a), g u := by
have hg2' : IntegrableOn (fun x => f' x • (g ∘ f) x) (Ici a) := by simpa [mul_comm] using hg2
simpa [mul_comm] using integral_comp_smul_deriv_Ioi hf hft hff' hg_cont hg1 hg2'
/-- Substitution `y = x ^ p` in integrals over `Ioi 0` -/
theorem integral_comp_rpow_Ioi (g : ℝ → E) {p : ℝ} (hp : p ≠ 0) :
(∫ x in Ioi 0, (|p| * x ^ (p - 1)) • g (x ^ p)) = ∫ y in Ioi 0, g y := by
let S := Ioi (0 : ℝ)
have a1 : ∀ x : ℝ, x ∈ S → HasDerivWithinAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) S x :=
fun x hx => (hasDerivAt_rpow_const (Or.inl (mem_Ioi.mp hx).ne')).hasDerivWithinAt
have a2 : InjOn (fun x : ℝ => x ^ p) S := by
rcases lt_or_gt_of_ne hp with (h | h)
· apply StrictAntiOn.injOn
intro x hx y hy hxy
rw [← inv_lt_inv₀ (rpow_pos_of_pos hx p) (rpow_pos_of_pos hy p), ← rpow_neg (le_of_lt hx),
← rpow_neg (le_of_lt hy)]
exact rpow_lt_rpow (le_of_lt hx) hxy (neg_pos.mpr h)
exact StrictMonoOn.injOn fun x hx y _ hxy => rpow_lt_rpow (mem_Ioi.mp hx).le hxy h
have a3 : (fun t : ℝ => t ^ p) '' S = S := by
ext1 x; rw [mem_image]; constructor
· rintro ⟨y, hy, rfl⟩; exact rpow_pos_of_pos hy p
· intro hx; refine ⟨x ^ (1 / p), rpow_pos_of_pos hx _, ?_⟩
rw [← rpow_mul (le_of_lt hx), one_div_mul_cancel hp, rpow_one]
have := integral_image_eq_integral_abs_deriv_smul measurableSet_Ioi a1 a2 g
rw [a3] at this; rw [this]
refine setIntegral_congr_fun measurableSet_Ioi ?_
intro x hx; dsimp only
rw [abs_mul, abs_of_nonneg (rpow_nonneg (le_of_lt hx) _)]
theorem integral_comp_rpow_Ioi_of_pos {g : ℝ → E} {p : ℝ} (hp : 0 < p) :
(∫ x in Ioi 0, (p * x ^ (p - 1)) • g (x ^ p)) = ∫ y in Ioi 0, g y := by
convert integral_comp_rpow_Ioi g hp.ne'
rw [abs_of_nonneg hp.le]
theorem integral_comp_mul_left_Ioi (g : ℝ → E) (a : ℝ) {b : ℝ} (hb : 0 < b) :
(∫ x in Ioi a, g (b * x)) = b⁻¹ • ∫ x in Ioi (b * a), g x := by
have : ∀ c : ℝ, MeasurableSet (Ioi c) := fun c => measurableSet_Ioi
rw [← integral_indicator (this a), ← integral_indicator (this (b * a)),
← abs_of_pos (inv_pos.mpr hb), ← Measure.integral_comp_mul_left]
congr
ext1 x
rw [← indicator_comp_right, preimage_const_mul_Ioi _ hb, mul_div_cancel_left₀ _ hb.ne',
Function.comp_def]
theorem integral_comp_mul_right_Ioi (g : ℝ → E) (a : ℝ) {b : ℝ} (hb : 0 < b) :
(∫ x in Ioi a, g (x * b)) = b⁻¹ • ∫ x in Ioi (a * b), g x := by
simpa only [mul_comm] using integral_comp_mul_left_Ioi g a hb
end IoiChangeVariables
section IoiIntegrability
open Real
open scoped Interval
variable {E : Type*} [NormedAddCommGroup E]
/-- The substitution `y = x ^ p` in integrals over `Ioi 0` preserves integrability. -/
theorem integrableOn_Ioi_comp_rpow_iff [NormedSpace ℝ E] (f : ℝ → E) {p : ℝ} (hp : p ≠ 0) :
IntegrableOn (fun x => (|p| * x ^ (p - 1)) • f (x ^ p)) (Ioi 0) ↔ IntegrableOn f (Ioi 0) := by
let S := Ioi (0 : ℝ)
have a1 : ∀ x : ℝ, x ∈ S → HasDerivWithinAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) S x :=
fun x hx => (hasDerivAt_rpow_const (Or.inl (mem_Ioi.mp hx).ne')).hasDerivWithinAt
have a2 : InjOn (fun x : ℝ => x ^ p) S := by
rcases lt_or_gt_of_ne hp with (h | h)
· apply StrictAntiOn.injOn
intro x hx y hy hxy
rw [← inv_lt_inv₀ (rpow_pos_of_pos hx p) (rpow_pos_of_pos hy p), ← rpow_neg (le_of_lt hx), ←
rpow_neg (le_of_lt hy)]
exact rpow_lt_rpow (le_of_lt hx) hxy (neg_pos.mpr h)
exact StrictMonoOn.injOn fun x hx y _hy hxy => rpow_lt_rpow (mem_Ioi.mp hx).le hxy h
have a3 : (fun t : ℝ => t ^ p) '' S = S := by
ext1 x; rw [mem_image]; constructor
· rintro ⟨y, hy, rfl⟩; exact rpow_pos_of_pos hy p
· intro hx; refine ⟨x ^ (1 / p), rpow_pos_of_pos hx _, ?_⟩
rw [← rpow_mul (le_of_lt hx), one_div_mul_cancel hp, rpow_one]
have := integrableOn_image_iff_integrableOn_abs_deriv_smul measurableSet_Ioi a1 a2 f
rw [a3] at this
rw [this]
refine integrableOn_congr_fun (fun x hx => ?_) measurableSet_Ioi
simp_rw [abs_mul, abs_of_nonneg (rpow_nonneg (le_of_lt hx) _)]
/-- The substitution `y = x ^ p` in integrals over `Ioi 0` preserves integrability (version
without `|p|` factor) -/
theorem integrableOn_Ioi_comp_rpow_iff' [NormedSpace ℝ E] (f : ℝ → E) {p : ℝ} (hp : p ≠ 0) :
IntegrableOn (fun x => x ^ (p - 1) • f (x ^ p)) (Ioi 0) ↔ IntegrableOn f (Ioi 0) := by
simpa only [← integrableOn_Ioi_comp_rpow_iff f hp, mul_smul] using
(integrable_smul_iff (abs_pos.mpr hp).ne' _).symm
theorem integrableOn_Ioi_comp_mul_left_iff (f : ℝ → E) (c : ℝ) {a : ℝ} (ha : 0 < a) :
IntegrableOn (fun x => f (a * x)) (Ioi c) ↔ IntegrableOn f (Ioi <| a * c) := by
rw [← integrable_indicator_iff (measurableSet_Ioi : MeasurableSet <| Ioi c)]
rw [← integrable_indicator_iff (measurableSet_Ioi : MeasurableSet <| Ioi <| a * c)]
convert integrable_comp_mul_left_iff ((Ioi (a * c)).indicator f) ha.ne' using 2
ext1 x
rw [← indicator_comp_right, preimage_const_mul_Ioi _ ha, mul_comm a c,
mul_div_cancel_right₀ _ ha.ne', Function.comp_def]
theorem integrableOn_Ioi_comp_mul_right_iff (f : ℝ → E) (c : ℝ) {a : ℝ} (ha : 0 < a) :
IntegrableOn (fun x => f (x * a)) (Ioi c) ↔ IntegrableOn f (Ioi <| c * a) := by
simpa only [mul_comm, mul_zero] using integrableOn_Ioi_comp_mul_left_iff f c ha
end IoiIntegrability
/-!
## Integration by parts
-/
section IntegrationByPartsBilinear
variable {E F G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup G] [NormedSpace ℝ G]
{L : E →L[ℝ] F →L[ℝ] G} {u : ℝ → E} {v : ℝ → F} {u' : ℝ → E} {v' : ℝ → F}
{m n : G}
theorem integral_bilinear_hasDerivAt_eq_sub [CompleteSpace G]
(hu : ∀ x, HasDerivAt u (u' x) x) (hv : ∀ x, HasDerivAt v (v' x) x)
(huv : Integrable (fun x ↦ L (u x) (v' x) + L (u' x) (v x)))
(h_bot : Tendsto (fun x ↦ L (u x) (v x)) atBot (𝓝 m))
(h_top : Tendsto (fun x ↦ L (u x) (v x)) atTop (𝓝 n)) :
∫ (x : ℝ), L (u x) (v' x) + L (u' x) (v x) = n - m :=
integral_of_hasDerivAt_of_tendsto (fun x ↦ L.hasDerivAt_of_bilinear (hu x) (hv x))
huv h_bot h_top
/-- **Integration by parts on (-∞, ∞).**
With respect to a general bilinear form. For the specific case of multiplication, see
`integral_mul_deriv_eq_deriv_mul`. -/
theorem integral_bilinear_hasDerivAt_right_eq_sub [CompleteSpace G]
(hu : ∀ x, HasDerivAt u (u' x) x) (hv : ∀ x, HasDerivAt v (v' x) x)
(huv' : Integrable (fun x ↦ L (u x) (v' x))) (hu'v : Integrable (fun x ↦ L (u' x) (v x)))
(h_bot : Tendsto (fun x ↦ L (u x) (v x)) atBot (𝓝 m))
(h_top : Tendsto (fun x ↦ L (u x) (v x)) atTop (𝓝 n)) :
∫ (x : ℝ), L (u x) (v' x) = n - m - ∫ (x : ℝ), L (u' x) (v x) := by
rw [eq_sub_iff_add_eq, ← integral_add huv' hu'v]
exact integral_bilinear_hasDerivAt_eq_sub hu hv (huv'.add hu'v) h_bot h_top
/-- **Integration by parts on (-∞, ∞).**
With respect to a general bilinear form, assuming moreover that the total function is integrable.
-/
theorem integral_bilinear_hasDerivAt_right_eq_neg_left_of_integrable
(hu : ∀ x, HasDerivAt u (u' x) x) (hv : ∀ x, HasDerivAt v (v' x) x)
(huv' : Integrable (fun x ↦ L (u x) (v' x))) (hu'v : Integrable (fun x ↦ L (u' x) (v x)))
(huv : Integrable (fun x ↦ L (u x) (v x))) :
∫ (x : ℝ), L (u x) (v' x) = - ∫ (x : ℝ), L (u' x) (v x) := by
by_cases hG : CompleteSpace G; swap
· simp [integral, hG]
have I : Tendsto (fun x ↦ L (u x) (v x)) atBot (𝓝 0) :=
tendsto_zero_of_hasDerivAt_of_integrableOn_Iic (a := 0)
(fun x _hx ↦ L.hasDerivAt_of_bilinear (hu x) (hv x))
(huv'.add hu'v).integrableOn huv.integrableOn
have J : Tendsto (fun x ↦ L (u x) (v x)) atTop (𝓝 0) :=
tendsto_zero_of_hasDerivAt_of_integrableOn_Ioi (a := 0)
(fun x _hx ↦ L.hasDerivAt_of_bilinear (hu x) (hv x))
(huv'.add hu'v).integrableOn huv.integrableOn
simp [integral_bilinear_hasDerivAt_right_eq_sub hu hv huv' hu'v I J]
end IntegrationByPartsBilinear
section IntegrationByPartsAlgebra
variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A]
{a : ℝ} {a' b' : A} {u : ℝ → A} {v : ℝ → A} {u' : ℝ → A} {v' : ℝ → A}
/-- For finite intervals, see: `intervalIntegral.integral_deriv_mul_eq_sub`. -/
theorem integral_deriv_mul_eq_sub [CompleteSpace A]
(hu : ∀ x, HasDerivAt u (u' x) x) (hv : ∀ x, HasDerivAt v (v' x) x)
(huv : Integrable (u' * v + u * v'))
(h_bot : Tendsto (u * v) atBot (𝓝 a')) (h_top : Tendsto (u * v) atTop (𝓝 b')) :
∫ (x : ℝ), u' x * v x + u x * v' x = b' - a' :=
integral_of_hasDerivAt_of_tendsto (fun x ↦ (hu x).mul (hv x)) huv h_bot h_top
/-- **Integration by parts on (-∞, ∞).**
For finite intervals, see: `intervalIntegral.integral_mul_deriv_eq_deriv_mul`. -/
theorem integral_mul_deriv_eq_deriv_mul [CompleteSpace A]
(hu : ∀ x, HasDerivAt u (u' x) x) (hv : ∀ x, HasDerivAt v (v' x) x)
(huv' : Integrable (u * v')) (hu'v : Integrable (u' * v))
(h_bot : Tendsto (u * v) atBot (𝓝 a')) (h_top : Tendsto (u * v) atTop (𝓝 b')) :
∫ (x : ℝ), u x * v' x = b' - a' - ∫ (x : ℝ), u' x * v x :=
integral_bilinear_hasDerivAt_right_eq_sub (L := ContinuousLinearMap.mul ℝ A)
hu hv huv' hu'v h_bot h_top
/-- **Integration by parts on (-∞, ∞).**
Version assuming that the total function is integrable -/
theorem integral_mul_deriv_eq_deriv_mul_of_integrable
(hu : ∀ x, HasDerivAt u (u' x) x) (hv : ∀ x, HasDerivAt v (v' x) x)
(huv' : Integrable (u * v')) (hu'v : Integrable (u' * v)) (huv : Integrable (u * v)) :
∫ (x : ℝ), u x * v' x = - ∫ (x : ℝ), u' x * v x :=
integral_bilinear_hasDerivAt_right_eq_neg_left_of_integrable (L := ContinuousLinearMap.mul ℝ A)
hu hv huv' hu'v huv
variable [CompleteSpace A]
-- TODO: also apply `Tendsto _ (𝓝[>] a) (𝓝 a')` generalization to
-- `integral_Ioi_of_hasDerivAt_of_tendsto` and `integral_Iic_of_hasDerivAt_of_tendsto`
/-- For finite intervals, see: `intervalIntegral.integral_deriv_mul_eq_sub`. -/
theorem integral_Ioi_deriv_mul_eq_sub
(hu : ∀ x ∈ Ioi a, HasDerivAt u (u' x) x) (hv : ∀ x ∈ Ioi a, HasDerivAt v (v' x) x)
(huv : IntegrableOn (u' * v + u * v') (Ioi a))
(h_zero : Tendsto (u * v) (𝓝[>] a) (𝓝 a')) (h_infty : Tendsto (u * v) atTop (𝓝 b')) :
∫ (x : ℝ) in Ioi a, u' x * v x + u x * v' x = b' - a' := by
rw [← Ici_diff_left] at h_zero
let f := Function.update (u * v) a a'
have hderiv : ∀ x ∈ Ioi a, HasDerivAt f (u' x * v x + u x * v' x) x := by
intro x (hx : a < x)
apply ((hu x hx).mul (hv x hx)).congr_of_eventuallyEq
filter_upwards [eventually_ne_nhds hx.ne.symm] with y hy
exact Function.update_of_ne hy a' (u * v)
have htendsto : Tendsto f atTop (𝓝 b') := by
apply h_infty.congr'
filter_upwards [eventually_ne_atTop a] with x hx
exact (Function.update_of_ne hx a' (u * v)).symm
simpa using integral_Ioi_of_hasDerivAt_of_tendsto
(continuousWithinAt_update_same.mpr h_zero) hderiv huv htendsto
/-- **Integration by parts on (a, ∞).**
For finite intervals, see: `intervalIntegral.integral_mul_deriv_eq_deriv_mul`. -/
theorem integral_Ioi_mul_deriv_eq_deriv_mul
(hu : ∀ x ∈ Ioi a, HasDerivAt u (u' x) x) (hv : ∀ x ∈ Ioi a, HasDerivAt v (v' x) x)
(huv' : IntegrableOn (u * v') (Ioi a)) (hu'v : IntegrableOn (u' * v) (Ioi a))
(h_zero : Tendsto (u * v) (𝓝[>] a) (𝓝 a')) (h_infty : Tendsto (u * v) atTop (𝓝 b')) :
∫ (x : ℝ) in Ioi a, u x * v' x = b' - a' - ∫ (x : ℝ) in Ioi a, u' x * v x := by
rw [Pi.mul_def] at huv' hu'v
rw [eq_sub_iff_add_eq, ← integral_add huv' hu'v]
simpa only [add_comm] using integral_Ioi_deriv_mul_eq_sub hu hv (hu'v.add huv') h_zero h_infty
/-- For finite intervals, see: `intervalIntegral.integral_deriv_mul_eq_sub`. -/
theorem integral_Iic_deriv_mul_eq_sub
(hu : ∀ x ∈ Iio a, HasDerivAt u (u' x) x) (hv : ∀ x ∈ Iio a, HasDerivAt v (v' x) x)
(huv : IntegrableOn (u' * v + u * v') (Iic a))
(h_zero : Tendsto (u * v) (𝓝[<] a) (𝓝 a')) (h_infty : Tendsto (u * v) atBot (𝓝 b')) :
∫ (x : ℝ) in Iic a, u' x * v x + u x * v' x = a' - b' := by
rw [← Iic_diff_right] at h_zero
let f := Function.update (u * v) a a'
have hderiv : ∀ x ∈ Iio a, HasDerivAt f (u' x * v x + u x * v' x) x := by
intro x hx
apply ((hu x hx).mul (hv x hx)).congr_of_eventuallyEq
filter_upwards [Iio_mem_nhds hx] with x (hx : x < a)
exact Function.update_of_ne (ne_of_lt hx) a' (u * v)
have htendsto : Tendsto f atBot (𝓝 b') := by
apply h_infty.congr'
filter_upwards [Iio_mem_atBot a] with x (hx : x < a)
exact (Function.update_of_ne (ne_of_lt hx) a' (u * v)).symm
simpa using integral_Iic_of_hasDerivAt_of_tendsto
(continuousWithinAt_update_same.mpr h_zero) hderiv huv htendsto
/-- **Integration by parts on (∞, a].**
For finite intervals, see: `intervalIntegral.integral_mul_deriv_eq_deriv_mul`. -/
theorem integral_Iic_mul_deriv_eq_deriv_mul
(hu : ∀ x ∈ Iio a, HasDerivAt u (u' x) x) (hv : ∀ x ∈ Iio a, HasDerivAt v (v' x) x)
(huv' : IntegrableOn (u * v') (Iic a)) (hu'v : IntegrableOn (u' * v) (Iic a))
(h_zero : Tendsto (u * v) (𝓝[<] a) (𝓝 a')) (h_infty : Tendsto (u * v) atBot (𝓝 b')) :
∫ (x : ℝ) in Iic a, u x * v' x = a' - b' - ∫ (x : ℝ) in Iic a, u' x * v x := by
rw [Pi.mul_def] at huv' hu'v
rw [eq_sub_iff_add_eq, ← integral_add huv' hu'v]
simpa only [add_comm] using integral_Iic_deriv_mul_eq_sub hu hv (hu'v.add huv') h_zero h_infty
end IntegrationByPartsAlgebra
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/Marginal.lean | import Mathlib.MeasureTheory.Constructions.Pi
/-!
# Marginals of multivariate functions
In this file, we define a convenient way to compute integrals of multivariate functions, especially
if you want to write expressions where you integrate only over some of the variables that the
function depends on. This is common in induction arguments involving integrals of multivariate
functions.
This constructions allows working with iterated integrals and applying Tonelli's theorem
and Fubini's theorem, without using measurable equivalences by changing the representation of your
space (e.g. `((ι ⊕ ι') → ℝ) ≃ (ι → ℝ) × (ι' → ℝ)`).
## Main Definitions
* Assume that `∀ i : ι, X i` is a product of measurable spaces with measures `μ i` on `X i`,
`f : (∀ i, X i) → ℝ≥0∞` is a function and `s : Finset ι`.
Then `lmarginal μ s f` or `∫⋯∫⁻_s, f ∂μ` is the function that integrates `f`
over all variables in `s`. It returns a function that still takes the same variables as `f`,
but is constant in the variables in `s`. Mathematically, if `s = {i₁, ..., iₖ}`,
then `lmarginal μ s f` is the expression
$$
\vec{x}\mapsto \int\!\!\cdots\!\!\int f(\vec{x}[\vec{y}])dy_{i_1}\cdots dy_{i_k}.
$$
where $\vec{x}[\vec{y}]$ is the vector $\vec{x}$ with $x_{i_j}$ replaced by $y_{i_j}$ for all
$1 \le j \le k$.
If `f` is the distribution of a random variable, this is the marginal distribution of all
variables not in `s` (but not the most general notion, since we only consider product measures
here).
Note that the notation `∫⋯∫⁻_s, f ∂μ` is not a binder, and returns a function.
## Main Results
* `lmarginal_union` is the analogue of Tonelli's theorem for iterated integrals. It states that
for measurable functions `f` and disjoint finsets `s` and `t` we have
`∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ`.
## Implementation notes
The function `f` can have an arbitrary product as its domain (even infinite products), but the
set `s` of integration variables is a `Finset`. We are assuming that the function `f` is measurable
for most of this file. Note that asking whether it is `AEMeasurable` is not even well-posed,
since there is no well-behaved measure on the domain of `f`.
## TODO
* Define the marginal function for functions taking values in a Banach space.
-/
open scoped ENNReal
open Set Function Equiv Finset
noncomputable section
namespace MeasureTheory
section LMarginal
variable {δ δ' : Type*} {X : δ → Type*} [∀ i, MeasurableSpace (X i)]
variable {μ : ∀ i, Measure (X i)} [DecidableEq δ]
variable {s t : Finset δ} {f : (∀ i, X i) → ℝ≥0∞} {x : ∀ i, X i}
/-- Integrate `f(x₁,…,xₙ)` over all variables `xᵢ` where `i ∈ s`. Return a function in the
remaining variables (it will be constant in the `xᵢ` for `i ∈ s`).
This is the marginal distribution of all variables not in `s` when the considered measure
is the product measure. -/
def lmarginal (μ : ∀ i, Measure (X i)) (s : Finset δ) (f : (∀ i, X i) → ℝ≥0∞)
(x : ∀ i, X i) : ℝ≥0∞ :=
∫⁻ y : ∀ i : s, X i, f (updateFinset x s y) ∂Measure.pi fun i : s => μ i
-- Note: this notation is not a binder. This is more convenient since it returns a function.
@[inherit_doc]
notation "∫⋯∫⁻_" s ", " f " ∂" μ:70 => lmarginal μ s f
@[inherit_doc]
notation "∫⋯∫⁻_" s ", " f => lmarginal (fun _ ↦ volume) s f
variable (μ)
theorem _root_.Measurable.lmarginal [∀ i, SigmaFinite (μ i)] (hf : Measurable f) :
Measurable (∫⋯∫⁻_s, f ∂μ) := by
refine Measurable.lintegral_prod_right ?_
refine hf.comp ?_
rw [measurable_pi_iff]; intro i
by_cases hi : i ∈ s
· simpa [hi, updateFinset] using measurable_pi_iff.1 measurable_snd _
· simpa [hi, updateFinset] using measurable_pi_iff.1 measurable_fst _
@[simp] theorem lmarginal_empty (f : (∀ i, X i) → ℝ≥0∞) : ∫⋯∫⁻_∅, f ∂μ = f := by
ext1 x
simp_rw [lmarginal, Measure.pi_of_empty fun i : (∅ : Finset δ) => μ i]
apply lintegral_dirac'
exact Subsingleton.measurable
/-- The marginal distribution is independent of the variables in `s`. -/
theorem lmarginal_congr {x y : ∀ i, X i} (f : (∀ i, X i) → ℝ≥0∞)
(h : ∀ i ∉ s, x i = y i) :
(∫⋯∫⁻_s, f ∂μ) x = (∫⋯∫⁻_s, f ∂μ) y := by
dsimp [lmarginal, updateFinset_def]; rcongr; exact h _ ‹_›
theorem lmarginal_update_of_mem {i : δ} (hi : i ∈ s)
(f : (∀ i, X i) → ℝ≥0∞) (x : ∀ i, X i) (y : X i) :
(∫⋯∫⁻_s, f ∂μ) (Function.update x i y) = (∫⋯∫⁻_s, f ∂μ) x := by
grind [MeasureTheory.lmarginal_congr]
variable {μ} in
theorem lmarginal_singleton (f : (∀ i, X i) → ℝ≥0∞) (i : δ) :
∫⋯∫⁻_{i}, f ∂μ = fun x => ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by
let α : Type _ := ({i} : Finset δ)
let e := (MeasurableEquiv.piUnique fun j : α ↦ X j).symm
ext1 x
calc (∫⋯∫⁻_{i}, f ∂μ) x
= ∫⁻ (y : X (default : α)), f (updateFinset x {i} (e y)) ∂μ (default : α) := by
simp_rw [lmarginal,
measurePreserving_piUnique (fun j : ({i} : Finset δ) ↦ μ j) |>.symm _
|>.lintegral_map_equiv, e, α]
_ = ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by simp [update_eq_updateFinset]; rfl
variable {μ} in
@[gcongr]
theorem lmarginal_mono {f g : (∀ i, X i) → ℝ≥0∞} (hfg : f ≤ g) : ∫⋯∫⁻_s, f ∂μ ≤ ∫⋯∫⁻_s, g ∂μ :=
fun _ => lintegral_mono fun _ => hfg _
variable [∀ i, SigmaFinite (μ i)]
theorem lmarginal_union (f : (∀ i, X i) → ℝ≥0∞) (hf : Measurable f)
(hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ := by
ext1 x
let e := MeasurableEquiv.piFinsetUnion X hst
calc (∫⋯∫⁻_s ∪ t, f ∂μ) x
= ∫⁻ (y : (i : ↥(s ∪ t)) → X i), f (updateFinset x (s ∪ t) y)
∂.pi fun i' : ↥(s ∪ t) ↦ μ i' := rfl
_ = ∫⁻ (y : ((i : s) → X i) × ((j : t) → X j)), f (updateFinset x (s ∪ t) _)
∂(Measure.pi fun i : s ↦ μ i).prod (.pi fun j : t ↦ μ j) := by
rw [measurePreserving_piFinsetUnion hst μ |>.lintegral_map_equiv]
_ = ∫⁻ (y : (i : s) → X i), ∫⁻ (z : (j : t) → X j), f (updateFinset x (s ∪ t) (e (y, z)))
∂.pi fun j : t ↦ μ j ∂.pi fun i : s ↦ μ i := by
apply lintegral_prod
apply Measurable.aemeasurable
exact hf.comp <| measurable_updateFinset.comp e.measurable
_ = (∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ) x := by
simp_rw [lmarginal, updateFinset_updateFinset hst]
rfl
theorem lmarginal_union' (f : (∀ i, X i) → ℝ≥0∞) (hf : Measurable f) {s t : Finset δ}
(hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_t, ∫⋯∫⁻_s, f ∂μ ∂μ := by
rw [Finset.union_comm, lmarginal_union μ f hf hst.symm]
variable {μ}
/-- Peel off a single integral from a `lmarginal` integral at the beginning (compare with
`lmarginal_insert'`, which peels off an integral at the end). -/
theorem lmarginal_insert (f : (∀ i, X i) → ℝ≥0∞) (hf : Measurable f) {i : δ}
(hi : i ∉ s) (x : ∀ i, X i) :
(∫⋯∫⁻_insert i s, f ∂μ) x = ∫⁻ xᵢ, (∫⋯∫⁻_s, f ∂μ) (Function.update x i xᵢ) ∂μ i := by
rw [Finset.insert_eq, lmarginal_union μ f hf (Finset.disjoint_singleton_left.mpr hi),
lmarginal_singleton]
/-- Peel off a single integral from a `lmarginal` integral at the beginning (compare with
`lmarginal_erase'`, which peels off an integral at the end). -/
theorem lmarginal_erase (f : (∀ i, X i) → ℝ≥0∞) (hf : Measurable f) {i : δ}
(hi : i ∈ s) (x : ∀ i, X i) :
(∫⋯∫⁻_s, f ∂μ) x = ∫⁻ xᵢ, (∫⋯∫⁻_(erase s i), f ∂μ) (Function.update x i xᵢ) ∂μ i := by
simpa [insert_erase hi] using lmarginal_insert _ hf (notMem_erase i s) x
/-- Peel off a single integral from a `lmarginal` integral at the end (compare with
`lmarginal_insert`, which peels off an integral at the beginning). -/
theorem lmarginal_insert' (f : (∀ i, X i) → ℝ≥0∞) (hf : Measurable f) {i : δ}
(hi : i ∉ s) :
∫⋯∫⁻_insert i s, f ∂μ = ∫⋯∫⁻_s, (fun x ↦ ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i) ∂μ := by
rw [Finset.insert_eq, Finset.union_comm,
lmarginal_union (s := s) μ f hf (Finset.disjoint_singleton_right.mpr hi), lmarginal_singleton]
/-- Peel off a single integral from a `lmarginal` integral at the end (compare with
`lmarginal_erase`, which peels off an integral at the beginning). -/
theorem lmarginal_erase' (f : (∀ i, X i) → ℝ≥0∞) (hf : Measurable f) {i : δ}
(hi : i ∈ s) :
∫⋯∫⁻_s, f ∂μ = ∫⋯∫⁻_(erase s i), (fun x ↦ ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i) ∂μ := by
simpa [insert_erase hi] using lmarginal_insert' _ hf (notMem_erase i s)
@[simp] theorem lmarginal_univ [Fintype δ] {f : (∀ i, X i) → ℝ≥0∞} :
∫⋯∫⁻_univ, f ∂μ = fun _ => ∫⁻ x, f x ∂Measure.pi μ := by
let e : { j // j ∈ Finset.univ } ≃ δ := Equiv.subtypeUnivEquiv mem_univ
ext1 x
simp_rw [lmarginal, measurePreserving_piCongrLeft μ e |>.lintegral_map_equiv, updateFinset_def]
simp
rfl
theorem lintegral_eq_lmarginal_univ [Fintype δ] {f : (∀ i, X i) → ℝ≥0∞} (x : ∀ i, X i) :
∫⁻ x, f x ∂Measure.pi μ = (∫⋯∫⁻_univ, f ∂μ) x := by simp
theorem lmarginal_image [DecidableEq δ'] {e : δ' → δ} (he : Injective e) (s : Finset δ')
{f : (∀ i, X (e i)) → ℝ≥0∞} (hf : Measurable f) (x : ∀ i, X i) :
(∫⋯∫⁻_s.image e, f ∘ (· ∘' e) ∂μ) x = (∫⋯∫⁻_s, f ∂μ ∘' e) (x ∘' e) := by
have h : Measurable ((· ∘' e) : (∀ i, X i) → _) :=
measurable_pi_iff.mpr <| fun i ↦ measurable_pi_apply (e i)
induction s using Finset.induction generalizing x with
| empty => simp
| insert _ _ hi ih =>
rw [image_insert, lmarginal_insert _ (hf.comp h) (he.mem_finset_image.not.mpr hi),
lmarginal_insert _ hf hi]
simp_rw [ih, ← update_comp_eq_of_injective' x he]
theorem lmarginal_update_of_notMem {i : δ}
{f : (∀ i, X i) → ℝ≥0∞} (hf : Measurable f) (hi : i ∉ s) (x : ∀ i, X i) (y : X i) :
(∫⋯∫⁻_s, f ∂μ) (Function.update x i y) = (∫⋯∫⁻_s, f ∘ (Function.update · i y) ∂μ) x := by
induction s using Finset.induction generalizing x with
| empty => simp
| insert i' s hi' ih =>
rw [lmarginal_insert _ hf hi', lmarginal_insert _ (hf.comp measurable_update_left) hi']
have hii' : i ≠ i' := mt (by rintro rfl; exact mem_insert_self i s) hi
simp_rw [update_comm hii', ih (mt Finset.mem_insert_of_mem hi)]
@[deprecated (since := "2025-05-23")]
alias lmarginal_update_of_not_mem := lmarginal_update_of_notMem
theorem lmarginal_eq_of_subset {f g : (∀ i, X i) → ℝ≥0∞} (hst : s ⊆ t)
(hf : Measurable f) (hg : Measurable g) (hfg : ∫⋯∫⁻_s, f ∂μ = ∫⋯∫⁻_s, g ∂μ) :
∫⋯∫⁻_t, f ∂μ = ∫⋯∫⁻_t, g ∂μ := by
rw [← union_sdiff_of_subset hst, lmarginal_union' μ f hf disjoint_sdiff,
lmarginal_union' μ g hg disjoint_sdiff, hfg]
theorem lmarginal_le_of_subset {f g : (∀ i, X i) → ℝ≥0∞} (hst : s ⊆ t)
(hf : Measurable f) (hg : Measurable g) (hfg : ∫⋯∫⁻_s, f ∂μ ≤ ∫⋯∫⁻_s, g ∂μ) :
∫⋯∫⁻_t, f ∂μ ≤ ∫⋯∫⁻_t, g ∂μ := by
rw [← union_sdiff_of_subset hst, lmarginal_union' μ f hf disjoint_sdiff,
lmarginal_union' μ g hg disjoint_sdiff]
exact lmarginal_mono hfg
theorem lintegral_eq_of_lmarginal_eq [Fintype δ] (s : Finset δ) {f g : (∀ i, X i) → ℝ≥0∞}
(hf : Measurable f) (hg : Measurable g) (hfg : ∫⋯∫⁻_s, f ∂μ = ∫⋯∫⁻_s, g ∂μ) :
∫⁻ x, f x ∂Measure.pi μ = ∫⁻ x, g x ∂Measure.pi μ := by
rcases isEmpty_or_nonempty (∀ i, X i) with h|⟨⟨x⟩⟩
· simp_rw [lintegral_of_isEmpty]
simp_rw [lintegral_eq_lmarginal_univ x, lmarginal_eq_of_subset (Finset.subset_univ s) hf hg hfg]
theorem lintegral_le_of_lmarginal_le [Fintype δ] (s : Finset δ) {f g : (∀ i, X i) → ℝ≥0∞}
(hf : Measurable f) (hg : Measurable g) (hfg : ∫⋯∫⁻_s, f ∂μ ≤ ∫⋯∫⁻_s, g ∂μ) :
∫⁻ x, f x ∂Measure.pi μ ≤ ∫⁻ x, g x ∂Measure.pi μ := by
rcases isEmpty_or_nonempty (∀ i, X i) with h|⟨⟨x⟩⟩
· simp_rw [lintegral_of_isEmpty, le_rfl]
simp_rw [lintegral_eq_lmarginal_univ x, lmarginal_le_of_subset (Finset.subset_univ s) hf hg hfg x]
end LMarginal
end MeasureTheory |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/IntervalIntegral.lean | import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic
import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus
import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts
deprecated_module (since := "2025-04-13") |
.lake/packages/mathlib/Mathlib/MeasureTheory/Integral/CircleIntegral.lean | import Mathlib.Analysis.Analytic.IsolatedZeros
import Mathlib.Analysis.SpecialFunctions.Complex.CircleMap
import Mathlib.Analysis.SpecialFunctions.NonIntegrable
/-!
# Integral over a circle in `ℂ`
In this file we define `∮ z in C(c, R), f z` to be the integral $\oint_{|z-c|=|R|} f(z)\,dz$ and
prove some properties of this integral. We give definition and prove most lemmas for a function
`f : ℂ → E`, where `E` is a complex Banach space. For this reason,
some lemmas use, e.g., `(z - c)⁻¹ • f z` instead of `f z / (z - c)`.
## Main definitions
* `CircleIntegrable f c R`: a function `f : ℂ → E` is integrable on the circle with center `c` and
radius `R` if `f ∘ circleMap c R` is integrable on `[0, 2π]`;
* `circleIntegral f c R`: the integral $\oint_{|z-c|=|R|} f(z)\,dz$, defined as
$\int_{0}^{2π}(c + Re^{θ i})' f(c+Re^{θ i})\,dθ$;
* `cauchyPowerSeries f c R`: the power series that is equal to
$\sum_{n=0}^{\infty} \oint_{|z-c|=R} \left(\frac{w-c}{z - c}\right)^n \frac{1}{z-c}f(z)\,dz$ at
`w - c`. The coefficients of this power series depend only on `f ∘ circleMap c R`, and the power
series converges to `f w` if `f` is differentiable on the closed ball `Metric.closedBall c R`
and `w` belongs to the corresponding open ball.
## Main statements
* `hasFPowerSeriesOn_cauchy_integral`: for any circle integrable function `f`, the power series
`cauchyPowerSeries f c R`, `R > 0`, converges to the Cauchy integral
`(2 * π * I : ℂ)⁻¹ • ∮ z in C(c, R), (z - w)⁻¹ • f z` on the open disc `Metric.ball c R`;
* `circleIntegral.integral_sub_zpow_of_undef`, `circleIntegral.integral_sub_zpow_of_ne`, and
`circleIntegral.integral_sub_inv_of_mem_ball`: formulas for `∮ z in C(c, R), (z - w) ^ n`,
`n : ℤ`. These lemmas cover the following cases:
- `circleIntegral.integral_sub_zpow_of_undef`, `n < 0` and `|w - c| = |R|`: in this case the
function is not integrable, so the integral is equal to its default value (zero);
- `circleIntegral.integral_sub_zpow_of_ne`, `n ≠ -1`: in the cases not covered by the previous
lemma, we have `(z - w) ^ n = ((z - w) ^ (n + 1) / (n + 1))'`, thus the integral equals zero;
- `circleIntegral.integral_sub_inv_of_mem_ball`, `n = -1`, `|w - c| < R`: in this case the
integral is equal to `2πi`.
The case `n = -1`, `|w -c| > R` is not covered by these lemmas. While it is possible to construct
an explicit primitive, it is easier to apply Cauchy theorem, so we postpone the proof till we have
this theorem (see https://github.com/leanprover-community/mathlib4/pull/10000).
## Notation
- `∮ z in C(c, R), f z`: notation for the integral $\oint_{|z-c|=|R|} f(z)\,dz$, defined as
$\int_{0}^{2π}(c + Re^{θ i})' f(c+Re^{θ i})\,dθ$.
## Tags
integral, circle, Cauchy integral
-/
variable {E : Type*} [NormedAddCommGroup E]
noncomputable section
open scoped Real NNReal Interval Pointwise Topology
open Complex MeasureTheory TopologicalSpace Metric Function Set Filter Asymptotics
/-!
### Facts about `circleMap`
-/
/-- The range of `circleMap c R` is the circle with center `c` and radius `|R|`. -/
@[simp]
theorem range_circleMap (c : ℂ) (R : ℝ) : range (circleMap c R) = sphere c |R| :=
calc
range (circleMap c R) = c +ᵥ R • range fun θ : ℝ => exp (θ * I) := by
simp +unfoldPartialApp only [← image_vadd, ← image_smul, ← range_comp,
vadd_eq_add, circleMap, comp_def, real_smul]
_ = sphere c |R| := by
rw [range_exp_mul_I, smul_sphere R 0 zero_le_one]
simp
/-- The image of `(0, 2π]` under `circleMap c R` is the circle with center `c` and radius `|R|`. -/
@[simp]
theorem image_circleMap_Ioc (c : ℂ) (R : ℝ) : circleMap c R '' Ioc 0 (2 * π) = sphere c |R| := by
rw [← range_circleMap, ← (periodic_circleMap c R).image_Ioc Real.two_pi_pos 0, zero_add]
theorem hasDerivAt_circleMap (c : ℂ) (R : ℝ) (θ : ℝ) :
HasDerivAt (circleMap c R) (circleMap 0 R θ * I) θ := by
simpa only [mul_assoc, one_mul, ofRealCLM_apply, circleMap, ofReal_one, zero_add]
using (((ofRealCLM.hasDerivAt (x := θ)).mul_const I).cexp.const_mul (R : ℂ)).const_add c
theorem differentiable_circleMap (c : ℂ) (R : ℝ) : Differentiable ℝ (circleMap c R) := fun θ =>
(hasDerivAt_circleMap c R θ).differentiableAt
/-- The circleMap is real analytic. -/
theorem analyticOnNhd_circleMap (c : ℂ) (R : ℝ) :
AnalyticOnNhd ℝ (circleMap c R) Set.univ := by
intro z hz
apply analyticAt_const.add
apply analyticAt_const.mul
rw [← Function.comp_def]
apply analyticAt_cexp.restrictScalars.comp ((ofRealCLM.analyticAt z).mul (by fun_prop))
/-- The circleMap is continuously differentiable. -/
theorem contDiff_circleMap (c : ℂ) (R : ℝ) {n : WithTop ℕ∞} :
ContDiff ℝ n (circleMap c R) :=
(analyticOnNhd_circleMap c R).contDiff
@[continuity, fun_prop]
theorem continuous_circleMap (c : ℂ) (R : ℝ) : Continuous (circleMap c R) :=
(differentiable_circleMap c R).continuous
@[fun_prop, measurability]
theorem measurable_circleMap (c : ℂ) (R : ℝ) : Measurable (circleMap c R) :=
(continuous_circleMap c R).measurable
@[simp]
theorem deriv_circleMap (c : ℂ) (R : ℝ) (θ : ℝ) : deriv (circleMap c R) θ = circleMap 0 R θ * I :=
(hasDerivAt_circleMap _ _ _).deriv
theorem deriv_circleMap_eq_zero_iff {c : ℂ} {R : ℝ} {θ : ℝ} :
deriv (circleMap c R) θ = 0 ↔ R = 0 := by simp [I_ne_zero]
theorem deriv_circleMap_ne_zero {c : ℂ} {R : ℝ} {θ : ℝ} (hR : R ≠ 0) :
deriv (circleMap c R) θ ≠ 0 :=
mt deriv_circleMap_eq_zero_iff.1 hR
theorem lipschitzWith_circleMap (c : ℂ) (R : ℝ) : LipschitzWith (Real.nnabs R) (circleMap c R) :=
lipschitzWith_of_nnnorm_deriv_le (differentiable_circleMap _ _) fun θ =>
NNReal.coe_le_coe.1 <| by simp
theorem continuous_circleMap_inv {R : ℝ} {z w : ℂ} (hw : w ∈ ball z R) :
Continuous fun θ => (circleMap z R θ - w)⁻¹ := by
have : ∀ θ, circleMap z R θ - w ≠ 0 := by
simp_rw [sub_ne_zero]
exact fun θ => circleMap_ne_mem_ball hw θ
-- Porting note: was `continuity`
exact Continuous.inv₀ (by fun_prop) this
theorem circleMap_preimage_codiscrete {c : ℂ} {R : ℝ} (hR : R ≠ 0) :
map (circleMap c R) (codiscrete ℝ) ≤ codiscreteWithin (Metric.sphere c |R|) := by
intro s hs
apply (analyticOnNhd_circleMap c R).preimage_mem_codiscreteWithin
· intro x hx
by_contra hCon
obtain ⟨a, ha⟩ := eventuallyConst_iff_exists_eventuallyEq.1 hCon
have := ha.deriv.eq_of_nhds
simp [hR] at this
· rwa [Set.image_univ, range_circleMap]
theorem circleMap_neg_radius {r x : ℝ} {c : ℂ} :
circleMap c (-r) x = circleMap c r (x + π) := by
simp [circleMap, add_mul, Complex.exp_add]
/-!
### Integrability of a function on a circle
-/
/-- We say that a function `f : ℂ → E` is integrable on the circle with center `c` and radius `R` if
the function `f ∘ circleMap c R` is integrable on `[0, 2π]`.
Note that the actual function used in the definition of `circleIntegral` is
`(deriv (circleMap c R) θ) • f (circleMap c R θ)`. Integrability of this function is equivalent
to integrability of `f ∘ circleMap c R` whenever `R ≠ 0`. -/
def CircleIntegrable (f : ℂ → E) (c : ℂ) (R : ℝ) : Prop :=
IntervalIntegrable (fun θ : ℝ ↦ f (circleMap c R θ)) volume 0 (2 * π)
theorem circleIntegrable_def (f : ℂ → E) (c : ℂ) (R : ℝ) : CircleIntegrable f c R ↔
IntervalIntegrable (fun θ : ℝ ↦ f (circleMap c R θ)) volume 0 (2 * π) := Iff.rfl
@[simp]
theorem circleIntegrable_const (a : E) (c : ℂ) (R : ℝ) : CircleIntegrable (fun _ => a) c R :=
intervalIntegrable_const
namespace CircleIntegrable
variable {f g : ℂ → E} {c : ℂ} {R : ℝ} {A : Type*} [NormedRing A] {a : A}
/--
Analogue of `IntervalIntegrable.abs`: If a real-valued function `f` is circle integrable, then so is
`|f|`.
-/
theorem abs {f : ℂ → ℝ} (hf : CircleIntegrable f c R) :
CircleIntegrable |f| c R := IntervalIntegrable.abs hf
nonrec theorem add (hf : CircleIntegrable f c R) (hg : CircleIntegrable g c R) :
CircleIntegrable (f + g) c R :=
hf.add hg
/-- Sums of circle integrable functions are circle integrable. -/
protected theorem sum {ι : Type*} (s : Finset ι) {f : ι → ℂ → E}
(h : ∀ i ∈ s, CircleIntegrable (f i) c R) :
CircleIntegrable (∑ i ∈ s, f i) c R := by
rw [CircleIntegrable, (by aesop : (fun θ ↦ (∑ i ∈ s, f i) (circleMap c R θ))
= ∑ i ∈ s, fun θ ↦ f i (circleMap c R θ))] at *
exact IntervalIntegrable.sum s h
/-- `finsum`s of circle integrable functions are circle integrable. -/
protected theorem finsum {ι : Type*} {f : ι → ℂ → E} (h : ∀ i, CircleIntegrable (f i) c R) :
CircleIntegrable (∑ᶠ i, f i) c R := by
by_cases h₁ : (Function.support f).Finite
· rw [finsum_eq_sum f h₁]
exact CircleIntegrable.sum h₁.toFinset (fun i _ ↦ h i)
· rw [finsum_of_infinite_support h₁]
apply circleIntegrable_const
nonrec theorem neg (hf : CircleIntegrable f c R) : CircleIntegrable (-f) c R :=
hf.neg
/-- If `f` is circle integrable, then so are its scalar multiples. -/
theorem const_smul {f : ℂ → A} (h : CircleIntegrable f c R) : CircleIntegrable (a • f) c R :=
IntervalIntegrable.const_mul h _
/-- If `f` is circle integrable, then so are its scalar multiples. -/
theorem const_fun_smul {f : ℂ → A} (h : CircleIntegrable f c R) :
CircleIntegrable (fun z ↦ a • f z) c R := const_smul h
/-- The function we actually integrate over `[0, 2π]` in the definition of `circleIntegral` is
integrable. -/
theorem out [NormedSpace ℂ E] (hf : CircleIntegrable f c R) :
IntervalIntegrable (fun θ : ℝ => deriv (circleMap c R) θ • f (circleMap c R θ)) volume 0
(2 * π) := by
simp only [CircleIntegrable, deriv_circleMap, intervalIntegrable_iff] at *
refine (hf.norm.const_mul |R|).mono' ?_ ?_
· exact ((continuous_circleMap _ _).aestronglyMeasurable.mul_const I).smul hf.aestronglyMeasurable
· simp [norm_smul]
end CircleIntegrable
@[simp]
theorem circleIntegrable_zero_radius {f : ℂ → E} {c : ℂ} : CircleIntegrable f c 0 := by
simp [CircleIntegrable]
/-- Circle integrability is invariant when functions change along discrete sets. -/
theorem CircleIntegrable.congr_codiscreteWithin {c : ℂ} {R : ℝ} {f₁ f₂ : ℂ → E}
(hf : f₁ =ᶠ[codiscreteWithin (Metric.sphere c |R|)] f₂) (hf₁ : CircleIntegrable f₁ c R) :
CircleIntegrable f₂ c R := by
by_cases hR : R = 0
· simp [hR]
apply (intervalIntegrable_congr_codiscreteWithin _).1 hf₁
rw [eventuallyEq_iff_exists_mem]
exact ⟨(circleMap c R)⁻¹' {z | f₁ z = f₂ z},
codiscreteWithin.mono (by simp only [Set.subset_univ]) (circleMap_preimage_codiscrete hR hf),
by tauto⟩
/-- Circle integrability is invariant when functions change along discrete sets. -/
theorem circleIntegrable_congr_codiscreteWithin {c : ℂ} {R : ℝ} {f₁ f₂ : ℂ → E}
(hf : f₁ =ᶠ[codiscreteWithin (Metric.sphere c |R|)] f₂) :
CircleIntegrable f₁ c R ↔ CircleIntegrable f₂ c R :=
⟨(CircleIntegrable.congr_codiscreteWithin hf ·),
(CircleIntegrable.congr_codiscreteWithin hf.symm ·)⟩
theorem circleIntegrable_iff [NormedSpace ℂ E] {f : ℂ → E} {c : ℂ} (R : ℝ) :
CircleIntegrable f c R ↔ IntervalIntegrable (fun θ : ℝ =>
deriv (circleMap c R) θ • f (circleMap c R θ)) volume 0 (2 * π) := by
by_cases h₀ : R = 0
· simp +unfoldPartialApp [h₀, const]
refine ⟨fun h => h.out, fun h => ?_⟩
simp only [CircleIntegrable, intervalIntegrable_iff, deriv_circleMap] at h ⊢
refine (h.norm.const_mul |R|⁻¹).mono' ?_ ?_
· have H : ∀ {θ}, circleMap 0 R θ * I ≠ 0 := fun {θ} => by simp [h₀, I_ne_zero]
simpa only [inv_smul_smul₀ H]
using ((continuous_circleMap 0 R).aestronglyMeasurable.mul_const
I).aemeasurable.inv.aestronglyMeasurable.smul h.aestronglyMeasurable
· simp [norm_smul, h₀]
theorem ContinuousOn.circleIntegrable' {f : ℂ → E} {c : ℂ} {R : ℝ}
(hf : ContinuousOn f (sphere c |R|)) : CircleIntegrable f c R :=
(hf.comp_continuous (continuous_circleMap _ _) (circleMap_mem_sphere' _ _)).intervalIntegrable _ _
theorem ContinuousOn.circleIntegrable {f : ℂ → E} {c : ℂ} {R : ℝ} (hR : 0 ≤ R)
(hf : ContinuousOn f (sphere c R)) : CircleIntegrable f c R :=
ContinuousOn.circleIntegrable' <| (abs_of_nonneg hR).symm ▸ hf
/-- The function `fun z ↦ (z - w) ^ n`, `n : ℤ`, is circle integrable on the circle with center `c`
and radius `|R|` if and only if `R = 0` or `0 ≤ n`, or `w` does not belong to this circle. -/
@[simp]
theorem circleIntegrable_sub_zpow_iff {c w : ℂ} {R : ℝ} {n : ℤ} :
CircleIntegrable (fun z => (z - w) ^ n) c R ↔ R = 0 ∨ 0 ≤ n ∨ w ∉ sphere c |R| := by
constructor
· intro h; contrapose! h; rcases h with ⟨hR, hn, hw⟩
simp only [circleIntegrable_iff R, deriv_circleMap]
rw [← image_circleMap_Ioc] at hw; rcases hw with ⟨θ, hθ, rfl⟩
replace hθ : θ ∈ [[0, 2 * π]] := Icc_subset_uIcc (Ioc_subset_Icc_self hθ)
refine not_intervalIntegrable_of_sub_inv_isBigO_punctured ?_ Real.two_pi_pos.ne hθ
set f : ℝ → ℂ := fun θ' => circleMap c R θ' - circleMap c R θ
have : ∀ᶠ θ' in 𝓝[≠] θ, f θ' ∈ ball (0 : ℂ) 1 \ {0} := by
suffices ∀ᶠ z in 𝓝[≠] circleMap c R θ, z - circleMap c R θ ∈ ball (0 : ℂ) 1 \ {0} from
((differentiable_circleMap c R θ).hasDerivAt.tendsto_nhdsNE
(deriv_circleMap_ne_zero hR)).eventually this
filter_upwards [self_mem_nhdsWithin, mem_nhdsWithin_of_mem_nhds (ball_mem_nhds _ zero_lt_one)]
simp_all [dist_eq, sub_eq_zero]
refine (((hasDerivAt_circleMap c R θ).isBigO_sub.mono inf_le_left).inv_rev
(this.mono fun θ' h₁ h₂ => absurd h₂ h₁.2)).trans ?_
refine IsBigO.of_bound |R|⁻¹ (this.mono fun θ' hθ' => ?_)
set x := ‖f θ'‖
suffices x⁻¹ ≤ x ^ n by
simp only [Algebra.id.smul_eq_mul, norm_mul,
norm_inv, norm_I, mul_one]
simpa only [norm_circleMap_zero, norm_zpow, Ne, abs_eq_zero.not.2 hR, not_false_iff,
inv_mul_cancel_left₀] using this
have : x ∈ Ioo (0 : ℝ) 1 := by simpa [x, and_comm] using hθ'
rw [← zpow_neg_one]
refine (zpow_right_strictAnti₀ this.1 this.2).le_iff_ge.2 (Int.lt_add_one_iff.1 ?_); exact hn
· rintro (rfl | H)
exacts [circleIntegrable_zero_radius,
((continuousOn_id.sub continuousOn_const).zpow₀ _ fun z hz =>
H.symm.imp_left fun (hw : w ∉ sphere c |R|) =>
sub_ne_zero.2 <| ne_of_mem_of_not_mem hz hw).circleIntegrable']
@[simp]
theorem circleIntegrable_sub_inv_iff {c w : ℂ} {R : ℝ} :
CircleIntegrable (fun z => (z - w)⁻¹) c R ↔ R = 0 ∨ w ∉ sphere c |R| := by
simp only [← zpow_neg_one, circleIntegrable_sub_zpow_iff]; simp
variable [NormedSpace ℂ E]
/-- Definition for $\oint_{|z-c|=R} f(z)\,dz$ -/
def circleIntegral (f : ℂ → E) (c : ℂ) (R : ℝ) : E :=
∫ θ : ℝ in 0..2 * π, deriv (circleMap c R) θ • f (circleMap c R θ)
/-- `∮ z in C(c, R), f z` is the circle integral $\oint_{|z-c|=R} f(z)\,dz$. -/
notation3 "∮ "(...)" in ""C("c", "R")"", "r:60:(scoped f => circleIntegral f c R) => r
theorem circleIntegral_def_Icc (f : ℂ → E) (c : ℂ) (R : ℝ) :
(∮ z in C(c, R), f z) = ∫ θ in Icc 0 (2 * π),
deriv (circleMap c R) θ • f (circleMap c R θ) := by
rw [circleIntegral, intervalIntegral.integral_of_le Real.two_pi_pos.le,
Measure.restrict_congr_set Ioc_ae_eq_Icc]
namespace circleIntegral
@[simp]
theorem integral_radius_zero (f : ℂ → E) (c : ℂ) : (∮ z in C(c, 0), f z) = 0 := by
simp +unfoldPartialApp [circleIntegral, const]
theorem integral_congr {f g : ℂ → E} {c : ℂ} {R : ℝ} (hR : 0 ≤ R) (h : EqOn f g (sphere c R)) :
(∮ z in C(c, R), f z) = ∮ z in C(c, R), g z :=
intervalIntegral.integral_congr fun θ _ => by simp only [h (circleMap_mem_sphere _ hR _)]
/-- Circle integrals are invariant when functions change along discrete sets. -/
theorem circleIntegral_congr_codiscreteWithin {c : ℂ} {R : ℝ} {f₁ f₂ : ℂ → ℂ}
(hf : f₁ =ᶠ[codiscreteWithin (Metric.sphere c |R|)] f₂) (hR : R ≠ 0) :
(∮ z in C(c, R), f₁ z) = (∮ z in C(c, R), f₂ z) := by
apply intervalIntegral.integral_congr_ae_restrict
apply ae_restrict_le_codiscreteWithin measurableSet_uIoc
simp only [deriv_circleMap, smul_eq_mul, mul_eq_mul_left_iff, mul_eq_zero,
circleMap_eq_center_iff, hR, Complex.I_ne_zero, or_self, or_false]
exact codiscreteWithin.mono (by tauto) (circleMap_preimage_codiscrete hR hf)
theorem integral_sub_inv_smul_sub_smul (f : ℂ → E) (c w : ℂ) (R : ℝ) :
(∮ z in C(c, R), (z - w)⁻¹ • (z - w) • f z) = ∮ z in C(c, R), f z := by
rcases eq_or_ne R 0 with (rfl | hR); · simp only [integral_radius_zero]
have : (circleMap c R ⁻¹' {w}).Countable := (countable_singleton _).preimage_circleMap c hR
refine intervalIntegral.integral_congr_ae ((this.ae_notMem _).mono fun θ hθ _' => ?_)
change circleMap c R θ ≠ w at hθ
simp only [inv_smul_smul₀ (sub_ne_zero.2 <| hθ)]
theorem integral_undef {f : ℂ → E} {c : ℂ} {R : ℝ} (hf : ¬CircleIntegrable f c R) :
(∮ z in C(c, R), f z) = 0 :=
intervalIntegral.integral_undef (mt (circleIntegrable_iff R).mpr hf)
theorem integral_add {f g : ℂ → E} {c : ℂ} {R : ℝ} (hf : CircleIntegrable f c R)
(hg : CircleIntegrable g c R) :
(∮ z in C(c, R), f z + g z) = (∮ z in C(c, R), f z) + (∮ z in C(c, R), g z) := by
simp only [circleIntegral, smul_add, intervalIntegral.integral_add hf.out hg.out]
theorem integral_sub {f g : ℂ → E} {c : ℂ} {R : ℝ} (hf : CircleIntegrable f c R)
(hg : CircleIntegrable g c R) :
(∮ z in C(c, R), f z - g z) = (∮ z in C(c, R), f z) - ∮ z in C(c, R), g z := by
simp only [circleIntegral, smul_sub, intervalIntegral.integral_sub hf.out hg.out]
theorem norm_integral_le_of_norm_le_const' {f : ℂ → E} {c : ℂ} {R C : ℝ}
(hf : ∀ z ∈ sphere c |R|, ‖f z‖ ≤ C) : ‖∮ z in C(c, R), f z‖ ≤ 2 * π * |R| * C :=
calc
‖∮ z in C(c, R), f z‖ ≤ |R| * C * |2 * π - 0| :=
intervalIntegral.norm_integral_le_of_norm_le_const fun θ _ =>
calc
‖deriv (circleMap c R) θ • f (circleMap c R θ)‖ = |R| * ‖f (circleMap c R θ)‖ := by
simp [norm_smul]
_ ≤ |R| * C :=
mul_le_mul_of_nonneg_left (hf _ <| circleMap_mem_sphere' _ _ _) (abs_nonneg _)
_ = 2 * π * |R| * C := by rw [sub_zero, _root_.abs_of_pos Real.two_pi_pos]; ac_rfl
theorem norm_integral_le_of_norm_le_const {f : ℂ → E} {c : ℂ} {R C : ℝ} (hR : 0 ≤ R)
(hf : ∀ z ∈ sphere c R, ‖f z‖ ≤ C) : ‖∮ z in C(c, R), f z‖ ≤ 2 * π * R * C :=
have : |R| = R := abs_of_nonneg hR
calc
‖∮ z in C(c, R), f z‖ ≤ 2 * π * |R| * C := norm_integral_le_of_norm_le_const' <| by rwa [this]
_ = 2 * π * R * C := by rw [this]
theorem norm_two_pi_i_inv_smul_integral_le_of_norm_le_const {f : ℂ → E} {c : ℂ} {R C : ℝ}
(hR : 0 ≤ R) (hf : ∀ z ∈ sphere c R, ‖f z‖ ≤ C) :
‖(2 * π * I : ℂ)⁻¹ • ∮ z in C(c, R), f z‖ ≤ R * C := by
have : ‖(2 * π * I : ℂ)⁻¹‖ = (2 * π)⁻¹ := by simp [Real.pi_pos.le]
rw [norm_smul, this, ← div_eq_inv_mul, div_le_iff₀ Real.two_pi_pos, mul_comm (R * C), ← mul_assoc]
exact norm_integral_le_of_norm_le_const hR hf
/-- If `f` is continuous on the circle `|z - c| = R`, `R > 0`, the `‖f z‖` is less than or equal to
`C : ℝ` on this circle, and this norm is strictly less than `C` at some point `z` of the circle,
then `‖∮ z in C(c, R), f z‖ < 2 * π * R * C`. -/
theorem norm_integral_lt_of_norm_le_const_of_lt {f : ℂ → E} {c : ℂ} {R C : ℝ} (hR : 0 < R)
(hc : ContinuousOn f (sphere c R)) (hf : ∀ z ∈ sphere c R, ‖f z‖ ≤ C)
(hlt : ∃ z ∈ sphere c R, ‖f z‖ < C) : ‖∮ z in C(c, R), f z‖ < 2 * π * R * C := by
rw [← _root_.abs_of_pos hR, ← image_circleMap_Ioc] at hlt
rcases hlt with ⟨_, ⟨θ₀, hmem, rfl⟩, hlt⟩
calc
‖∮ z in C(c, R), f z‖ ≤ ∫ θ in 0..2 * π, ‖deriv (circleMap c R) θ • f (circleMap c R θ)‖ :=
intervalIntegral.norm_integral_le_integral_norm Real.two_pi_pos.le
_ < ∫ _ in 0..2 * π, R * C := by
simp only [deriv_circleMap, norm_smul, norm_mul, norm_circleMap_zero, abs_of_pos hR, norm_I,
mul_one]
refine intervalIntegral.integral_lt_integral_of_continuousOn_of_le_of_exists_lt
Real.two_pi_pos ?_ continuousOn_const (fun θ _ => ?_) ⟨θ₀, Ioc_subset_Icc_self hmem, ?_⟩
· exact continuousOn_const.mul (hc.comp (continuous_circleMap _ _).continuousOn fun θ _ =>
circleMap_mem_sphere _ hR.le _).norm
· exact mul_le_mul_of_nonneg_left (hf _ <| circleMap_mem_sphere _ hR.le _) hR.le
· gcongr
_ = 2 * π * R * C := by simp [mul_assoc]; ring
@[simp]
theorem integral_smul {𝕜 : Type*} [RCLike 𝕜] [NormedSpace 𝕜 E] [SMulCommClass 𝕜 ℂ E] (a : 𝕜)
(f : ℂ → E) (c : ℂ) (R : ℝ) : (∮ z in C(c, R), a • f z) = a • ∮ z in C(c, R), f z := by
simp only [circleIntegral, ← smul_comm a (_ : ℂ) (_ : E), intervalIntegral.integral_smul]
@[simp]
theorem integral_smul_const [CompleteSpace E] (f : ℂ → ℂ) (a : E) (c : ℂ) (R : ℝ) :
(∮ z in C(c, R), f z • a) = (∮ z in C(c, R), f z) • a := by
simp only [circleIntegral, intervalIntegral.integral_smul_const, ← smul_assoc]
@[simp]
theorem integral_const_mul (a : ℂ) (f : ℂ → ℂ) (c : ℂ) (R : ℝ) :
(∮ z in C(c, R), a * f z) = a * ∮ z in C(c, R), f z :=
integral_smul a f c R
@[simp]
theorem integral_sub_center_inv (c : ℂ) {R : ℝ} (hR : R ≠ 0) :
(∮ z in C(c, R), (z - c)⁻¹) = 2 * π * I := by
simp [circleIntegral, ← div_eq_mul_inv, mul_div_cancel_left₀ _ (circleMap_ne_center hR)]
/-- If `f' : ℂ → E` is a derivative of a complex differentiable function on the circle
`Metric.sphere c |R|`, then `∮ z in C(c, R), f' z = 0`. -/
theorem integral_eq_zero_of_hasDerivWithinAt' [CompleteSpace E] {f f' : ℂ → E} {c : ℂ} {R : ℝ}
(h : ∀ z ∈ sphere c |R|, HasDerivWithinAt f (f' z) (sphere c |R|) z) :
(∮ z in C(c, R), f' z) = 0 := by
by_cases hi : CircleIntegrable f' c R
· rw [← sub_eq_zero.2 ((periodic_circleMap c R).comp f).eq]
refine intervalIntegral.integral_eq_sub_of_hasDerivAt (fun θ _ => ?_) hi.out
exact (h _ (circleMap_mem_sphere' _ _ _)).scomp_hasDerivAt θ
(differentiable_circleMap _ _ _).hasDerivAt (circleMap_mem_sphere' _ _)
· exact integral_undef hi
/-- If `f' : ℂ → E` is a derivative of a complex differentiable function on the circle
`Metric.sphere c R`, then `∮ z in C(c, R), f' z = 0`. -/
theorem integral_eq_zero_of_hasDerivWithinAt [CompleteSpace E]
{f f' : ℂ → E} {c : ℂ} {R : ℝ} (hR : 0 ≤ R)
(h : ∀ z ∈ sphere c R, HasDerivWithinAt f (f' z) (sphere c R) z) : (∮ z in C(c, R), f' z) = 0 :=
integral_eq_zero_of_hasDerivWithinAt' <| (abs_of_nonneg hR).symm ▸ h
/-- If `n < 0` and `|w - c| = |R|`, then `(z - w) ^ n` is not circle integrable on the circle with
center `c` and radius `|R|`, so the integral `∮ z in C(c, R), (z - w) ^ n` is equal to zero. -/
theorem integral_sub_zpow_of_undef {n : ℤ} {c w : ℂ} {R : ℝ} (hn : n < 0)
(hw : w ∈ sphere c |R|) : (∮ z in C(c, R), (z - w) ^ n) = 0 := by
rcases eq_or_ne R 0 with (rfl | h0)
· apply integral_radius_zero
· apply integral_undef
simpa [circleIntegrable_sub_zpow_iff, *, not_or]
/-- If `n ≠ -1` is an integer number, then the integral of `(z - w) ^ n` over the circle equals
zero. -/
theorem integral_sub_zpow_of_ne {n : ℤ} (hn : n ≠ -1) (c w : ℂ) (R : ℝ) :
(∮ z in C(c, R), (z - w) ^ n) = 0 := by
by_cases! H : w ∈ sphere c |R| ∧ n < -1
· rcases H with ⟨hw, hn⟩
exact integral_sub_zpow_of_undef (hn.trans (by decide)) hw
have hd : ∀ z, z ≠ w ∨ -1 ≤ n →
HasDerivAt (fun z => (z - w) ^ (n + 1) / (n + 1)) ((z - w) ^ n) z := by
intro z hne
convert ((hasDerivAt_zpow (n + 1) _ (hne.imp _ _)).comp z
((hasDerivAt_id z).sub_const w)).div_const _ using 1
· have hn' : (n + 1 : ℂ) ≠ 0 := by
rwa [Ne, ← eq_neg_iff_add_eq_zero, ← Int.cast_one, ← Int.cast_neg, Int.cast_inj]
simp [mul_div_cancel_left₀ _ hn']
exacts [sub_ne_zero.2, neg_le_iff_add_nonneg.1]
refine integral_eq_zero_of_hasDerivWithinAt' fun z hz => (hd z ?_).hasDerivWithinAt
exact (ne_or_eq z w).imp_right fun (h : z = w) => H <| h ▸ hz
end circleIntegral
/-- The power series that is equal to
$\frac{1}{2πi}\sum_{n=0}^{\infty}
\oint_{|z-c|=R} \left(\frac{w-c}{z - c}\right)^n \frac{1}{z-c}f(z)\,dz$ at
`w - c`. The coefficients of this power series depend only on `f ∘ circleMap c R`, and the power
series converges to `f w` if `f` is differentiable on the closed ball `Metric.closedBall c R` and
`w` belongs to the corresponding open ball. For any circle integrable function `f`, this power
series converges to the Cauchy integral for `f`. -/
def cauchyPowerSeries (f : ℂ → E) (c : ℂ) (R : ℝ) : FormalMultilinearSeries ℂ ℂ E := fun n =>
ContinuousMultilinearMap.mkPiRing ℂ _ <|
(2 * π * I : ℂ)⁻¹ • ∮ z in C(c, R), (z - c)⁻¹ ^ n • (z - c)⁻¹ • f z
theorem cauchyPowerSeries_apply (f : ℂ → E) (c : ℂ) (R : ℝ) (n : ℕ) (w : ℂ) :
(cauchyPowerSeries f c R n fun _ => w) =
(2 * π * I : ℂ)⁻¹ • ∮ z in C(c, R), (w / (z - c)) ^ n • (z - c)⁻¹ • f z := by
simp only [cauchyPowerSeries, ContinuousMultilinearMap.mkPiRing_apply, Fin.prod_const,
div_eq_mul_inv, mul_pow, mul_smul, circleIntegral.integral_smul]
rw [← smul_comm (w ^ n)]
theorem norm_cauchyPowerSeries_le (f : ℂ → E) (c : ℂ) (R : ℝ) (n : ℕ) :
‖cauchyPowerSeries f c R n‖ ≤
((2 * π)⁻¹ * ∫ θ : ℝ in 0..2 * π, ‖f (circleMap c R θ)‖) * |R|⁻¹ ^ n :=
calc ‖cauchyPowerSeries f c R n‖
_ = (2 * π)⁻¹ * ‖∮ z in C(c, R), (z - c)⁻¹ ^ n • (z - c)⁻¹ • f z‖ := by
simp [cauchyPowerSeries, norm_smul, Real.pi_pos.le]
_ ≤ (2 * π)⁻¹ * ∫ θ in 0..2 * π, ‖deriv (circleMap c R) θ •
(circleMap c R θ - c)⁻¹ ^ n • (circleMap c R θ - c)⁻¹ • f (circleMap c R θ)‖ :=
(mul_le_mul_of_nonneg_left
(intervalIntegral.norm_integral_le_integral_norm Real.two_pi_pos.le)
(by simp [Real.pi_pos.le]))
_ = (2 * π)⁻¹ *
(|R|⁻¹ ^ n * (|R| * (|R|⁻¹ * ∫ x : ℝ in 0..2 * π, ‖f (circleMap c R x)‖))) := by
simp [norm_smul, mul_left_comm |R|]
_ ≤ ((2 * π)⁻¹ * ∫ θ : ℝ in 0..2 * π, ‖f (circleMap c R θ)‖) * |R|⁻¹ ^ n := by
rcases eq_or_ne R 0 with (rfl | hR)
· cases n <;> simp [-mul_inv_rev]
· rw [mul_inv_cancel_left₀, mul_assoc, mul_comm (|R|⁻¹ ^ n)]
rwa [Ne, _root_.abs_eq_zero]
theorem le_radius_cauchyPowerSeries (f : ℂ → E) (c : ℂ) (R : ℝ≥0) :
↑R ≤ (cauchyPowerSeries f c R).radius := by
refine
(cauchyPowerSeries f c R).le_radius_of_bound
((2 * π)⁻¹ * ∫ θ : ℝ in 0..2 * π, ‖f (circleMap c R θ)‖) fun n => ?_
refine (mul_le_mul_of_nonneg_right (norm_cauchyPowerSeries_le _ _ _ _)
(pow_nonneg R.coe_nonneg _)).trans ?_
rw [abs_of_nonneg R.coe_nonneg]
rcases eq_or_ne (R ^ n : ℝ) 0 with hR | hR
· rw_mod_cast [hR, mul_zero]
exact mul_nonneg (inv_nonneg.2 Real.two_pi_pos.le)
(intervalIntegral.integral_nonneg Real.two_pi_pos.le fun _ _ => norm_nonneg _)
· rw [inv_pow]
have : (R : ℝ) ^ n ≠ 0 := by norm_cast at hR ⊢
rw [inv_mul_cancel_right₀ this]
/-- For any circle integrable function `f`, the power series `cauchyPowerSeries f c R` multiplied
by `2πI` converges to the integral `∮ z in C(c, R), (z - w)⁻¹ • f z` on the open disc
`Metric.ball c R`. -/
theorem hasSum_two_pi_I_cauchyPowerSeries_integral {f : ℂ → E} {c : ℂ} {R : ℝ} {w : ℂ}
(hf : CircleIntegrable f c R) (hw : ‖w‖ < R) :
HasSum (fun n : ℕ => ∮ z in C(c, R), (w / (z - c)) ^ n • (z - c)⁻¹ • f z)
(∮ z in C(c, R), (z - (c + w))⁻¹ • f z) := by
have hR : 0 < R := (norm_nonneg w).trans_lt hw
have hwR : ‖w‖ / R ∈ Ico (0 : ℝ) 1 :=
⟨div_nonneg (norm_nonneg w) hR.le, (div_lt_one hR).2 hw⟩
refine intervalIntegral.hasSum_integral_of_dominated_convergence
(fun n θ => ‖f (circleMap c R θ)‖ * (‖w‖ / R) ^ n) (fun n => ?_) (fun n => ?_) ?_ ?_ ?_
· simp only [deriv_circleMap]
apply_rules [AEStronglyMeasurable.smul, hf.def'.1] <;> apply Measurable.aestronglyMeasurable
· fun_prop
· fun_prop
· fun_prop
· simp [norm_smul, abs_of_pos hR, mul_left_comm R, inv_mul_cancel_left₀ hR.ne', mul_comm ‖_‖]
· exact Eventually.of_forall fun _ _ => (summable_geometric_of_lt_one hwR.1 hwR.2).mul_left _
· simpa only [tsum_mul_left, tsum_geometric_of_lt_one hwR.1 hwR.2] using
hf.norm.mul_continuousOn continuousOn_const
· refine Eventually.of_forall fun θ _ => HasSum.const_smul _ ?_
simp only [smul_smul]
refine HasSum.smul_const ?_ _
have : ‖w / (circleMap c R θ - c)‖ < 1 := by simpa [abs_of_pos hR] using hwR.2
convert (hasSum_geometric_of_norm_lt_one this).mul_right _ using 1
simp [← sub_sub, ← mul_inv, sub_mul, div_mul_cancel₀ _ (circleMap_ne_center hR.ne')]
/-- For any circle integrable function `f`, the power series `cauchyPowerSeries f c R`, `R > 0`,
converges to the Cauchy integral `(2 * π * I : ℂ)⁻¹ • ∮ z in C(c, R), (z - w)⁻¹ • f z` on the open
disc `Metric.ball c R`. -/
theorem hasSum_cauchyPowerSeries_integral {f : ℂ → E} {c : ℂ} {R : ℝ} {w : ℂ}
(hf : CircleIntegrable f c R) (hw : ‖w‖ < R) :
HasSum (fun n => cauchyPowerSeries f c R n fun _ => w)
((2 * π * I : ℂ)⁻¹ • ∮ z in C(c, R), (z - (c + w))⁻¹ • f z) := by
simp only [cauchyPowerSeries_apply]
exact (hasSum_two_pi_I_cauchyPowerSeries_integral hf hw).const_smul _
/-- For any circle integrable function `f`, the power series `cauchyPowerSeries f c R`, `R > 0`,
converges to the Cauchy integral `(2 * π * I : ℂ)⁻¹ • ∮ z in C(c, R), (z - w)⁻¹ • f z` on the open
disc `Metric.ball c R`. -/
theorem sum_cauchyPowerSeries_eq_integral {f : ℂ → E} {c : ℂ} {R : ℝ} {w : ℂ}
(hf : CircleIntegrable f c R) (hw : ‖w‖ < R) :
(cauchyPowerSeries f c R).sum w = (2 * π * I : ℂ)⁻¹ • ∮ z in C(c, R), (z - (c + w))⁻¹ • f z :=
(hasSum_cauchyPowerSeries_integral hf hw).tsum_eq
/-- For any circle integrable function `f`, the power series `cauchyPowerSeries f c R`, `R > 0`,
converges to the Cauchy integral `(2 * π * I : ℂ)⁻¹ • ∮ z in C(c, R), (z - w)⁻¹ • f z` on the open
disc `Metric.ball c R`. -/
theorem hasFPowerSeriesOn_cauchy_integral {f : ℂ → E} {c : ℂ} {R : ℝ≥0}
(hf : CircleIntegrable f c R) (hR : 0 < R) :
HasFPowerSeriesOnBall (fun w => (2 * π * I : ℂ)⁻¹ • ∮ z in C(c, R), (z - w)⁻¹ • f z)
(cauchyPowerSeries f c R) c R :=
{ r_le := le_radius_cauchyPowerSeries _ _ _
r_pos := ENNReal.coe_pos.2 hR
hasSum := fun hy ↦ hasSum_cauchyPowerSeries_integral hf <| by simpa using hy }
namespace circleIntegral
/-- Integral $\oint_{|z-c|=R} \frac{dz}{z-w} = 2πi$ whenever $|w-c| < R$. -/
theorem integral_sub_inv_of_mem_ball {c w : ℂ} {R : ℝ} (hw : w ∈ ball c R) :
(∮ z in C(c, R), (z - w)⁻¹) = 2 * π * I := by
have hR : 0 < R := dist_nonneg.trans_lt hw
suffices H : HasSum (fun n : ℕ => ∮ z in C(c, R), ((w - c) / (z - c)) ^ n * (z - c)⁻¹)
(2 * π * I) by
have A : CircleIntegrable (fun _ => (1 : ℂ)) c R := continuousOn_const.circleIntegrable'
refine (H.unique ?_).symm
simpa only [smul_eq_mul, mul_one, add_sub_cancel] using
hasSum_two_pi_I_cauchyPowerSeries_integral A hw
have H : ∀ n : ℕ, n ≠ 0 → (∮ z in C(c, R), (z - c) ^ (-n - 1 : ℤ)) = 0 := by
refine fun n hn => integral_sub_zpow_of_ne ?_ _ _ _; simpa
have : (∮ z in C(c, R), ((w - c) / (z - c)) ^ 0 * (z - c)⁻¹) = 2 * π * I := by simp [hR.ne']
refine this ▸ hasSum_single _ fun n hn => ?_
simp only [div_eq_mul_inv, mul_pow, integral_const_mul, mul_assoc]
rw [(integral_congr hR.le fun z hz => _).trans (H n hn), mul_zero]
intro z _
rw [← pow_succ, ← zpow_natCast, inv_zpow, ← zpow_neg, Int.natCast_succ, neg_add,
sub_eq_add_neg _ (1 : ℤ)]
end circleIntegral |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.