Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 001ffdc

Browse files
committed
feat(probability/independence): Independence of singletons (#18506)
Characterisation of independence in terms of measure distributing over finite intersections, and lemmas connecting the different concepts of independence. Also add supporting `measurable_space` and `set.preimage` lemmas
1 parent 8818fde commit 001ffdc

File tree

5 files changed

+146
-5
lines changed

5 files changed

+146
-5
lines changed

src/data/set/basic.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,3 +1906,6 @@ lemma subset_right_of_subset_union (h : s ⊆ t ∪ u) (hab : disjoint s t) : s
19061906
hab.left_le_of_le_sup_left h
19071907

19081908
end disjoint
1909+
1910+
@[simp] lemma Prop.compl_singleton (p : Prop) : ({p}ᶜ : set Prop) = {¬ p} :=
1911+
ext $ λ q, by simpa [@iff.comm q] using not_iff

src/data/set/image.lean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ theorem subset_preimage_univ {s : set α} : s ⊆ f ⁻¹' univ := subset_univ _
7171
@[simp] theorem preimage_diff (f : α → β) (s t : set β) :
7272
f ⁻¹' (s \ t) = f ⁻¹' s \ f ⁻¹' t := rfl
7373

74+
@[simp] lemma preimage_symm_diff (f : α → β) (s t : set β) :
75+
f ⁻¹' (s ∆ t) = (f ⁻¹' s) ∆ (f ⁻¹' t) := rfl
76+
7477
@[simp] theorem preimage_ite (f : α → β) (s t₁ t₂ : set β) :
7578
f ⁻¹' (s.ite t₁ t₂) = (f ⁻¹' s).ite (f ⁻¹' t₁) (f ⁻¹' t₂) :=
7679
rfl
@@ -120,6 +123,10 @@ lemma nonempty_of_nonempty_preimage {s : set β} {f : α → β} (hf : (f ⁻¹'
120123
s.nonempty :=
121124
let ⟨x, hx⟩ := hf in ⟨f x, hx⟩
122125

126+
@[simp] lemma preimage_singleton_true (p : α → Prop) : p ⁻¹' {true} = {a | p a} := by { ext, simp }
127+
@[simp] lemma preimage_singleton_false (p : α → Prop) : p ⁻¹' {false} = {a | ¬ p a} :=
128+
by { ext, simp }
129+
123130
lemma preimage_subtype_coe_eq_compl {α : Type*} {s u v : set α} (hsuv : s ⊆ u ∪ v)
124131
(H : s ∩ (u ∩ v) = ∅) : (coe : s → α) ⁻¹' u = (coe ⁻¹' v)ᶜ :=
125132
begin
@@ -1003,6 +1010,9 @@ lemma left_inverse.preimage_preimage {g : β → α} (h : left_inverse g f) (s :
10031010
f ⁻¹' (g ⁻¹' s) = s :=
10041011
by rw [← preimage_comp, h.comp_eq_id, preimage_id]
10051012

1013+
protected lemma involutive.preimage {f : α → α} (hf : involutive f) : involutive (preimage f) :=
1014+
hf.right_inverse.preimage_preimage
1015+
10061016
end function
10071017

10081018
namespace equiv_like

src/measure_theory/measurable_space.lean

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Authors: Johannes Hölzl, Mario Carneiro
77
import data.prod.tprod
88
import group_theory.coset
99
import logic.equiv.fin
10+
import logic.lemmas
1011
import measure_theory.measurable_space_def
1112
import order.filter.small_sets
1213
import order.liminf_limsup
@@ -136,6 +137,12 @@ lemma le_map_comap : m ≤ (m.comap g).map g := (gc_comap_map g).le_u_l _
136137

137138
end functors
138139

140+
@[simp] lemma map_const {m} (b : β) : measurable_space.map (λ a : α, b) m = ⊤ :=
141+
eq_top_iff.2 $ by { rintro s hs, by_cases b ∈ s; change measurable_set (preimage _ _); simp [*] }
142+
143+
@[simp] lemma comap_const {m} (b : β) : measurable_space.comap (λ a : α, b) m = ⊥ :=
144+
eq_bot_iff.2 $ by { rintro _ ⟨s, -, rfl⟩, by_cases b ∈ s; simp [*] }
145+
139146
lemma comap_generate_from {f : α → β} {s : set (set β)} :
140147
(generate_from s).comap f = generate_from (preimage f '' s) :=
141148
le_antisymm
@@ -291,13 +298,15 @@ section constructions
291298
instance : measurable_space empty := ⊤
292299
instance : measurable_space punit := ⊤ -- this also works for `unit`
293300
instance : measurable_space bool := ⊤
301+
instance Prop.measurable_space : measurable_space Prop := ⊤
294302
instance : measurable_space ℕ := ⊤
295303
instance : measurable_space ℤ := ⊤
296304
instance : measurable_space ℚ := ⊤
297305

298306
instance : measurable_singleton_class empty := ⟨λ _, trivial⟩
299307
instance : measurable_singleton_class punit := ⟨λ _, trivial⟩
300308
instance : measurable_singleton_class bool := ⟨λ _, trivial⟩
309+
instance Prop.measurable_singleton_class : measurable_singleton_class Prop := ⟨λ _, trivial⟩
301310
instance : measurable_singleton_class ℕ := ⟨λ _, trivial⟩
302311
instance : measurable_singleton_class ℤ := ⟨λ _, trivial⟩
303312
instance : measurable_singleton_class ℚ := ⟨λ _, trivial⟩
@@ -340,6 +349,15 @@ begin
340349
exact h,
341350
end
342351

352+
lemma measurable_to_prop {f : α → Prop} (h : measurable_set (f⁻¹' {true})) : measurable f :=
353+
begin
354+
refine measurable_to_countable' (λ x, _),
355+
by_cases hx : x,
356+
{ simpa [hx] using h },
357+
{ simpa only [hx, ←preimage_compl, Prop.compl_singleton, not_true, preimage_singleton_false]
358+
using h.compl }
359+
end
360+
343361
lemma measurable_find_greatest' {p : α → ℕ → Prop} [∀ x, decidable_pred (p x)]
344362
{N : ℕ} (hN : ∀ k ≤ N, measurable_set {x | nat.find_greatest (p x) N = k}) :
345363
measurable (λ x, nat.find_greatest (p x) N) :=
@@ -860,8 +878,38 @@ end sum
860878
instance {α} {β : α → Type*} [m : Πa, measurable_space (β a)] : measurable_space (sigma β) :=
861879
⨅a, (m a).map (sigma.mk a)
862880

881+
section prop
882+
variables {p : α → Prop}
883+
884+
variables [measurable_space α]
885+
886+
@[simp] lemma measurable_set_set_of : measurable_set {a | p a} ↔ measurable p :=
887+
⟨λ h, measurable_to_prop $ by simpa only [preimage_singleton_true], λ h,
888+
by simpa using h (measurable_set_singleton true)⟩
889+
890+
@[simp] lemma measurable_mem : measurable (∈ s) ↔ measurable_set s := measurable_set_set_of.symm
891+
892+
alias measurable_set_set_of ↔ _ measurable.set_of
893+
alias measurable_mem ↔ _ measurable_set.mem
894+
895+
end prop
863896
end constructions
864897

898+
namespace measurable_space
899+
900+
/-- The sigma-algebra generated by a single set `s` is `{∅, s, sᶜ, univ}`. -/
901+
@[simp] lemma generate_from_singleton (s : set α) :
902+
generate_from {s} = measurable_space.comap (∈ s) ⊤ :=
903+
begin
904+
classical,
905+
letI : measurable_space α := generate_from {s},
906+
refine le_antisymm (generate_from_le $ λ t ht, ⟨{true}, trivial, by simp [ht.symm]⟩) _,
907+
rintro _ ⟨u, -, rfl⟩,
908+
exact (show measurable_set s, from generate_measurable.basic _ $ mem_singleton s).mem trivial,
909+
end
910+
911+
end measurable_space
912+
865913
/-- A map `f : α → β` is called a *measurable embedding* if it is injective, measurable, and sends
866914
measurable sets to measurable sets. The latter assumption can be replaced with “`f` has measurable
867915
inverse `g : range f → α`”, see `measurable_embedding.measurable_range_splitting`,
@@ -1052,6 +1100,9 @@ e.to_equiv.image_eq_preimage s
10521100
measurable_set (e '' s) ↔ measurable_set s :=
10531101
by rw [image_eq_preimage, measurable_set_preimage]
10541102

1103+
@[simp] lemma map_eq (e : α ≃ᵐ β) : measurable_space.map e ‹_› = ‹_› :=
1104+
e.measurable.le_map.antisymm' $ λ s, e.measurable_set_preimage.1
1105+
10551106
/-- A measurable equivalence is a measurable embedding. -/
10561107
protected lemma measurable_embedding (e : α ≃ᵐ β) : measurable_embedding e :=
10571108
{ injective := e.injective,
@@ -1277,12 +1328,41 @@ def sum_compl {s : set α} [decidable_pred s] (hs : measurable_set s) : s ⊕ (s
12771328
measurable_to_fun := by {apply measurable.sum_elim; exact measurable_subtype_coe},
12781329
measurable_inv_fun := measurable.dite measurable_inl measurable_inr hs }
12791330

1331+
/-- Convert a measurable involutive function `f` to a measurable permutation with
1332+
`to_fun = inv_fun = f`. See also `function.involutive.to_perm`. -/
1333+
@[simps to_equiv] def of_involutive (f : α → α) (hf : involutive f) (hf' : measurable f) : α ≃ᵐ α :=
1334+
{ measurable_to_fun := hf',
1335+
measurable_inv_fun := hf',
1336+
..hf.to_perm _ }
1337+
1338+
@[simp] lemma of_involutive_apply (f : α → α) (hf : involutive f) (hf' : measurable f) (a : α) :
1339+
of_involutive f hf hf' a = f a := rfl
1340+
1341+
@[simp] lemma of_involutive_symm (f : α → α) (hf : involutive f) (hf' : measurable f) :
1342+
(of_involutive f hf hf').symm = of_involutive f hf hf' := rfl
1343+
12801344
end measurable_equiv
12811345

12821346
namespace measurable_embedding
12831347

12841348
variables [measurable_space α] [measurable_space β] [measurable_space γ] {f : α → β} {g : β → α}
12851349

1350+
@[simp] lemma comap_eq (hf : measurable_embedding f) : measurable_space.comap f ‹_› = ‹_› :=
1351+
hf.measurable.comap_le.antisymm $ λ s h,
1352+
⟨_, hf.measurable_set_image' h, hf.injective.preimage_image _⟩
1353+
1354+
lemma iff_comap_eq :
1355+
measurable_embedding f ↔
1356+
injective f ∧ measurable_space.comap f ‹_› = ‹_› ∧ measurable_set (range f) :=
1357+
⟨λ hf, ⟨hf.injective, hf.comap_eq, hf.measurable_set_range⟩, λ hf,
1358+
{ injective := hf.1,
1359+
measurable := by { rw ←hf.2.1, exact comap_measurable f },
1360+
measurable_set_image' := begin
1361+
rw ←hf.2.1,
1362+
rintro _ ⟨s, hs, rfl⟩,
1363+
simpa only [image_preimage_eq_inter_range] using hs.inter hf.2.2,
1364+
end }⟩
1365+
12861366
/-- A set is equivalent to its image under a function `f` as measurable spaces,
12871367
if `f` is a measurable embedding -/
12881368
noncomputable def equiv_image (s : set α) (hf : measurable_embedding f) :
@@ -1377,6 +1457,19 @@ end
13771457

13781458
end measurable_embedding
13791459

1460+
lemma measurable_space.comap_compl {m' : measurable_space β} [boolean_algebra β]
1461+
(h : measurable (compl : β → β)) (f : α → β) :
1462+
measurable_space.comap (λ a, (f a)ᶜ) infer_instance = measurable_space.comap f infer_instance :=
1463+
begin
1464+
rw ←measurable_space.comap_comp,
1465+
congr',
1466+
exact (measurable_equiv.of_involutive _ compl_involutive h).measurable_embedding.comap_eq,
1467+
end
1468+
1469+
@[simp] lemma measurable_space.comap_not (p : α → Prop) :
1470+
measurable_space.comap (λ a, ¬ p a) infer_instance = measurable_space.comap p infer_instance :=
1471+
measurable_space.comap_compl (λ _ _, trivial) _
1472+
13801473
section countably_generated
13811474

13821475
namespace measurable_space

src/measure_theory/measurable_space_def.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ by { cases i, exacts [h₂, h₁] }
196196
measurable_set (disjointed f n) :=
197197
disjointed_rec (λ t i ht, measurable_set.diff ht $ h _) (h n)
198198

199-
@[simp] lemma measurable_set.const (p : Prop) : measurable_set {a : α | p} :=
199+
lemma measurable_set.const (p : Prop) : measurable_set {a : α | p} :=
200200
by { by_cases p; simp [h, measurable_set.empty]; apply measurable_set.univ }
201201

202202
/-- Every set has a measurable superset. Declare this as local instance as needed. -/
@@ -377,10 +377,10 @@ begin
377377
{ exact measurable_set_generate_from ht, },
378378
end
379379

380-
@[simp] lemma generate_from_singleton_empty : generate_from {∅} = (⊥ : measurable_space α) :=
380+
lemma generate_from_singleton_empty : generate_from {∅} = (⊥ : measurable_space α) :=
381381
by { rw [eq_bot_iff, generate_from_le_iff], simp, }
382382

383-
@[simp] lemma generate_from_singleton_univ : generate_from {set.univ} = (⊥ : measurable_space α) :=
383+
lemma generate_from_singleton_univ : generate_from {set.univ} = (⊥ : measurable_space α) :=
384384
by { rw [eq_bot_iff, generate_from_le_iff], simp, }
385385

386386
lemma measurable_set_bot_iff {s : set α} : @measurable_set α ⊥ s ↔ (s = ∅ ∨ s = univ) :=

src/probability/independence/basic.lean

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ when defining `μ` in the example above, the measurable space used is the last o
6464
Part A, Chapter 4.
6565
-/
6666

67-
open measure_theory measurable_space
67+
open measure_theory measurable_space set
6868
open_locale big_operators measure_theory ennreal
6969

7070
namespace probability_theory
@@ -577,7 +577,8 @@ We prove the following equivalences on `indep_set`, for measurable sets `s, t`.
577577
* `indep_set s t μ ↔ indep_sets {s} {t} μ`.
578578
-/
579579

580-
variables {s t : set Ω} (S T : set (set Ω))
580+
variables {s t : set Ω} (S T : set (set Ω)) {π : ι → set (set Ω)} {f : ι → set Ω}
581+
{m0 : measurable_space Ω} {μ : measure Ω}
581582

582583
lemma indep_set_iff_indep_sets_singleton {m0 : measurable_space Ω}
583584
(hs_meas : measurable_set s) (ht_meas : measurable_set t)
@@ -624,6 +625,40 @@ lemma indep_iff_forall_indep_set (m₁ m₂ : measurable_space Ω) {m0 : measura
624625
λ h s t hs ht, h s t hs ht s t (measurable_set_generate_from (set.mem_singleton s))
625626
(measurable_set_generate_from (set.mem_singleton t))⟩
626627

628+
lemma Indep_sets.meas_Inter [fintype ι] (h : Indep_sets π μ) (hf : ∀ i, f i ∈ π i) :
629+
μ (⋂ i, f i) = ∏ i, μ (f i) :=
630+
by simp [← h _ (λ i _, hf _)]
631+
632+
lemma Indep_comap_mem_iff : Indep (λ i, measurable_space.comap (∈ f i) ⊤) μ ↔ Indep_set f μ :=
633+
by { simp_rw ←generate_from_singleton, refl }
634+
635+
alias Indep_comap_mem_iff ↔ _ Indep_set.Indep_comap_mem
636+
637+
lemma Indep_sets_singleton_iff :
638+
Indep_sets (λ i, {f i}) μ ↔ ∀ t, μ (⋂ i ∈ t, f i) = ∏ i in t, μ (f i) :=
639+
forall_congr $ λ t,
640+
⟨λ h, h $ λ _ _, mem_singleton _,
641+
λ h f hf, begin
642+
refine eq.trans _ (h.trans $ finset.prod_congr rfl $ λ i hi, congr_arg _ $ (hf i hi).symm),
643+
rw Inter₂_congr hf,
644+
end
645+
646+
variables [is_probability_measure μ]
647+
648+
lemma Indep_set_iff_Indep_sets_singleton (hf : ∀ i, measurable_set (f i)) :
649+
Indep_set f μ ↔ Indep_sets (λ i, {f i}) μ :=
650+
⟨Indep.Indep_sets $ λ _, rfl, Indep_sets.Indep _
651+
(λ i, generate_from_le $ by { rintro t (rfl : t = _), exact hf _}) _
652+
(λ _, is_pi_system.singleton _) $ λ _, rfl⟩
653+
654+
lemma Indep_set_iff_measure_Inter_eq_prod (hf : ∀ i, measurable_set (f i)) :
655+
Indep_set f μ ↔ ∀ s, μ (⋂ i ∈ s, f i) = ∏ i in s, μ (f i) :=
656+
(Indep_set_iff_Indep_sets_singleton hf).trans Indep_sets_singleton_iff
657+
658+
lemma Indep_sets.Indep_set_of_mem (hfπ : ∀ i, f i ∈ π i) (hf : ∀ i, measurable_set (f i))
659+
(hπ : Indep_sets π μ) : Indep_set f μ :=
660+
(Indep_set_iff_measure_Inter_eq_prod hf).2 $ λ t, hπ _ $ λ i _, hfπ _
661+
627662
end indep_set
628663

629664
section indep_fun

0 commit comments

Comments
 (0)