Skip to content

Commit caee90c

Browse files
committed
feat(Probability/Independence): relate conditional independence and factorization of a kernel (#29884)
```lean CondIndepFun m' hm' f g μ ↔ (condExpKernel μ m').map (fun ω ↦ (f ω, g ω)) =ᵐ[μ.trim hm'] (condExpKernel μ m').map f ×ₖ (condExpKernel μ m').map g ``` From the LeanBandits project. Co-authored-by: Remy Degenne <remydegenne@gmail.com>
1 parent 11f59c5 commit caee90c

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

Mathlib/Probability/Independence/Conditional.lean

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Rémy Degenne
55
-/
66
import Mathlib.Probability.Independence.Kernel
7+
import Mathlib.Probability.Kernel.CompProdEqIff
8+
import Mathlib.Probability.Kernel.Composition.Lemmas
79
import Mathlib.Probability.Kernel.Condexp
810

911
/-!
@@ -737,6 +739,57 @@ lemma condIndepFun_self_right {mβ : MeasurableSpace β} {mβ' : MeasurableSpace
737739
CondIndepFun (mβ'.comap Z) hZ.comap_le X Z μ :=
738740
condIndepFun_of_measurable_right hX (comap_measurable Z)
739741

742+
/-- Two random variables are conditionally independent iff they satisfy the almost sure equality
743+
of conditional expectations `μ⟦f ⁻¹' s ∩ g ⁻¹' t | m'⟧ =ᵐ[μ] μ⟦f ⁻¹' s | m'⟧ * μ⟦g ⁻¹' t | m'⟧`
744+
for all measurable sets `s` and `t` (see `condIndepFun_iff_condExp_inter_preimage_eq_mul`).
745+
Here, this is phrased with Markov kernels associated to the conditional expectations, and the
746+
almost sure equality is expressed as equality of the composition-product with the measure, which is
747+
equivalent to a.e. equality. See `condIndepFun_iff_map_prod_eq_prod_map_map` for the a.e. equality
748+
version with kernels.
749+
750+
For a random variable `f`, `(condExpKernel μ m').map f` is the law of the conditional expectation
751+
of `f` given `m'`: almost surely, `(condExpKernel μ m').map f ω s = μ⟦f ⁻¹' s | m'⟧ ω`. -/
752+
theorem condIndepFun_iff_compProd_map_prod_eq_compProd_prod_map_map
753+
{mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'} (hf : Measurable f) (hg : Measurable g) :
754+
CondIndepFun m' hm' f g μ
755+
↔ (μ.trim hm') ⊗ₘ (condExpKernel μ m').map (fun ω ↦ (f ω, g ω))
756+
= (μ.trim hm') ⊗ₘ ((condExpKernel μ m').map f ×ₖ (condExpKernel μ m').map g) :=
757+
Kernel.indepFun_iff_compProd_map_prod_eq_compProd_prod_map_map hf hg
758+
759+
/-- Two random variables are conditionally independent iff they satisfy the almost sure equality
760+
of conditional expectations `μ⟦f ⁻¹' s ∩ g ⁻¹' t | m'⟧ =ᵐ[μ] μ⟦f ⁻¹' s | m'⟧ * μ⟦g ⁻¹' t | m'⟧`
761+
for all measurable sets `s` and `t` (see `condIndepFun_iff_condExp_inter_preimage_eq_mul`).
762+
Here, this is phrased with Markov kernels associated to the conditional expectations.
763+
764+
For a random variable `f`, `(condExpKernel μ m').map f` is the law of the conditional expectation
765+
of `f` given `m'`: almost surely, `(condExpKernel μ m').map f ω s = μ⟦f ⁻¹' s | m'⟧ ω`. -/
766+
theorem condIndepFun_iff_map_prod_eq_prod_map_map
767+
{mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'} [CountableOrCountablyGenerated Ω (β × β')]
768+
(hf : Measurable f) (hg : Measurable g) :
769+
CondIndepFun m' hm' f g μ
770+
↔ (condExpKernel μ m').map (fun ω ↦ (f ω, g ω))
771+
=ᵐ[μ.trim hm'] (condExpKernel μ m').map f ×ₖ (condExpKernel μ m').map g := by
772+
rw [condIndepFun_iff_compProd_map_prod_eq_compProd_prod_map_map hf hg, ← Kernel.compProd_eq_iff]
773+
774+
/-- Two random variables are conditionally independent with respect to `m'` iff the law of
775+
`(id, f, g)` under `μ`, in which the identity is to the space with σ-algebra `m'`, can be written
776+
as a product involving the conditional expectations of `f` and `g` given `m'`.
777+
778+
For a random variable `f`, `(condExpKernel μ m').map f` is the law of the conditional expectation
779+
of `f` given `m'`: almost surely, `(condExpKernel μ m').map f ω s = μ⟦f ⁻¹' s | m'⟧ ω`. -/
780+
lemma condIndepFun_iff_map_prod_eq_prod_comp_trim
781+
{mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'} (hf : Measurable f) (hg : Measurable g) :
782+
CondIndepFun m' hm' f g μ
783+
↔ @Measure.map _ _ _ (m'.prod _) (fun ω ↦ (ω, f ω, g ω)) μ
784+
= (Kernel.id ×ₖ ((condExpKernel μ m').map f ×ₖ (condExpKernel μ m').map g))
785+
∘ₘ μ.trim hm' := by
786+
rw [condIndepFun_iff_compProd_map_prod_eq_compProd_prod_map_map hf hg]
787+
congr!
788+
· rw [Measure.compProd_map (by fun_prop), compProd_trim_condExpKernel,
789+
Measure.map_map (by fun_prop) ((measurable_id.mono le_rfl hm').prodMk measurable_id)]
790+
rfl
791+
· rw [Measure.compProd_eq_comp_prod]
792+
740793
section iCondIndepFun
741794
variable {β : ι → Type*} {m : ∀ i, MeasurableSpace (β i)} {f : ∀ i, Ω → β i}
742795

Mathlib/Probability/Independence/Kernel.lean

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,43 @@ theorem IndepFun.neg_left {_mβ : MeasurableSpace β} {_mβ' : MeasurableSpace
10191019
[MeasurableNeg β] (hfg : IndepFun f g κ μ) :
10201020
IndepFun (-f) g κ μ := hfg.comp measurable_neg measurable_id
10211021

1022+
/-- Two random variables `f, g` are independent given a kernel `κ` and a measure `μ` iff
1023+
`μ ⊗ₘ κ.map (fun ω ↦ (f ω, g ω)) = μ ⊗ₘ (κ.map f ×ₖ κ.map g)`. -/
1024+
theorem indepFun_iff_compProd_map_prod_eq_compProd_prod_map_map
1025+
{mβ : MeasurableSpace β} {mγ : MeasurableSpace γ}
1026+
[IsFiniteMeasure μ] [IsFiniteKernel κ] {f : Ω → β} {g : Ω → γ}
1027+
(hf : Measurable f) (hg : Measurable g) :
1028+
IndepFun f g κ μ ↔ μ ⊗ₘ κ.map (fun ω ↦ (f ω, g ω)) = μ ⊗ₘ (κ.map f ×ₖ κ.map g) := by
1029+
classical
1030+
rw [indepFun_iff_measure_inter_preimage_eq_mul]
1031+
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
1032+
· rw [Measure.ext_prod₃_iff]
1033+
intro u s t hu hs ht
1034+
rw [Measure.compProd_apply (hu.prod (hs.prod ht)),
1035+
Measure.compProd_apply (hu.prod (hs.prod ht))]
1036+
refine lintegral_congr_ae ?_
1037+
have h_set_eq ω : Prod.mk ω ⁻¹' u ×ˢ s ×ˢ t = if ω ∈ u then s ×ˢ t else ∅ := by ext; simp
1038+
simp_rw [h_set_eq]
1039+
filter_upwards [h s t hs ht] with ω hω
1040+
by_cases hωu : ω ∈ u
1041+
swap; · simp [hωu]
1042+
simp only [hωu, ↓reduceIte]
1043+
rw [map_apply _ (by fun_prop), Measure.map_apply (by fun_prop) (hs.prod ht),
1044+
mk_preimage_prod, hω, prod_apply_prod, map_apply' _ (by fun_prop), map_apply' _ (by fun_prop)]
1045+
exacts [ht, hs]
1046+
· intro s t hs ht
1047+
rw [Measure.ext_prod₃_iff] at h
1048+
refine ae_eq_of_forall_setLIntegral_eq_of_sigmaFinite ?_ ?_ ?_
1049+
· exact Kernel.measurable_coe _ ((hf hs).inter (hg ht))
1050+
· exact (Kernel.measurable_coe _ (hf hs)).mul (Kernel.measurable_coe _ (hg ht))
1051+
intro u hu hμu
1052+
specialize h hu hs ht
1053+
rw [Measure.compProd_apply_prod hu (hs.prod ht),
1054+
Measure.compProd_apply_prod hu (hs.prod ht)] at h
1055+
convert h with ω ω
1056+
· rw [map_apply' _ (by fun_prop) _ (hs.prod ht), mk_preimage_prod]
1057+
· rw [prod_apply_prod, map_apply' _ (by fun_prop) _ hs, map_apply' _ (by fun_prop) _ ht]
1058+
10221059
section iIndepFun
10231060
variable {β : ι → Type*} {m : ∀ i, MeasurableSpace (β i)} {f : ∀ i, Ω → β i}
10241061

0 commit comments

Comments
 (0)