probability.density
⟷
Mathlib.Probability.Density
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
Define the Lebesgue integral version of the average of a measurable function and prove the corresponding first moment method.
@@ -341,7 +341,7 @@ begin
simp [hnt] },
rw [heq, set.inter_univ] at this,
exact hns this },
- exact set.indicator_ae_eq_zero hu.symm,
+ exact set.indicator_ae_eq_zero.1 hu.symm,
end
lemma pdf_to_real_ae_eq {m : measurable_space Ω}
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(first ported)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -100,7 +100,7 @@ theorem pdf_undef {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {
theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
(h : pdf X ℙ μ ≠ 0) : HasPDF X ℙ μ := by
by_contra hpdf
- rw [pdf, dif_neg hpdf] at h
+ rw [pdf, dif_neg hpdf] at h
exact hpdf (False.ndrec (has_pdf X ℙ μ) (h rfl))
#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPDF_of_pdf_ne_zero
-/
@@ -241,7 +241,7 @@ theorem integral_pdf_smul [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ]
rw [lintegral_congr_ae this]
exact hpdf.2
· rw [integral_undef hpdf, integral_undef]
- rwa [← integrable_iff_integrable_mul_pdf hf] at hpdf
+ rwa [← integrable_iff_integrable_mul_pdf hf] at hpdf
all_goals infer_instance
#align measure_theory.pdf.integral_fun_mul_eq_integral MeasureTheory.pdf.integral_pdf_smul
-/
@@ -311,7 +311,7 @@ theorem quasiMeasurePreserving_hasPDF {X : Ω → E} [HasPDF X ℙ μ] {g : E
refine' absolutely_continuous.mk fun s hsm hs => _
rw [map_apply hg.measurable hsm, with_density_apply _ (hg.measurable hsm)]
have := hg.absolutely_continuous hs
- rw [map_apply hg.measurable hsm] at this
+ rw [map_apply hg.measurable hsm] at this
exact set_lintegral_measure_zero _ _ this
#align measure_theory.pdf.quasi_measure_preserving_has_pdf MeasureTheory.pdf.quasiMeasurePreserving_hasPDF
-/
@@ -403,7 +403,7 @@ theorem hasPDF {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ :
hasPDF_of_pdf_ne_zero
(by
intro hpdf
- rw [is_uniform, hpdf] at hu
+ rw [is_uniform, hpdf] at hu
suffices μ (s ∩ Function.support ((μ s)⁻¹ • 1)) = 0
by
have heq : Function.support ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) = Set.univ :=
@@ -411,7 +411,7 @@ theorem hasPDF {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ :
ext x
rw [Function.mem_support]
simp [hnt]
- rw [HEq, Set.inter_univ] at this
+ rw [HEq, Set.inter_univ] at this
exact hns this
exact Set.indicator_ae_eq_zero.1 hu.symm)
#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -74,13 +74,13 @@ class HasPDF {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
#align measure_theory.has_pdf MeasureTheory.HasPDF
-/
-#print MeasureTheory.HasPDF.measurable /-
+#print MeasureTheory.HasPDF.aemeasurable /-
@[measurability]
-theorem HasPDF.measurable {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
+theorem HasPDF.aemeasurable {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPDF X ℙ μ] :
Measurable X :=
hX.pdf'.1
-#align measure_theory.has_pdf.measurable MeasureTheory.HasPDF.measurable
+#align measure_theory.has_pdf.measurable MeasureTheory.HasPDF.aemeasurable
-/
#print MeasureTheory.pdf /-
@@ -92,11 +92,9 @@ def pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
#align measure_theory.pdf MeasureTheory.pdf
-/
-#print MeasureTheory.pdf_undef /-
theorem pdf_undef {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
(h : ¬HasPDF X ℙ μ) : pdf X ℙ μ = 0 := by simp only [pdf, dif_neg h]
#align measure_theory.pdf_undef MeasureTheory.pdf_undef
--/
#print MeasureTheory.hasPDF_of_pdf_ne_zero /-
theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
@@ -107,18 +105,18 @@ theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ :
#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPDF_of_pdf_ne_zero
-/
-#print MeasureTheory.pdf_eq_zero_of_not_measurable /-
-theorem pdf_eq_zero_of_not_measurable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
- {X : Ω → E} (hX : ¬Measurable X) : pdf X ℙ μ = 0 :=
+#print MeasureTheory.pdf_of_not_aemeasurable /-
+theorem pdf_of_not_aemeasurable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
+ (hX : ¬Measurable X) : pdf X ℙ μ = 0 :=
pdf_undef fun hpdf => hX hpdf.pdf'.1
-#align measure_theory.pdf_eq_zero_of_not_measurable MeasureTheory.pdf_eq_zero_of_not_measurable
+#align measure_theory.pdf_eq_zero_of_not_measurable MeasureTheory.pdf_of_not_aemeasurable
-/
-#print MeasureTheory.measurable_of_pdf_ne_zero /-
-theorem measurable_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
+#print MeasureTheory.aemeasurable_of_pdf_ne_zero /-
+theorem aemeasurable_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
(X : Ω → E) (h : pdf X ℙ μ ≠ 0) : Measurable X := by by_contra hX;
exact h (pdf_eq_zero_of_not_measurable hX)
-#align measure_theory.measurable_of_pdf_ne_zero MeasureTheory.measurable_of_pdf_ne_zero
+#align measure_theory.measurable_of_pdf_ne_zero MeasureTheory.aemeasurable_of_pdf_ne_zero
-/
#print MeasureTheory.measurable_pdf /-
@@ -184,22 +182,22 @@ theorem ofReal_toReal_ae_eq [IsFiniteMeasure ℙ] {X : Ω → E} :
#align measure_theory.pdf.of_real_to_real_ae_eq MeasureTheory.pdf.ofReal_toReal_ae_eq
-/
-#print MeasureTheory.pdf.integrable_iff_integrable_mul_pdf /-
-theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → ℝ}
+#print MeasureTheory.pdf.integrable_pdf_smul_iff /-
+theorem integrable_pdf_smul_iff [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → ℝ}
(hf : Measurable f) :
Integrable (fun x => f (X x)) ℙ ↔ Integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ :=
by
rw [← integrable_map_measure hf.ae_strongly_measurable (has_pdf.measurable X ℙ μ).AEMeasurable,
map_eq_with_density_pdf X ℙ μ, integrable_with_density_iff (measurable_pdf _ _ _) ae_lt_top]
infer_instance
-#align measure_theory.pdf.integrable_iff_integrable_mul_pdf MeasureTheory.pdf.integrable_iff_integrable_mul_pdf
+#align measure_theory.pdf.integrable_iff_integrable_mul_pdf MeasureTheory.pdf.integrable_pdf_smul_iff
-/
-#print MeasureTheory.pdf.integral_fun_mul_eq_integral /-
+#print MeasureTheory.pdf.integral_pdf_smul /-
/-- **The Law of the Unconscious Statistician**: Given a random variable `X` and a measurable
function `f`, `f ∘ X` is a random variable with expectation `∫ x, f x * pdf X ∂μ`
where `μ` is a measure on the codomain of `X`. -/
-theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → ℝ}
+theorem integral_pdf_smul [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → ℝ}
(hf : Measurable f) : ∫ x, f x * (pdf X ℙ μ x).toReal ∂μ = ∫ x, f (X x) ∂ℙ :=
by
by_cases hpdf : integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ
@@ -245,34 +243,35 @@ theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPD
· rw [integral_undef hpdf, integral_undef]
rwa [← integrable_iff_integrable_mul_pdf hf] at hpdf
all_goals infer_instance
-#align measure_theory.pdf.integral_fun_mul_eq_integral MeasureTheory.pdf.integral_fun_mul_eq_integral
+#align measure_theory.pdf.integral_fun_mul_eq_integral MeasureTheory.pdf.integral_pdf_smul
-/
-#print MeasureTheory.pdf.map_absolutelyContinuous /-
-theorem map_absolutelyContinuous {X : Ω → E} [HasPDF X ℙ μ] : map X ℙ ≪ μ := by
+#print MeasureTheory.HasPDF.absolutelyContinuous /-
+theorem absolutelyContinuous {X : Ω → E} [HasPDF X ℙ μ] : map X ℙ ≪ μ := by
rw [map_eq_with_density_pdf X ℙ μ]; exact with_density_absolutely_continuous _ _
-#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.pdf.map_absolutelyContinuous
+#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.HasPDF.absolutelyContinuous
-/
-#print MeasureTheory.pdf.to_quasiMeasurePreserving /-
+#print MeasureTheory.HasPDF.quasiMeasurePreserving_of_measurable /-
/-- A random variable that `has_pdf` is quasi-measure preserving. -/
-theorem to_quasiMeasurePreserving {X : Ω → E} [HasPDF X ℙ μ] : QuasiMeasurePreserving X ℙ μ :=
- { Measurable := HasPDF.measurable X ℙ μ
- AbsolutelyContinuous := map_absolutelyContinuous }
-#align measure_theory.pdf.to_quasi_measure_preserving MeasureTheory.pdf.to_quasiMeasurePreserving
+theorem quasiMeasurePreserving_of_measurable {X : Ω → E} [HasPDF X ℙ μ] :
+ QuasiMeasurePreserving X ℙ μ :=
+ { Measurable := HasPDF.aemeasurable X ℙ μ
+ AbsolutelyContinuous := absolutelyContinuous }
+#align measure_theory.pdf.to_quasi_measure_preserving MeasureTheory.HasPDF.quasiMeasurePreserving_of_measurable
-/
-#print MeasureTheory.pdf.haveLebesgueDecomposition_of_hasPDF /-
-theorem haveLebesgueDecomposition_of_hasPDF {X : Ω → E} [hX' : HasPDF X ℙ μ] :
+#print MeasureTheory.HasPDF.haveLebesgueDecomposition /-
+theorem haveLebesgueDecomposition {X : Ω → E} [hX' : HasPDF X ℙ μ] :
(map X ℙ).HaveLebesgueDecomposition μ :=
⟨⟨⟨0, pdf X ℙ μ⟩, by
simp only [zero_add, measurable_pdf X ℙ μ, true_and_iff, mutually_singular.zero_left,
map_eq_with_density_pdf X ℙ μ]⟩⟩
-#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.pdf.haveLebesgueDecomposition_of_hasPDF
+#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.HasPDF.haveLebesgueDecomposition
-/
-#print MeasureTheory.pdf.hasPDF_iff /-
-theorem hasPDF_iff {X : Ω → E} :
+#print MeasureTheory.hasPDF_iff /-
+theorem MeasureTheory.hasPDF_iff {X : Ω → E} :
HasPDF X ℙ μ ↔ Measurable X ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ :=
by
constructor
@@ -282,14 +281,14 @@ theorem hasPDF_iff {X : Ω → E} :
haveI := h_decomp
refine' ⟨⟨hX, (measure.map X ℙ).rnDeriv μ, measurable_rn_deriv _ _, _⟩⟩
rwa [with_density_rn_deriv_eq]
-#align measure_theory.pdf.has_pdf_iff MeasureTheory.pdf.hasPDF_iff
+#align measure_theory.pdf.has_pdf_iff MeasureTheory.hasPDF_iff
-/
-#print MeasureTheory.pdf.hasPDF_iff_of_measurable /-
-theorem hasPDF_iff_of_measurable {X : Ω → E} (hX : Measurable X) :
+#print MeasureTheory.hasPDF_iff_of_aemeasurable /-
+theorem MeasureTheory.hasPDF_iff_of_aemeasurable {X : Ω → E} (hX : Measurable X) :
HasPDF X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ := by rw [has_pdf_iff];
simp only [hX, true_and_iff]
-#align measure_theory.pdf.has_pdf_iff_of_measurable MeasureTheory.pdf.hasPDF_iff_of_measurable
+#align measure_theory.pdf.has_pdf_iff_of_measurable MeasureTheory.hasPDF_iff_of_aemeasurable
-/
section
@@ -330,14 +329,14 @@ section Real
variable [IsFiniteMeasure ℙ] {X : Ω → ℝ}
-#print Real.hasPDF_iff_of_measurable /-
+#print Real.hasPDF_iff_of_aemeasurable /-
/-- A real-valued random variable `X` `has_pdf X ℙ λ` (where `λ` is the Lebesgue measure) if and
only if the push-forward measure of `ℙ` along `X` is absolutely continuous with respect to `λ`. -/
-theorem Real.hasPDF_iff_of_measurable (hX : Measurable X) : HasPDF X ℙ ↔ map X ℙ ≪ volume :=
+theorem Real.hasPDF_iff_of_aemeasurable (hX : Measurable X) : HasPDF X ℙ ↔ map X ℙ ≪ volume :=
by
rw [has_pdf_iff_of_measurable hX, and_iff_right_iff_imp]
exact fun h => inferInstance
-#align measure_theory.pdf.real.has_pdf_iff_of_measurable Real.hasPDF_iff_of_measurable
+#align measure_theory.pdf.real.has_pdf_iff_of_measurable Real.hasPDF_iff_of_aemeasurable
-/
#print Real.hasPDF_iff /-
@@ -355,7 +354,7 @@ theorem Real.hasPDF_iff : HasPDF X ℙ ↔ Measurable X ∧ map X ℙ ≪ volume
/-- If `X` is a real-valued random variable that has pdf `f`, then the expectation of `X` equals
`∫ x, x * f x ∂λ` where `λ` is the Lebesgue measure. -/
theorem integral_mul_eq_integral [HasPDF X ℙ] : ∫ x, x * (pdf X ℙ volume x).toReal = ∫ x, X x ∂ℙ :=
- integral_fun_mul_eq_integral measurable_id
+ integral_pdf_smul measurable_id
#align measure_theory.pdf.integral_mul_eq_integral MeasureTheory.pdf.integral_mul_eq_integral
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2021 Kexing Ying. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying
-/
-import Mathbin.MeasureTheory.Decomposition.RadonNikodym
-import Mathbin.MeasureTheory.Measure.Haar.OfBasis
+import MeasureTheory.Decomposition.RadonNikodym
+import MeasureTheory.Measure.Haar.OfBasis
#align_import probability.density from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2021 Kexing Ying. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying
-
-! This file was ported from Lean 3 source module probability.density
-! leanprover-community/mathlib commit c14c8fcde993801fca8946b0d80131a1a81d1520
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.MeasureTheory.Decomposition.RadonNikodym
import Mathbin.MeasureTheory.Measure.Haar.OfBasis
+#align_import probability.density from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
+
/-!
# Probability density function
mathlib commit https://github.com/leanprover-community/mathlib/commit/bf2428c9486c407ca38b5b3fb10b87dad0bc99fa
@@ -417,7 +417,7 @@ theorem hasPDF {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ :
simp [hnt]
rw [HEq, Set.inter_univ] at this
exact hns this
- exact MeasureTheory.Set.indicator_ae_eq_zero.1 hu.symm)
+ exact Set.indicator_ae_eq_zero.1 hu.symm)
#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/6285167a053ad0990fc88e56c48ccd9fae6550eb
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying
! This file was ported from Lean 3 source module probability.density
-! leanprover-community/mathlib commit 44e2ae8cffc713925494e4975ee31ec1d06929b3
+! leanprover-community/mathlib commit c14c8fcde993801fca8946b0d80131a1a81d1520
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -417,7 +417,7 @@ theorem hasPDF {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ :
simp [hnt]
rw [HEq, Set.inter_univ] at this
exact hns this
- exact MeasureTheory.Set.indicator_ae_eq_zero hu.symm)
+ exact MeasureTheory.Set.indicator_ae_eq_zero.1 hu.symm)
#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/8efcf8022aac8e01df8d302dcebdbc25d6a886c8
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying
! This file was ported from Lean 3 source module probability.density
-! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
+! leanprover-community/mathlib commit 44e2ae8cffc713925494e4975ee31ec1d06929b3
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -14,6 +14,9 @@ import Mathbin.MeasureTheory.Measure.Haar.OfBasis
/-!
# Probability density function
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
This file defines the probability density function of random variables, by which we mean
measurable functions taking values in a Borel space. In particular, a measurable function `f`
is said to the probability density function of a random variable `X` if for all measurable
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -74,12 +74,14 @@ class HasPDF {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
#align measure_theory.has_pdf MeasureTheory.HasPDF
-/
+#print MeasureTheory.HasPDF.measurable /-
@[measurability]
theorem HasPDF.measurable {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPDF X ℙ μ] :
Measurable X :=
hX.pdf'.1
#align measure_theory.has_pdf.measurable MeasureTheory.HasPDF.measurable
+-/
#print MeasureTheory.pdf /-
/-- If `X` is a random variable that `has_pdf X ℙ μ`, then `pdf X` is the measurable function `f`
@@ -90,27 +92,36 @@ def pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
#align measure_theory.pdf MeasureTheory.pdf
-/
+#print MeasureTheory.pdf_undef /-
theorem pdf_undef {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
(h : ¬HasPDF X ℙ μ) : pdf X ℙ μ = 0 := by simp only [pdf, dif_neg h]
#align measure_theory.pdf_undef MeasureTheory.pdf_undef
+-/
+#print MeasureTheory.hasPDF_of_pdf_ne_zero /-
theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
(h : pdf X ℙ μ ≠ 0) : HasPDF X ℙ μ := by
by_contra hpdf
rw [pdf, dif_neg hpdf] at h
exact hpdf (False.ndrec (has_pdf X ℙ μ) (h rfl))
#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPDF_of_pdf_ne_zero
+-/
+#print MeasureTheory.pdf_eq_zero_of_not_measurable /-
theorem pdf_eq_zero_of_not_measurable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
{X : Ω → E} (hX : ¬Measurable X) : pdf X ℙ μ = 0 :=
pdf_undef fun hpdf => hX hpdf.pdf'.1
#align measure_theory.pdf_eq_zero_of_not_measurable MeasureTheory.pdf_eq_zero_of_not_measurable
+-/
+#print MeasureTheory.measurable_of_pdf_ne_zero /-
theorem measurable_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
(X : Ω → E) (h : pdf X ℙ μ ≠ 0) : Measurable X := by by_contra hX;
exact h (pdf_eq_zero_of_not_measurable hX)
#align measure_theory.measurable_of_pdf_ne_zero MeasureTheory.measurable_of_pdf_ne_zero
+-/
+#print MeasureTheory.measurable_pdf /-
@[measurability]
theorem measurable_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) : Measurable (pdf X ℙ μ) :=
@@ -121,7 +132,9 @@ theorem measurable_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω
· rw [pdf, dif_neg hX]
exact measurable_zero
#align measure_theory.measurable_pdf MeasureTheory.measurable_pdf
+-/
+#print MeasureTheory.map_eq_withDensity_pdf /-
theorem map_eq_withDensity_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPDF X ℙ μ] :
Measure.map X ℙ = μ.withDensity (pdf X ℙ μ) :=
@@ -129,23 +142,29 @@ theorem map_eq_withDensity_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Me
rw [pdf, dif_pos hX]
exact (Classical.choose_spec hX.pdf'.2).2
#align measure_theory.map_eq_with_density_pdf MeasureTheory.map_eq_withDensity_pdf
+-/
+#print MeasureTheory.map_eq_set_lintegral_pdf /-
theorem map_eq_set_lintegral_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPDF X ℙ μ] {s : Set E}
(hs : MeasurableSet s) : Measure.map X ℙ s = ∫⁻ x in s, pdf X ℙ μ x ∂μ := by
rw [← with_density_apply _ hs, map_eq_with_density_pdf X ℙ μ]
#align measure_theory.map_eq_set_lintegral_pdf MeasureTheory.map_eq_set_lintegral_pdf
+-/
namespace Pdf
variable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
+#print MeasureTheory.pdf.lintegral_eq_measure_univ /-
theorem lintegral_eq_measure_univ {X : Ω → E} [HasPDF X ℙ μ] : ∫⁻ x, pdf X ℙ μ x ∂μ = ℙ Set.univ :=
by
rw [← set_lintegral_univ, ← map_eq_set_lintegral_pdf X ℙ μ MeasurableSet.univ,
measure.map_apply (has_pdf.measurable X ℙ μ) MeasurableSet.univ, Set.preimage_univ]
#align measure_theory.pdf.lintegral_eq_measure_univ MeasureTheory.pdf.lintegral_eq_measure_univ
+-/
+#print MeasureTheory.pdf.ae_lt_top /-
theorem ae_lt_top [IsFiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} : ∀ᵐ x ∂μ, pdf X ℙ μ x < ∞ :=
by
by_cases hpdf : has_pdf X ℙ μ
@@ -156,12 +175,16 @@ theorem ae_lt_top [IsFiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} : ∀ᵐ
· rw [pdf, dif_neg hpdf]
exact Filter.eventually_of_forall fun x => WithTop.zero_lt_top
#align measure_theory.pdf.ae_lt_top MeasureTheory.pdf.ae_lt_top
+-/
+#print MeasureTheory.pdf.ofReal_toReal_ae_eq /-
theorem ofReal_toReal_ae_eq [IsFiniteMeasure ℙ] {X : Ω → E} :
(fun x => ENNReal.ofReal (pdf X ℙ μ x).toReal) =ᵐ[μ] pdf X ℙ μ :=
ofReal_toReal_ae_eq ae_lt_top
#align measure_theory.pdf.of_real_to_real_ae_eq MeasureTheory.pdf.ofReal_toReal_ae_eq
+-/
+#print MeasureTheory.pdf.integrable_iff_integrable_mul_pdf /-
theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → ℝ}
(hf : Measurable f) :
Integrable (fun x => f (X x)) ℙ ↔ Integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ :=
@@ -170,7 +193,9 @@ theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [
map_eq_with_density_pdf X ℙ μ, integrable_with_density_iff (measurable_pdf _ _ _) ae_lt_top]
infer_instance
#align measure_theory.pdf.integrable_iff_integrable_mul_pdf MeasureTheory.pdf.integrable_iff_integrable_mul_pdf
+-/
+#print MeasureTheory.pdf.integral_fun_mul_eq_integral /-
/-- **The Law of the Unconscious Statistician**: Given a random variable `X` and a measurable
function `f`, `f ∘ X` is a random variable with expectation `∫ x, f x * pdf X ∂μ`
where `μ` is a measure on the codomain of `X`. -/
@@ -221,24 +246,32 @@ theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPD
rwa [← integrable_iff_integrable_mul_pdf hf] at hpdf
all_goals infer_instance
#align measure_theory.pdf.integral_fun_mul_eq_integral MeasureTheory.pdf.integral_fun_mul_eq_integral
+-/
+#print MeasureTheory.pdf.map_absolutelyContinuous /-
theorem map_absolutelyContinuous {X : Ω → E} [HasPDF X ℙ μ] : map X ℙ ≪ μ := by
rw [map_eq_with_density_pdf X ℙ μ]; exact with_density_absolutely_continuous _ _
#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.pdf.map_absolutelyContinuous
+-/
+#print MeasureTheory.pdf.to_quasiMeasurePreserving /-
/-- A random variable that `has_pdf` is quasi-measure preserving. -/
theorem to_quasiMeasurePreserving {X : Ω → E} [HasPDF X ℙ μ] : QuasiMeasurePreserving X ℙ μ :=
{ Measurable := HasPDF.measurable X ℙ μ
AbsolutelyContinuous := map_absolutelyContinuous }
#align measure_theory.pdf.to_quasi_measure_preserving MeasureTheory.pdf.to_quasiMeasurePreserving
+-/
+#print MeasureTheory.pdf.haveLebesgueDecomposition_of_hasPDF /-
theorem haveLebesgueDecomposition_of_hasPDF {X : Ω → E} [hX' : HasPDF X ℙ μ] :
(map X ℙ).HaveLebesgueDecomposition μ :=
⟨⟨⟨0, pdf X ℙ μ⟩, by
simp only [zero_add, measurable_pdf X ℙ μ, true_and_iff, mutually_singular.zero_left,
map_eq_with_density_pdf X ℙ μ]⟩⟩
#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.pdf.haveLebesgueDecomposition_of_hasPDF
+-/
+#print MeasureTheory.pdf.hasPDF_iff /-
theorem hasPDF_iff {X : Ω → E} :
HasPDF X ℙ μ ↔ Measurable X ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ :=
by
@@ -250,16 +283,20 @@ theorem hasPDF_iff {X : Ω → E} :
refine' ⟨⟨hX, (measure.map X ℙ).rnDeriv μ, measurable_rn_deriv _ _, _⟩⟩
rwa [with_density_rn_deriv_eq]
#align measure_theory.pdf.has_pdf_iff MeasureTheory.pdf.hasPDF_iff
+-/
+#print MeasureTheory.pdf.hasPDF_iff_of_measurable /-
theorem hasPDF_iff_of_measurable {X : Ω → E} (hX : Measurable X) :
HasPDF X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ := by rw [has_pdf_iff];
simp only [hX, true_and_iff]
#align measure_theory.pdf.has_pdf_iff_of_measurable MeasureTheory.pdf.hasPDF_iff_of_measurable
+-/
section
variable {F : Type _} [MeasurableSpace F] {ν : Measure F}
+#print MeasureTheory.pdf.quasiMeasurePreserving_hasPDF /-
/-- A random variable that `has_pdf` transformed under a `quasi_measure_preserving`
map also `has_pdf` if `(map g (map X ℙ)).have_lebesgue_decomposition μ`.
@@ -278,11 +315,14 @@ theorem quasiMeasurePreserving_hasPDF {X : Ω → E} [HasPDF X ℙ μ] {g : E
rw [map_apply hg.measurable hsm] at this
exact set_lintegral_measure_zero _ _ this
#align measure_theory.pdf.quasi_measure_preserving_has_pdf MeasureTheory.pdf.quasiMeasurePreserving_hasPDF
+-/
+#print MeasureTheory.pdf.quasiMeasurePreserving_hasPDF' /-
theorem quasiMeasurePreserving_hasPDF' [IsFiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E}
[HasPDF X ℙ μ] {g : E → F} (hg : QuasiMeasurePreserving g μ ν) : HasPDF (g ∘ X) ℙ ν :=
quasiMeasurePreserving_hasPDF hg inferInstance
#align measure_theory.pdf.quasi_measure_preserving_has_pdf' MeasureTheory.pdf.quasiMeasurePreserving_hasPDF'
+-/
end
@@ -311,12 +351,15 @@ theorem Real.hasPDF_iff : HasPDF X ℙ ↔ Measurable X ∧ map X ℙ ≪ volume
#align measure_theory.pdf.real.has_pdf_iff Real.hasPDF_iff
-/
+#print MeasureTheory.pdf.integral_mul_eq_integral /-
/-- If `X` is a real-valued random variable that has pdf `f`, then the expectation of `X` equals
`∫ x, x * f x ∂λ` where `λ` is the Lebesgue measure. -/
theorem integral_mul_eq_integral [HasPDF X ℙ] : ∫ x, x * (pdf X ℙ volume x).toReal = ∫ x, X x ∂ℙ :=
integral_fun_mul_eq_integral measurable_id
#align measure_theory.pdf.integral_mul_eq_integral MeasureTheory.pdf.integral_mul_eq_integral
+-/
+#print MeasureTheory.pdf.hasFiniteIntegral_mul /-
theorem hasFiniteIntegral_mul {f : ℝ → ℝ} {g : ℝ → ℝ≥0∞} (hg : pdf X ℙ =ᵐ[volume] g)
(hgi : ∫⁻ x, ‖f x‖₊ * g x ≠ ∞) : HasFiniteIntegral fun x => f x * (pdf X ℙ volume x).toReal :=
by
@@ -335,6 +378,7 @@ theorem hasFiniteIntegral_mul {f : ℝ → ℝ} {g : ℝ → ℝ≥0∞} (hg : p
exact Real.ennnorm_eq_ofReal ENNReal.toReal_nonneg
rwa [lt_top_iff_ne_top, ← lintegral_congr_ae this]
#align measure_theory.pdf.has_finite_integral_mul MeasureTheory.pdf.hasFiniteIntegral_mul
+-/
end Real
@@ -354,6 +398,7 @@ def IsUniform {m : MeasurableSpace Ω} (X : Ω → E) (support : Set E) (ℙ : M
namespace IsUniform
+#print MeasureTheory.pdf.IsUniform.hasPDF /-
theorem hasPDF {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E} {s : Set E}
(hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : HasPDF X ℙ μ :=
hasPDF_of_pdf_ne_zero
@@ -371,14 +416,18 @@ theorem hasPDF {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ :
exact hns this
exact MeasureTheory.Set.indicator_ae_eq_zero hu.symm)
#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF
+-/
+#print MeasureTheory.pdf.IsUniform.pdf_toReal_ae_eq /-
theorem pdf_toReal_ae_eq {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
{s : Set E} (hX : IsUniform X s ℙ μ) :
(fun x => (pdf X ℙ μ x).toReal) =ᵐ[μ] fun x =>
(s.indicator ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) x).toReal :=
Filter.EventuallyEq.fun_comp hX ENNReal.toReal
#align measure_theory.pdf.is_uniform.pdf_to_real_ae_eq MeasureTheory.pdf.IsUniform.pdf_toReal_ae_eq
+-/
+#print MeasureTheory.pdf.IsUniform.measure_preimage /-
theorem measure_preimage {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
{s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hms : MeasurableSet s) (hu : IsUniform X s ℙ μ)
{A : Set E} (hA : MeasurableSet A) : ℙ (X ⁻¹' A) = μ (s ∩ A) / μ s :=
@@ -390,7 +439,9 @@ theorem measure_preimage {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure
mul_one, lintegral_const, restrict_apply', Set.univ_inter]
rw [ENNReal.div_eq_inv_mul]
#align measure_theory.pdf.is_uniform.measure_preimage MeasureTheory.pdf.IsUniform.measure_preimage
+-/
+#print MeasureTheory.pdf.IsUniform.isProbabilityMeasure /-
theorem isProbabilityMeasure {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
{s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hms : MeasurableSet s) (hu : IsUniform X s ℙ μ) :
IsProbabilityMeasure ℙ :=
@@ -399,11 +450,11 @@ theorem isProbabilityMeasure {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Meas
rw [← this, hu.measure_preimage hns hnt hms MeasurableSet.univ, Set.inter_univ,
ENNReal.div_self hns hnt]⟩
#align measure_theory.pdf.is_uniform.is_probability_measure MeasureTheory.pdf.IsUniform.isProbabilityMeasure
+-/
variable {X : Ω → ℝ} {s : Set ℝ} (hms : MeasurableSet s) (hns : volume s ≠ 0)
-include hms hns
-
+#print MeasureTheory.pdf.IsUniform.mul_pdf_integrable /-
theorem mul_pdf_integrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
Integrable fun x : ℝ => x * (pdf X ℙ volume x).toReal :=
by
@@ -432,7 +483,9 @@ theorem mul_pdf_integrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUn
(ENNReal.inv_lt_top.2 (pos_iff_ne_zero.mpr hns)).Ne).Ne
· infer_instance
#align measure_theory.pdf.is_uniform.mul_pdf_integrable MeasureTheory.pdf.IsUniform.mul_pdf_integrable
+-/
+#print MeasureTheory.pdf.IsUniform.integral_eq /-
/-- A real uniform random variable `X` with support `s` has expectation
`(λ s)⁻¹ * ∫ x in s, x ∂λ` where `λ` is the Lebesgue measure. -/
theorem integral_eq (hnt : volume s ≠ ∞) (huX : IsUniform X s ℙ) :
@@ -455,6 +508,7 @@ theorem integral_eq (hnt : volume s ≠ ∞) (huX : IsUniform X s ℙ) :
change ∫ x in s, x * (volume s)⁻¹.toReal • 1 ∂volume = _
rw [integral_mul_right, mul_comm, Algebra.id.smul_eq_mul, mul_one]
#align measure_theory.pdf.is_uniform.integral_eq MeasureTheory.pdf.IsUniform.integral_eq
+-/
end IsUniform
mathlib commit https://github.com/leanprover-community/mathlib/commit/ccdbfb6e5614667af5aa3ab2d50885e0ef44a46f
@@ -64,38 +64,42 @@ open TopologicalSpace MeasureTheory.Measure
variable {Ω E : Type _} [MeasurableSpace E]
+#print MeasureTheory.HasPDF /-
/-- A random variable `X : Ω → E` is said to `has_pdf` with respect to the measure `ℙ` on `Ω` and
`μ` on `E` if there exists a measurable function `f` such that the push-forward measure of `ℙ`
along `X` equals `μ.with_density f`. -/
-class HasPdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
+class HasPDF {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) : Prop where
pdf' : Measurable X ∧ ∃ f : E → ℝ≥0∞, Measurable f ∧ map X ℙ = μ.withDensity f
-#align measure_theory.has_pdf MeasureTheory.HasPdf
+#align measure_theory.has_pdf MeasureTheory.HasPDF
+-/
@[measurability]
-theorem HasPdf.measurable {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
- (μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPdf X ℙ μ] :
+theorem HasPDF.measurable {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
+ (μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPDF X ℙ μ] :
Measurable X :=
hX.pdf'.1
-#align measure_theory.has_pdf.measurable MeasureTheory.HasPdf.measurable
+#align measure_theory.has_pdf.measurable MeasureTheory.HasPDF.measurable
+#print MeasureTheory.pdf /-
/-- If `X` is a random variable that `has_pdf X ℙ μ`, then `pdf X` is the measurable function `f`
such that the push-forward measure of `ℙ` along `X` equals `μ.with_density f`. -/
def pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) :=
- if hX : HasPdf X ℙ μ then Classical.choose hX.pdf'.2 else 0
+ if hX : HasPDF X ℙ μ then Classical.choose hX.pdf'.2 else 0
#align measure_theory.pdf MeasureTheory.pdf
+-/
theorem pdf_undef {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
- (h : ¬HasPdf X ℙ μ) : pdf X ℙ μ = 0 := by simp only [pdf, dif_neg h]
+ (h : ¬HasPDF X ℙ μ) : pdf X ℙ μ = 0 := by simp only [pdf, dif_neg h]
#align measure_theory.pdf_undef MeasureTheory.pdf_undef
-theorem hasPdf_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
- (h : pdf X ℙ μ ≠ 0) : HasPdf X ℙ μ := by
+theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
+ (h : pdf X ℙ μ ≠ 0) : HasPDF X ℙ μ := by
by_contra hpdf
rw [pdf, dif_neg hpdf] at h
exact hpdf (False.ndrec (has_pdf X ℙ μ) (h rfl))
-#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPdf_of_pdf_ne_zero
+#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPDF_of_pdf_ne_zero
theorem pdf_eq_zero_of_not_measurable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
{X : Ω → E} (hX : ¬Measurable X) : pdf X ℙ μ = 0 :=
@@ -119,7 +123,7 @@ theorem measurable_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω
#align measure_theory.measurable_pdf MeasureTheory.measurable_pdf
theorem map_eq_withDensity_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
- (μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPdf X ℙ μ] :
+ (μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPDF X ℙ μ] :
Measure.map X ℙ = μ.withDensity (pdf X ℙ μ) :=
by
rw [pdf, dif_pos hX]
@@ -127,7 +131,7 @@ theorem map_eq_withDensity_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Me
#align measure_theory.map_eq_with_density_pdf MeasureTheory.map_eq_withDensity_pdf
theorem map_eq_set_lintegral_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
- (μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPdf X ℙ μ] {s : Set E}
+ (μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPDF X ℙ μ] {s : Set E}
(hs : MeasurableSet s) : Measure.map X ℙ s = ∫⁻ x in s, pdf X ℙ μ x ∂μ := by
rw [← with_density_apply _ hs, map_eq_with_density_pdf X ℙ μ]
#align measure_theory.map_eq_set_lintegral_pdf MeasureTheory.map_eq_set_lintegral_pdf
@@ -136,7 +140,7 @@ namespace Pdf
variable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
-theorem lintegral_eq_measure_univ {X : Ω → E} [HasPdf X ℙ μ] : ∫⁻ x, pdf X ℙ μ x ∂μ = ℙ Set.univ :=
+theorem lintegral_eq_measure_univ {X : Ω → E} [HasPDF X ℙ μ] : ∫⁻ x, pdf X ℙ μ x ∂μ = ℙ Set.univ :=
by
rw [← set_lintegral_univ, ← map_eq_set_lintegral_pdf X ℙ μ MeasurableSet.univ,
measure.map_apply (has_pdf.measurable X ℙ μ) MeasurableSet.univ, Set.preimage_univ]
@@ -158,7 +162,7 @@ theorem ofReal_toReal_ae_eq [IsFiniteMeasure ℙ] {X : Ω → E} :
ofReal_toReal_ae_eq ae_lt_top
#align measure_theory.pdf.of_real_to_real_ae_eq MeasureTheory.pdf.ofReal_toReal_ae_eq
-theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
+theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → ℝ}
(hf : Measurable f) :
Integrable (fun x => f (X x)) ℙ ↔ Integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ :=
by
@@ -170,7 +174,7 @@ theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [
/-- **The Law of the Unconscious Statistician**: Given a random variable `X` and a measurable
function `f`, `f ∘ X` is a random variable with expectation `∫ x, f x * pdf X ∂μ`
where `μ` is a measure on the codomain of `X`. -/
-theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
+theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → ℝ}
(hf : Measurable f) : ∫ x, f x * (pdf X ℙ μ x).toReal ∂μ = ∫ x, f (X x) ∂ℙ :=
by
by_cases hpdf : integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ
@@ -218,25 +222,25 @@ theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPd
all_goals infer_instance
#align measure_theory.pdf.integral_fun_mul_eq_integral MeasureTheory.pdf.integral_fun_mul_eq_integral
-theorem map_absolutelyContinuous {X : Ω → E} [HasPdf X ℙ μ] : map X ℙ ≪ μ := by
+theorem map_absolutelyContinuous {X : Ω → E} [HasPDF X ℙ μ] : map X ℙ ≪ μ := by
rw [map_eq_with_density_pdf X ℙ μ]; exact with_density_absolutely_continuous _ _
#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.pdf.map_absolutelyContinuous
/-- A random variable that `has_pdf` is quasi-measure preserving. -/
-theorem to_quasiMeasurePreserving {X : Ω → E} [HasPdf X ℙ μ] : QuasiMeasurePreserving X ℙ μ :=
- { Measurable := HasPdf.measurable X ℙ μ
+theorem to_quasiMeasurePreserving {X : Ω → E} [HasPDF X ℙ μ] : QuasiMeasurePreserving X ℙ μ :=
+ { Measurable := HasPDF.measurable X ℙ μ
AbsolutelyContinuous := map_absolutelyContinuous }
#align measure_theory.pdf.to_quasi_measure_preserving MeasureTheory.pdf.to_quasiMeasurePreserving
-theorem haveLebesgueDecomposition_of_hasPdf {X : Ω → E} [hX' : HasPdf X ℙ μ] :
+theorem haveLebesgueDecomposition_of_hasPDF {X : Ω → E} [hX' : HasPDF X ℙ μ] :
(map X ℙ).HaveLebesgueDecomposition μ :=
⟨⟨⟨0, pdf X ℙ μ⟩, by
simp only [zero_add, measurable_pdf X ℙ μ, true_and_iff, mutually_singular.zero_left,
map_eq_with_density_pdf X ℙ μ]⟩⟩
-#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.pdf.haveLebesgueDecomposition_of_hasPdf
+#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.pdf.haveLebesgueDecomposition_of_hasPDF
-theorem hasPdf_iff {X : Ω → E} :
- HasPdf X ℙ μ ↔ Measurable X ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ :=
+theorem hasPDF_iff {X : Ω → E} :
+ HasPDF X ℙ μ ↔ Measurable X ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ :=
by
constructor
· intro hX'
@@ -245,12 +249,12 @@ theorem hasPdf_iff {X : Ω → E} :
haveI := h_decomp
refine' ⟨⟨hX, (measure.map X ℙ).rnDeriv μ, measurable_rn_deriv _ _, _⟩⟩
rwa [with_density_rn_deriv_eq]
-#align measure_theory.pdf.has_pdf_iff MeasureTheory.pdf.hasPdf_iff
+#align measure_theory.pdf.has_pdf_iff MeasureTheory.pdf.hasPDF_iff
-theorem hasPdf_iff_of_measurable {X : Ω → E} (hX : Measurable X) :
- HasPdf X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ := by rw [has_pdf_iff];
+theorem hasPDF_iff_of_measurable {X : Ω → E} (hX : Measurable X) :
+ HasPDF X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ := by rw [has_pdf_iff];
simp only [hX, true_and_iff]
-#align measure_theory.pdf.has_pdf_iff_of_measurable MeasureTheory.pdf.hasPdf_iff_of_measurable
+#align measure_theory.pdf.has_pdf_iff_of_measurable MeasureTheory.pdf.hasPDF_iff_of_measurable
section
@@ -261,9 +265,9 @@ map also `has_pdf` if `(map g (map X ℙ)).have_lebesgue_decomposition μ`.
`quasi_measure_preserving_has_pdf'` is more useful in the case we are working with a
probability measure and a real-valued random variable. -/
-theorem quasiMeasurePreserving_hasPdf {X : Ω → E} [HasPdf X ℙ μ] {g : E → F}
+theorem quasiMeasurePreserving_hasPDF {X : Ω → E} [HasPDF X ℙ μ] {g : E → F}
(hg : QuasiMeasurePreserving g μ ν) (hmap : (map g (map X ℙ)).HaveLebesgueDecomposition ν) :
- HasPdf (g ∘ X) ℙ ν :=
+ HasPDF (g ∘ X) ℙ ν :=
by
rw [has_pdf_iff, ← map_map hg.measurable (has_pdf.measurable X ℙ μ)]
refine' ⟨hg.measurable.comp (has_pdf.measurable X ℙ μ), hmap, _⟩
@@ -273,12 +277,12 @@ theorem quasiMeasurePreserving_hasPdf {X : Ω → E} [HasPdf X ℙ μ] {g : E
have := hg.absolutely_continuous hs
rw [map_apply hg.measurable hsm] at this
exact set_lintegral_measure_zero _ _ this
-#align measure_theory.pdf.quasi_measure_preserving_has_pdf MeasureTheory.pdf.quasiMeasurePreserving_hasPdf
+#align measure_theory.pdf.quasi_measure_preserving_has_pdf MeasureTheory.pdf.quasiMeasurePreserving_hasPDF
-theorem quasiMeasurePreserving_has_pdf' [IsFiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E}
- [HasPdf X ℙ μ] {g : E → F} (hg : QuasiMeasurePreserving g μ ν) : HasPdf (g ∘ X) ℙ ν :=
- quasiMeasurePreserving_hasPdf hg inferInstance
-#align measure_theory.pdf.quasi_measure_preserving_has_pdf' MeasureTheory.pdf.quasiMeasurePreserving_has_pdf'
+theorem quasiMeasurePreserving_hasPDF' [IsFiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E}
+ [HasPDF X ℙ μ] {g : E → F} (hg : QuasiMeasurePreserving g μ ν) : HasPDF (g ∘ X) ℙ ν :=
+ quasiMeasurePreserving_hasPDF hg inferInstance
+#align measure_theory.pdf.quasi_measure_preserving_has_pdf' MeasureTheory.pdf.quasiMeasurePreserving_hasPDF'
end
@@ -286,26 +290,30 @@ section Real
variable [IsFiniteMeasure ℙ] {X : Ω → ℝ}
+#print Real.hasPDF_iff_of_measurable /-
/-- A real-valued random variable `X` `has_pdf X ℙ λ` (where `λ` is the Lebesgue measure) if and
only if the push-forward measure of `ℙ` along `X` is absolutely continuous with respect to `λ`. -/
-theorem Real.hasPdf_iff_of_measurable (hX : Measurable X) : HasPdf X ℙ ↔ map X ℙ ≪ volume :=
+theorem Real.hasPDF_iff_of_measurable (hX : Measurable X) : HasPDF X ℙ ↔ map X ℙ ≪ volume :=
by
rw [has_pdf_iff_of_measurable hX, and_iff_right_iff_imp]
exact fun h => inferInstance
-#align measure_theory.pdf.real.has_pdf_iff_of_measurable MeasureTheory.pdf.Real.hasPdf_iff_of_measurable
+#align measure_theory.pdf.real.has_pdf_iff_of_measurable Real.hasPDF_iff_of_measurable
+-/
-theorem Real.hasPdf_iff : HasPdf X ℙ ↔ Measurable X ∧ map X ℙ ≪ volume :=
+#print Real.hasPDF_iff /-
+theorem Real.hasPDF_iff : HasPDF X ℙ ↔ Measurable X ∧ map X ℙ ≪ volume :=
by
by_cases hX : Measurable X
· rw [real.has_pdf_iff_of_measurable hX, iff_and_self]
exact fun h => hX
infer_instance
· exact ⟨fun h => False.elim (hX h.pdf'.1), fun h => False.elim (hX h.1)⟩
-#align measure_theory.pdf.real.has_pdf_iff MeasureTheory.pdf.Real.hasPdf_iff
+#align measure_theory.pdf.real.has_pdf_iff Real.hasPDF_iff
+-/
/-- If `X` is a real-valued random variable that has pdf `f`, then the expectation of `X` equals
`∫ x, x * f x ∂λ` where `λ` is the Lebesgue measure. -/
-theorem integral_mul_eq_integral [HasPdf X ℙ] : ∫ x, x * (pdf X ℙ volume x).toReal = ∫ x, X x ∂ℙ :=
+theorem integral_mul_eq_integral [HasPDF X ℙ] : ∫ x, x * (pdf X ℙ volume x).toReal = ∫ x, X x ∂ℙ :=
integral_fun_mul_eq_integral measurable_id
#align measure_theory.pdf.integral_mul_eq_integral MeasureTheory.pdf.integral_mul_eq_integral
@@ -335,18 +343,20 @@ section
/-! **Uniform Distribution** -/
+#print MeasureTheory.pdf.IsUniform /-
/-- A random variable `X` has uniform distribution if it has a probability density function `f`
with support `s` such that `f = (μ s)⁻¹ 1ₛ` a.e. where `1ₛ` is the indicator function for `s`. -/
def IsUniform {m : MeasurableSpace Ω} (X : Ω → E) (support : Set E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) :=
pdf X ℙ μ =ᵐ[μ] support.indicator ((μ support)⁻¹ • 1)
#align measure_theory.pdf.is_uniform MeasureTheory.pdf.IsUniform
+-/
namespace IsUniform
-theorem hasPdf {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E} {s : Set E}
- (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : HasPdf X ℙ μ :=
- hasPdf_of_pdf_ne_zero
+theorem hasPDF {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E} {s : Set E}
+ (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : HasPDF X ℙ μ :=
+ hasPDF_of_pdf_ne_zero
(by
intro hpdf
rw [is_uniform, hpdf] at hu
@@ -360,7 +370,7 @@ theorem hasPdf {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ :
rw [HEq, Set.inter_univ] at this
exact hns this
exact MeasureTheory.Set.indicator_ae_eq_zero hu.symm)
-#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPdf
+#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF
theorem pdf_toReal_ae_eq {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
{s : Set E} (hX : IsUniform X s ℙ μ) :
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -136,8 +136,8 @@ namespace Pdf
variable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
-theorem lintegral_eq_measure_univ {X : Ω → E} [HasPdf X ℙ μ] :
- (∫⁻ x, pdf X ℙ μ x ∂μ) = ℙ Set.univ := by
+theorem lintegral_eq_measure_univ {X : Ω → E} [HasPdf X ℙ μ] : ∫⁻ x, pdf X ℙ μ x ∂μ = ℙ Set.univ :=
+ by
rw [← set_lintegral_univ, ← map_eq_set_lintegral_pdf X ℙ μ MeasurableSet.univ,
measure.map_apply (has_pdf.measurable X ℙ μ) MeasurableSet.univ, Set.preimage_univ]
#align measure_theory.pdf.lintegral_eq_measure_univ MeasureTheory.pdf.lintegral_eq_measure_univ
@@ -171,7 +171,7 @@ theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [
function `f`, `f ∘ X` is a random variable with expectation `∫ x, f x * pdf X ∂μ`
where `μ` is a measure on the codomain of `X`. -/
theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
- (hf : Measurable f) : (∫ x, f x * (pdf X ℙ μ x).toReal ∂μ) = ∫ x, f (X x) ∂ℙ :=
+ (hf : Measurable f) : ∫ x, f x * (pdf X ℙ μ x).toReal ∂μ = ∫ x, f (X x) ∂ℙ :=
by
by_cases hpdf : integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ
· rw [← integral_map (has_pdf.measurable X ℙ μ).AEMeasurable hf.ae_strongly_measurable,
@@ -305,13 +305,12 @@ theorem Real.hasPdf_iff : HasPdf X ℙ ↔ Measurable X ∧ map X ℙ ≪ volume
/-- If `X` is a real-valued random variable that has pdf `f`, then the expectation of `X` equals
`∫ x, x * f x ∂λ` where `λ` is the Lebesgue measure. -/
-theorem integral_mul_eq_integral [HasPdf X ℙ] :
- (∫ x, x * (pdf X ℙ volume x).toReal) = ∫ x, X x ∂ℙ :=
+theorem integral_mul_eq_integral [HasPdf X ℙ] : ∫ x, x * (pdf X ℙ volume x).toReal = ∫ x, X x ∂ℙ :=
integral_fun_mul_eq_integral measurable_id
#align measure_theory.pdf.integral_mul_eq_integral MeasureTheory.pdf.integral_mul_eq_integral
theorem hasFiniteIntegral_mul {f : ℝ → ℝ} {g : ℝ → ℝ≥0∞} (hg : pdf X ℙ =ᵐ[volume] g)
- (hgi : (∫⁻ x, ‖f x‖₊ * g x) ≠ ∞) : HasFiniteIntegral fun x => f x * (pdf X ℙ volume x).toReal :=
+ (hgi : ∫⁻ x, ‖f x‖₊ * g x ≠ ∞) : HasFiniteIntegral fun x => f x * (pdf X ℙ volume x).toReal :=
by
rw [has_finite_integral]
have : (fun x => ↑‖f x‖₊ * g x) =ᵐ[volume] fun x => ‖f x * (pdf X ℙ volume x).toReal‖₊ :=
@@ -427,7 +426,7 @@ theorem mul_pdf_integrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUn
/-- A real uniform random variable `X` with support `s` has expectation
`(λ s)⁻¹ * ∫ x in s, x ∂λ` where `λ` is the Lebesgue measure. -/
theorem integral_eq (hnt : volume s ≠ ∞) (huX : IsUniform X s ℙ) :
- (∫ x, X x ∂ℙ) = (volume s)⁻¹.toReal * ∫ x in s, x :=
+ ∫ x, X x ∂ℙ = (volume s)⁻¹.toReal * ∫ x in s, x :=
by
haveI := has_pdf hns hnt huX
haveI := huX.is_probability_measure hns hnt hms
@@ -443,7 +442,7 @@ theorem integral_eq (hnt : volume s ≠ ∞) (huX : IsUniform X s ℙ) :
· simp [Set.indicator_of_mem hx]
· simp [Set.indicator_of_not_mem hx]
simp_rw [this, ← s.indicator_mul_right fun x => x, integral_indicator hms]
- change (∫ x in s, x * (volume s)⁻¹.toReal • 1 ∂volume) = _
+ change ∫ x in s, x * (volume s)⁻¹.toReal • 1 ∂volume = _
rw [integral_mul_right, mul_comm, Algebra.id.smul_eq_mul, mul_one]
#align measure_theory.pdf.is_uniform.integral_eq MeasureTheory.pdf.IsUniform.integral_eq
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -142,7 +142,7 @@ theorem lintegral_eq_measure_univ {X : Ω → E} [HasPdf X ℙ μ] :
measure.map_apply (has_pdf.measurable X ℙ μ) MeasurableSet.univ, Set.preimage_univ]
#align measure_theory.pdf.lintegral_eq_measure_univ MeasureTheory.pdf.lintegral_eq_measure_univ
-theorem ae_lt_top [FiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} : ∀ᵐ x ∂μ, pdf X ℙ μ x < ∞ :=
+theorem ae_lt_top [IsFiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} : ∀ᵐ x ∂μ, pdf X ℙ μ x < ∞ :=
by
by_cases hpdf : has_pdf X ℙ μ
· haveI := hpdf
@@ -153,12 +153,12 @@ theorem ae_lt_top [FiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} : ∀ᵐ x
exact Filter.eventually_of_forall fun x => WithTop.zero_lt_top
#align measure_theory.pdf.ae_lt_top MeasureTheory.pdf.ae_lt_top
-theorem ofReal_toReal_ae_eq [FiniteMeasure ℙ] {X : Ω → E} :
+theorem ofReal_toReal_ae_eq [IsFiniteMeasure ℙ] {X : Ω → E} :
(fun x => ENNReal.ofReal (pdf X ℙ μ x).toReal) =ᵐ[μ] pdf X ℙ μ :=
ofReal_toReal_ae_eq ae_lt_top
#align measure_theory.pdf.of_real_to_real_ae_eq MeasureTheory.pdf.ofReal_toReal_ae_eq
-theorem integrable_iff_integrable_mul_pdf [FiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
+theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
(hf : Measurable f) :
Integrable (fun x => f (X x)) ℙ ↔ Integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ :=
by
@@ -170,7 +170,7 @@ theorem integrable_iff_integrable_mul_pdf [FiniteMeasure ℙ] {X : Ω → E} [Ha
/-- **The Law of the Unconscious Statistician**: Given a random variable `X` and a measurable
function `f`, `f ∘ X` is a random variable with expectation `∫ x, f x * pdf X ∂μ`
where `μ` is a measure on the codomain of `X`. -/
-theorem integral_fun_mul_eq_integral [FiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
+theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
(hf : Measurable f) : (∫ x, f x * (pdf X ℙ μ x).toReal ∂μ) = ∫ x, f (X x) ∂ℙ :=
by
by_cases hpdf : integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ
@@ -275,8 +275,8 @@ theorem quasiMeasurePreserving_hasPdf {X : Ω → E} [HasPdf X ℙ μ] {g : E
exact set_lintegral_measure_zero _ _ this
#align measure_theory.pdf.quasi_measure_preserving_has_pdf MeasureTheory.pdf.quasiMeasurePreserving_hasPdf
-theorem quasiMeasurePreserving_has_pdf' [FiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E} [HasPdf X ℙ μ]
- {g : E → F} (hg : QuasiMeasurePreserving g μ ν) : HasPdf (g ∘ X) ℙ ν :=
+theorem quasiMeasurePreserving_has_pdf' [IsFiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E}
+ [HasPdf X ℙ μ] {g : E → F} (hg : QuasiMeasurePreserving g μ ν) : HasPdf (g ∘ X) ℙ ν :=
quasiMeasurePreserving_hasPdf hg inferInstance
#align measure_theory.pdf.quasi_measure_preserving_has_pdf' MeasureTheory.pdf.quasiMeasurePreserving_has_pdf'
@@ -284,7 +284,7 @@ end
section Real
-variable [FiniteMeasure ℙ] {X : Ω → ℝ}
+variable [IsFiniteMeasure ℙ] {X : Ω → ℝ}
/-- A real-valued random variable `X` `has_pdf X ℙ λ` (where `λ` is the Lebesgue measure) if and
only if the push-forward measure of `ℙ` along `X` is absolutely continuous with respect to `λ`. -/
@@ -382,20 +382,20 @@ theorem measure_preimage {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure
rw [ENNReal.div_eq_inv_mul]
#align measure_theory.pdf.is_uniform.measure_preimage MeasureTheory.pdf.IsUniform.measure_preimage
-theorem probabilityMeasure {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
+theorem isProbabilityMeasure {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
{s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hms : MeasurableSet s) (hu : IsUniform X s ℙ μ) :
- ProbabilityMeasure ℙ :=
+ IsProbabilityMeasure ℙ :=
⟨by
have : X ⁻¹' Set.univ = Set.univ := by simp only [Set.preimage_univ]
rw [← this, hu.measure_preimage hns hnt hms MeasurableSet.univ, Set.inter_univ,
ENNReal.div_self hns hnt]⟩
-#align measure_theory.pdf.is_uniform.is_probability_measure MeasureTheory.pdf.IsUniform.probabilityMeasure
+#align measure_theory.pdf.is_uniform.is_probability_measure MeasureTheory.pdf.IsUniform.isProbabilityMeasure
variable {X : Ω → ℝ} {s : Set ℝ} (hms : MeasurableSet s) (hns : volume s ≠ 0)
include hms hns
-theorem mul_pdf_integrable [FiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
+theorem mul_pdf_integrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
Integrable fun x : ℝ => x * (pdf X ℙ volume x).toReal :=
by
by_cases hsupp : volume s = ∞
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -68,7 +68,7 @@ variable {Ω E : Type _} [MeasurableSpace E]
`μ` on `E` if there exists a measurable function `f` such that the push-forward measure of `ℙ`
along `X` equals `μ.with_density f`. -/
class HasPdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
- (μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) : Prop where
+ (μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) : Prop where
pdf' : Measurable X ∧ ∃ f : E → ℝ≥0∞, Measurable f ∧ map X ℙ = μ.withDensity f
#align measure_theory.has_pdf MeasureTheory.HasPdf
@@ -93,7 +93,7 @@ theorem pdf_undef {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {
theorem hasPdf_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
(h : pdf X ℙ μ ≠ 0) : HasPdf X ℙ μ := by
by_contra hpdf
- rw [pdf, dif_neg hpdf] at h
+ rw [pdf, dif_neg hpdf] at h
exact hpdf (False.ndrec (has_pdf X ℙ μ) (h rfl))
#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPdf_of_pdf_ne_zero
@@ -214,7 +214,7 @@ theorem integral_fun_mul_eq_integral [FiniteMeasure ℙ] {X : Ω → E} [HasPdf
rw [lintegral_congr_ae this]
exact hpdf.2
· rw [integral_undef hpdf, integral_undef]
- rwa [← integrable_iff_integrable_mul_pdf hf] at hpdf
+ rwa [← integrable_iff_integrable_mul_pdf hf] at hpdf
all_goals infer_instance
#align measure_theory.pdf.integral_fun_mul_eq_integral MeasureTheory.pdf.integral_fun_mul_eq_integral
@@ -271,7 +271,7 @@ theorem quasiMeasurePreserving_hasPdf {X : Ω → E} [HasPdf X ℙ μ] {g : E
refine' absolutely_continuous.mk fun s hsm hs => _
rw [map_apply hg.measurable hsm, with_density_apply _ (hg.measurable hsm)]
have := hg.absolutely_continuous hs
- rw [map_apply hg.measurable hsm] at this
+ rw [map_apply hg.measurable hsm] at this
exact set_lintegral_measure_zero _ _ this
#align measure_theory.pdf.quasi_measure_preserving_has_pdf MeasureTheory.pdf.quasiMeasurePreserving_hasPdf
@@ -350,7 +350,7 @@ theorem hasPdf {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ :
hasPdf_of_pdf_ne_zero
(by
intro hpdf
- rw [is_uniform, hpdf] at hu
+ rw [is_uniform, hpdf] at hu
suffices μ (s ∩ Function.support ((μ s)⁻¹ • 1)) = 0
by
have heq : Function.support ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) = Set.univ :=
@@ -358,7 +358,7 @@ theorem hasPdf {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ :
ext x
rw [Function.mem_support]
simp [hnt]
- rw [HEq, Set.inter_univ] at this
+ rw [HEq, Set.inter_univ] at this
exact hns this
exact MeasureTheory.Set.indicator_ae_eq_zero hu.symm)
#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPdf
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -56,7 +56,7 @@ which we currently do not have.
noncomputable section
-open Classical MeasureTheory NNReal ENNReal
+open scoped Classical MeasureTheory NNReal ENNReal
namespace MeasureTheory
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -103,9 +103,7 @@ theorem pdf_eq_zero_of_not_measurable {m : MeasurableSpace Ω} {ℙ : Measure Ω
#align measure_theory.pdf_eq_zero_of_not_measurable MeasureTheory.pdf_eq_zero_of_not_measurable
theorem measurable_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
- (X : Ω → E) (h : pdf X ℙ μ ≠ 0) : Measurable X :=
- by
- by_contra hX
+ (X : Ω → E) (h : pdf X ℙ μ ≠ 0) : Measurable X := by by_contra hX;
exact h (pdf_eq_zero_of_not_measurable hX)
#align measure_theory.measurable_of_pdf_ne_zero MeasureTheory.measurable_of_pdf_ne_zero
@@ -220,10 +218,8 @@ theorem integral_fun_mul_eq_integral [FiniteMeasure ℙ] {X : Ω → E} [HasPdf
all_goals infer_instance
#align measure_theory.pdf.integral_fun_mul_eq_integral MeasureTheory.pdf.integral_fun_mul_eq_integral
-theorem map_absolutelyContinuous {X : Ω → E} [HasPdf X ℙ μ] : map X ℙ ≪ μ :=
- by
- rw [map_eq_with_density_pdf X ℙ μ]
- exact with_density_absolutely_continuous _ _
+theorem map_absolutelyContinuous {X : Ω → E} [HasPdf X ℙ μ] : map X ℙ ≪ μ := by
+ rw [map_eq_with_density_pdf X ℙ μ]; exact with_density_absolutely_continuous _ _
#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.pdf.map_absolutelyContinuous
/-- A random variable that `has_pdf` is quasi-measure preserving. -/
@@ -252,9 +248,7 @@ theorem hasPdf_iff {X : Ω → E} :
#align measure_theory.pdf.has_pdf_iff MeasureTheory.pdf.hasPdf_iff
theorem hasPdf_iff_of_measurable {X : Ω → E} (hX : Measurable X) :
- HasPdf X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ :=
- by
- rw [has_pdf_iff]
+ HasPdf X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ := by rw [has_pdf_iff];
simp only [hX, true_and_iff]
#align measure_theory.pdf.has_pdf_iff_of_measurable MeasureTheory.pdf.hasPdf_iff_of_measurable
mathlib commit https://github.com/leanprover-community/mathlib/commit/75e7fca56381d056096ce5d05e938f63a6567828
@@ -414,7 +414,7 @@ theorem mul_pdf_integrable [FiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUnif
Filter.EventuallyEq.mul (ae_eq_refl _) (Filter.EventuallyEq.fun_comp this.symm ENNReal.toReal)
refine'
⟨ae_strongly_measurable_id.mul
- (measurable_pdf X ℙ).AEMeasurable.ennreal_toReal.AeStronglyMeasurable,
+ (measurable_pdf X ℙ).AEMeasurable.ennreal_toReal.AEStronglyMeasurable,
_⟩
refine' has_finite_integral_mul huX _
set ind := (volume s)⁻¹ • (1 : ℝ → ℝ≥0∞) with hind
mathlib commit https://github.com/leanprover-community/mathlib/commit/33c67ae661dd8988516ff7f247b0be3018cdd952
@@ -414,7 +414,7 @@ theorem mul_pdf_integrable [FiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUnif
Filter.EventuallyEq.mul (ae_eq_refl _) (Filter.EventuallyEq.fun_comp this.symm ENNReal.toReal)
refine'
⟨ae_strongly_measurable_id.mul
- (measurable_pdf X ℙ).AEMeasurable.eNNReal_toReal.AeStronglyMeasurable,
+ (measurable_pdf X ℙ).AEMeasurable.ennreal_toReal.AeStronglyMeasurable,
_⟩
refine' has_finite_integral_mul huX _
set ind := (volume s)⁻¹ • (1 : ℝ → ℝ≥0∞) with hind
mathlib commit https://github.com/leanprover-community/mathlib/commit/f51de8769c34652d82d1c8e5f8f18f8374782bed
@@ -4,12 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying
! This file was ported from Lean 3 source module probability.density
-! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
+! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.MeasureTheory.Decomposition.RadonNikodym
-import Mathbin.MeasureTheory.Measure.HaarOfBasis
+import Mathbin.MeasureTheory.Measure.Haar.OfBasis
/-!
# Probability density function
mathlib commit https://github.com/leanprover-community/mathlib/commit/d4437c68c8d350fc9d4e95e1e174409db35e30d7
@@ -144,7 +144,7 @@ theorem lintegral_eq_measure_univ {X : Ω → E} [HasPdf X ℙ μ] :
measure.map_apply (has_pdf.measurable X ℙ μ) MeasurableSet.univ, Set.preimage_univ]
#align measure_theory.pdf.lintegral_eq_measure_univ MeasureTheory.pdf.lintegral_eq_measure_univ
-theorem ae_lt_top [IsFiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} : ∀ᵐ x ∂μ, pdf X ℙ μ x < ∞ :=
+theorem ae_lt_top [FiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} : ∀ᵐ x ∂μ, pdf X ℙ μ x < ∞ :=
by
by_cases hpdf : has_pdf X ℙ μ
· haveI := hpdf
@@ -155,12 +155,12 @@ theorem ae_lt_top [IsFiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} : ∀ᵐ
exact Filter.eventually_of_forall fun x => WithTop.zero_lt_top
#align measure_theory.pdf.ae_lt_top MeasureTheory.pdf.ae_lt_top
-theorem ofReal_toReal_ae_eq [IsFiniteMeasure ℙ] {X : Ω → E} :
+theorem ofReal_toReal_ae_eq [FiniteMeasure ℙ] {X : Ω → E} :
(fun x => ENNReal.ofReal (pdf X ℙ μ x).toReal) =ᵐ[μ] pdf X ℙ μ :=
ofReal_toReal_ae_eq ae_lt_top
#align measure_theory.pdf.of_real_to_real_ae_eq MeasureTheory.pdf.ofReal_toReal_ae_eq
-theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
+theorem integrable_iff_integrable_mul_pdf [FiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
(hf : Measurable f) :
Integrable (fun x => f (X x)) ℙ ↔ Integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ :=
by
@@ -172,7 +172,7 @@ theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [
/-- **The Law of the Unconscious Statistician**: Given a random variable `X` and a measurable
function `f`, `f ∘ X` is a random variable with expectation `∫ x, f x * pdf X ∂μ`
where `μ` is a measure on the codomain of `X`. -/
-theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
+theorem integral_fun_mul_eq_integral [FiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
(hf : Measurable f) : (∫ x, f x * (pdf X ℙ μ x).toReal ∂μ) = ∫ x, f (X x) ∂ℙ :=
by
by_cases hpdf : integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ
@@ -281,8 +281,8 @@ theorem quasiMeasurePreserving_hasPdf {X : Ω → E} [HasPdf X ℙ μ] {g : E
exact set_lintegral_measure_zero _ _ this
#align measure_theory.pdf.quasi_measure_preserving_has_pdf MeasureTheory.pdf.quasiMeasurePreserving_hasPdf
-theorem quasiMeasurePreserving_has_pdf' [IsFiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E}
- [HasPdf X ℙ μ] {g : E → F} (hg : QuasiMeasurePreserving g μ ν) : HasPdf (g ∘ X) ℙ ν :=
+theorem quasiMeasurePreserving_has_pdf' [FiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E} [HasPdf X ℙ μ]
+ {g : E → F} (hg : QuasiMeasurePreserving g μ ν) : HasPdf (g ∘ X) ℙ ν :=
quasiMeasurePreserving_hasPdf hg inferInstance
#align measure_theory.pdf.quasi_measure_preserving_has_pdf' MeasureTheory.pdf.quasiMeasurePreserving_has_pdf'
@@ -290,7 +290,7 @@ end
section Real
-variable [IsFiniteMeasure ℙ] {X : Ω → ℝ}
+variable [FiniteMeasure ℙ] {X : Ω → ℝ}
/-- A real-valued random variable `X` `has_pdf X ℙ λ` (where `λ` is the Lebesgue measure) if and
only if the push-forward measure of `ℙ` along `X` is absolutely continuous with respect to `λ`. -/
@@ -388,20 +388,20 @@ theorem measure_preimage {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure
rw [ENNReal.div_eq_inv_mul]
#align measure_theory.pdf.is_uniform.measure_preimage MeasureTheory.pdf.IsUniform.measure_preimage
-theorem isProbabilityMeasure {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
+theorem probabilityMeasure {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
{s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hms : MeasurableSet s) (hu : IsUniform X s ℙ μ) :
- IsProbabilityMeasure ℙ :=
+ ProbabilityMeasure ℙ :=
⟨by
have : X ⁻¹' Set.univ = Set.univ := by simp only [Set.preimage_univ]
rw [← this, hu.measure_preimage hns hnt hms MeasurableSet.univ, Set.inter_univ,
ENNReal.div_self hns hnt]⟩
-#align measure_theory.pdf.is_uniform.is_probability_measure MeasureTheory.pdf.IsUniform.isProbabilityMeasure
+#align measure_theory.pdf.is_uniform.is_probability_measure MeasureTheory.pdf.IsUniform.probabilityMeasure
variable {X : Ω → ℝ} {s : Set ℝ} (hms : MeasurableSet s) (hns : volume s ≠ 0)
include hms hns
-theorem mul_pdf_integrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
+theorem mul_pdf_integrable [FiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
Integrable fun x : ℝ => x * (pdf X ℙ volume x).toReal :=
by
by_cases hsupp : volume s = ∞
mathlib commit https://github.com/leanprover-community/mathlib/commit/738054fa93d43512da144ec45ce799d18fd44248
@@ -4,12 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying
! This file was ported from Lean 3 source module probability.density
-! leanprover-community/mathlib commit 17ef379e997badd73e5eabb4d38f11919ab3c4b3
+! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.MeasureTheory.Decomposition.RadonNikodym
-import Mathbin.MeasureTheory.Measure.Lebesgue
+import Mathbin.MeasureTheory.Measure.HaarOfBasis
/-!
# Probability density function
mathlib commit https://github.com/leanprover-community/mathlib/commit/92c69b77c5a7dc0f7eeddb552508633305157caa
@@ -90,12 +90,12 @@ theorem pdf_undef {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {
(h : ¬HasPdf X ℙ μ) : pdf X ℙ μ = 0 := by simp only [pdf, dif_neg h]
#align measure_theory.pdf_undef MeasureTheory.pdf_undef
-theorem hasPdfOfPdfNeZero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
+theorem hasPdf_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
(h : pdf X ℙ μ ≠ 0) : HasPdf X ℙ μ := by
by_contra hpdf
rw [pdf, dif_neg hpdf] at h
exact hpdf (False.ndrec (has_pdf X ℙ μ) (h rfl))
-#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPdfOfPdfNeZero
+#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPdf_of_pdf_ne_zero
theorem pdf_eq_zero_of_not_measurable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
{X : Ω → E} (hX : ¬Measurable X) : pdf X ℙ μ = 0 :=
@@ -164,7 +164,7 @@ theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [
(hf : Measurable f) :
Integrable (fun x => f (X x)) ℙ ↔ Integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ :=
by
- rw [← integrable_map_measure hf.ae_strongly_measurable (has_pdf.measurable X ℙ μ).AeMeasurable,
+ rw [← integrable_map_measure hf.ae_strongly_measurable (has_pdf.measurable X ℙ μ).AEMeasurable,
map_eq_with_density_pdf X ℙ μ, integrable_with_density_iff (measurable_pdf _ _ _) ae_lt_top]
infer_instance
#align measure_theory.pdf.integrable_iff_integrable_mul_pdf MeasureTheory.pdf.integrable_iff_integrable_mul_pdf
@@ -176,7 +176,7 @@ theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPd
(hf : Measurable f) : (∫ x, f x * (pdf X ℙ μ x).toReal ∂μ) = ∫ x, f (X x) ∂ℙ :=
by
by_cases hpdf : integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ
- · rw [← integral_map (has_pdf.measurable X ℙ μ).AeMeasurable hf.ae_strongly_measurable,
+ · rw [← integral_map (has_pdf.measurable X ℙ μ).AEMeasurable hf.ae_strongly_measurable,
map_eq_with_density_pdf X ℙ μ, integral_eq_lintegral_pos_part_sub_lintegral_neg_part hpdf,
integral_eq_lintegral_pos_part_sub_lintegral_neg_part,
lintegral_with_density_eq_lintegral_mul _ (measurable_pdf X ℙ μ) hf.neg.ennreal_of_real,
@@ -220,24 +220,24 @@ theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPd
all_goals infer_instance
#align measure_theory.pdf.integral_fun_mul_eq_integral MeasureTheory.pdf.integral_fun_mul_eq_integral
-theorem mapAbsolutelyContinuous {X : Ω → E} [HasPdf X ℙ μ] : map X ℙ ≪ μ :=
+theorem map_absolutelyContinuous {X : Ω → E} [HasPdf X ℙ μ] : map X ℙ ≪ μ :=
by
rw [map_eq_with_density_pdf X ℙ μ]
exact with_density_absolutely_continuous _ _
-#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.pdf.mapAbsolutelyContinuous
+#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.pdf.map_absolutelyContinuous
/-- A random variable that `has_pdf` is quasi-measure preserving. -/
-theorem toQuasiMeasurePreserving {X : Ω → E} [HasPdf X ℙ μ] : QuasiMeasurePreserving X ℙ μ :=
+theorem to_quasiMeasurePreserving {X : Ω → E} [HasPdf X ℙ μ] : QuasiMeasurePreserving X ℙ μ :=
{ Measurable := HasPdf.measurable X ℙ μ
- AbsolutelyContinuous := mapAbsolutelyContinuous }
-#align measure_theory.pdf.to_quasi_measure_preserving MeasureTheory.pdf.toQuasiMeasurePreserving
+ AbsolutelyContinuous := map_absolutelyContinuous }
+#align measure_theory.pdf.to_quasi_measure_preserving MeasureTheory.pdf.to_quasiMeasurePreserving
-theorem haveLebesgueDecompositionOfHasPdf {X : Ω → E} [hX' : HasPdf X ℙ μ] :
+theorem haveLebesgueDecomposition_of_hasPdf {X : Ω → E} [hX' : HasPdf X ℙ μ] :
(map X ℙ).HaveLebesgueDecomposition μ :=
⟨⟨⟨0, pdf X ℙ μ⟩, by
simp only [zero_add, measurable_pdf X ℙ μ, true_and_iff, mutually_singular.zero_left,
map_eq_with_density_pdf X ℙ μ]⟩⟩
-#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.pdf.haveLebesgueDecompositionOfHasPdf
+#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.pdf.haveLebesgueDecomposition_of_hasPdf
theorem hasPdf_iff {X : Ω → E} :
HasPdf X ℙ μ ↔ Measurable X ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ :=
@@ -267,7 +267,7 @@ map also `has_pdf` if `(map g (map X ℙ)).have_lebesgue_decomposition μ`.
`quasi_measure_preserving_has_pdf'` is more useful in the case we are working with a
probability measure and a real-valued random variable. -/
-theorem quasiMeasurePreservingHasPdf {X : Ω → E} [HasPdf X ℙ μ] {g : E → F}
+theorem quasiMeasurePreserving_hasPdf {X : Ω → E} [HasPdf X ℙ μ] {g : E → F}
(hg : QuasiMeasurePreserving g μ ν) (hmap : (map g (map X ℙ)).HaveLebesgueDecomposition ν) :
HasPdf (g ∘ X) ℙ ν :=
by
@@ -279,12 +279,12 @@ theorem quasiMeasurePreservingHasPdf {X : Ω → E} [HasPdf X ℙ μ] {g : E →
have := hg.absolutely_continuous hs
rw [map_apply hg.measurable hsm] at this
exact set_lintegral_measure_zero _ _ this
-#align measure_theory.pdf.quasi_measure_preserving_has_pdf MeasureTheory.pdf.quasiMeasurePreservingHasPdf
+#align measure_theory.pdf.quasi_measure_preserving_has_pdf MeasureTheory.pdf.quasiMeasurePreserving_hasPdf
-theorem quasiMeasurePreservingHasPdf' [IsFiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E} [HasPdf X ℙ μ]
- {g : E → F} (hg : QuasiMeasurePreserving g μ ν) : HasPdf (g ∘ X) ℙ ν :=
- quasiMeasurePreservingHasPdf hg inferInstance
-#align measure_theory.pdf.quasi_measure_preserving_has_pdf' MeasureTheory.pdf.quasiMeasurePreservingHasPdf'
+theorem quasiMeasurePreserving_has_pdf' [IsFiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E}
+ [HasPdf X ℙ μ] {g : E → F} (hg : QuasiMeasurePreserving g μ ν) : HasPdf (g ∘ X) ℙ ν :=
+ quasiMeasurePreserving_hasPdf hg inferInstance
+#align measure_theory.pdf.quasi_measure_preserving_has_pdf' MeasureTheory.pdf.quasiMeasurePreserving_has_pdf'
end
@@ -316,7 +316,7 @@ theorem integral_mul_eq_integral [HasPdf X ℙ] :
integral_fun_mul_eq_integral measurable_id
#align measure_theory.pdf.integral_mul_eq_integral MeasureTheory.pdf.integral_mul_eq_integral
-theorem hasFiniteIntegralMul {f : ℝ → ℝ} {g : ℝ → ℝ≥0∞} (hg : pdf X ℙ =ᵐ[volume] g)
+theorem hasFiniteIntegral_mul {f : ℝ → ℝ} {g : ℝ → ℝ≥0∞} (hg : pdf X ℙ =ᵐ[volume] g)
(hgi : (∫⁻ x, ‖f x‖₊ * g x) ≠ ∞) : HasFiniteIntegral fun x => f x * (pdf X ℙ volume x).toReal :=
by
rw [has_finite_integral]
@@ -333,7 +333,7 @@ theorem hasFiniteIntegralMul {f : ℝ → ℝ} {g : ℝ → ℝ≥0∞} (hg : pd
ext1 x
exact Real.ennnorm_eq_ofReal ENNReal.toReal_nonneg
rwa [lt_top_iff_ne_top, ← lintegral_congr_ae this]
-#align measure_theory.pdf.has_finite_integral_mul MeasureTheory.pdf.hasFiniteIntegralMul
+#align measure_theory.pdf.has_finite_integral_mul MeasureTheory.pdf.hasFiniteIntegral_mul
end Real
@@ -353,7 +353,7 @@ namespace IsUniform
theorem hasPdf {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E} {s : Set E}
(hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : HasPdf X ℙ μ :=
- hasPdfOfPdfNeZero
+ hasPdf_of_pdf_ne_zero
(by
intro hpdf
rw [is_uniform, hpdf] at hu
@@ -366,7 +366,7 @@ theorem hasPdf {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ :
simp [hnt]
rw [HEq, Set.inter_univ] at this
exact hns this
- exact Set.indicator_ae_eq_zero hu.symm)
+ exact MeasureTheory.Set.indicator_ae_eq_zero hu.symm)
#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPdf
theorem pdf_toReal_ae_eq {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
@@ -401,7 +401,7 @@ variable {X : Ω → ℝ} {s : Set ℝ} (hms : MeasurableSet s) (hns : volume s
include hms hns
-theorem mulPdfIntegrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
+theorem mul_pdf_integrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
Integrable fun x : ℝ => x * (pdf X ℙ volume x).toReal :=
by
by_cases hsupp : volume s = ∞
@@ -414,7 +414,7 @@ theorem mulPdfIntegrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUnif
Filter.EventuallyEq.mul (ae_eq_refl _) (Filter.EventuallyEq.fun_comp this.symm ENNReal.toReal)
refine'
⟨ae_strongly_measurable_id.mul
- (measurable_pdf X ℙ).AeMeasurable.eNNReal_toReal.AeStronglyMeasurable,
+ (measurable_pdf X ℙ).AEMeasurable.eNNReal_toReal.AeStronglyMeasurable,
_⟩
refine' has_finite_integral_mul huX _
set ind := (volume s)⁻¹ • (1 : ℝ → ℝ≥0∞) with hind
@@ -428,7 +428,7 @@ theorem mulPdfIntegrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUnif
(ENNReal.mul_lt_top (set_lintegral_lt_top_of_is_compact hsupp hcs continuous_nnnorm).Ne
(ENNReal.inv_lt_top.2 (pos_iff_ne_zero.mpr hns)).Ne).Ne
· infer_instance
-#align measure_theory.pdf.is_uniform.mul_pdf_integrable MeasureTheory.pdf.IsUniform.mulPdfIntegrable
+#align measure_theory.pdf.is_uniform.mul_pdf_integrable MeasureTheory.pdf.IsUniform.mul_pdf_integrable
/-- A real uniform random variable `X` with support `s` has expectation
`(λ s)⁻¹ * ∫ x in s, x ∂λ` where `λ` is the Lebesgue measure. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/eb0cb4511aaef0da2462207b67358a0e1fe1e2ee
@@ -56,7 +56,7 @@ which we currently do not have.
noncomputable section
-open Classical MeasureTheory NNReal Ennreal
+open Classical MeasureTheory NNReal ENNReal
namespace MeasureTheory
@@ -156,7 +156,7 @@ theorem ae_lt_top [IsFiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} : ∀ᵐ
#align measure_theory.pdf.ae_lt_top MeasureTheory.pdf.ae_lt_top
theorem ofReal_toReal_ae_eq [IsFiniteMeasure ℙ] {X : Ω → E} :
- (fun x => Ennreal.ofReal (pdf X ℙ μ x).toReal) =ᵐ[μ] pdf X ℙ μ :=
+ (fun x => ENNReal.ofReal (pdf X ℙ μ x).toReal) =ᵐ[μ] pdf X ℙ μ :=
ofReal_toReal_ae_eq ae_lt_top
#align measure_theory.pdf.of_real_to_real_ae_eq MeasureTheory.pdf.ofReal_toReal_ae_eq
@@ -184,20 +184,20 @@ theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPd
· congr 2
· have :
∀ x,
- Ennreal.ofReal (f x * (pdf X ℙ μ x).toReal) =
- Ennreal.ofReal (pdf X ℙ μ x).toReal * Ennreal.ofReal (f x) :=
+ ENNReal.ofReal (f x * (pdf X ℙ μ x).toReal) =
+ ENNReal.ofReal (pdf X ℙ μ x).toReal * ENNReal.ofReal (f x) :=
by
intro x
- rw [mul_comm, Ennreal.ofReal_mul Ennreal.toReal_nonneg]
+ rw [mul_comm, ENNReal.ofReal_mul ENNReal.toReal_nonneg]
simp_rw [this]
exact lintegral_congr_ae (Filter.EventuallyEq.mul of_real_to_real_ae_eq (ae_eq_refl _))
· have :
∀ x,
- Ennreal.ofReal (-(f x * (pdf X ℙ μ x).toReal)) =
- Ennreal.ofReal (pdf X ℙ μ x).toReal * Ennreal.ofReal (-f x) :=
+ ENNReal.ofReal (-(f x * (pdf X ℙ μ x).toReal)) =
+ ENNReal.ofReal (pdf X ℙ μ x).toReal * ENNReal.ofReal (-f x) :=
by
intro x
- rw [neg_mul_eq_neg_mul, mul_comm, Ennreal.ofReal_mul Ennreal.toReal_nonneg]
+ rw [neg_mul_eq_neg_mul, mul_comm, ENNReal.ofReal_mul ENNReal.toReal_nonneg]
simp_rw [this]
exact lintegral_congr_ae (Filter.EventuallyEq.mul of_real_to_real_ae_eq (ae_eq_refl _))
· refine' ⟨hf.ae_strongly_measurable, _⟩
@@ -207,12 +207,12 @@ theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPd
have :
(fun x => (pdf X ℙ μ * fun x => ↑‖f x‖₊) x) =ᵐ[μ] fun x => ‖f x * (pdf X ℙ μ x).toReal‖₊ :=
by
- simp_rw [← smul_eq_mul, nnnorm_smul, Ennreal.coe_mul]
+ simp_rw [← smul_eq_mul, nnnorm_smul, ENNReal.coe_mul]
rw [smul_eq_mul, mul_comm]
refine' Filter.EventuallyEq.mul (ae_eq_refl _) (ae_eq_trans of_real_to_real_ae_eq.symm _)
convert ae_eq_refl _
ext1 x
- exact Real.ennnorm_eq_ofReal Ennreal.toReal_nonneg
+ exact Real.ennnorm_eq_ofReal ENNReal.toReal_nonneg
rw [lintegral_congr_ae this]
exact hpdf.2
· rw [integral_undef hpdf, integral_undef]
@@ -327,11 +327,11 @@ theorem hasFiniteIntegralMul {f : ℝ → ℝ} {g : ℝ → ℝ≥0∞} (hg : pd
(Filter.EventuallyEq.mul (ae_eq_refl fun x => ‖f x‖₊)
(ae_eq_trans hg.symm of_real_to_real_ae_eq.symm))
_
- simp_rw [← smul_eq_mul, nnnorm_smul, Ennreal.coe_mul, smul_eq_mul]
+ simp_rw [← smul_eq_mul, nnnorm_smul, ENNReal.coe_mul, smul_eq_mul]
refine' Filter.EventuallyEq.mul (ae_eq_refl _) _
convert ae_eq_refl _
ext1 x
- exact Real.ennnorm_eq_ofReal Ennreal.toReal_nonneg
+ exact Real.ennnorm_eq_ofReal ENNReal.toReal_nonneg
rwa [lt_top_iff_ne_top, ← lintegral_congr_ae this]
#align measure_theory.pdf.has_finite_integral_mul MeasureTheory.pdf.hasFiniteIntegralMul
@@ -373,7 +373,7 @@ theorem pdf_toReal_ae_eq {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure
{s : Set E} (hX : IsUniform X s ℙ μ) :
(fun x => (pdf X ℙ μ x).toReal) =ᵐ[μ] fun x =>
(s.indicator ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) x).toReal :=
- Filter.EventuallyEq.fun_comp hX Ennreal.toReal
+ Filter.EventuallyEq.fun_comp hX ENNReal.toReal
#align measure_theory.pdf.is_uniform.pdf_to_real_ae_eq MeasureTheory.pdf.IsUniform.pdf_toReal_ae_eq
theorem measure_preimage {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
@@ -385,7 +385,7 @@ theorem measure_preimage {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure
lintegral_congr_ae hu.restrict]
simp only [hms, hA, lintegral_indicator, Pi.smul_apply, Pi.one_apply, Algebra.id.smul_eq_mul,
mul_one, lintegral_const, restrict_apply', Set.univ_inter]
- rw [Ennreal.div_eq_inv_mul]
+ rw [ENNReal.div_eq_inv_mul]
#align measure_theory.pdf.is_uniform.measure_preimage MeasureTheory.pdf.IsUniform.measure_preimage
theorem isProbabilityMeasure {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
@@ -394,7 +394,7 @@ theorem isProbabilityMeasure {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Meas
⟨by
have : X ⁻¹' Set.univ = Set.univ := by simp only [Set.preimage_univ]
rw [← this, hu.measure_preimage hns hnt hms MeasurableSet.univ, Set.inter_univ,
- Ennreal.div_self hns hnt]⟩
+ ENNReal.div_self hns hnt]⟩
#align measure_theory.pdf.is_uniform.is_probability_measure MeasureTheory.pdf.IsUniform.isProbabilityMeasure
variable {X : Ω → ℝ} {s : Set ℝ} (hms : MeasurableSet s) (hns : volume s ≠ 0)
@@ -411,10 +411,10 @@ theorem mulPdfIntegrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUnif
refine' integrable.congr (integrable_zero _ _ _) _
rw [(by simp : (fun x => 0 : ℝ → ℝ) = fun x => x * (0 : ℝ≥0∞).toReal)]
refine'
- Filter.EventuallyEq.mul (ae_eq_refl _) (Filter.EventuallyEq.fun_comp this.symm Ennreal.toReal)
+ Filter.EventuallyEq.mul (ae_eq_refl _) (Filter.EventuallyEq.fun_comp this.symm ENNReal.toReal)
refine'
⟨ae_strongly_measurable_id.mul
- (measurable_pdf X ℙ).AeMeasurable.ennreal_toReal.AeStronglyMeasurable,
+ (measurable_pdf X ℙ).AeMeasurable.eNNReal_toReal.AeStronglyMeasurable,
_⟩
refine' has_finite_integral_mul huX _
set ind := (volume s)⁻¹ • (1 : ℝ → ℝ≥0∞) with hind
@@ -425,8 +425,8 @@ theorem mulPdfIntegrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUnif
rw [lintegral_mul_const _ measurable_nnnorm.coe_nnreal_ennreal]
·
refine'
- (Ennreal.mul_lt_top (set_lintegral_lt_top_of_is_compact hsupp hcs continuous_nnnorm).Ne
- (Ennreal.inv_lt_top.2 (pos_iff_ne_zero.mpr hns)).Ne).Ne
+ (ENNReal.mul_lt_top (set_lintegral_lt_top_of_is_compact hsupp hcs continuous_nnnorm).Ne
+ (ENNReal.inv_lt_top.2 (pos_iff_ne_zero.mpr hns)).Ne).Ne
· infer_instance
#align measure_theory.pdf.is_uniform.mul_pdf_integrable MeasureTheory.pdf.IsUniform.mulPdfIntegrable
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -241,7 +241,7 @@ variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F
theorem integrable_pdf_smul_iff [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → F}
(hf : AEStronglyMeasurable f μ) :
Integrable (fun x => (pdf X ℙ μ x).toReal • f x) μ ↔ Integrable (fun x => f (X x)) ℙ := by
- -- porting note: using `erw` because `rw` doesn't recognize `(f <| X ·)` as `f ∘ X`
+ -- Porting note: using `erw` because `rw` doesn't recognize `(f <| X ·)` as `f ∘ X`
-- https://github.com/leanprover-community/mathlib4/issues/5164
erw [← integrable_map_measure (hf.mono' HasPDF.absolutelyContinuous) (HasPDF.aemeasurable X ℙ μ),
map_eq_withDensity_pdf X ℙ μ, pdf_def, integrable_rnDeriv_smul_iff HasPDF.absolutelyContinuous]
≤
on measures (#10714)
Redefine ≤
on MeasureTheory.Measure
so that μ ≤ ν ↔ ∀ s, μ s ≤ ν s
by definition
instead of ∀ s, MeasurableSet s → μ s ≤ ν s
.
≤
on outer measures;DFunLike
types
and migrate measures to FunLike
, then this is unavoidable;μ ≤ ν
this way";
the counter-argument is
"it's slightly harder to apply μ ≤ ν
this way".@[gcongr]
tags to some ENNReal
lemmas;ENNReal.coe_lt_coe_of_le
-> ENNReal.ENNReal.coe_lt_coe_of_lt
;MeasurableSet
assumption
in set_lintegral_pdf_le_map
@@ -175,10 +175,10 @@ theorem withDensity_pdf_le_map {_ : MeasurableSpace Ω} (X : Ω → E) (ℙ : Me
withDensity_rnDeriv_le _ _
theorem set_lintegral_pdf_le_map {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
- (μ : Measure E := by volume_tac) {s : Set E} (hs : MeasurableSet s) :
+ (μ : Measure E := by volume_tac) (s : Set E) :
∫⁻ x in s, pdf X ℙ μ x ∂μ ≤ map X ℙ s := by
apply (withDensity_apply_le _ s).trans
- exact withDensity_pdf_le_map _ _ _ s hs
+ exact withDensity_pdf_le_map _ _ _ s
theorem map_eq_withDensity_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by volume_tac) [hX : HasPDF X ℙ μ] :
feat : collect uniform distribution for measures and uniform PMF in one file.
This collects the various notions of uniform distribution in one file, to unify them with a forthcoming PR.
@@ -338,138 +338,6 @@ theorem hasFiniteIntegral_mul {f : ℝ → ℝ} {g : ℝ → ℝ≥0∞} (hg : p
end Real
-section
-
-/-! **Uniform Distribution** -/
-
-/-- A random variable `X` has uniform distribution on `s` if its push-forward measure is
-`(μ s)⁻¹ • μ.restrict s`. -/
-def IsUniform (X : Ω → E) (support : Set E) (ℙ : Measure Ω) (μ : Measure E := by volume_tac) :=
- map X ℙ = (μ support)⁻¹ • μ.restrict support
-#align measure_theory.pdf.is_uniform MeasureTheory.pdf.IsUniform
-
-namespace IsUniform
-
-theorem aemeasurable {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
- (hu : IsUniform X s ℙ μ) : AEMeasurable X ℙ := by
- dsimp [IsUniform] at hu
- by_contra h
- rw [map_of_not_aemeasurable h] at hu
- apply zero_ne_one' ℝ≥0∞
- calc
- 0 = (0 : Measure E) Set.univ := rfl
- _ = _ := by rw [hu, smul_apply, restrict_apply MeasurableSet.univ,
- Set.univ_inter, smul_eq_mul, ENNReal.inv_mul_cancel hns hnt]
-
-theorem absolutelyContinuous {X : Ω → E} {s : Set E} (hu : IsUniform X s ℙ μ) : map X ℙ ≪ μ := by
- intro t ht
- rw [hu, smul_apply, smul_eq_mul]
- apply mul_eq_zero.mpr
- refine Or.inr (le_antisymm ?_ (zero_le _))
- exact ht ▸ restrict_apply_le s t
-
-theorem measure_preimage {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
- (hu : IsUniform X s ℙ μ) {A : Set E} (hA : MeasurableSet A) :
- ℙ (X ⁻¹' A) = μ (s ∩ A) / μ s := by
- rw [← map_apply_of_aemeasurable (hu.aemeasurable hns hnt) hA, hu, smul_apply, restrict_apply hA,
- ENNReal.div_eq_inv_mul, smul_eq_mul, Set.inter_comm]
-#align measure_theory.pdf.is_uniform.measure_preimage MeasureTheory.pdf.IsUniform.measure_preimage
-
-theorem isProbabilityMeasure {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
- (hu : IsUniform X s ℙ μ) : IsProbabilityMeasure ℙ :=
- ⟨by
- have : X ⁻¹' Set.univ = Set.univ := Set.preimage_univ
- rw [← this, hu.measure_preimage hns hnt MeasurableSet.univ, Set.inter_univ,
- ENNReal.div_self hns hnt]⟩
-#align measure_theory.pdf.is_uniform.is_probability_measure MeasureTheory.pdf.IsUniform.isProbabilityMeasure
-
-theorem toMeasurable_iff {X : Ω → E} {s : Set E} :
- IsUniform X (toMeasurable μ s) ℙ μ ↔ IsUniform X s ℙ μ := by
- by_cases hnt : μ s = ∞
- · simp [IsUniform, hnt]
- · simp [IsUniform, restrict_toMeasurable hnt]
-
-protected theorem toMeasurable {X : Ω → E} {s : Set E} (hu : IsUniform X s ℙ μ) :
- IsUniform X (toMeasurable μ s) ℙ μ := toMeasurable_iff.2 hu
-
-theorem hasPDF {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
- (hu : IsUniform X s ℙ μ) : HasPDF X ℙ μ := by
- let t := toMeasurable μ s
- apply hasPDF_of_map_eq_withDensity (hu.aemeasurable hns hnt) (t.indicator ((μ t)⁻¹ • 1)) <|
- (measurable_one.aemeasurable.const_smul (μ t)⁻¹).indicator (measurableSet_toMeasurable μ s)
- rw [hu, withDensity_indicator (measurableSet_toMeasurable μ s), withDensity_smul _ measurable_one,
- withDensity_one, restrict_toMeasurable hnt, measure_toMeasurable]
-#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF
-
-theorem pdf_eq_zero_of_measure_eq_zero_or_top {X : Ω → E} {s : Set E}
- (hu : IsUniform X s ℙ μ) (hμs : μ s = 0 ∨ μ s = ∞) : pdf X ℙ μ =ᵐ[μ] 0 := by
- rcases hμs with H|H
- · simp only [IsUniform, H, ENNReal.inv_zero, restrict_eq_zero.mpr H, smul_zero] at hu
- simp [pdf, hu]
- · simp only [IsUniform, H, ENNReal.inv_top, zero_smul] at hu
- simp [pdf, hu]
-
-theorem pdf_eq {X : Ω → E} {s : Set E} (hms : MeasurableSet s)
- (hu : IsUniform X s ℙ μ) : pdf X ℙ μ =ᵐ[μ] s.indicator ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) := by
- by_cases hnt : μ s = ∞
- · simp [pdf_eq_zero_of_measure_eq_zero_or_top hu (Or.inr hnt), hnt]
- by_cases hns : μ s = 0
- · filter_upwards [measure_zero_iff_ae_nmem.mp hns,
- pdf_eq_zero_of_measure_eq_zero_or_top hu (Or.inl hns)] with x hx h'x
- simp [hx, h'x, hns]
- have : HasPDF X ℙ μ := hasPDF hns hnt hu
- have : IsProbabilityMeasure ℙ := isProbabilityMeasure hns hnt hu
- apply (eq_of_map_eq_withDensity _ _).mp
- · rw [hu, withDensity_indicator hms, withDensity_smul _ measurable_one, withDensity_one]
- · exact (measurable_one.aemeasurable.const_smul (μ s)⁻¹).indicator hms
-
-theorem pdf_toReal_ae_eq {X : Ω → E} {s : Set E} (hms : MeasurableSet s)
- (hX : IsUniform X s ℙ μ) :
- (fun x => (pdf X ℙ μ x).toReal) =ᵐ[μ] fun x =>
- (s.indicator ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) x).toReal :=
- Filter.EventuallyEq.fun_comp (pdf_eq hms hX) ENNReal.toReal
-#align measure_theory.pdf.is_uniform.pdf_to_real_ae_eq MeasureTheory.pdf.IsUniform.pdf_toReal_ae_eq
-
-variable {X : Ω → ℝ} {s : Set ℝ}
-
-theorem mul_pdf_integrable (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
- Integrable fun x : ℝ => x * (pdf X ℙ volume x).toReal := by
- by_cases hnt : volume s = 0 ∨ volume s = ∞
- · have I : Integrable (fun x ↦ x * ENNReal.toReal (0)) := by simp
- apply I.congr
- filter_upwards [pdf_eq_zero_of_measure_eq_zero_or_top huX hnt] with x hx
- simp [hx]
- simp only [not_or] at hnt
- have : IsProbabilityMeasure ℙ := isProbabilityMeasure hnt.1 hnt.2 huX
- constructor
- · exact aestronglyMeasurable_id.mul
- (measurable_pdf X ℙ).aemeasurable.ennreal_toReal.aestronglyMeasurable
- refine' hasFiniteIntegral_mul (pdf_eq hcs.measurableSet huX) _
- set ind := (volume s)⁻¹ • (1 : ℝ → ℝ≥0∞)
- have : ∀ x, ↑‖x‖₊ * s.indicator ind x = s.indicator (fun x => ‖x‖₊ * ind x) x := fun x =>
- (s.indicator_mul_right (fun x => ↑‖x‖₊) ind).symm
- simp only [this, lintegral_indicator _ hcs.measurableSet, mul_one, Algebra.id.smul_eq_mul,
- Pi.one_apply, Pi.smul_apply]
- rw [lintegral_mul_const _ measurable_nnnorm.coe_nnreal_ennreal]
- exact (ENNReal.mul_lt_top (set_lintegral_lt_top_of_isCompact hnt.2 hcs continuous_nnnorm).ne
- (ENNReal.inv_lt_top.2 (pos_iff_ne_zero.mpr hnt.1)).ne).ne
-#align measure_theory.pdf.is_uniform.mul_pdf_integrable MeasureTheory.pdf.IsUniform.mul_pdf_integrable
-
-/-- A real uniform random variable `X` with support `s` has expectation
-`(λ s)⁻¹ * ∫ x in s, x ∂λ` where `λ` is the Lebesgue measure. -/
-theorem integral_eq (huX : IsUniform X s ℙ) :
- ∫ x, X x ∂ℙ = (volume s)⁻¹.toReal * ∫ x in s, x := by
- rw [← smul_eq_mul, ← integral_smul_measure, ← huX]
- by_cases hX : AEMeasurable X ℙ
- · exact (integral_map hX aestronglyMeasurable_id).symm
- · rw [map_of_not_aemeasurable hX, integral_zero_measure, integral_non_aestronglyMeasurable]
- rwa [aestronglyMeasurable_iff_aemeasurable]
-#align measure_theory.pdf.is_uniform.integral_eq MeasureTheory.pdf.IsUniform.integral_eq
-
-end IsUniform
-
-end
-
section TwoVariables
open ProbabilityTheory
IsUniform.integral_eq
(#10021)
Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr>
@@ -378,79 +378,92 @@ theorem measure_preimage {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ
theorem isProbabilityMeasure {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
(hu : IsUniform X s ℙ μ) : IsProbabilityMeasure ℙ :=
⟨by
- have : X ⁻¹' Set.univ = Set.univ := by simp only [Set.preimage_univ]
+ have : X ⁻¹' Set.univ = Set.univ := Set.preimage_univ
rw [← this, hu.measure_preimage hns hnt MeasurableSet.univ, Set.inter_univ,
ENNReal.div_self hns hnt]⟩
#align measure_theory.pdf.is_uniform.is_probability_measure MeasureTheory.pdf.IsUniform.isProbabilityMeasure
-theorem hasPDF {X : Ω → E} {s : Set E} (hms : MeasurableSet s) (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
+theorem toMeasurable_iff {X : Ω → E} {s : Set E} :
+ IsUniform X (toMeasurable μ s) ℙ μ ↔ IsUniform X s ℙ μ := by
+ by_cases hnt : μ s = ∞
+ · simp [IsUniform, hnt]
+ · simp [IsUniform, restrict_toMeasurable hnt]
+
+protected theorem toMeasurable {X : Ω → E} {s : Set E} (hu : IsUniform X s ℙ μ) :
+ IsUniform X (toMeasurable μ s) ℙ μ := toMeasurable_iff.2 hu
+
+theorem hasPDF {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
(hu : IsUniform X s ℙ μ) : HasPDF X ℙ μ := by
- apply hasPDF_of_map_eq_withDensity (hu.aemeasurable hns hnt) (s.indicator ((μ s)⁻¹ • 1)) <|
- (measurable_one.aemeasurable.const_smul (μ s)⁻¹).indicator hms
- rw [hu, withDensity_indicator hms, withDensity_smul _ measurable_one, withDensity_one]
+ let t := toMeasurable μ s
+ apply hasPDF_of_map_eq_withDensity (hu.aemeasurable hns hnt) (t.indicator ((μ t)⁻¹ • 1)) <|
+ (measurable_one.aemeasurable.const_smul (μ t)⁻¹).indicator (measurableSet_toMeasurable μ s)
+ rw [hu, withDensity_indicator (measurableSet_toMeasurable μ s), withDensity_smul _ measurable_one,
+ withDensity_one, restrict_toMeasurable hnt, measure_toMeasurable]
#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF
-theorem hasPDF₀ {X : Ω → E} {s : Set E} (hms : NullMeasurableSet s μ) (hns : μ s ≠ 0)
- (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : HasPDF X ℙ μ := by
- have hms' := measurableSet_toMeasurable μ s
- apply hasPDF (m := m) (ℙ := ℙ) (μ := μ) hms'
- (measure_toMeasurable s ▸ hns) (measure_toMeasurable s ▸ hnt) _
- unfold IsUniform
- rw [measure_toMeasurable, restrict_congr_set hms.toMeasurable_ae_eq, hu]
+theorem pdf_eq_zero_of_measure_eq_zero_or_top {X : Ω → E} {s : Set E}
+ (hu : IsUniform X s ℙ μ) (hμs : μ s = 0 ∨ μ s = ∞) : pdf X ℙ μ =ᵐ[μ] 0 := by
+ rcases hμs with H|H
+ · simp only [IsUniform, H, ENNReal.inv_zero, restrict_eq_zero.mpr H, smul_zero] at hu
+ simp [pdf, hu]
+ · simp only [IsUniform, H, ENNReal.inv_top, zero_smul] at hu
+ simp [pdf, hu]
-theorem pdf_eq {X : Ω → E} {s : Set E} (hms : MeasurableSet s) (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
+theorem pdf_eq {X : Ω → E} {s : Set E} (hms : MeasurableSet s)
(hu : IsUniform X s ℙ μ) : pdf X ℙ μ =ᵐ[μ] s.indicator ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) := by
- have : HasPDF X ℙ μ := hasPDF hms hns hnt hu
+ by_cases hnt : μ s = ∞
+ · simp [pdf_eq_zero_of_measure_eq_zero_or_top hu (Or.inr hnt), hnt]
+ by_cases hns : μ s = 0
+ · filter_upwards [measure_zero_iff_ae_nmem.mp hns,
+ pdf_eq_zero_of_measure_eq_zero_or_top hu (Or.inl hns)] with x hx h'x
+ simp [hx, h'x, hns]
+ have : HasPDF X ℙ μ := hasPDF hns hnt hu
have : IsProbabilityMeasure ℙ := isProbabilityMeasure hns hnt hu
apply (eq_of_map_eq_withDensity _ _).mp
· rw [hu, withDensity_indicator hms, withDensity_smul _ measurable_one, withDensity_one]
· exact (measurable_one.aemeasurable.const_smul (μ s)⁻¹).indicator hms
-theorem pdf_toReal_ae_eq {X : Ω → E}
- {s : Set E} (hms : MeasurableSet s) (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
+theorem pdf_toReal_ae_eq {X : Ω → E} {s : Set E} (hms : MeasurableSet s)
(hX : IsUniform X s ℙ μ) :
(fun x => (pdf X ℙ μ x).toReal) =ᵐ[μ] fun x =>
(s.indicator ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) x).toReal :=
- Filter.EventuallyEq.fun_comp (pdf_eq hms hns hnt hX) ENNReal.toReal
+ Filter.EventuallyEq.fun_comp (pdf_eq hms hX) ENNReal.toReal
#align measure_theory.pdf.is_uniform.pdf_to_real_ae_eq MeasureTheory.pdf.IsUniform.pdf_toReal_ae_eq
-variable {X : Ω → ℝ} {s : Set ℝ} (hms : MeasurableSet s) (hns : volume s ≠ 0) (hnt : volume s ≠ ∞)
+variable {X : Ω → ℝ} {s : Set ℝ}
-theorem mul_pdf_integrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
+theorem mul_pdf_integrable (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
Integrable fun x : ℝ => x * (pdf X ℙ volume x).toReal := by
- constructor -- porting note: `refine` was failing, don't know why
+ by_cases hnt : volume s = 0 ∨ volume s = ∞
+ · have I : Integrable (fun x ↦ x * ENNReal.toReal (0)) := by simp
+ apply I.congr
+ filter_upwards [pdf_eq_zero_of_measure_eq_zero_or_top huX hnt] with x hx
+ simp [hx]
+ simp only [not_or] at hnt
+ have : IsProbabilityMeasure ℙ := isProbabilityMeasure hnt.1 hnt.2 huX
+ constructor
· exact aestronglyMeasurable_id.mul
(measurable_pdf X ℙ).aemeasurable.ennreal_toReal.aestronglyMeasurable
- refine' hasFiniteIntegral_mul (pdf_eq hms hns hnt huX) _
+ refine' hasFiniteIntegral_mul (pdf_eq hcs.measurableSet huX) _
set ind := (volume s)⁻¹ • (1 : ℝ → ℝ≥0∞)
have : ∀ x, ↑‖x‖₊ * s.indicator ind x = s.indicator (fun x => ‖x‖₊ * ind x) x := fun x =>
(s.indicator_mul_right (fun x => ↑‖x‖₊) ind).symm
- simp only [this, lintegral_indicator _ hms, mul_one, Algebra.id.smul_eq_mul, Pi.one_apply,
- Pi.smul_apply]
+ simp only [this, lintegral_indicator _ hcs.measurableSet, mul_one, Algebra.id.smul_eq_mul,
+ Pi.one_apply, Pi.smul_apply]
rw [lintegral_mul_const _ measurable_nnnorm.coe_nnreal_ennreal]
- refine' (ENNReal.mul_lt_top (set_lintegral_lt_top_of_isCompact hnt hcs continuous_nnnorm).ne
- (ENNReal.inv_lt_top.2 (pos_iff_ne_zero.mpr hns)).ne).ne
+ exact (ENNReal.mul_lt_top (set_lintegral_lt_top_of_isCompact hnt.2 hcs continuous_nnnorm).ne
+ (ENNReal.inv_lt_top.2 (pos_iff_ne_zero.mpr hnt.1)).ne).ne
#align measure_theory.pdf.is_uniform.mul_pdf_integrable MeasureTheory.pdf.IsUniform.mul_pdf_integrable
/-- A real uniform random variable `X` with support `s` has expectation
`(λ s)⁻¹ * ∫ x in s, x ∂λ` where `λ` is the Lebesgue measure. -/
theorem integral_eq (huX : IsUniform X s ℙ) :
∫ x, X x ∂ℙ = (volume s)⁻¹.toReal * ∫ x in s, x := by
- haveI := hasPDF hms hns hnt huX
- haveI := huX.isProbabilityMeasure hns hnt
- rw [← integral_mul_eq_integral]
- rw [integral_congr_ae (Filter.EventuallyEq.mul (ae_eq_refl _) (pdf_toReal_ae_eq hms hns hnt huX))]
- have :
- ∀ x,
- x * (s.indicator ((volume s)⁻¹ • (1 : ℝ → ℝ≥0∞)) x).toReal =
- x * s.indicator ((volume s)⁻¹.toReal • (1 : ℝ → ℝ)) x := by
- refine' fun x => congr_arg (x * ·) _
- by_cases hx : x ∈ s
- · simp [Set.indicator_of_mem hx]
- · simp [Set.indicator_of_not_mem hx]
- simp_rw [this, ← s.indicator_mul_right fun x => x, integral_indicator hms]
- change ∫ x in s, x * (volume s)⁻¹.toReal • (1 : ℝ) = _
- rw [integral_mul_right, mul_comm, smul_eq_mul, mul_one]
+ rw [← smul_eq_mul, ← integral_smul_measure, ← huX]
+ by_cases hX : AEMeasurable X ℙ
+ · exact (integral_map hX aestronglyMeasurable_id).symm
+ · rw [map_of_not_aemeasurable hX, integral_zero_measure, integral_non_aestronglyMeasurable]
+ rwa [aestronglyMeasurable_iff_aemeasurable]
#align measure_theory.pdf.is_uniform.integral_eq MeasureTheory.pdf.IsUniform.integral_eq
end IsUniform
(· op ·) a
by (a op ·)
(#8843)
I used the regex \(\(· (.) ·\) (.)\)
, replacing with ($2 $1 ·)
.
@@ -444,7 +444,7 @@ theorem integral_eq (huX : IsUniform X s ℙ) :
∀ x,
x * (s.indicator ((volume s)⁻¹ • (1 : ℝ → ℝ≥0∞)) x).toReal =
x * s.indicator ((volume s)⁻¹.toReal • (1 : ℝ → ℝ)) x := by
- refine' fun x => congr_arg ((· * ·) x) _
+ refine' fun x => congr_arg (x * ·) _
by_cases hx : x ∈ s
· simp [Set.indicator_of_mem hx]
· simp [Set.indicator_of_not_mem hx]
Defines pdf
in terms of rnDeriv
.
Main definition change:
/-- A random variable `X : Ω → E` is said to `HasPDF` with respect to the measure `ℙ` on `Ω` and
`μ` on `E` if the push-forward measure of `ℙ` along `X` is absolutely continuous with respect to
`μ` and they `HaveLebesgueDecomposition`. -/
class HasPDF {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by volume_tac) : Prop where
pdf' : Measurable X ∧ HaveLebesgueDecomposition (map X ℙ) μ ∧ map X ℙ ≪ μ
/-- If `X` is a random variable that `HasPDF X ℙ μ`, then `pdf X` is the Radon–Nikodym
derivative of the push-forward measure of `ℙ` along `X` with respect to `μ`. -/
def pdf {_ : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω) (μ : Measure E := by volume_tac) :
E → ℝ≥0∞ :=
if HasPDF X ℙ μ then (map X ℙ).rnDeriv μ else 0
The law of the unconscious statistician is first generalized to rnDeriv
on a general Banach space (∫ x, (μ.rnDeriv ν x).toReal • f x ∂ν = ∫ x, f x ∂μ
), and then proven for PDFs.
@@ -13,7 +13,8 @@ import Mathlib.Probability.Independence.Basic
# Probability density function
This file defines the probability density function of random variables, by which we mean
-measurable functions taking values in a Borel space. In particular, a measurable function `f`
+measurable functions taking values in a Borel space. The probability density function is defined
+as the Radon–Nikodym derivative of the law of `X`. In particular, a measurable function `f`
is said to the probability density function of a random variable `X` if for all measurable
sets `S`, `ℙ(X ∈ S) = ∫ x in S, f x dx`. Probability density functions are one way of describing
the distribution of a random variable, and are useful for calculating probabilities and
@@ -25,19 +26,18 @@ random variables with this distribution.
## Main definitions
* `MeasureTheory.HasPDF` : A random variable `X : Ω → E` is said to `HasPDF` with
- respect to the measure `ℙ` on `Ω` and `μ` on `E` if there exists a measurable function `f`
- such that the push-forward measure of `ℙ` along `X` equals `μ.withDensity f`.
+ respect to the measure `ℙ` on `Ω` and `μ` on `E` if the push-forward measure of `ℙ` along `X`
+ is absolutely continuous with respect to `μ` and they `HaveLebesgueDecomposition`.
* `MeasureTheory.pdf` : If `X` is a random variable that `HasPDF X ℙ μ`, then `pdf X`
- is the measurable function `f` such that the push-forward measure of `ℙ` along `X` equals
- `μ.withDensity f`.
+ is the Radon–Nikodym derivative of the push-forward measure of `ℙ` along `X` with respect to `μ`.
* `MeasureTheory.pdf.IsUniform` : A random variable `X` is said to follow the uniform
distribution if it has a constant probability density function with a compact, non-null support.
## Main results
-* `MeasureTheory.pdf.integral_fun_mul_eq_integral` : Law of the unconscious statistician,
- i.e. if a random variable `X : Ω → E` has pdf `f`, then `𝔼(g(X)) = ∫ x, g x * f x dx` for
- all measurable `g : E → ℝ`.
+* `MeasureTheory.pdf.integral_pdf_smul` : Law of the unconscious statistician,
+ i.e. if a random variable `X : Ω → E` has pdf `f`, then `𝔼(g(X)) = ∫ x, f x • g x dx` for
+ all measurable `g : E → F`.
* `MeasureTheory.pdf.integral_mul_eq_integral` : A real-valued random variable `X` with
pdf `f` has expectation `∫ x, x * f x dx`.
* `MeasureTheory.pdf.IsUniform.integral_eq` : If `X` follows the uniform distribution with
@@ -63,67 +63,132 @@ namespace MeasureTheory
variable {Ω E : Type*} [MeasurableSpace E]
/-- A random variable `X : Ω → E` is said to `HasPDF` with respect to the measure `ℙ` on `Ω` and
-`μ` on `E` if there exists a measurable function `f` such that the push-forward measure of `ℙ`
-along `X` equals `μ.withDensity f`. -/
+`μ` on `E` if the push-forward measure of `ℙ` along `X` is absolutely continuous with respect to
+`μ` and they `HaveLebesgueDecomposition`. -/
class HasPDF {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by volume_tac) : Prop where
- -- porting note: TODO: split into fields `Measurable` and `exists_pdf`
- pdf' : Measurable X ∧ ∃ f : E → ℝ≥0∞, Measurable f ∧ map X ℙ = μ.withDensity f
+ pdf' : AEMeasurable X ℙ ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ
#align measure_theory.has_pdf MeasureTheory.HasPDF
+section HasPDF
+
+variable {_ : MeasurableSpace Ω}
+
+theorem hasPDF_iff {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E} :
+ HasPDF X ℙ μ ↔ AEMeasurable X ℙ ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ :=
+ ⟨@HasPDF.pdf' _ _ _ _ _ _ _, HasPDF.mk⟩
+#align measure_theory.pdf.has_pdf_iff MeasureTheory.hasPDF_iff
+
+theorem hasPDF_iff_of_aemeasurable {X : Ω → E} {ℙ : Measure Ω}
+ {μ : Measure E} (hX : AEMeasurable X ℙ) :
+ HasPDF X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ := by
+ rw [hasPDF_iff]
+ simp only [hX, true_and]
+#align measure_theory.pdf.has_pdf_iff_of_measurable MeasureTheory.hasPDF_iff_of_aemeasurable
+
@[measurability]
-theorem HasPDF.measurable {_ : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
- (μ : Measure E := by volume_tac) [hX : HasPDF X ℙ μ] :
- Measurable X :=
+theorem HasPDF.aemeasurable (X : Ω → E) (ℙ : Measure Ω)
+ (μ : Measure E) [hX : HasPDF X ℙ μ] : AEMeasurable X ℙ :=
hX.pdf'.1
-#align measure_theory.has_pdf.measurable MeasureTheory.HasPDF.measurable
+#align measure_theory.has_pdf.measurable MeasureTheory.HasPDF.aemeasurable
+
+instance HasPDF.haveLebesgueDecomposition {X : Ω → E} {ℙ : Measure Ω}
+ {μ : Measure E} [hX : HasPDF X ℙ μ] : (map X ℙ).HaveLebesgueDecomposition μ :=
+ hX.pdf'.2.1
+#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.HasPDF.haveLebesgueDecomposition
+
+theorem HasPDF.absolutelyContinuous {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
+ [hX : HasPDF X ℙ μ] : map X ℙ ≪ μ :=
+ hX.pdf'.2.2
+#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.HasPDF.absolutelyContinuous
-/-- If `X` is a random variable that `HasPDF X ℙ μ`, then `pdf X` is the measurable function `f`
-such that the push-forward measure of `ℙ` along `X` equals `μ.withDensity f`. -/
+/-- A random variable that `HasPDF` is quasi-measure preserving. -/
+theorem HasPDF.quasiMeasurePreserving_of_measurable (X : Ω → E) (ℙ : Measure Ω) (μ : Measure E)
+ [HasPDF X ℙ μ] (h : Measurable X) : QuasiMeasurePreserving X ℙ μ :=
+ { measurable := h
+ absolutelyContinuous := HasPDF.absolutelyContinuous }
+#align measure_theory.pdf.to_quasi_measure_preserving MeasureTheory.HasPDF.quasiMeasurePreserving_of_measurable
+
+theorem HasPDF.congr {X Y : Ω → E} {ℙ : Measure Ω} {μ : Measure E} (hXY : X =ᵐ[ℙ] Y)
+ [hX : HasPDF X ℙ μ] : HasPDF Y ℙ μ :=
+ ⟨(HasPDF.aemeasurable X ℙ μ).congr hXY, ℙ.map_congr hXY ▸ hX.haveLebesgueDecomposition,
+ ℙ.map_congr hXY ▸ hX.absolutelyContinuous⟩
+
+theorem HasPDF.congr' {X Y : Ω → E} {ℙ : Measure Ω} {μ : Measure E} (hXY : X =ᵐ[ℙ] Y) :
+ HasPDF X ℙ μ ↔ HasPDF Y ℙ μ :=
+ ⟨fun _ ↦ HasPDF.congr hXY, fun _ ↦ HasPDF.congr hXY.symm⟩
+
+/-- X `HasPDF` if there is a pdf `f` such that `map X ℙ = μ.withDensity f`. -/
+theorem hasPDF_of_map_eq_withDensity {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
+ (hX : AEMeasurable X ℙ) (f : E → ℝ≥0∞) (hf : AEMeasurable f μ) (h : map X ℙ = μ.withDensity f) :
+ HasPDF X ℙ μ := by
+ refine ⟨hX, ?_, ?_⟩ <;> rw [h]
+ · rw [withDensity_congr_ae hf.ae_eq_mk]
+ exact haveLebesgueDecomposition_withDensity μ hf.measurable_mk
+ · exact withDensity_absolutelyContinuous μ f
+
+end HasPDF
+
+/-- If `X` is a random variable, then `pdf X` is the Radon–Nikodym derivative of the push-forward
+measure of `ℙ` along `X` with respect to `μ`. -/
def pdf {_ : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω) (μ : Measure E := by volume_tac) :
E → ℝ≥0∞ :=
- if hX : HasPDF X ℙ μ then Classical.choose hX.pdf'.2 else 0
+ (map X ℙ).rnDeriv μ
#align measure_theory.pdf MeasureTheory.pdf
-theorem pdf_undef {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
- (h : ¬HasPDF X ℙ μ) : pdf X ℙ μ = 0 := by simp only [pdf, dif_neg h]
-#align measure_theory.pdf_undef MeasureTheory.pdf_undef
+theorem pdf_def {_ : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E} :
+ pdf X ℙ μ = (map X ℙ).rnDeriv μ := rfl
-theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
- (h : pdf X ℙ μ ≠ 0) : HasPDF X ℙ μ := by
- by_contra hpdf
- simp [pdf, hpdf] at h
-#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPDF_of_pdf_ne_zero
+theorem pdf_of_not_aemeasurable {_ : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
+ {X : Ω → E} (hX : ¬AEMeasurable X ℙ) : pdf X ℙ μ =ᵐ[μ] 0 := by
+ rw [pdf_def, map_of_not_aemeasurable hX]
+ exact rnDeriv_zero μ
+#align measure_theory.pdf_eq_zero_of_not_measurable MeasureTheory.pdf_of_not_aemeasurable
-theorem pdf_eq_zero_of_not_measurable {_ : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
- {X : Ω → E} (hX : ¬Measurable X) : pdf X ℙ μ = 0 :=
- pdf_undef fun hpdf => hX hpdf.pdf'.1
-#align measure_theory.pdf_eq_zero_of_not_measurable MeasureTheory.pdf_eq_zero_of_not_measurable
+theorem pdf_of_not_haveLebesgueDecomposition {_ : MeasurableSpace Ω} {ℙ : Measure Ω}
+ {μ : Measure E} {X : Ω → E} (h : ¬(map X ℙ).HaveLebesgueDecomposition μ) : pdf X ℙ μ = 0 :=
+ rnDeriv_of_not_haveLebesgueDecomposition h
-theorem measurable_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
- (X : Ω → E) (h : pdf X ℙ μ ≠ 0) : Measurable X := by
- by_contra hX
- exact h (pdf_eq_zero_of_not_measurable hX)
-#align measure_theory.measurable_of_pdf_ne_zero MeasureTheory.measurable_of_pdf_ne_zero
+theorem aemeasurable_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
+ (X : Ω → E) (h : ¬pdf X ℙ μ =ᵐ[μ] 0) : AEMeasurable X ℙ := by
+ contrapose! h
+ exact pdf_of_not_aemeasurable h
+#align measure_theory.measurable_of_pdf_ne_zero MeasureTheory.aemeasurable_of_pdf_ne_zero
+
+theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
+ (hac : map X ℙ ≪ μ) (hpdf : ¬pdf X ℙ μ =ᵐ[μ] 0) : HasPDF X ℙ μ := by
+ refine ⟨?_, ?_, hac⟩
+ · exact aemeasurable_of_pdf_ne_zero X hpdf
+ · contrapose! hpdf
+ have := pdf_of_not_haveLebesgueDecomposition hpdf
+ filter_upwards using congrFun this
+#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPDF_of_pdf_ne_zero
@[measurability]
theorem measurable_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by volume_tac) : Measurable (pdf X ℙ μ) := by
- unfold pdf
- split_ifs with h
- exacts [(Classical.choose_spec h.1.2).1, measurable_zero]
+ exact measurable_rnDeriv _ _
#align measure_theory.measurable_pdf MeasureTheory.measurable_pdf
+theorem withDensity_pdf_le_map {_ : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
+ (μ : Measure E := by volume_tac) : μ.withDensity (pdf X ℙ μ) ≤ map X ℙ :=
+ withDensity_rnDeriv_le _ _
+
+theorem set_lintegral_pdf_le_map {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
+ (μ : Measure E := by volume_tac) {s : Set E} (hs : MeasurableSet s) :
+ ∫⁻ x in s, pdf X ℙ μ x ∂μ ≤ map X ℙ s := by
+ apply (withDensity_apply_le _ s).trans
+ exact withDensity_pdf_le_map _ _ _ s hs
+
theorem map_eq_withDensity_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by volume_tac) [hX : HasPDF X ℙ μ] :
- Measure.map X ℙ = μ.withDensity (pdf X ℙ μ) := by
- simp only [pdf, dif_pos hX]
- exact (Classical.choose_spec hX.pdf'.2).2
+ map X ℙ = μ.withDensity (pdf X ℙ μ) := by
+ rw [pdf_def, withDensity_rnDeriv_eq _ _ hX.absolutelyContinuous]
#align measure_theory.map_eq_with_density_pdf MeasureTheory.map_eq_withDensity_pdf
theorem map_eq_set_lintegral_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by volume_tac) [hX : HasPDF X ℙ μ] {s : Set E}
- (hs : MeasurableSet s) : Measure.map X ℙ s = ∫⁻ x in s, pdf X ℙ μ x ∂μ := by
+ (hs : MeasurableSet s) : map X ℙ s = ∫⁻ x in s, pdf X ℙ μ x ∂μ := by
rw [← withDensity_apply _ hs, map_eq_withDensity_pdf X ℙ μ]
#align measure_theory.map_eq_set_lintegral_pdf MeasureTheory.map_eq_set_lintegral_pdf
@@ -131,32 +196,30 @@ namespace pdf
variable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
+protected theorem congr {X Y : Ω → E} (hXY : X =ᵐ[ℙ] Y) : pdf X ℙ μ = pdf Y ℙ μ :=
+ by rw [pdf_def, pdf_def, map_congr hXY]
+
theorem lintegral_eq_measure_univ {X : Ω → E} [HasPDF X ℙ μ] :
∫⁻ x, pdf X ℙ μ x ∂μ = ℙ Set.univ := by
rw [← set_lintegral_univ, ← map_eq_set_lintegral_pdf X ℙ μ MeasurableSet.univ,
- Measure.map_apply (HasPDF.measurable X ℙ μ) MeasurableSet.univ, Set.preimage_univ]
+ map_apply_of_aemeasurable (HasPDF.aemeasurable X ℙ μ) MeasurableSet.univ, Set.preimage_univ]
#align measure_theory.pdf.lintegral_eq_measure_univ MeasureTheory.pdf.lintegral_eq_measure_univ
-theorem unique [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] (f : E → ℝ≥0∞)
- (hmf : AEMeasurable f μ) : ℙ.map X = μ.withDensity f ↔ pdf X ℙ μ =ᵐ[μ] f := by
+theorem eq_of_map_eq_withDensity [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] (f : E → ℝ≥0∞)
+ (hmf : AEMeasurable f μ) : map X ℙ = μ.withDensity f ↔ pdf X ℙ μ =ᵐ[μ] f := by
rw [map_eq_withDensity_pdf X ℙ μ]
apply withDensity_eq_iff (measurable_pdf X ℙ μ).aemeasurable hmf
rw [lintegral_eq_measure_univ]
exact measure_ne_top _ _
-theorem unique' [SigmaFinite μ] {X : Ω → E} [HasPDF X ℙ μ] (f : E → ℝ≥0∞) (hmf : AEMeasurable f μ) :
- ℙ.map X = μ.withDensity f ↔ pdf X ℙ μ =ᵐ[μ] f :=
+theorem eq_of_map_eq_withDensity' [SigmaFinite μ] {X : Ω → E} [HasPDF X ℙ μ] (f : E → ℝ≥0∞)
+ (hmf : AEMeasurable f μ) : map X ℙ = μ.withDensity f ↔ pdf X ℙ μ =ᵐ[μ] f :=
map_eq_withDensity_pdf X ℙ μ ▸
withDensity_eq_iff_of_sigmaFinite (measurable_pdf X ℙ μ).aemeasurable hmf
nonrec theorem ae_lt_top [IsFiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} :
- ∀ᵐ x ∂μ, pdf X ℙ μ x < ∞ := by
- by_cases hpdf : HasPDF X ℙ μ
- · haveI := hpdf
- refine' ae_lt_top (measurable_pdf X ℙ μ) _
- rw [lintegral_eq_measure_univ]
- exact measure_ne_top _ _
- · simp [pdf, hpdf]
+ ∀ᵐ x ∂μ, pdf X ℙ μ x < ∞ :=
+ rnDeriv_lt_top (map X ℙ) μ
#align measure_theory.pdf.ae_lt_top MeasureTheory.pdf.ae_lt_top
nonrec theorem ofReal_toReal_ae_eq [IsFiniteMeasure ℙ] {X : Ω → E} :
@@ -164,89 +227,39 @@ nonrec theorem ofReal_toReal_ae_eq [IsFiniteMeasure ℙ] {X : Ω → E} :
ofReal_toReal_ae_eq ae_lt_top
#align measure_theory.pdf.of_real_to_real_ae_eq MeasureTheory.pdf.ofReal_toReal_ae_eq
-theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → ℝ}
- (hf : Measurable f) :
- Integrable (fun x => f (X x)) ℙ ↔ Integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ := by
+section IntegralPDFMul
+
+/-- **The Law of the Unconscious Statistician** for nonnegative random variables. -/
+theorem lintegral_pdf_mul {X : Ω → E} [HasPDF X ℙ μ] {f : E → ℝ≥0∞}
+ (hf : AEMeasurable f μ) : ∫⁻ x, pdf X ℙ μ x * f x ∂μ = ∫⁻ x, f (X x) ∂ℙ := by
+ rw [pdf_def,
+ ← lintegral_map' (hf.mono_ac HasPDF.absolutelyContinuous) (HasPDF.aemeasurable X ℙ μ),
+ lintegral_rnDeriv_mul HasPDF.absolutelyContinuous hf]
+
+variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F]
+
+theorem integrable_pdf_smul_iff [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → F}
+ (hf : AEStronglyMeasurable f μ) :
+ Integrable (fun x => (pdf X ℙ μ x).toReal • f x) μ ↔ Integrable (fun x => f (X x)) ℙ := by
-- porting note: using `erw` because `rw` doesn't recognize `(f <| X ·)` as `f ∘ X`
-- https://github.com/leanprover-community/mathlib4/issues/5164
- erw [← integrable_map_measure hf.aestronglyMeasurable (HasPDF.measurable X ℙ μ).aemeasurable,
- map_eq_withDensity_pdf X ℙ μ, integrable_withDensity_iff (measurable_pdf _ _ _) ae_lt_top]
-#align measure_theory.pdf.integrable_iff_integrable_mul_pdf MeasureTheory.pdf.integrable_iff_integrable_mul_pdf
+ erw [← integrable_map_measure (hf.mono' HasPDF.absolutelyContinuous) (HasPDF.aemeasurable X ℙ μ),
+ map_eq_withDensity_pdf X ℙ μ, pdf_def, integrable_rnDeriv_smul_iff HasPDF.absolutelyContinuous]
+ eta_reduce
+ rw [withDensity_rnDeriv_eq _ _ HasPDF.absolutelyContinuous]
+#align measure_theory.pdf.integrable_iff_integrable_mul_pdf MeasureTheory.pdf.integrable_pdf_smul_iff
/-- **The Law of the Unconscious Statistician**: Given a random variable `X` and a measurable
-function `f`, `f ∘ X` is a random variable with expectation `∫ x, f x * pdf X ∂μ`
+function `f`, `f ∘ X` is a random variable with expectation `∫ x, pdf X x • f x ∂μ`
where `μ` is a measure on the codomain of `X`. -/
-theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → ℝ}
- (hf : Measurable f) : ∫ x, f x * (pdf X ℙ μ x).toReal ∂μ = ∫ x, f (X x) ∂ℙ := by
- by_cases hpdf : Integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ
- · rw [← integral_map (HasPDF.measurable X ℙ μ).aemeasurable hf.aestronglyMeasurable,
- map_eq_withDensity_pdf X ℙ μ, integral_eq_lintegral_pos_part_sub_lintegral_neg_part hpdf,
- integral_eq_lintegral_pos_part_sub_lintegral_neg_part,
- lintegral_withDensity_eq_lintegral_mul _ (measurable_pdf X ℙ μ) hf.neg.ennreal_ofReal,
- lintegral_withDensity_eq_lintegral_mul _ (measurable_pdf X ℙ μ) hf.ennreal_ofReal]
- · congr 2
- · have : ∀ x, ENNReal.ofReal (f x * (pdf X ℙ μ x).toReal) =
- ENNReal.ofReal (pdf X ℙ μ x).toReal * ENNReal.ofReal (f x) := fun x ↦ by
- rw [mul_comm, ENNReal.ofReal_mul ENNReal.toReal_nonneg]
- simp_rw [this]
- exact lintegral_congr_ae (Filter.EventuallyEq.mul ofReal_toReal_ae_eq (ae_eq_refl _))
- · have :
- ∀ x,
- ENNReal.ofReal (-(f x * (pdf X ℙ μ x).toReal)) =
- ENNReal.ofReal (pdf X ℙ μ x).toReal * ENNReal.ofReal (-f x) := by
- intro x
- rw [neg_mul_eq_neg_mul, mul_comm, ENNReal.ofReal_mul ENNReal.toReal_nonneg]
- simp_rw [this]
- exact lintegral_congr_ae (Filter.EventuallyEq.mul ofReal_toReal_ae_eq (ae_eq_refl _))
- · refine' ⟨hf.aestronglyMeasurable, _⟩
- rw [HasFiniteIntegral,
- lintegral_withDensity_eq_lintegral_mul _ (measurable_pdf _ _ _)
- hf.nnnorm.coe_nnreal_ennreal]
- have : (fun x => (pdf X ℙ μ * fun x => (‖f x‖₊ : ℝ≥0∞)) x) =ᵐ[μ]
- fun x => ‖f x * (pdf X ℙ μ x).toReal‖₊ := by
- simp_rw [← smul_eq_mul, nnnorm_smul, ENNReal.coe_mul]
- rw [smul_eq_mul, mul_comm]
- refine' Filter.EventuallyEq.mul (ae_eq_refl _) (ae_eq_trans ofReal_toReal_ae_eq.symm _)
- simp only [Real.ennnorm_eq_ofReal ENNReal.toReal_nonneg, ae_eq_refl]
- rw [lintegral_congr_ae this]
- exact hpdf.2
- · rw [integral_undef hpdf, integral_undef]
- rwa [← integrable_iff_integrable_mul_pdf hf] at hpdf
-#align measure_theory.pdf.integral_fun_mul_eq_integral MeasureTheory.pdf.integral_fun_mul_eq_integral
-
-theorem map_absolutelyContinuous {X : Ω → E} [HasPDF X ℙ μ] : map X ℙ ≪ μ := by
- rw [map_eq_withDensity_pdf X ℙ μ]; exact withDensity_absolutelyContinuous _ _
-#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.pdf.map_absolutelyContinuous
+theorem integral_pdf_smul [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] {f : E → F}
+ (hf : AEStronglyMeasurable f μ) : ∫ x, (pdf X ℙ μ x).toReal • f x ∂μ = ∫ x, f (X x) ∂ℙ := by
+ rw [← integral_map (HasPDF.aemeasurable X ℙ μ) (hf.mono' HasPDF.absolutelyContinuous),
+ map_eq_withDensity_pdf X ℙ μ, pdf_def, integral_rnDeriv_smul HasPDF.absolutelyContinuous,
+ withDensity_rnDeriv_eq _ _ HasPDF.absolutelyContinuous]
+#align measure_theory.pdf.integral_fun_mul_eq_integral MeasureTheory.pdf.integral_pdf_smul
-/-- A random variable that `HasPDF` is quasi-measure preserving. -/
-theorem to_quasiMeasurePreserving {X : Ω → E} [HasPDF X ℙ μ] : QuasiMeasurePreserving X ℙ μ :=
- { measurable := HasPDF.measurable X ℙ μ
- absolutelyContinuous := map_absolutelyContinuous }
-#align measure_theory.pdf.to_quasi_measure_preserving MeasureTheory.pdf.to_quasiMeasurePreserving
-
-theorem haveLebesgueDecomposition_of_hasPDF {X : Ω → E} [hX' : HasPDF X ℙ μ] :
- (map X ℙ).HaveLebesgueDecomposition μ :=
- ⟨⟨⟨0, pdf X ℙ μ⟩, by
- simp only [zero_add, measurable_pdf X ℙ μ, true_and_iff, MutuallySingular.zero_left,
- map_eq_withDensity_pdf X ℙ μ]⟩⟩
-#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.pdf.haveLebesgueDecomposition_of_hasPDF
-
-theorem hasPDF_iff {X : Ω → E} :
- HasPDF X ℙ μ ↔ Measurable X ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ := by
- constructor
- · intro hX'
- exact ⟨hX'.pdf'.1, haveLebesgueDecomposition_of_hasPDF, map_absolutelyContinuous⟩
- · rintro ⟨hX, h_decomp, h⟩
- haveI := h_decomp
- refine' ⟨⟨hX, (Measure.map X ℙ).rnDeriv μ, measurable_rnDeriv _ _, _⟩⟩
- rwa [withDensity_rnDeriv_eq]
-#align measure_theory.pdf.has_pdf_iff MeasureTheory.pdf.hasPDF_iff
-
-theorem hasPDF_iff_of_measurable {X : Ω → E} (hX : Measurable X) :
- HasPDF X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ := by
- rw [hasPDF_iff]
- simp only [hX, true_and]
-#align measure_theory.pdf.has_pdf_iff_of_measurable MeasureTheory.pdf.hasPDF_iff_of_measurable
+end IntegralPDFMul
section
@@ -257,11 +270,16 @@ map also `HasPDF` if `(map g (map X ℙ)).HaveLebesgueDecomposition μ`.
`quasiMeasurePreserving_hasPDF` is more useful in the case we are working with a
probability measure and a real-valued random variable. -/
-theorem quasiMeasurePreserving_hasPDF {X : Ω → E} [HasPDF X ℙ μ] {g : E → F}
+theorem quasiMeasurePreserving_hasPDF {X : Ω → E} [HasPDF X ℙ μ] (hX : AEMeasurable X ℙ) {g : E → F}
(hg : QuasiMeasurePreserving g μ ν) (hmap : (map g (map X ℙ)).HaveLebesgueDecomposition ν) :
HasPDF (g ∘ X) ℙ ν := by
- rw [hasPDF_iff, ← map_map hg.measurable (HasPDF.measurable X ℙ μ)]
- refine' ⟨hg.measurable.comp (HasPDF.measurable X ℙ μ), hmap, _⟩
+ wlog hmX : Measurable X
+ · have hae : g ∘ X =ᵐ[ℙ] g ∘ hX.mk := hX.ae_eq_mk.mono fun x h ↦ by dsimp; rw [h]
+ have hXmk : HasPDF hX.mk ℙ μ := HasPDF.congr hX.ae_eq_mk
+ apply (HasPDF.congr' hae).mpr
+ exact this hX.measurable_mk.aemeasurable hg (map_congr hX.ae_eq_mk ▸ hmap) hX.measurable_mk
+ rw [hasPDF_iff, ← map_map hg.measurable hmX]
+ refine' ⟨(hg.measurable.comp hmX).aemeasurable, hmap, _⟩
rw [map_eq_withDensity_pdf X ℙ μ]
refine' AbsolutelyContinuous.mk fun s hsm hs => _
rw [map_apply hg.measurable hsm, withDensity_apply _ (hg.measurable hsm)]
@@ -271,8 +289,9 @@ theorem quasiMeasurePreserving_hasPDF {X : Ω → E} [HasPDF X ℙ μ] {g : E
#align measure_theory.pdf.quasi_measure_preserving_has_pdf MeasureTheory.pdf.quasiMeasurePreserving_hasPDF
theorem quasiMeasurePreserving_hasPDF' [IsFiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E}
- [HasPDF X ℙ μ] {g : E → F} (hg : QuasiMeasurePreserving g μ ν) : HasPDF (g ∘ X) ℙ ν :=
- quasiMeasurePreserving_hasPDF hg inferInstance
+ [HasPDF X ℙ μ] (hX : AEMeasurable X ℙ) {g : E → F} (hg : QuasiMeasurePreserving g μ ν) :
+ HasPDF (g ∘ X) ℙ ν :=
+ quasiMeasurePreserving_hasPDF hX hg inferInstance
#align measure_theory.pdf.quasi_measure_preserving_has_pdf' MeasureTheory.pdf.quasiMeasurePreserving_hasPDF'
end
@@ -283,15 +302,15 @@ variable [IsFiniteMeasure ℙ] {X : Ω → ℝ}
/-- A real-valued random variable `X` `HasPDF X ℙ λ` (where `λ` is the Lebesgue measure) if and
only if the push-forward measure of `ℙ` along `X` is absolutely continuous with respect to `λ`. -/
-nonrec theorem _root_.Real.hasPDF_iff_of_measurable (hX : Measurable X) :
+nonrec theorem _root_.Real.hasPDF_iff_of_aemeasurable (hX : AEMeasurable X ℙ) :
HasPDF X ℙ ↔ map X ℙ ≪ volume := by
- rw [hasPDF_iff_of_measurable hX]
+ rw [hasPDF_iff_of_aemeasurable hX]
exact and_iff_right inferInstance
-#align measure_theory.pdf.real.has_pdf_iff_of_measurable Real.hasPDF_iff_of_measurable
+#align measure_theory.pdf.real.has_pdf_iff_of_measurable Real.hasPDF_iff_of_aemeasurable
-theorem _root_.Real.hasPDF_iff : HasPDF X ℙ ↔ Measurable X ∧ map X ℙ ≪ volume := by
- by_cases hX : Measurable X
- · rw [Real.hasPDF_iff_of_measurable hX, iff_and_self]
+theorem _root_.Real.hasPDF_iff : HasPDF X ℙ ↔ AEMeasurable X ℙ ∧ map X ℙ ≪ volume := by
+ by_cases hX : AEMeasurable X ℙ
+ · rw [Real.hasPDF_iff_of_aemeasurable hX, iff_and_self]
exact fun _ => hX
· exact ⟨fun h => False.elim (hX h.pdf'.1), fun h => False.elim (hX h.1)⟩
#align measure_theory.pdf.real.has_pdf_iff Real.hasPDF_iff
@@ -299,7 +318,9 @@ theorem _root_.Real.hasPDF_iff : HasPDF X ℙ ↔ Measurable X ∧ map X ℙ ≪
/-- If `X` is a real-valued random variable that has pdf `f`, then the expectation of `X` equals
`∫ x, x * f x ∂λ` where `λ` is the Lebesgue measure. -/
theorem integral_mul_eq_integral [HasPDF X ℙ] : ∫ x, x * (pdf X ℙ volume x).toReal = ∫ x, X x ∂ℙ :=
- integral_fun_mul_eq_integral measurable_id
+ calc
+ _ = ∫ x, (pdf X ℙ volume x).toReal * x := by congr with x; exact mul_comm _ _
+ _ = _ := integral_pdf_smul measurable_id.aestronglyMeasurable
#align measure_theory.pdf.integral_mul_eq_integral MeasureTheory.pdf.integral_mul_eq_integral
theorem hasFiniteIntegral_mul {f : ℝ → ℝ} {g : ℝ → ℝ≥0∞} (hg : pdf X ℙ =ᵐ[volume] g)
@@ -321,92 +342,104 @@ section
/-! **Uniform Distribution** -/
-/-- A random variable `X` has uniform distribution if it has a probability density function `f`
-with support `s` such that `f = (μ s)⁻¹ 1ₛ` a.e. where `1ₛ` is the indicator function for `s`. -/
-def IsUniform {_ : MeasurableSpace Ω} (X : Ω → E) (support : Set E) (ℙ : Measure Ω)
- (μ : Measure E := by volume_tac) :=
- pdf X ℙ μ =ᵐ[μ] support.indicator ((μ support)⁻¹ • (1 : E → ℝ≥0∞))
+/-- A random variable `X` has uniform distribution on `s` if its push-forward measure is
+`(μ s)⁻¹ • μ.restrict s`. -/
+def IsUniform (X : Ω → E) (support : Set E) (ℙ : Measure Ω) (μ : Measure E := by volume_tac) :=
+ map X ℙ = (μ support)⁻¹ • μ.restrict support
#align measure_theory.pdf.is_uniform MeasureTheory.pdf.IsUniform
namespace IsUniform
-theorem hasPDF {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E} {s : Set E}
- (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : HasPDF X ℙ μ :=
- hasPDF_of_pdf_ne_zero
- (by
- intro hpdf
- simp only [IsUniform, hpdf] at hu
- suffices μ (s ∩ Function.support ((μ s)⁻¹ • (1 : E → ℝ≥0∞))) = 0 by
- have heq : Function.support ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) = Set.univ := by
- ext x
- rw [Function.mem_support]
- simp [hnt]
- rw [heq, Set.inter_univ] at this
- exact hns this
- exact Set.indicator_ae_eq_zero.1 hu.symm)
-#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF
-
-theorem pdf_toReal_ae_eq {_ : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
- {s : Set E} (hX : IsUniform X s ℙ μ) :
- (fun x => (pdf X ℙ μ x).toReal) =ᵐ[μ] fun x =>
- (s.indicator ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) x).toReal :=
- Filter.EventuallyEq.fun_comp hX ENNReal.toReal
-#align measure_theory.pdf.is_uniform.pdf_to_real_ae_eq MeasureTheory.pdf.IsUniform.pdf_toReal_ae_eq
-
-theorem measure_preimage {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
- {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hms : MeasurableSet s) (hu : IsUniform X s ℙ μ)
- {A : Set E} (hA : MeasurableSet A) : ℙ (X ⁻¹' A) = μ (s ∩ A) / μ s := by
- haveI := hu.hasPDF hns hnt
- rw [← Measure.map_apply (HasPDF.measurable X ℙ μ) hA, map_eq_set_lintegral_pdf X ℙ μ hA,
- lintegral_congr_ae hu.restrict]
- simp only [hms, hA, lintegral_indicator, Pi.smul_apply, Pi.one_apply, Algebra.id.smul_eq_mul,
- mul_one, lintegral_const, restrict_apply', Set.univ_inter]
- rw [ENNReal.div_eq_inv_mul]
+theorem aemeasurable {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
+ (hu : IsUniform X s ℙ μ) : AEMeasurable X ℙ := by
+ dsimp [IsUniform] at hu
+ by_contra h
+ rw [map_of_not_aemeasurable h] at hu
+ apply zero_ne_one' ℝ≥0∞
+ calc
+ 0 = (0 : Measure E) Set.univ := rfl
+ _ = _ := by rw [hu, smul_apply, restrict_apply MeasurableSet.univ,
+ Set.univ_inter, smul_eq_mul, ENNReal.inv_mul_cancel hns hnt]
+
+theorem absolutelyContinuous {X : Ω → E} {s : Set E} (hu : IsUniform X s ℙ μ) : map X ℙ ≪ μ := by
+ intro t ht
+ rw [hu, smul_apply, smul_eq_mul]
+ apply mul_eq_zero.mpr
+ refine Or.inr (le_antisymm ?_ (zero_le _))
+ exact ht ▸ restrict_apply_le s t
+
+theorem measure_preimage {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
+ (hu : IsUniform X s ℙ μ) {A : Set E} (hA : MeasurableSet A) :
+ ℙ (X ⁻¹' A) = μ (s ∩ A) / μ s := by
+ rw [← map_apply_of_aemeasurable (hu.aemeasurable hns hnt) hA, hu, smul_apply, restrict_apply hA,
+ ENNReal.div_eq_inv_mul, smul_eq_mul, Set.inter_comm]
#align measure_theory.pdf.is_uniform.measure_preimage MeasureTheory.pdf.IsUniform.measure_preimage
-theorem isProbabilityMeasure {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
- {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hms : MeasurableSet s) (hu : IsUniform X s ℙ μ) :
- IsProbabilityMeasure ℙ :=
+theorem isProbabilityMeasure {X : Ω → E} {s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
+ (hu : IsUniform X s ℙ μ) : IsProbabilityMeasure ℙ :=
⟨by
have : X ⁻¹' Set.univ = Set.univ := by simp only [Set.preimage_univ]
- rw [← this, hu.measure_preimage hns hnt hms MeasurableSet.univ, Set.inter_univ,
+ rw [← this, hu.measure_preimage hns hnt MeasurableSet.univ, Set.inter_univ,
ENNReal.div_self hns hnt]⟩
#align measure_theory.pdf.is_uniform.is_probability_measure MeasureTheory.pdf.IsUniform.isProbabilityMeasure
-variable {X : Ω → ℝ} {s : Set ℝ} (hms : MeasurableSet s) (hns : volume s ≠ 0)
+theorem hasPDF {X : Ω → E} {s : Set E} (hms : MeasurableSet s) (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
+ (hu : IsUniform X s ℙ μ) : HasPDF X ℙ μ := by
+ apply hasPDF_of_map_eq_withDensity (hu.aemeasurable hns hnt) (s.indicator ((μ s)⁻¹ • 1)) <|
+ (measurable_one.aemeasurable.const_smul (μ s)⁻¹).indicator hms
+ rw [hu, withDensity_indicator hms, withDensity_smul _ measurable_one, withDensity_one]
+#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF
+
+theorem hasPDF₀ {X : Ω → E} {s : Set E} (hms : NullMeasurableSet s μ) (hns : μ s ≠ 0)
+ (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : HasPDF X ℙ μ := by
+ have hms' := measurableSet_toMeasurable μ s
+ apply hasPDF (m := m) (ℙ := ℙ) (μ := μ) hms'
+ (measure_toMeasurable s ▸ hns) (measure_toMeasurable s ▸ hnt) _
+ unfold IsUniform
+ rw [measure_toMeasurable, restrict_congr_set hms.toMeasurable_ae_eq, hu]
+
+theorem pdf_eq {X : Ω → E} {s : Set E} (hms : MeasurableSet s) (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
+ (hu : IsUniform X s ℙ μ) : pdf X ℙ μ =ᵐ[μ] s.indicator ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) := by
+ have : HasPDF X ℙ μ := hasPDF hms hns hnt hu
+ have : IsProbabilityMeasure ℙ := isProbabilityMeasure hns hnt hu
+ apply (eq_of_map_eq_withDensity _ _).mp
+ · rw [hu, withDensity_indicator hms, withDensity_smul _ measurable_one, withDensity_one]
+ · exact (measurable_one.aemeasurable.const_smul (μ s)⁻¹).indicator hms
+
+theorem pdf_toReal_ae_eq {X : Ω → E}
+ {s : Set E} (hms : MeasurableSet s) (hns : μ s ≠ 0) (hnt : μ s ≠ ∞)
+ (hX : IsUniform X s ℙ μ) :
+ (fun x => (pdf X ℙ μ x).toReal) =ᵐ[μ] fun x =>
+ (s.indicator ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) x).toReal :=
+ Filter.EventuallyEq.fun_comp (pdf_eq hms hns hnt hX) ENNReal.toReal
+#align measure_theory.pdf.is_uniform.pdf_to_real_ae_eq MeasureTheory.pdf.IsUniform.pdf_toReal_ae_eq
+
+variable {X : Ω → ℝ} {s : Set ℝ} (hms : MeasurableSet s) (hns : volume s ≠ 0) (hnt : volume s ≠ ∞)
theorem mul_pdf_integrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
Integrable fun x : ℝ => x * (pdf X ℙ volume x).toReal := by
- by_cases hsupp : volume s = ∞
- · have : pdf X ℙ =ᵐ[volume] 0 := by
- refine' ae_eq_trans huX _
- simp [hsupp, ae_eq_refl]
- refine' Integrable.congr (integrable_zero _ _ _) _
- rw [(by simp : (fun x => 0 : ℝ → ℝ) = fun x => x * (0 : ℝ≥0∞).toReal)]
- refine'
- Filter.EventuallyEq.mul (ae_eq_refl _) (Filter.EventuallyEq.fun_comp this.symm ENNReal.toReal)
constructor -- porting note: `refine` was failing, don't know why
· exact aestronglyMeasurable_id.mul
(measurable_pdf X ℙ).aemeasurable.ennreal_toReal.aestronglyMeasurable
- refine' hasFiniteIntegral_mul huX _
+ refine' hasFiniteIntegral_mul (pdf_eq hms hns hnt huX) _
set ind := (volume s)⁻¹ • (1 : ℝ → ℝ≥0∞)
have : ∀ x, ↑‖x‖₊ * s.indicator ind x = s.indicator (fun x => ‖x‖₊ * ind x) x := fun x =>
(s.indicator_mul_right (fun x => ↑‖x‖₊) ind).symm
simp only [this, lintegral_indicator _ hms, mul_one, Algebra.id.smul_eq_mul, Pi.one_apply,
Pi.smul_apply]
rw [lintegral_mul_const _ measurable_nnnorm.coe_nnreal_ennreal]
- refine' (ENNReal.mul_lt_top (set_lintegral_lt_top_of_isCompact hsupp hcs continuous_nnnorm).ne
+ refine' (ENNReal.mul_lt_top (set_lintegral_lt_top_of_isCompact hnt hcs continuous_nnnorm).ne
(ENNReal.inv_lt_top.2 (pos_iff_ne_zero.mpr hns)).ne).ne
#align measure_theory.pdf.is_uniform.mul_pdf_integrable MeasureTheory.pdf.IsUniform.mul_pdf_integrable
/-- A real uniform random variable `X` with support `s` has expectation
`(λ s)⁻¹ * ∫ x in s, x ∂λ` where `λ` is the Lebesgue measure. -/
-theorem integral_eq (hnt : volume s ≠ ∞) (huX : IsUniform X s ℙ) :
+theorem integral_eq (huX : IsUniform X s ℙ) :
∫ x, X x ∂ℙ = (volume s)⁻¹.toReal * ∫ x in s, x := by
- haveI := hasPDF hns hnt huX
- haveI := huX.isProbabilityMeasure hns hnt hms
+ haveI := hasPDF hms hns hnt huX
+ haveI := huX.isProbabilityMeasure hns hnt
rw [← integral_mul_eq_integral]
- rw [integral_congr_ae (Filter.EventuallyEq.mul (ae_eq_refl _) (pdf_toReal_ae_eq huX))]
+ rw [integral_congr_ae (Filter.EventuallyEq.mul (ae_eq_refl _) (pdf_toReal_ae_eq hms hns hnt huX))]
have :
∀ x,
x * (s.indicator ((volume s)⁻¹ • (1 : ℝ → ℝ≥0∞)) x).toReal =
@@ -435,17 +468,17 @@ theorem indepFun_iff_pdf_prod_eq_pdf_mul_pdf
[IsFiniteMeasure ℙ] [SigmaFinite μ] [SigmaFinite ν] [HasPDF (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)] :
IndepFun X Y ℙ ↔
pdf (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν) =ᵐ[μ.prod ν] fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 := by
- have : HasPDF X ℙ μ := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν) (X := fun ω ↦ (X ω, Y ω))
- quasiMeasurePreserving_fst
- have : HasPDF Y ℙ ν := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν) (X := fun ω ↦ (X ω, Y ω))
- quasiMeasurePreserving_snd
+ have : HasPDF X ℙ μ := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
+ (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_fst
+ have : HasPDF Y ℙ ν := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
+ (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_snd
have h₀ : (ℙ.map X).prod (ℙ.map Y) =
(μ.prod ν).withDensity fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 :=
prod_eq fun s t hs ht ↦ by rw [withDensity_apply _ (hs.prod ht), ← prod_restrict,
lintegral_prod_mul (measurable_pdf X ℙ μ).aemeasurable (measurable_pdf Y ℙ ν).aemeasurable,
map_eq_set_lintegral_pdf X ℙ μ hs, map_eq_set_lintegral_pdf Y ℙ ν ht]
- rw [indepFun_iff_map_prod_eq_prod_map_map (HasPDF.measurable X ℙ μ) (HasPDF.measurable Y ℙ ν),
- ← unique, h₀]
+ rw [indepFun_iff_map_prod_eq_prod_map_map (HasPDF.aemeasurable X ℙ μ) (HasPDF.aemeasurable Y ℙ ν),
+ ← eq_of_map_eq_withDensity, h₀]
exact (((measurable_pdf X ℙ μ).comp measurable_fst).mul
((measurable_pdf Y ℙ ν).comp measurable_snd)).aemeasurable
This PR proves that two random variables are independent, iff their joint distribution is the product measure of marginal distributions, iff their joint density is a product of their marginal densities up to AE equality. It also uses lemmas stating that μ.withDensity
is injective up to AE equality.
@@ -5,6 +5,7 @@ Authors: Kexing Ying
-/
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
+import Mathlib.Probability.Independence.Basic
#align_import probability.density from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
@@ -136,13 +137,25 @@ theorem lintegral_eq_measure_univ {X : Ω → E} [HasPDF X ℙ μ] :
Measure.map_apply (HasPDF.measurable X ℙ μ) MeasurableSet.univ, Set.preimage_univ]
#align measure_theory.pdf.lintegral_eq_measure_univ MeasureTheory.pdf.lintegral_eq_measure_univ
+theorem unique [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] (f : E → ℝ≥0∞)
+ (hmf : AEMeasurable f μ) : ℙ.map X = μ.withDensity f ↔ pdf X ℙ μ =ᵐ[μ] f := by
+ rw [map_eq_withDensity_pdf X ℙ μ]
+ apply withDensity_eq_iff (measurable_pdf X ℙ μ).aemeasurable hmf
+ rw [lintegral_eq_measure_univ]
+ exact measure_ne_top _ _
+
+theorem unique' [SigmaFinite μ] {X : Ω → E} [HasPDF X ℙ μ] (f : E → ℝ≥0∞) (hmf : AEMeasurable f μ) :
+ ℙ.map X = μ.withDensity f ↔ pdf X ℙ μ =ᵐ[μ] f :=
+ map_eq_withDensity_pdf X ℙ μ ▸
+ withDensity_eq_iff_of_sigmaFinite (measurable_pdf X ℙ μ).aemeasurable hmf
+
nonrec theorem ae_lt_top [IsFiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} :
∀ᵐ x ∂μ, pdf X ℙ μ x < ∞ := by
by_cases hpdf : HasPDF X ℙ μ
· haveI := hpdf
refine' ae_lt_top (measurable_pdf X ℙ μ) _
rw [lintegral_eq_measure_univ]
- exact (measure_lt_top _ _).ne
+ exact measure_ne_top _ _
· simp [pdf, hpdf]
#align measure_theory.pdf.ae_lt_top MeasureTheory.pdf.ae_lt_top
@@ -411,6 +424,33 @@ end IsUniform
end
+section TwoVariables
+
+open ProbabilityTheory
+
+variable {F : Type*} [MeasurableSpace F] {ν : Measure F} {X : Ω → E} {Y : Ω → F}
+
+/-- Random variables are independent iff their joint density is a product of marginal densities. -/
+theorem indepFun_iff_pdf_prod_eq_pdf_mul_pdf
+ [IsFiniteMeasure ℙ] [SigmaFinite μ] [SigmaFinite ν] [HasPDF (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)] :
+ IndepFun X Y ℙ ↔
+ pdf (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν) =ᵐ[μ.prod ν] fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 := by
+ have : HasPDF X ℙ μ := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν) (X := fun ω ↦ (X ω, Y ω))
+ quasiMeasurePreserving_fst
+ have : HasPDF Y ℙ ν := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν) (X := fun ω ↦ (X ω, Y ω))
+ quasiMeasurePreserving_snd
+ have h₀ : (ℙ.map X).prod (ℙ.map Y) =
+ (μ.prod ν).withDensity fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 :=
+ prod_eq fun s t hs ht ↦ by rw [withDensity_apply _ (hs.prod ht), ← prod_restrict,
+ lintegral_prod_mul (measurable_pdf X ℙ μ).aemeasurable (measurable_pdf Y ℙ ν).aemeasurable,
+ map_eq_set_lintegral_pdf X ℙ μ hs, map_eq_set_lintegral_pdf Y ℙ ν ht]
+ rw [indepFun_iff_map_prod_eq_prod_map_map (HasPDF.measurable X ℙ μ) (HasPDF.measurable Y ℙ ν),
+ ← unique, h₀]
+ exact (((measurable_pdf X ℙ μ).comp measurable_fst).mul
+ ((measurable_pdf Y ℙ ν).comp measurable_snd)).aemeasurable
+
+end TwoVariables
+
end pdf
end MeasureTheory
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -59,7 +59,7 @@ noncomputable section
namespace MeasureTheory
-variable {Ω E : Type _} [MeasurableSpace E]
+variable {Ω E : Type*} [MeasurableSpace E]
/-- A random variable `X : Ω → E` is said to `HasPDF` with respect to the measure `ℙ` on `Ω` and
`μ` on `E` if there exists a measurable function `f` such that the push-forward measure of `ℙ`
@@ -237,7 +237,7 @@ theorem hasPDF_iff_of_measurable {X : Ω → E} (hX : Measurable X) :
section
-variable {F : Type _} [MeasurableSpace F] {ν : Measure F}
+variable {F : Type*} [MeasurableSpace F] {ν : Measure F}
/-- A random variable that `HasPDF` transformed under a `QuasiMeasurePreserving`
map also `HasPDF` if `(map g (map X ℙ)).HaveLebesgueDecomposition μ`.
@@ -2,15 +2,12 @@
Copyright (c) 2021 Kexing Ying. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying
-
-! This file was ported from Lean 3 source module probability.density
-! leanprover-community/mathlib commit c14c8fcde993801fca8946b0d80131a1a81d1520
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
+#align_import probability.density from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
+
/-!
# Probability density function
Match https://github.com/leanprover-community/mathlib/pull/19199
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying
! This file was ported from Lean 3 source module probability.density
-! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
+! leanprover-community/mathlib commit c14c8fcde993801fca8946b0d80131a1a81d1520
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -333,7 +333,7 @@ theorem hasPDF {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ :
simp [hnt]
rw [heq, Set.inter_univ] at this
exact hns this
- exact MeasureTheory.Set.indicator_ae_eq_zero hu.symm)
+ exact Set.indicator_ae_eq_zero.1 hu.symm)
#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPDF
theorem pdf_toReal_ae_eq {_ : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
@@ -134,7 +134,7 @@ namespace pdf
variable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
theorem lintegral_eq_measure_univ {X : Ω → E} [HasPDF X ℙ μ] :
- (∫⁻ x, pdf X ℙ μ x ∂μ) = ℙ Set.univ := by
+ ∫⁻ x, pdf X ℙ μ x ∂μ = ℙ Set.univ := by
rw [← set_lintegral_univ, ← map_eq_set_lintegral_pdf X ℙ μ MeasurableSet.univ,
Measure.map_apply (HasPDF.measurable X ℙ μ) MeasurableSet.univ, Set.preimage_univ]
#align measure_theory.pdf.lintegral_eq_measure_univ MeasureTheory.pdf.lintegral_eq_measure_univ
@@ -32,7 +32,7 @@ random variables with this distribution.
* `MeasureTheory.pdf` : If `X` is a random variable that `HasPDF X ℙ μ`, then `pdf X`
is the measurable function `f` such that the push-forward measure of `ℙ` along `X` equals
`μ.withDensity f`.
-* `measure_theory.pdf.uniform` : A random variable `X` is said to follow the uniform
+* `MeasureTheory.pdf.IsUniform` : A random variable `X` is said to follow the uniform
distribution if it has a constant probability density function with a compact, non-null support.
## Main results
@@ -42,7 +42,7 @@ random variables with this distribution.
all measurable `g : E → ℝ`.
* `MeasureTheory.pdf.integral_mul_eq_integral` : A real-valued random variable `X` with
pdf `f` has expectation `∫ x, x * f x dx`.
-* `measure_theory.pdf.uniform.integral_eq` : If `X` follows the uniform distribution with
+* `MeasureTheory.pdf.IsUniform.integral_eq` : If `X` follows the uniform distribution with
its pdf having support `s`, then `X` has expectation `(λ s)⁻¹ * ∫ x in s, x dx` where `λ`
is the Lebesgue measure.
@@ -242,10 +242,10 @@ section
variable {F : Type _} [MeasurableSpace F] {ν : Measure F}
-/-- A random variable that `HasPDF` transformed under a `quasi_measure_preserving`
-map also `HasPDF` if `(map g (map X ℙ)).have_lebesgue_decomposition μ`.
+/-- A random variable that `HasPDF` transformed under a `QuasiMeasurePreserving`
+map also `HasPDF` if `(map g (map X ℙ)).HaveLebesgueDecomposition μ`.
-`quasi_measure_preserving_hasPDF'` is more useful in the case we are working with a
+`quasiMeasurePreserving_hasPDF` is more useful in the case we are working with a
probability measure and a real-valued random variable. -/
theorem quasiMeasurePreserving_hasPDF {X : Ω → E} [HasPDF X ℙ μ] {g : E → F}
(hg : QuasiMeasurePreserving g μ ν) (hmap : (map g (map X ℙ)).HaveLebesgueDecomposition ν) :
@@ -158,6 +158,7 @@ theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [
(hf : Measurable f) :
Integrable (fun x => f (X x)) ℙ ↔ Integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ := by
-- porting note: using `erw` because `rw` doesn't recognize `(f <| X ·)` as `f ∘ X`
+ -- https://github.com/leanprover-community/mathlib4/issues/5164
erw [← integrable_map_measure hf.aestronglyMeasurable (HasPDF.measurable X ℙ μ).aemeasurable,
map_eq_withDensity_pdf X ℙ μ, integrable_withDensity_iff (measurable_pdf _ _ _) ae_lt_top]
#align measure_theory.pdf.integrable_iff_integrable_mul_pdf MeasureTheory.pdf.integrable_iff_integrable_mul_pdf
The unported dependencies are
algebra.order.module
init.core
linear_algebra.free_module.finite.rank
algebra.order.monoid.cancel.defs
algebra.abs
algebra.group_power.lemmas
init.data.list.basic
linear_algebra.free_module.rank
algebra.order.monoid.cancel.basic
init.data.list.default
topology.subset_properties
init.logic
The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file