File: Mathlib/Probability/Density.lean

full_name: MeasureTheory.HasPDF.pdf'
code: /-- 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' : AEMeasurable X ℙ ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ
goal: AEMeasurable X ℙ ∧ (MeasureTheory.Measure.map X ℙ).HaveLebesgueDecomposition μ ∧ MeasureTheory.Measure.map X ℙ ≪ μ

full_name: MeasureTheory.HasPDF
code: /-- 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' : AEMeasurable X ℙ ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ
goal: Prop

full_name: MeasureTheory.hasPDF_iff
code: theorem hasPDF_iff {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E} :
    HasPDF X ℙ μ ↔ AEMeasurable X ℙ ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ 
goal: ∀ {x : MeasurableSpace Ω} {X : Ω → E} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E},
  MeasureTheory.HasPDF X ℙ μ ↔
    AEMeasurable X ℙ ∧ (MeasureTheory.Measure.map X ℙ).HaveLebesgueDecomposition μ ∧ MeasureTheory.Measure.map X ℙ ≪ μ

full_name: MeasureTheory.hasPDF_iff_of_aemeasurable
code: theorem hasPDF_iff_of_aemeasurable {X : Ω → E} {ℙ : Measure Ω}
    {μ : Measure E} (hX : AEMeasurable X ℙ) :
    HasPDF X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ 
goal: ∀ {x : MeasurableSpace Ω} {X : Ω → E} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E},
  AEMeasurable X ℙ →
    (MeasureTheory.HasPDF X ℙ μ ↔
      (MeasureTheory.Measure.map X ℙ).HaveLebesgueDecomposition μ ∧ MeasureTheory.Measure.map X ℙ ≪ μ)

full_name: MeasureTheory.HasPDF.aemeasurable
code: @[measurability]
theorem HasPDF.aemeasurable (X : Ω → E) (ℙ : Measure Ω)
    (μ : Measure E) [hX : HasPDF X ℙ μ] : AEMeasurable X ℙ 
goal: ∀ {x : MeasurableSpace Ω} (X : Ω → E) (ℙ : MeasureTheory.Measure Ω) (μ : MeasureTheory.Measure E)
  [hX : MeasureTheory.HasPDF X ℙ μ], AEMeasurable X ℙ

full_name: MeasureTheory.HasPDF.haveLebesgueDecomposition
code: instance HasPDF.haveLebesgueDecomposition {X : Ω → E} {ℙ : Measure Ω}
    {μ : Measure E} [hX : HasPDF X ℙ μ] : (map X ℙ).HaveLebesgueDecomposition μ 
goal: ∀ {x : MeasurableSpace Ω} {X : Ω → E} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E}
  [hX : MeasureTheory.HasPDF X ℙ μ], (MeasureTheory.Measure.map X ℙ).HaveLebesgueDecomposition μ

full_name: MeasureTheory.HasPDF.absolutelyContinuous
code: theorem HasPDF.absolutelyContinuous {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
    [hX : HasPDF X ℙ μ] : map X ℙ ≪ μ 
goal: ∀ {x : MeasurableSpace Ω} {X : Ω → E} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E}
  [hX : MeasureTheory.HasPDF X ℙ μ], MeasureTheory.Measure.map X ℙ ≪ μ

full_name: MeasureTheory.HasPDF.quasiMeasurePreserving_of_measurable
code: /-- 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 ℙ μ 
goal: ∀ {x : MeasurableSpace Ω} (X : Ω → E) (ℙ : MeasureTheory.Measure Ω) (μ : MeasureTheory.Measure E)
  [inst : MeasureTheory.HasPDF X ℙ μ], Measurable X → MeasureTheory.Measure.QuasiMeasurePreserving X ℙ μ

full_name: MeasureTheory.HasPDF.congr
code: theorem HasPDF.congr {X Y : Ω → E} {ℙ : Measure Ω} {μ : Measure E} (hXY : X =ᵐ[ℙ] Y)
    [hX : HasPDF X ℙ μ] : HasPDF Y ℙ μ 
