Skip to content

Commit e66d2d2

Browse files
authored
Prove independence lemmas (#39)
2 parents 84698ca + 2c266b4 commit e66d2d2

3 files changed

Lines changed: 58 additions & 6 deletions

File tree

‎LeanBandits/ForMathlib/IndepFun.lean‎

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ open MeasureTheory Finset
44

55
namespace ProbabilityTheory
66

7-
variable {Ω E : Type*} {mΩ : MeasurableSpace Ω} {mE : MeasurableSpace E} {μ : Measure Ω}
7+
variable {α Ω Ω' E ι : Type*} [Countable ι] {mα : MeasurableSpace α}
8+
{mΩ : MeasurableSpace Ω} {mΩ' : MeasurableSpace Ω'}
9+
{mE : MeasurableSpace E} {μ ν : Measure Ω}
810

911
lemma iIndepFun_nat_iff_forall_indepFun {X : ℕ → Ω → E} (hX : ∀ n, AEMeasurable (X n) μ) :
1012
iIndepFun X μ ↔ ∀ n, X (n + 1) ⟂ᵢ[μ] fun ω (i : Iic n) ↦ X i ω := by
@@ -23,4 +25,47 @@ lemma iIndepFun_nat_iff_forall_indepFun {X : ℕ → Ω → E} (hX : ∀ n, AEMe
2325
intro n
2426
sorry
2527

28+
-- todo: kernel version?
29+
lemma IndepFun_map_iff [IsFiniteMeasure μ] {X : Ω' → E} {Y : Ω' → E} {f : Ω → Ω'}
30+
(hf : AEMeasurable f μ) (hX : AEMeasurable X (μ.map f)) (hY : AEMeasurable Y (μ.map f)) :
31+
X ⟂ᵢ[μ.map f] Y ↔ (X ∘ f) ⟂ᵢ[μ] (Y ∘ f) := by
32+
rw [indepFun_iff_map_prod_eq_prod_map_map hX hY,
33+
indepFun_iff_map_prod_eq_prod_map_map (by fun_prop) (by fun_prop)]
34+
rw [AEMeasurable.map_map_of_aemeasurable hY hf, AEMeasurable.map_map_of_aemeasurable hX hf,
35+
AEMeasurable.map_map_of_aemeasurable (by fun_prop) (by fun_prop)]
36+
rfl
37+
38+
lemma iIndepFun_map_iff [IsProbabilityMeasure μ] {X : ι → Ω' → E} {f : Ω → Ω'}
39+
(hf : AEMeasurable f μ) (hX : ∀ n, AEMeasurable (X n) (μ.map f)) :
40+
iIndepFun X (μ.map f) ↔ iIndepFun (fun n ↦ X n ∘ f) μ := by
41+
have := Measure.isProbabilityMeasure_map hf (μ := μ)
42+
rw [iIndepFun_iff_map_fun_eq_infinitePi_map₀' hX,
43+
iIndepFun_iff_map_fun_eq_infinitePi_map₀' (by fun_prop)]
44+
rw [AEMeasurable.map_map_of_aemeasurable (by fun_prop) hf]
45+
congr! 3
46+
rw [AEMeasurable.map_map_of_aemeasurable (hX _) hf]
47+
48+
lemma identDistrib_map_right_iff {X : Ω → E} {Y : Ω' → E} {f : Ω → Ω'}
49+
(hf : AEMeasurable f ν) (hX : AEMeasurable X μ) (hY : AEMeasurable Y (ν.map f)) :
50+
IdentDistrib X Y μ (ν.map f) ↔ IdentDistrib X (Y ∘ f) μ ν := by
51+
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
52+
· constructor
53+
· exact hX
54+
· fun_prop
55+
· rw [h.map_eq, AEMeasurable.map_map_of_aemeasurable (by fun_prop) hf]
56+
· constructor
57+
· exact hX
58+
· fun_prop
59+
· rw [h.map_eq, AEMeasurable.map_map_of_aemeasurable hY hf]
60+
61+
lemma identDistrib_comm (X : Ω → E) (Y : Ω' → E) {ν : Measure Ω'} :
62+
IdentDistrib X Y μ ν ↔ IdentDistrib Y X ν μ :=
63+
⟨fun h ↦ h.symm, fun h ↦ h.symm⟩
64+
65+
lemma identDistrib_map_left_iff {X : Ω → E} {Y : Ω' → E} {f : Ω → Ω'}
66+
(hf : AEMeasurable f ν) (hX : AEMeasurable X μ) (hY : AEMeasurable Y (ν.map f)) :
67+
IdentDistrib Y X (ν.map f) μ ↔ IdentDistrib (Y ∘ f) X ν μ := by
68+
rw [identDistrib_comm Y, identDistrib_comm _ X]
69+
exact identDistrib_map_right_iff hf hX hY
70+
2671
end ProbabilityTheory

‎LeanBandits/RewardByCountMeasure.lean‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ lemma identDistrib_rewardByCount_stream' [Countable α] [StandardBorelSpace α]
365365
(Bandit.measure alg ν) (Bandit.streamMeasure ν) := by
366366
refine IdentDistrib.pi (fun n ↦ ?_) ?_ ?_
367367
· refine identDistrib_rewardByCount_eval a (n + 1) n (by simp) (ν := ν)
368-
· sorry
368+
· have h_indep := iIndepFun_rewardByCount' alg ν a
369+
exact iIndepFun.precomp (g := fun n ↦ n + 1) (fun i j hij ↦ by grind) h_indep
369370
· exact iIndepFun_eval_streamMeasure'' ν a
370371

371372
lemma identDistrib_rewardByCount_stream [Countable α] [StandardBorelSpace α] [Nonempty α]
@@ -374,9 +375,15 @@ lemma identDistrib_rewardByCount_stream [Countable α] [StandardBorelSpace α] [
374375
(Bandit.measure alg ν) (Bandit.measure alg ν) := by
375376
refine (identDistrib_rewardByCount_stream' a).trans ?_
376377
refine IdentDistrib.pi (fun n ↦ ?_) ?_ ?_
377-
· sorry
378-
· sorry
379-
· sorry
378+
· rw [← Bandit.snd_measure alg ν, Measure.snd,
379+
identDistrib_map_left_iff (by fun_prop) (by fun_prop)
380+
(Measurable.aemeasurable <| by fun_prop)]
381+
exact IdentDistrib.refl (by fun_prop)
382+
· exact iIndepFun_eval_streamMeasure'' ν a
383+
· change iIndepFun (fun n ↦ ((fun ω ↦ ω n a) ∘ Prod.snd)) (Bandit.measure alg ν)
384+
rw [← iIndepFun_map_iff (by fun_prop) (fun _ ↦ Measurable.aemeasurable (by fun_prop))]
385+
rw [← Measure.snd, Bandit.snd_measure]
386+
exact iIndepFun_eval_streamMeasure'' ν a
380387

381388
lemma indepFun_rewardByCount_of_ne {a b : α} (hab : a ≠ b) :
382389
IndepFun (fun ω s ↦ rewardByCount a s ω.1 ω.2) (fun ω s ↦ rewardByCount b s ω.1 ω.2)

‎lake-manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"subDir": null,
1717
"scope": "",
18-
"rev": "98b14016adbf3d90a2cc79399e49b9ee67b4155c",
18+
"rev": "be9d1e42709f0c71f23bf54fdcea77c4058cd659",
1919
"name": "mathlib",
2020
"manifestFile": "lake-manifest.json",
2121
"inputRev": null,

0 commit comments

Comments
 (0)