Skip to content

Commit dc52d25

Browse files
authored
Prove a few sorry (#33)
2 parents eb36159 + 6122d41 commit dc52d25

3 files changed

Lines changed: 61 additions & 9 deletions

File tree

‎LeanBandits/Algorithm.lean‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,43 @@ lemma action_zero_detAlgorithm [MeasurableSingletonClass α] : action 0 =ᵐ[
208208
simp [detAlgorithm]
209209
exact ae_of_ae_map (by fun_prop) h_eq
210210

211+
lemma action_eq_eval_comp_hist (n : ℕ) :
212+
action (α := α) (R := R) n = (fun x ↦ (x ⟨n, by simp⟩).1) ∘ (hist n) := rfl
213+
214+
lemma reward_eq_eval_comp_hist (n : ℕ) :
215+
reward (α := α) (R := R) n = (fun x ↦ (x ⟨n, by simp⟩).2) ∘ (hist n) := rfl
216+
217+
lemma measurable_hist_filtration (n : ℕ) : Measurable[Learning.filtration α R n] (hist n) := by
218+
simp [Learning.filtration, Filtration.piLE_eq_comap_frestrictLe, ← hist_eq_frestrictLe,
219+
measurable_iff_comap_le]
220+
221+
-- todo: due to the type of `Adapted` and the fact that `Iic n → α × R` depends on `n`, we cannot
222+
-- state that `hist` is adapted.
223+
224+
lemma measurable_action_filtration (n : ℕ) : Measurable[Learning.filtration α R n] (action n) := by
225+
simp only [Learning.filtration, Filtration.piLE_eq_comap_frestrictLe, ← hist_eq_frestrictLe]
226+
rw [action_eq_eval_comp_hist, measurable_iff_comap_le, ← MeasurableSpace.comap_comp]
227+
refine MeasurableSpace.comap_mono ?_
228+
rw [← measurable_iff_comap_le]
229+
fun_prop
230+
231+
lemma adapted_action [TopologicalSpace α] [TopologicalSpace.PseudoMetrizableSpace α]
232+
[SecondCountableTopology α] [OpensMeasurableSpace α] :
233+
Adapted (Learning.filtration α R) action :=
234+
fun n ↦ (measurable_action_filtration n).stronglyMeasurable
235+
236+
lemma measurable_reward_filtration (n : ℕ) : Measurable[Learning.filtration α R n] (reward n) := by
237+
simp only [Learning.filtration, Filtration.piLE_eq_comap_frestrictLe, ← hist_eq_frestrictLe]
238+
rw [reward_eq_eval_comp_hist, measurable_iff_comap_le, ← MeasurableSpace.comap_comp]
239+
refine MeasurableSpace.comap_mono ?_
240+
rw [← measurable_iff_comap_le]
241+
fun_prop
242+
243+
lemma adapted_reward [TopologicalSpace R] [TopologicalSpace.PseudoMetrizableSpace R]
244+
[SecondCountableTopology R] [OpensMeasurableSpace R] :
245+
Adapted (Learning.filtration α R) reward :=
246+
fun n ↦ (measurable_reward_filtration n).stronglyMeasurable
247+
211248
lemma action_detAlgorithm_ae_eq
212249
[StandardBorelSpace α] [Nonempty α] [StandardBorelSpace R] [Nonempty R]
213250
(n : ℕ) :

‎LeanBandits/Bandit.lean‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,18 @@ lemma integral_eval_streamMeasure (ν : Kernel α ℝ) [IsMarkovKernel ν] (n :
121121
rw [integral_map (Measurable.aemeasurable (by fun_prop)) (by fun_prop)]
122122
_ = (ν a)[id] := by simp [(hasLaw_eval_eval_streamMeasure ν n a).map_eq]
123123

124-
lemma iIndepFun_eval_streamMeasure (ν : Kernel α R) [IsMarkovKernel ν] :
125-
iIndepFun (fun (p : ℕ × α) ω ↦ ω p.1 p.2) (Bandit.streamMeasure ν) := by
126-
sorry
127-
128124
lemma iIndepFun_eval_streamMeasure' (ν : Kernel α R) [IsMarkovKernel ν] :
129-
iIndepFun (fun n ω ↦ ω n) (Bandit.streamMeasure ν) := by
130-
sorry
125+
iIndepFun (fun n ω ↦ ω n) (Bandit.streamMeasure ν) :=
126+
iIndepFun_infinitePi (μ := fun (_ : ℕ) ↦ Measure.infinitePi ν) (Ω := fun _ ↦ α → R)
127+
(X := fun i u ↦ u) (fun i ↦ by fun_prop)
131128

132129
lemma iIndepFun_eval_streamMeasure'' (ν : Kernel α R) [IsMarkovKernel ν] (a : α) :
133-
iIndepFun (fun n ω ↦ ω n a) (Bandit.streamMeasure ν) := by
130+
iIndepFun (fun n ω ↦ ω n a) (Bandit.streamMeasure ν) :=
131+
(iIndepFun_eval_streamMeasure' ν).comp (g := fun i ω ↦ ω a) (by fun_prop)
132+
133+
lemma iIndepFun_eval_streamMeasure (ν : Kernel α R) [IsMarkovKernel ν] :
134+
iIndepFun (fun (p : ℕ × α) ω ↦ ω p.1 p.2) (Bandit.streamMeasure ν) := by
135+
have h_ind := iIndepFun_eval_streamMeasure' ν
134136
sorry
135137

136138
lemma indepFun_eval_streamMeasure (ν : Kernel α R) [IsMarkovKernel ν] {n m : ℕ} {a b : α}

‎LeanBandits/Regret.lean‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,24 @@ lemma stepsUntil_eq_congr {h' : ℕ → α × ℝ} (h_eq : ∀ i ≤ n, arm i h
193193

194194
lemma pullCount_stepsUntil_add_one (h_exists : ∃ s, pullCount a (s + 1) h = m) :
195195
pullCount a (stepsUntil a m h + 1).toNat h = m := by
196-
sorry
196+
classical
197+
have h_eq := stepsUntil_eq_dite a m h
198+
simp only [h_exists, ↓reduceDIte] at h_eq
199+
have h' := Nat.find_spec h_exists
200+
rw [h_eq]
201+
rw [ENat.toNat_add (by simp) (by simp)]
202+
simp only [ENat.toNat_coe, ENat.toNat_one]
203+
exact h'
197204

198205
lemma pullCount_stepsUntil (hm : m ≠ 0) (h_exists : ∃ s, pullCount a (s + 1) h = m) :
199206
pullCount a (stepsUntil a m h).toNat h = m - 1 := by
200-
sorry
207+
have h_arm := arm_eq_of_stepsUntil_eq_coe (n := (stepsUntil a m h).toNat) (a := a) (ω := h) hm ?_
208+
swap; · symm; simpa [stepsUntil_eq_top_iff]
209+
have h_add_one := pullCount_stepsUntil_add_one h_exists
210+
nth_rw 1 [← h_arm] at h_add_one
211+
rw [ENat.toNat_add ?_ (by simp), ENat.toNat_one, pullCount_eq_pullCount_add_one] at h_add_one
212+
swap; · simpa [stepsUntil_eq_top_iff]
213+
grind
201214

202215
section SumRewards
203216

0 commit comments

Comments
 (0)