Skip to content

Commit 14e9d58

Browse files
committed
feat: independence from a stochastic process (leanprover-community#31050)
Prove that a stochastic process $(X\_s)\_{s \in S}$ is independent from a random variable $Y$ if for all $s_1, ..., s_p \in S$ the family $(X_{s_1}, ..., X_{s_p})$ is independent from $Y$. Use this to refactor proofs.
1 parent c6208eb commit 14e9d58

1 file changed

Lines changed: 75 additions & 36 deletions

File tree

β€ŽMathlib/Probability/Independence/Process.leanβ€Ž

Lines changed: 75 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ import Mathlib.Probability.Independence.Basic
99
/-!
1010
# Independence of stochastic processes
1111
12+
We prove that a stochastic process $(X_s)_{s \in S}$ is independent from a random variable $Y$ if
13+
for all $s_1, ..., s_p \in S$ the family $(X_{s_1}, ..., X_{s_p})$ is independent from $Y$.
14+
1215
We prove that two stochastic processes $(X_s)_{s \in S}$ and $(Y_t)_{t \in T}$ are independent if
1316
for all $s_1, ..., s_p \in S$ and $t_1, ..., t_q \in T$ the two families
14-
$(X_{s_1}, ..., X_{s_p})$ and $(Y_{t_1}, ..., Y_{t_q})$ are independent. We prove an analogous
15-
condition for a family of stochastic processes.
17+
$(X_{s_1}, ..., X_{s_p})$ and $(Y_{t_1}, ..., Y_{t_q})$ are independent.
18+
We prove an analogous condition for a family of stochastic processes.
1619
1720
## Tags
1821
@@ -29,15 +32,14 @@ namespace Kernel
2932

3033
variable {Ξ± : Type*} {mΞ± : MeasurableSpace Ξ±} {ΞΊ : Kernel Ξ± Ξ©} {P : Measure Ξ±}
3134

32-
/-- Two stochastic processes $(X_s)_{s \in S}$ and $(Y_t)_{t \in T}$ are independent if
33-
for all $s_1, ..., s_p \in S$ and $t_1, ..., t_q \in T$ the two families
34-
$(X_{s_1}, ..., X_{s_p})$ and $(Y_{t_1}, ..., Y_{t_q})$ are independent. -/
35-
lemma IndepFun.indepFun_process {T : Type*} {𝓧 : S β†’ Type*} {𝓨 : T β†’ Type*}
36-
[βˆ€ i, MeasurableSpace (𝓧 i)] [βˆ€ j, MeasurableSpace (𝓨 j)] {X : (i : S) β†’ Ξ© β†’ 𝓧 i}
37-
{Y : (j : T) β†’ Ξ© β†’ 𝓨 j} (hX : βˆ€ i, Measurable (X i)) (hY : βˆ€ j, Measurable (Y j))
38-
(h : βˆ€ (I : Finset S) (J : Finset T),
39-
IndepFun (fun Ο‰ (i : I) ↦ X i Ο‰) (fun Ο‰ (j : J) ↦ Y j Ο‰) ΞΊ P) [IsZeroOrMarkovKernel ΞΊ] :
40-
IndepFun (fun Ο‰ i ↦ X i Ο‰) (fun Ο‰ j ↦ Y j Ο‰) ΞΊ P := by
35+
/-- A stochastic process $(X_s)_{s \in S}$ is independent from a random variable $Y$ if
36+
for all $s_1, ..., s_p \in S$ the family $(X_{s_1}, ..., X_{s_p})$ is independent from $Y$. -/
37+
lemma IndepFun.process_indepFun {𝓧 : S β†’ Type*} {𝓨 : Type*}
38+
[βˆ€ i, MeasurableSpace (𝓧 i)] [MeasurableSpace 𝓨] {X : (i : S) β†’ Ξ© β†’ 𝓧 i}
39+
{Y : Ξ© β†’ 𝓨} (hX : βˆ€ i, Measurable (X i)) (hY : Measurable Y)
40+
(h : βˆ€ (I : Finset S),
41+
IndepFun (fun Ο‰ (i : I) ↦ X i Ο‰) Y ΞΊ P) [IsZeroOrMarkovKernel ΞΊ] :
42+
IndepFun (fun Ο‰ i ↦ X i Ο‰) Y ΞΊ P := by
4143
-- The Ο€-system obtained by pulling back the Ο€-system of square cylinders by `X`.
4244
let Ο€X := {s : Set Ξ© | βˆƒ t ∈ squareCylinders (fun i ↦ {s : Set (𝓧 i) | MeasurableSet s}),
4345
(fun Ο‰ i ↦ X i Ο‰) ⁻¹' t = s}
@@ -46,30 +48,43 @@ lemma IndepFun.indepFun_process {T : Type*} {𝓧 : S β†’ Type*} {𝓨 : T β†’ T
4648
have Ο€X_gen : (MeasurableSpace.pi.comap fun Ο‰ i ↦ X i Ο‰) = generateFrom Ο€X := by
4749
rw [generateFrom_squareCylinders.symm, MeasurableSpace.comap_generateFrom]
4850
rfl
49-
-- The Ο€-system obtained by pulling back the Ο€-system of square cylinders by `Y`.
50-
let Ο€Y := {s : Set Ξ© | βˆƒ t ∈ squareCylinders (fun j ↦ {s : Set (𝓨 j) | MeasurableSet s}),
51-
(fun Ο‰ j ↦ Y j Ο‰) ⁻¹' t = s}
52-
have Ο€Y_pi : IsPiSystem Ο€Y :=
53-
IsPiSystem.comap (isPiSystem_squareCylinders (fun _ ↦ isPiSystem_measurableSet) (by simp)) _
54-
have Ο€Y_gen : (MeasurableSpace.pi.comap fun Ο‰ j ↦ Y j Ο‰) = generateFrom Ο€Y := by
55-
rw [generateFrom_squareCylinders.symm, MeasurableSpace.comap_generateFrom]
56-
rfl
57-
-- To prove independence, we prove independence of the generating Ο€-systems.
58-
refine IndepSets.indep (measurable_pi_iff.2 hX).comap_le (measurable_pi_iff.2 hY).comap_le
59-
Ο€X_pi Ο€Y_pi Ο€X_gen Ο€Y_gen ?_
60-
rintro - - ⟨-, ⟨I, s, hs, rfl⟩, rfl⟩ ⟨-, ⟨J, t, ht, rfl⟩, rfl⟩
61-
simp only [Set.mem_pi, Set.mem_univ, Set.mem_setOf_eq, forall_const] at hs ht
62-
have : (fun Ο‰ i ↦ X i Ο‰) ⁻¹' .pi I s ∩ (fun Ο‰ j ↦ Y j Ο‰) ⁻¹' .pi J t =
63-
(fun Ο‰ (i : I) ↦ X i Ο‰) ⁻¹' .pi (SetLike.coe Finset.univ) (fun i ↦ s i) ∩
64-
(fun Ο‰ (j : J) ↦ Y j Ο‰) ⁻¹' .pi (SetLike.coe Finset.univ) (fun j ↦ t j) := by
51+
-- To prove independence, we prove independence of the generating Ο€-system with the `Οƒ`-alebra.
52+
refine IndepSets.indep (measurable_pi_iff.2 hX).comap_le hY.comap_le
53+
Ο€X_pi (@isPiSystem_measurableSet Ξ© (.comap Y inferInstance)) Ο€X_gen
54+
(@generateFrom_measurableSet Ξ© (.comap Y inferInstance)).symm ?_
55+
rintro - - ⟨-, ⟨I, s, hs, rfl⟩, rfl⟩ ⟨t, ht, rfl⟩
56+
simp only [Set.mem_pi, Set.mem_univ, Set.mem_setOf_eq, forall_const] at hs
57+
have : (fun Ο‰ i ↦ X i Ο‰) ⁻¹' .pi I s =
58+
(fun Ο‰ (i : I) ↦ X i Ο‰) ⁻¹' .pi (SetLike.coe Finset.univ) (fun i ↦ s i)
59+
:= by
6560
ext; simp
6661
have h1 : MeasurableSet <| .pi (SetLike.coe Finset.univ) (fun (i : I) ↦ s i) :=
6762
.pi (Finset.countable_toSet _) (fun _ _ ↦ hs _)
68-
have h2 : MeasurableSet <| .pi (SetLike.coe Finset.univ) (fun (j : J) ↦ t j) :=
69-
.pi (Finset.countable_toSet _) (fun _ _ ↦ ht _)
70-
filter_upwards [(h I J).measure_inter_preimage_eq_mul _ _ h1 h2] with ω hω
63+
filter_upwards [(h I).measure_inter_preimage_eq_mul _ _ h1 ht] with ω hω
7164
rw [this, hω]
72-
congr 2 <;> ext <;> simp
65+
66+
/-- A random variable $X$ is independent from a stochastic process $(Y_s)_{s \in S}$ if
67+
for all $s_1, ..., s_p \in S$ the variable $Y$ is independent from the family
68+
$(X_{s_1}, ..., X_{s_p})$. -/
69+
lemma IndepFun.indepFun_process {𝓧 : Type*} {𝓨 : S β†’ Type*}
70+
[MeasurableSpace 𝓧] [βˆ€ i, MeasurableSpace (𝓨 i)] {X : Ξ© β†’ 𝓧}
71+
{Y : (i : S) β†’ Ξ© β†’ 𝓨 i} (hX : Measurable X) (hY : βˆ€ i, Measurable (Y i))
72+
(h : βˆ€ (I : Finset S),
73+
IndepFun X (fun Ο‰ (i : I) ↦ Y i Ο‰) ΞΊ P) [IsZeroOrMarkovKernel ΞΊ] :
74+
IndepFun X (fun Ο‰ i ↦ Y i Ο‰) ΞΊ P :=
75+
(IndepFun.process_indepFun hY hX (fun I ↦ (h I).symm)).symm
76+
77+
/-- Two stochastic processes $(X_s)_{s \in S}$ and $(Y_t)_{t \in T}$ are independent if
78+
for all $s_1, ..., s_p \in S$ and $t_1, ..., t_q \in T$ the two families
79+
$(X_{s_1}, ..., X_{s_p})$ and $(Y_{t_1}, ..., Y_{t_q})$ are independent. -/
80+
lemma IndepFun.process_indepFun_process {T : Type*} {𝓧 : S β†’ Type*} {𝓨 : T β†’ Type*}
81+
[βˆ€ i, MeasurableSpace (𝓧 i)] [βˆ€ j, MeasurableSpace (𝓨 j)] {X : (i : S) β†’ Ξ© β†’ 𝓧 i}
82+
{Y : (j : T) β†’ Ξ© β†’ 𝓨 j} (hX : βˆ€ i, Measurable (X i)) (hY : βˆ€ j, Measurable (Y j))
83+
(h : βˆ€ (I : Finset S) (J : Finset T),
84+
IndepFun (fun Ο‰ (i : I) ↦ X i Ο‰) (fun Ο‰ (j : J) ↦ Y j Ο‰) ΞΊ P) [IsZeroOrMarkovKernel ΞΊ] :
85+
IndepFun (fun Ο‰ i ↦ X i Ο‰) (fun Ο‰ j ↦ Y j Ο‰) ΞΊ P := by
86+
refine IndepFun.process_indepFun hX (measurable_pi_lambda _ hY) fun I ↦ ?_
87+
exact IndepFun.indepFun_process (measurable_pi_lambda _ fun _ ↦ hX _) hY fun J ↦ h I J
7388

7489
/-- Stochastic processes $((X^s_t)_{t \in T_s})_{s \in S}$ are mutually independent if
7590
for all $s_1, ..., s_n$ and all $t^{s_i}_1, ..., t^{s_i}_{p_i}^ the families
@@ -117,16 +132,41 @@ end Kernel
117132

118133
variable {P : Measure Ξ©}
119134

135+
/-- A stochastic process $(X_s)_{s \in S}$ is independent from a random variable $Y$ if
136+
for all $s_1, ..., s_p \in S$ the family $(X_{s_1}, ..., X_{s_p})$ is independent from $Y$. -/
137+
lemma IndepFun.process_indepFun {𝓧 : S β†’ Type*} {𝓨 : Type*}
138+
[βˆ€ i, MeasurableSpace (𝓧 i)] [MeasurableSpace 𝓨] {X : (i : S) β†’ Ξ© β†’ 𝓧 i}
139+
{Y : Ξ© β†’ 𝓨} (hX : βˆ€ i, Measurable (X i)) (hY : AEMeasurable Y P)
140+
(h : βˆ€ (I : Finset S),
141+
IndepFun (fun Ο‰ (i : I) ↦ X i Ο‰) Y P) [IsZeroOrProbabilityMeasure P] :
142+
IndepFun (fun Ο‰ i ↦ X i Ο‰) Y P := by
143+
suffices (fun Ο‰ i ↦ X i Ο‰) βŸ‚α΅’[P] (hY.mk Y) from
144+
this.congr .rfl hY.ae_eq_mk.symm
145+
exact Kernel.IndepFun.process_indepFun hX hY.measurable_mk (fun I ↦ (h I).congr .rfl hY.ae_eq_mk)
146+
147+
/-- A random variable $X$ is independent from a stochastic process $(Y_s)_{s \in S}$ if
148+
for all $s_1, ..., s_p \in S$ the variable $Y$ is independent from the family
149+
$(X_{s_1}, ..., X_{s_p})$. -/
150+
lemma IndepFun.indepFun_process {𝓧 : Type*} {𝓨 : S β†’ Type*}
151+
[MeasurableSpace 𝓧] [βˆ€ i, MeasurableSpace (𝓨 i)] {X : Ξ© β†’ 𝓧}
152+
{Y : (i : S) β†’ Ξ© β†’ 𝓨 i} (hX : AEMeasurable X P) (hY : βˆ€ i, Measurable (Y i))
153+
(h : βˆ€ (I : Finset S),
154+
IndepFun X (fun Ο‰ (i : I) ↦ Y i Ο‰) P) [IsZeroOrProbabilityMeasure P] :
155+
IndepFun X (fun Ο‰ i ↦ Y i Ο‰) P := by
156+
suffices (hX.mk X) βŸ‚α΅’[P] (fun Ο‰ i ↦ Y i Ο‰) from
157+
this.congr hX.ae_eq_mk.symm .rfl
158+
exact Kernel.IndepFun.indepFun_process hX.measurable_mk hY (fun I ↦ (h I).congr hX.ae_eq_mk .rfl)
159+
120160
/-- Two stochastic processes $(X_s)_{s \in S}$ and $(Y_t)_{t \in T}$ are independent if
121161
for all $s_1, ..., s_p \in S$ and $t_1, ..., t_q \in T$ the two families
122162
$(X_{s_1}, ..., X_{s_p})$ and $(Y_{t_1}, ..., Y_{t_q})$ are independent. -/
123-
lemma IndepFun.indepFun_process {T : Type*} {𝓧 : S β†’ Type*} {𝓨 : T β†’ Type*}
163+
lemma IndepFun.process_indepFun_process {T : Type*} {𝓧 : S β†’ Type*} {𝓨 : T β†’ Type*}
124164
[βˆ€ i, MeasurableSpace (𝓧 i)] [βˆ€ j, MeasurableSpace (𝓨 j)] {X : (i : S) β†’ Ξ© β†’ 𝓧 i}
125165
{Y : (j : T) β†’ Ξ© β†’ 𝓨 j} (hX : βˆ€ i, Measurable (X i)) (hY : βˆ€ j, Measurable (Y j))
126166
(h : βˆ€ (I : Finset S) (J : Finset T),
127-
IndepFun (fun Ο‰ (i : I) ↦ X i Ο‰) (fun Ο‰ (j : J) ↦ Y j Ο‰) P) [IsProbabilityMeasure P] :
167+
IndepFun (fun Ο‰ (i : I) ↦ X i Ο‰) (fun Ο‰ (j : J) ↦ Y j Ο‰) P) [IsZeroOrProbabilityMeasure P] :
128168
IndepFun (fun Ο‰ i ↦ X i Ο‰) (fun Ο‰ j ↦ Y j Ο‰) P :=
129-
Kernel.IndepFun.indepFun_process hX hY h
169+
Kernel.IndepFun.process_indepFun_process hX hY h
130170

131171
/-- Stochastic processes $((X^s_t)_{t \in T_s})_{s \in S}$ are mutually independent if
132172
for all $s_1, ..., s_n$ and all $t^{s_i}_1, ..., t^{s_i}_{p_i}^ the families
@@ -135,8 +175,7 @@ $(X^{s_1}_{t^{s_1}_1}, ..., X^{s_1}_{t^{s_1}_{p_1}}), ...,
135175
lemma iIndepFun.iIndepFun_process {T : S β†’ Type*} {𝓧 : (i : S) β†’ (j : T i) β†’ Type*}
136176
[βˆ€ i j, MeasurableSpace (𝓧 i j)] {X : (i : S) β†’ (j : T i) β†’ Ξ© β†’ 𝓧 i j}
137177
(hX : βˆ€ i j, Measurable (X i j))
138-
(h : βˆ€ (I : Finset S) (J : (i : I) β†’ Finset (T i)),
139-
iIndepFun (fun i Ο‰ (j : J i) ↦ X i j Ο‰) P) :
178+
(h : βˆ€ (I : Finset S) (J : (i : I) β†’ Finset (T i)), iIndepFun (fun i Ο‰ (j : J i) ↦ X i j Ο‰) P) :
140179
iIndepFun (fun i Ο‰ j ↦ X i j Ο‰) P :=
141180
Kernel.iIndepFun.iIndepFun_process hX h
142181

0 commit comments

Comments
Β (0)