goal: ∀ {x : MeasurableSpace Ω} {X Y : Ω → E} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E},
  X =ᵐ[ℙ] Y → ∀ [hX : MeasureTheory.HasPDF X ℙ μ], MeasureTheory.HasPDF Y ℙ μ

full_name: MeasureTheory.HasPDF.congr'
code: theorem HasPDF.congr' {X Y : Ω → E} {ℙ : Measure Ω} {μ : Measure E} (hXY : X =ᵐ[ℙ] Y) :
    HasPDF X ℙ μ ↔ HasPDF Y ℙ μ 
goal: ∀ {x : MeasurableSpace Ω} {X Y : Ω → E} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E},
  X =ᵐ[ℙ] Y → (MeasureTheory.HasPDF X ℙ μ ↔ MeasureTheory.HasPDF Y ℙ μ)

full_name: MeasureTheory.hasPDF_of_map_eq_withDensity
code: /-- 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 ℙ μ 
goal: ∀ {x : MeasurableSpace Ω} {X : Ω → E} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E},
  AEMeasurable X ℙ →
    ∀ (f : E → ℝ≥0∞), AEMeasurable f μ → MeasureTheory.Measure.map X ℙ = μ.withDensity f → MeasureTheory.HasPDF X ℙ μ

full_name: MeasureTheory.pdf
code: /-- 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∞ 
goal: {x : MeasurableSpace Ω} → (Ω → E) → MeasureTheory.Measure Ω → autoParam (MeasureTheory.Measure E) _auto✝ → E → ℝ≥0∞

full_name: MeasureTheory.pdf_def
code: theorem pdf_def {_ : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E} :
    pdf X ℙ μ = (map X ℙ).rnDeriv μ 
goal: ∀ {x : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : Ω → E},
  MeasureTheory.pdf X ℙ μ = (MeasureTheory.Measure.map X ℙ).rnDeriv μ

