Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 0f74a7a

Browse files
committed
feat(measure_theory/measure/probability_measure): Add a bit of simple API to probability_measure. (#17610)
Add a bit of simple API to `probability_measure` and `finite_measure`.
1 parent 44e2d1e commit 0f74a7a

File tree

2 files changed

+80
-7
lines changed

2 files changed

+80
-7
lines changed

src/measure_theory/measure/finite_measure.lean

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ lemma coe_fn_eq_to_nnreal_coe_fn_to_measure (ν : finite_measure Ω) :
119119
lemma coe_injective : function.injective (coe : finite_measure Ω → measure Ω) :=
120120
subtype.coe_injective
121121

122+
lemma apply_mono (μ : finite_measure Ω) {s₁ s₂ : set Ω} (h : s₁ ⊆ s₂) :
123+
μ s₁ ≤ μ s₂ :=
124+
begin
125+
change ((μ : measure Ω) s₁).to_nnreal ≤ ((μ : measure Ω) s₂).to_nnreal,
126+
have key : (μ : measure Ω) s₁ ≤ (μ : measure Ω) s₂ := (μ : measure Ω).mono h,
127+
apply (ennreal.to_nnreal_le_to_nnreal (measure_ne_top _ s₁) (measure_ne_top _ s₂)).mpr key,
128+
end
129+
122130
/-- The (total) mass of a finite measure `μ` is `μ univ`, i.e., the cast to `nnreal` of
123131
`(μ : measure Ω) univ`. -/
124132
def mass (μ : finite_measure Ω) : ℝ≥0 := μ univ
@@ -145,11 +153,16 @@ begin
145153
exact finite_measure.mass_zero_iff μ,
146154
end
147155

148-
@[ext] lemma extensionality (μ ν : finite_measure Ω)
156+
@[ext] lemma eq_of_forall_measure_apply_eq (μ ν : finite_measure Ω)
157+
(h : ∀ (s : set Ω), measurable_set s → (μ : measure Ω) s = (ν : measure Ω) s) :
158+
μ = ν :=
159+
by { ext1, ext1 s s_mble, exact h s s_mble, }
160+
161+
lemma eq_of_forall_apply_eq (μ ν : finite_measure Ω)
149162
(h : ∀ (s : set Ω), measurable_set s → μ s = ν s) :
150163
μ = ν :=
151164
begin
152-
ext1, ext1 s s_mble,
165+
ext1 s s_mble,
153166
simpa [ennreal_coe_fn_eq_coe_fn_to_measure] using congr_arg (coe : ℝ≥0 → ℝ≥0∞) (h s s_mble),
154167
end
155168

@@ -198,6 +211,39 @@ function.injective.module _ coe_add_monoid_hom coe_injective coe_smul
198211
(c • μ) s = c • (μ s) :=
199212
by { simp only [coe_fn_smul, pi.smul_apply], }
200213

214+
/-- Restrict a finite measure μ to a set A. -/
215+
def restrict (μ : finite_measure Ω) (A : set Ω) : finite_measure Ω :=
216+
{ val := (μ : measure Ω).restrict A,
217+
property := measure_theory.is_finite_measure_restrict μ A, }
218+
219+
lemma restrict_measure_eq (μ : finite_measure Ω) (A : set Ω) :
220+
(μ.restrict A : measure Ω) = (μ : measure Ω).restrict A := rfl
221+
222+
lemma restrict_apply_measure (μ : finite_measure Ω) (A : set Ω)
223+
{s : set Ω} (s_mble : measurable_set s) :
224+
(μ.restrict A : measure Ω) s = (μ : measure Ω) (s ∩ A) :=
225+
measure.restrict_apply s_mble
226+
227+
lemma restrict_apply (μ : finite_measure Ω) (A : set Ω)
228+
{s : set Ω} (s_mble : measurable_set s) :
229+
(μ.restrict A) s = μ (s ∩ A) :=
230+
begin
231+
apply congr_arg ennreal.to_nnreal,
232+
exact measure.restrict_apply s_mble,
233+
end
234+
235+
lemma restrict_mass (μ : finite_measure Ω) (A : set Ω) :
236+
(μ.restrict A).mass = μ A :=
237+
by simp only [mass, restrict_apply μ A measurable_set.univ, univ_inter]
238+
239+
lemma restrict_eq_zero_iff (μ : finite_measure Ω) (A : set Ω) :
240+
μ.restrict A = 0 ↔ μ A = 0 :=
241+
by rw [← mass_zero_iff, restrict_mass]
242+
243+
lemma restrict_nonzero_iff (μ : finite_measure Ω) (A : set Ω) :
244+
μ.restrict A ≠ 0 ↔ μ A ≠ 0 :=
245+
by rw [← mass_nonzero_iff, restrict_mass]
246+
201247
variables [topological_space Ω]
202248

203249
/-- The pairing of a finite (Borel) measure `μ` with a nonnegative bounded continuous

src/measure_theory/measure/probability_measure.lean

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Authors: Kalle Kytölä
55
-/
66
import measure_theory.measure.finite_measure
77
import measure_theory.integral.average
8+
import probability.conditional_probability
89

910
/-!
1011
# Probability measures
@@ -116,6 +117,9 @@ subtype.coe_injective
116117
@[simp] lemma coe_fn_univ (ν : probability_measure Ω) : ν univ = 1 :=
117118
congr_arg ennreal.to_nnreal ν.prop.measure_univ
118119

120+
lemma coe_fn_univ_ne_zero (ν : probability_measure Ω) : ν univ ≠ 0 :=
121+
by simp only [coe_fn_univ, ne.def, one_ne_zero, not_false_iff]
122+
119123
/-- A probability measure can be interpreted as a finite measure. -/
120124
def to_finite_measure (μ : probability_measure Ω) : finite_measure Ω := ⟨μ, infer_instance⟩
121125

@@ -130,11 +134,32 @@ def to_finite_measure (μ : probability_measure Ω) : finite_measure Ω := ⟨μ
130134
by rw [← coe_fn_comp_to_finite_measure_eq_coe_fn,
131135
finite_measure.ennreal_coe_fn_eq_coe_fn_to_measure, coe_comp_to_finite_measure_eq_coe]
132136

133-
@[ext] lemma extensionality (μ ν : probability_measure Ω)
137+
lemma apply_mono (μ : probability_measure Ω) {s₁ s₂ : set Ω} (h : s₁ ⊆ s₂) :
138+
μ s₁ ≤ μ s₂ :=
139+
begin
140+
rw ← coe_fn_comp_to_finite_measure_eq_coe_fn,
141+
exact measure_theory.finite_measure.apply_mono _ h,
142+
end
143+
144+
lemma nonempty_of_probability_measure (μ : probability_measure Ω) : nonempty Ω :=
145+
begin
146+
by_contra maybe_empty,
147+
have zero : (μ : measure Ω) univ = 0,
148+
by rw [univ_eq_empty_iff.mpr (not_nonempty_iff.mp maybe_empty), measure_empty],
149+
rw measure_univ at zero,
150+
exact zero_ne_one zero.symm,
151+
end
152+
153+
@[ext] lemma eq_of_forall_measure_apply_eq (μ ν : probability_measure Ω)
154+
(h : ∀ (s : set Ω), measurable_set s → (μ : measure Ω) s = (ν : measure Ω) s) :
155+
μ = ν :=
156+
by { ext1, ext1 s s_mble, exact h s s_mble, }
157+
158+
lemma eq_of_forall_apply_eq (μ ν : probability_measure Ω)
134159
(h : ∀ (s : set Ω), measurable_set s → μ s = ν s) :
135160
μ = ν :=
136161
begin
137-
ext1, ext1 s s_mble,
162+
ext1 s s_mble,
138163
simpa [ennreal_coe_fn_eq_coe_fn_to_measure] using congr_arg (coe : ℝ≥0 → ℝ≥0∞) (h s s_mble),
139164
end
140165

@@ -268,7 +293,8 @@ end
268293

269294
lemma self_eq_mass_smul_normalize : μ = μ.mass • μ.normalize.to_finite_measure :=
270295
begin
271-
ext s s_mble,
296+
apply eq_of_forall_apply_eq,
297+
intros s s_mble,
272298
rw [μ.self_eq_mass_mul_normalize s, coe_fn_smul_apply, smul_eq_mul,
273299
probability_measure.coe_fn_comp_to_finite_measure_eq_coe_fn],
274300
end
@@ -299,10 +325,11 @@ end
299325
{m0 : measurable_space Ω} (μ : probability_measure Ω) :
300326
μ.to_finite_measure.normalize = μ :=
301327
begin
302-
ext s s_mble,
328+
apply probability_measure.eq_of_forall_apply_eq,
329+
intros s s_mble,
303330
rw μ.to_finite_measure.normalize_eq_of_nonzero μ.to_finite_measure_nonzero s,
304331
simp only [probability_measure.mass_to_finite_measure, inv_one, one_mul,
305-
probability_measure.coe_fn_comp_to_finite_measure_eq_coe_fn],
332+
probability_measure.coe_fn_comp_to_finite_measure_eq_coe_fn],
306333
end
307334

308335
/-- Averaging with respect to a finite measure is the same as integraing against

0 commit comments

Comments
 (0)