Skip to content

Commit c398cab

Browse files
committed
feat(Probability/Independence): reindexing lemmas for iIndep* (#31309)
1 parent 1764613 commit c398cab

File tree

2 files changed

+112
-38
lines changed

2 files changed

+112
-38
lines changed

Mathlib/Probability/Independence/Basic.lean

Lines changed: 51 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ scoped[ProbabilityTheory] notation3 X:50 " ⟂ᵢ " Y:50 => ProbabilityTheory.In
155155

156156
section Definition_lemmas
157157
variable {π : ι → Set (Set Ω)} {m : ι → MeasurableSpace Ω} {_ : MeasurableSpace Ω} {μ : Measure Ω}
158-
{S : Finset ι} {s : ι → Set Ω}
158+
{S : Finset ι} {s : ι → Set Ω} {ι' : Type*} {g : ι' → ι}
159159

160160
lemma iIndepSets_iff (π : ι → Set (Set Ω)) (μ : Measure Ω) :
161161
iIndepSets π μ ↔ ∀ (s : Finset ι) {f : ι → Set Ω} (_H : ∀ i, i ∈ s → f i ∈ π i),
@@ -283,6 +283,56 @@ lemma IndepFun.meas_inter [mβ : MeasurableSpace β] [mγ : MeasurableSpace γ]
283283
μ (s ∩ t) = μ s * μ t :=
284284
(IndepFun_iff _ _ _).1 hfg _ _ hs ht
285285

286+
lemma iIndepSets.precomp (hg : Function.Injective g) (h : iIndepSets π μ) :
287+
iIndepSets (π ∘ g) μ :=
288+
Kernel.iIndepSets.precomp hg h
289+
290+
lemma iIndepSets.of_precomp (hg : Function.Surjective g) (h : iIndepSets (π ∘ g) μ) :
291+
iIndepSets π μ :=
292+
Kernel.iIndepSets.of_precomp hg h
293+
294+
lemma iIndepSets_precomp_of_bijective (hg : Function.Bijective g) :
295+
iIndepSets (π ∘ g) μ ↔ iIndepSets π μ :=
296+
Kernel.iIndepSets_precomp_of_bijective hg
297+
298+
lemma iIndep.precomp (hg : Function.Injective g) (h : iIndep m μ) :
299+
iIndep (m ∘ g) μ :=
300+
Kernel.iIndep.precomp hg h
301+
302+
lemma iIndep.of_precomp (hg : Function.Surjective g) (h : iIndep (m ∘ g) μ) :
303+
iIndep m μ :=
304+
Kernel.iIndep.of_precomp hg h
305+
306+
lemma iIndep_precomp_of_bijective (hg : Function.Bijective g) :
307+
iIndep (m ∘ g) μ ↔ iIndep m μ :=
308+
Kernel.iIndep_precomp_of_bijective hg
309+
310+
lemma iIndepSet.precomp (hg : Function.Injective g) (h : iIndepSet s μ) :
311+
iIndepSet (s ∘ g) μ :=
312+
Kernel.iIndepSet.precomp hg h
313+
314+
lemma iIndepSet.of_precomp (hg : Function.Surjective g) (h : iIndepSet (s ∘ g) μ) :
315+
iIndepSet s μ :=
316+
Kernel.iIndepSet.of_precomp hg h
317+
318+
lemma iIndepSet_precomp_of_bijective (hg : Function.Bijective g) :
319+
iIndepSet (s ∘ g) μ ↔ iIndepSet s μ :=
320+
Kernel.iIndepSet_precomp_of_bijective hg
321+
322+
variable {β : ι → Type*} {m : ∀ i, MeasurableSpace (β i)} {f : ∀ i, Ω → β i}
323+
324+
lemma iIndepFun.precomp (hg : g.Injective) (h : iIndepFun f μ) :
325+
iIndepFun (m := fun i ↦ m (g i)) (fun i ↦ f (g i)) μ :=
326+
Kernel.iIndepFun.precomp hg h
327+
328+
lemma iIndepFun.of_precomp (hg : g.Surjective)
329+
(h : iIndepFun (m := fun i ↦ m (g i)) (fun i ↦ f (g i)) μ) : iIndepFun f μ :=
330+
Kernel.iIndepFun.of_precomp hg h
331+
332+
lemma iIndepFun_precomp_of_bijective (hg : g.Bijective) :
333+
iIndepFun (m := fun i ↦ m (g i)) (fun i ↦ f (g i)) μ ↔ iIndepFun f μ :=
334+
Kernel.iIndepFun_precomp_of_bijective hg
335+
286336
end Definition_lemmas
287337

288338
section Indep
@@ -818,18 +868,6 @@ lemma iIndepFun.indepFun_prodMk_prodMk₀ (h_indep : iIndepFun f μ) (hf : ∀ i
818868
IndepFun (fun a ↦ (f i a, f j a)) (fun a ↦ (f k a, f l a)) μ :=
819869
Kernel.iIndepFun.indepFun_prodMk_prodMk₀ h_indep (by simp [hf]) i j k l hik hil hjk hjl
820870

821-
variable {ι' : Type*} {α : ι → Type*} [∀ i, MeasurableSpace (α i)]
822-
823-
open Function in
824-
lemma iIndepFun.precomp {g : ι' → ι} (hg : g.Injective) (h : iIndepFun f μ) :
825-
iIndepFun (m := fun i ↦ m (g i)) (fun i ↦ f (g i)) μ := by
826-
have : IsProbabilityMeasure μ := h.isProbabilityMeasure
827-
nontriviality ι'
828-
have A (x) : Function.invFun g (g x) = x := Function.leftInverse_invFun hg x
829-
rw [iIndepFun_iff] at h ⊢
830-
intro t s' hs'
831-
simpa [A] using h (t.map ⟨g, hg⟩) (f' := fun i ↦ s' (invFun g i)) (by simpa [A] using hs')
832-
833871
lemma iIndepFun_iff_finset : iIndepFun f μ ↔ ∀ s : Finset ι, iIndepFun (s.restrict f) μ where
834872
mp h s := h.precomp (g := ((↑) : s → ι)) Subtype.val_injective
835873
mpr h := by
@@ -839,30 +877,6 @@ lemma iIndepFun_iff_finset : iIndepFun f μ ↔ ∀ s : Finset ι, iIndepFun (s.
839877
rw [← Finset.prod_coe_sort, this]
840878
exact (h s).meas_iInter fun i ↦ hs i i.2
841879

842-
lemma iIndepFun.of_precomp {g : ι' → ι} (hg : g.Surjective)
843-
(h : iIndepFun (m := fun i ↦ m (g i)) (fun i ↦ f (g i)) μ) : iIndepFun f μ := by
844-
have : IsProbabilityMeasure μ := h.isProbabilityMeasure
845-
nontriviality ι
846-
have := hg.nontrivial
847-
classical
848-
rw [iIndepFun_iff] at h ⊢
849-
intro t s hs
850-
have A (x) : g (Function.invFun g x) = x := Function.rightInverse_invFun hg x
851-
have : ∀ i ∈ Finset.image (Function.invFun g) t,
852-
@MeasurableSet _ (MeasurableSpace.comap (f <| g i) (m <| g i)) (s <| g i) := by
853-
intro i hi
854-
obtain ⟨j, hj, rfl⟩ := Finset.mem_image.mp hi
855-
simpa [A] using (A j).symm ▸ hs j hj
856-
have eq : ∏ i ∈ Finset.image (Function.invFun g) t, μ (s (g i)) = ∏ i ∈ t, μ (s i) := by
857-
rw [Finset.prod_image (fun x hx y hy h => ?_), Finset.prod_congr rfl (fun x _ => by rw [A])]
858-
rw [← A x, ← A y, h]
859-
simpa [A, eq] using h (t.image (Function.invFun g)) (f' := fun i ↦ s (g i)) this
860-
861-
lemma iIndepFun_precomp_of_bijective {g : ι' → ι} (hg : g.Bijective) :
862-
iIndepFun (m := fun i ↦ m (g i)) (fun i ↦ f (g i)) μ ↔ iIndepFun f μ where
863-
mp := .of_precomp hg.surjective
864-
mpr := .precomp hg.injective
865-
866880
end iIndepFun
867881

868882
section Mul

Mathlib/Probability/Independence/Kernel.lean

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ variable {β : ι → Type*} {mβ : ∀ i, MeasurableSpace (β i)}
127127
{_mα : MeasurableSpace α} {m : ι → MeasurableSpace Ω} {_mΩ : MeasurableSpace Ω}
128128
{κ η : Kernel α Ω} {μ : Measure α}
129129
{π : ι → Set (Set Ω)} {s : ι → Set Ω} {S : Finset ι} {f : ∀ x : ι, Ω → β x}
130-
{s1 s2 : Set (Set Ω)}
130+
{s1 s2 : Set (Set Ω)} {ι' : Type*} {g : ι' → ι}
131131

132132
@[simp] lemma iIndepSets_zero_right : iIndepSets π κ 0 := by simp [iIndepSets]
133133

@@ -273,6 +273,64 @@ lemma IndepFun.meas_inter {β γ : Type*} [mβ : MeasurableSpace β] [mγ : Meas
273273
{s t : Set Ω} (hs : MeasurableSet[mβ.comap f] s) (ht : MeasurableSet[mγ.comap g] t) :
274274
∀ᵐ a ∂μ, κ a (s ∩ t) = κ a s * κ a t := hfg _ _ hs ht
275275

276+
lemma iIndepSets.precomp (hg : Function.Injective g) (h : iIndepSets π κ μ) :
277+
iIndepSets (π ∘ g) κ μ := by
278+
intro s f hf
279+
let f' := Function.extend g f fun _ => ∅
280+
have f'_apply x : f' (g x) = f x := hg.extend_apply ..
281+
classical
282+
have hf' : ∀ i ∈ s.image g, f' i ∈ π i := by
283+
simp_rw [Finset.forall_mem_image, f'_apply]
284+
exact hf
285+
filter_upwards [@h (s.image g) f' hf'] with a ha
286+
simpa [Finset.set_biInter_finset_image, Finset.prod_image hg.injOn, f'_apply] using ha
287+
288+
lemma iIndepSets.of_precomp (hg : Function.Surjective g) (h : iIndepSets (π ∘ g) κ μ) :
289+
iIndepSets π κ μ := by
290+
obtain ⟨g', hg'⟩ := hg.hasRightInverse
291+
convert h.precomp hg'.injective
292+
rw [Function.comp_assoc, hg'.comp_eq_id, Function.comp_id]
293+
294+
lemma iIndepSets_precomp_of_bijective (hg : Function.Bijective g) :
295+
iIndepSets (π ∘ g) κ μ ↔ iIndepSets π κ μ :=
296+
⟨.of_precomp hg.surjective, .precomp hg.injective⟩
297+
298+
lemma iIndep.precomp (hg : Function.Injective g) (h : iIndep m κ μ) :
299+
iIndep (m ∘ g) κ μ :=
300+
(iIndepSets.precomp hg h :)
301+
302+
lemma iIndep.of_precomp (hg : Function.Surjective g) (h : iIndep (m ∘ g) κ μ) :
303+
iIndep m κ μ :=
304+
iIndepSets.of_precomp hg h
305+
306+
lemma iIndep_precomp_of_bijective (hg : Function.Bijective g) :
307+
iIndep (m ∘ g) κ μ ↔ iIndep m κ μ :=
308+
⟨.of_precomp hg.surjective, .precomp hg.injective⟩
309+
310+
lemma iIndepSet.precomp (hg : Function.Injective g) (h : iIndepSet s κ μ) :
311+
iIndepSet (s ∘ g) κ μ :=
312+
iIndep.precomp hg h
313+
314+
lemma iIndepSet.of_precomp (hg : Function.Surjective g) (h : iIndepSet (s ∘ g) κ μ) :
315+
iIndepSet s κ μ :=
316+
iIndep.of_precomp hg h
317+
318+
lemma iIndepSet_precomp_of_bijective (hg : Function.Bijective g) :
319+
iIndepSet (s ∘ g) κ μ ↔ iIndepSet s κ μ :=
320+
⟨.of_precomp hg.surjective, .precomp hg.injective⟩
321+
322+
lemma iIndepFun.precomp (hg : Function.Injective g) (h : iIndepFun f κ μ) :
323+
iIndepFun (fun i ↦ f (g i)) κ μ :=
324+
iIndep.precomp hg h
325+
326+
lemma iIndepFun.of_precomp (hg : Function.Surjective g) (h : iIndepFun (fun i ↦ f (g i)) κ μ) :
327+
iIndepFun f κ μ :=
328+
iIndep.of_precomp hg h
329+
330+
lemma iIndepFun_precomp_of_bijective (hg : Function.Bijective g) :
331+
iIndepFun (fun i ↦ f (g i)) κ μ ↔ iIndepFun f κ μ :=
332+
⟨.of_precomp hg.surjective, .precomp hg.injective⟩
333+
276334
end ByDefinition
277335

278336
section Indep
@@ -1482,3 +1540,5 @@ lemma iIndepFun.cond_iInter [Finite ι] (hY : ∀ i, Measurable (Y i))
14821540
-- for kernels
14831541

14841542
end ProbabilityTheory.Kernel
1543+
1544+
set_option linter.style.longFile 1700

0 commit comments

Comments
 (0)