full_name: MeasureTheory.pdf_of_not_aemeasurable
code: theorem pdf_of_not_aemeasurable {_ : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
    {X : Ω → E} (hX : ¬AEMeasurable X ℙ) : pdf X ℙ μ =ᵐ[μ] 0 
goal: ∀ {x : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : Ω → E},
  ¬AEMeasurable X ℙ → MeasureTheory.pdf X ℙ μ =ᵐ[μ] 0

full_name: MeasureTheory.pdf_of_not_haveLebesgueDecomposition
code: theorem pdf_of_not_haveLebesgueDecomposition {_ : MeasurableSpace Ω} {ℙ : Measure Ω}
    {μ : Measure E} {X : Ω → E} (h : ¬(map X ℙ).HaveLebesgueDecomposition μ) : pdf X ℙ μ = 0 
goal: ∀ {x : MeasurableSpace Ω} {ℙ : MeasureTheory.Measure Ω} {μ : MeasureTheory.Measure E} {X : Ω → E},
  ¬(MeasureTheory.Measure.map X ℙ).HaveLebesgueDecomposition μ → MeasureTheory.pdf X ℙ μ = 0

full_name: MeasureTheory.aemeasurable_of_pdf_ne_zero
code: theorem aemeasurable_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
    (X : Ω → E) (h : ¬pdf X ℙ μ =ᵐ[μ] 0) : AEMeasurable X ℙ 
goal: AEMeasurable X ℙ

full_name: MeasureTheory.hasPDF_of_pdf_ne_zero
code: theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
    (hac : map X ℙ ≪ μ) (hpdf : ¬pdf X ℙ μ =ᵐ[μ] 0) : HasPDF X ℙ μ 
goal: MeasureTheory.HasPDF X ℙ μ

full_name: MeasureTheory.measurable_pdf
code: @[measurability]
theorem measurable_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
    (μ : Measure E := by volume_tac) : Measurable (pdf X ℙ μ) 
goal: Measurable (MeasureTheory.pdf X ℙ μ)

full_name: MeasureTheory.withDensity_pdf_le_map
code: theorem withDensity_pdf_le_map {_ : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
    (μ : Measure E := by volume_tac) : μ.withDensity (pdf X ℙ μ) ≤ map X ℙ 
goal: ∀ {x : MeasurableSpace Ω} (X : Ω → E) (ℙ : MeasureTheory.Measure Ω) (μ : autoParam (MeasureTheory.Measure E) _auto✝),
  MeasureTheory.Measure.withDensity μ (MeasureTheory.pdf X ℙ μ) ≤ MeasureTheory.Measure.map X ℙ

full_name: MeasureTheory.setLIntegral_pdf_le_map
code: theorem setLIntegral_pdf_le_map {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
    (μ : Measure E := by volume_tac) (s : Set E) :
    ∫⁻ x in s, pdf X ℙ μ x ∂μ ≤ map X ℙ s 
goal: ∫⁻ (x : E) in s, MeasureTheory.pdf X ℙ μ x ∂μ ≤ (MeasureTheory.Measure.map X ℙ) s

full_name: MeasureTheory.map_eq_withDensity_pdf
code: theorem map_eq_withDensity_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
    (μ : Measure E := by volume_tac) [hX : HasPDF X ℙ μ] :
    map X ℙ = μ.withDensity (pdf X ℙ μ) 
goal: MeasureTheory.Measure.map X ℙ = MeasureTheory.Measure.withDensity μ (MeasureTheory.pdf X ℙ μ)

full_name: MeasureTheory.map_eq_setLIntegral_pdf
code: theorem map_eq_setLIntegral_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
    (μ : Measure E := by volume_tac) [hX : HasPDF X ℙ μ] {s : Set E}
    (hs : MeasurableSet s) : map X ℙ s = ∫⁻ x in s, pdf X ℙ μ x ∂μ 
goal: (MeasureTheory.Measure.map X ℙ) s = ∫⁻ (x : E) in s, MeasureTheory.pdf X ℙ μ x ∂μ

full_name: MeasureTheory.pdf.congr
code: protected theorem congr {X Y : Ω → E} (hXY : X =ᵐ[ℙ] Y) : pdf X ℙ μ = pdf Y ℙ μ 
goal: MeasureTheory.pdf X ℙ μ = MeasureTheory.pdf Y ℙ μ

full_name: MeasureTheory.pdf.lintegral_eq_measure_univ
code: theorem lintegral_eq_measure_univ {X : Ω → E} [HasPDF X ℙ μ] :
    ∫⁻ x, pdf X ℙ μ x ∂μ = ℙ Set.univ 
goal: ∫⁻ (x : E), MeasureTheory.pdf X ℙ μ x ∂μ = ℙ Set.univ

full_name: MeasureTheory.pdf.eq_of_map_eq_withDensity
code: theorem eq_of_map_eq_withDensity [IsFiniteMeasure ℙ] {X : Ω → E} [HasPDF X ℙ μ] (f : E → ℝ≥0∞)
    (hmf : AEMeasurable f μ) : map X ℙ = μ.withDensity f ↔ pdf X ℙ μ =ᵐ[μ] f 
goal: MeasureTheory.Measure.map X ℙ = μ.withDensity f ↔ MeasureTheory.pdf X ℙ μ =ᵐ[μ] f

full_name: MeasureTheory.pdf.eq_of_map_eq_withDensity'
code: theorem eq_of_map_eq_withDensity' [SigmaFinite μ] {X : Ω → E} [HasPDF X ℙ μ] (f : E → ℝ≥0∞)
    (hmf : AEMeasurable f μ) : map X ℙ = μ.withDensity f ↔ pdf X ℙ μ =ᵐ[μ] f 
goal: MeasureTheory.Measure.map X ℙ = μ.withDensity f ↔ MeasureTheory.pdf X ℙ μ =ᵐ[μ] f

full_name: MeasureTheory.pdf.ae_lt_top
code: nonrec theorem ae_lt_top [IsFiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} :
    ∀ᵐ x ∂μ, pdf X ℙ μ x < ∞ 
goal: ∀ᵐ (x : E) ∂μ, MeasureTheory.pdf X ℙ μ x < ⊤

full_name: MeasureTheory.pdf.ofReal_toReal_ae_eq
code: nonrec theorem ofReal_toReal_ae_eq [IsFiniteMeasure ℙ] {X : Ω → E} :
    (fun x => ENNReal.ofReal (pdf X ℙ μ x).toReal) =ᵐ[μ] pdf X ℙ μ 
goal: (fun x => ENNReal.ofReal (MeasureTheory.pdf X ℙ μ x).toReal) =ᵐ[μ] MeasureTheory.pdf X ℙ μ

full_name: MeasureTheory.pdf.lintegral_pdf_mul
code: /-- **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) ∂ℙ 
goal: ∫⁻ (x : E), MeasureTheory.pdf X ℙ μ x * f x ∂μ = ∫⁻ (x : Ω), f (X x) ∂ℙ

full_name: MeasureTheory.pdf.integrable_pdf_smul_iff
code: 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)) ℙ 
goal: MeasureTheory.Integrable (fun x => (MeasureTheory.pdf X ℙ μ x).toReal • f x) μ ↔
  MeasureTheory.Integrable (fun x => f (X x)) ℙ

