Skip to content

Commit 7d58598

Browse files
committed
feat: the law of independent random variables is the product of their laws (leanprover-community#37830)
1 parent 8ebfdd9 commit 7d58598

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

Mathlib/Probability/HasLaw.lean

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,35 @@ lemma HasPDF.hasLaw [h : HasPDF X P μ] : HasLaw X (μ.withDensity (pdf X P μ))
150150
aemeasurable := h.aemeasurable
151151
map_eq := map_eq_withDensity_pdf X P μ
152152

153+
lemma indepFun_iff_hasLaw_prodMk_prod [IsFiniteMeasure P] {𝓨 : Type*} {m𝓨 : MeasurableSpace 𝓨}
154+
{ν : Measure 𝓨} {Y : Ω → 𝓨} (hX : HasLaw X μ P) (hY : HasLaw Y ν P) :
155+
X ⟂ᵢ[P] Y ↔ HasLaw (fun ω ↦ (X ω, Y ω)) (μ.prod ν) P where
156+
mp h :=
157+
{ map_eq := by
158+
rw [(indepFun_iff_map_prod_eq_prod_map_map (by fun_prop) (by fun_prop)).1 h, hX.map_eq,
159+
hY.map_eq] }
160+
mpr h := by
161+
rw [indepFun_iff_map_prod_eq_prod_map_map (by fun_prop) (by fun_prop),
162+
h.map_eq, hX.map_eq, hY.map_eq]
163+
164+
alias ⟨IndepFun.hasLaw_prod, _⟩ := indepFun_iff_hasLaw_prodMk_prod
165+
166+
lemma iIndepFun.hasLaw_pi {ι : Type*} [Fintype ι] {𝓧 : ι → Type*} {m𝓧 : ∀ i, MeasurableSpace (𝓧 i)}
167+
{μ : (i : ι) → Measure (𝓧 i)} {X : (i : ι) → Ω → 𝓧 i} (hX : ∀ i, HasLaw (X i) (μ i) P)
168+
(h : iIndepFun X P) :
169+
HasLaw (fun ω i ↦ X i ω) (Measure.pi μ) P where
170+
map_eq := by
171+
have := h.isProbabilityMeasure
172+
rw [(iIndepFun_iff_map_fun_eq_pi_map (by fun_prop)).1 h]
173+
simp_rw [fun i ↦ (hX i).map_eq]
174+
175+
lemma iIndepFun_iff_hasLaw_pi_pi [IsProbabilityMeasure P] {ι : Type*} [Fintype ι] {𝓧 : ι → Type*}
176+
{m𝓧 : ∀ i, MeasurableSpace (𝓧 i)} {μ : (i : ι) → Measure (𝓧 i)}
177+
{X : (i : ι) → Ω → 𝓧 i} (hX : ∀ i, HasLaw (X i) (μ i) P) :
178+
iIndepFun X P ↔ HasLaw (fun ω i ↦ X i ω) (Measure.pi μ) P where
179+
mp h := h.hasLaw_pi hX
180+
mpr h := by
181+
rw [iIndepFun_iff_map_fun_eq_pi_map (by fun_prop), h.map_eq]
182+
simp_rw [fun i ↦ (hX i).map_eq]
183+
153184
end ProbabilityTheory

Mathlib/Probability/Independence/InfinitePi.lean

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Authors: Etienne Marion
55
-/
66
module
77

8+
public import Mathlib.Probability.HasLaw
89
public import Mathlib.Probability.Independence.Basic
910
public import Mathlib.Probability.ProductMeasure
1011

@@ -79,6 +80,24 @@ lemma iIndepFun_iff_map_fun_eq_infinitePi_map (mX : ∀ i, Measurable (X i)) :
7980
iIndepFun X P ↔ P.map (fun ω i ↦ X i ω) = infinitePi (fun i ↦ P.map (X i)) :=
8081
iIndepFun_iff_map_fun_eq_infinitePi_map₀ <| measurable_pi_iff.2 mX |>.aemeasurable
8182

83+
omit [IsProbabilityMeasure P] in
84+
lemma iIndepFun.hasLaw_infinitePi {μ : (i : ι) → Measure (𝓧 i)} (hX : ∀ i, HasLaw (X i) (μ i) P)
85+
(h1 : iIndepFun X P) (h2 : AEMeasurable (fun ω i ↦ X i ω) P) :
86+
HasLaw (fun ω i ↦ X i ω) (infinitePi μ) P where
87+
aemeasurable := h2
88+
map_eq := by
89+
have := h1.isProbabilityMeasure
90+
rw [(iIndepFun_iff_map_fun_eq_infinitePi_map₀ h2).1 h1]
91+
simp_rw [fun i ↦ (hX i).map_eq]
92+
93+
lemma iIndepFun_iff_hasLaw_Pi_infinitePi {μ : (i : ι) → Measure (𝓧 i)}
94+
(hX : ∀ i, HasLaw (X i) (μ i) P) (hm : AEMeasurable (fun ω i ↦ X i ω) P) :
95+
iIndepFun X P ↔ HasLaw (fun ω i ↦ X i ω) (infinitePi μ) P where
96+
mp h := h.hasLaw_infinitePi hX hm
97+
mpr h := by
98+
rw [iIndepFun_iff_map_fun_eq_infinitePi_map₀ hm, h.map_eq]
99+
simp_rw [fun i ↦ (hX i).map_eq]
100+
82101
/-- Given random variables `X i : Ω i → 𝓧 i`, they are independent when viewed as random
83102
variables defined on the product space `Π i, Ω i`. -/
84103
lemma iIndepFun_infinitePi {Ω : ι → Type*} {mΩ : ∀ i, MeasurableSpace (Ω i)}

0 commit comments

Comments
 (0)