full_name: MeasureTheory.pdf.integral_pdf_smul
code: /-- **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, pdf X x • f x ∂μ`
where `μ` is a measure on the codomain of `X`. -/
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) ∂ℙ 
goal: ∫ (x : E), (MeasureTheory.pdf X ℙ μ x).toReal • f x ∂μ = ∫ (x : Ω), f (X x) ∂ℙ

full_name: MeasureTheory.pdf.quasiMeasurePreserving_hasPDF
code: /-- A random variable that `HasPDF` transformed under a `QuasiMeasurePreserving`
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 ℙ μ] (hX : AEMeasurable X ℙ) {g : E → F}
    (hg : QuasiMeasurePreserving g μ ν) (hmap : (map g (map X ℙ)).HaveLebesgueDecomposition ν) :
    HasPDF (g ∘ X) ℙ ν 
goal: MeasureTheory.HasPDF (g ∘ X) ℙ ν

full_name: MeasureTheory.pdf.quasiMeasurePreserving_hasPDF'
code: theorem quasiMeasurePreserving_hasPDF' [IsFiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E}
    [HasPDF X ℙ μ] (hX : AEMeasurable X ℙ) {g : E → F} (hg : QuasiMeasurePreserving g μ ν) :
    HasPDF (g ∘ X) ℙ ν 
goal: MeasureTheory.HasPDF (g ∘ X) ℙ ν

full_name: Real.hasPDF_iff_of_aemeasurable
code: /-- 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_aemeasurable (hX : AEMeasurable X ℙ) :
    HasPDF X ℙ ↔ map X ℙ ≪ volume 
goal: MeasureTheory.HasPDF X ℙ MeasureTheory.volume ↔ MeasureTheory.Measure.map X ℙ ≪ MeasureTheory.volume

full_name: Real.hasPDF_iff
code: theorem _root_.Real.hasPDF_iff : HasPDF X ℙ ↔ AEMeasurable X ℙ ∧ map X ℙ ≪ volume 
goal: MeasureTheory.HasPDF X ℙ MeasureTheory.volume ↔ AEMeasurable X ℙ ∧ MeasureTheory.Measure.map X ℙ ≪ MeasureTheory.volume

full_name: MeasureTheory.pdf.integral_mul_eq_integral
code: /-- 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 ∂ℙ 
goal: ∫ (x : ℝ), x * (MeasureTheory.pdf X ℙ MeasureTheory.volume x).toReal = ∫ (x : Ω), X x ∂ℙ

full_name: MeasureTheory.pdf.hasFiniteIntegral_mul
code: 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 
goal: MeasureTheory.HasFiniteIntegral (fun x => f x * (MeasureTheory.pdf X ℙ MeasureTheory.volume x).toReal)
  MeasureTheory.volume

full_name: MeasureTheory.pdf.indepFun_iff_pdf_prod_eq_pdf_mul_pdf
code: /-- 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 
goal: ProbabilityTheory.IndepFun X Y ℙ ↔
  MeasureTheory.pdf (fun ω => (X ω, Y ω)) ℙ (μ.prod ν) =ᵐ[μ.prod ν] fun z =>
    MeasureTheory.pdf X ℙ μ z.1 * MeasureTheory.pdf Y ℙ ν z.2