Skip to content

Commit d40b8ee

Browse files
authored
Remove last sorry in UCB file (#48)
2 parents f722bf7 + 7a384ff commit d40b8ee

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

‎LeanBandits/BanditAlgorithms/UCB.lean‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,25 @@ lemma pullCount_le_add (a : Fin K) (n C : ℕ) (ω : ℕ → Fin K × ℝ) :
468468
rw [Finset.sum_add_distrib]
469469
_ ≤ C + 1 + ∑ s ∈ range n, {s | arm s ω = a ∧ C < pullCount a s ω}.indicator 1 s := by
470470
gcongr
471-
simp_rw [pullCount_eq_sum]
472-
sorry
471+
have h_le n : ∑ s ∈ range n, {s | arm s ω = a ∧ pullCount a s ω ≤ C}.indicator 1 s ≤
472+
pullCount a n ω := by
473+
rw [pullCount_eq_sum]
474+
gcongr with s hs
475+
simp only [Set.indicator_apply, Set.mem_setOf_eq, Pi.one_apply]
476+
grind
477+
induction n with
478+
| zero => simp
479+
| succ n hn =>
480+
rw [Finset.sum_range_succ]
481+
rcases le_or_gt (pullCount a n ω) C with h_pc | h_pc
482+
· have hn' : ∑ s ∈ range n, {s | arm s ω = a ∧ pullCount a s ω ≤ C}.indicator 1 s ≤ C :=
483+
(h_le n).trans h_pc
484+
grw [hn']
485+
gcongr
486+
simp only [Set.indicator_apply, Set.mem_setOf_eq, Pi.one_apply]
487+
grind
488+
· refine le_trans ?_ hn
489+
simp [h_pc]
473490

474491
omit [IsMarkovKernel ν] in
475492
lemma pullCount_le_add_three [Nonempty (Fin K)] (a : Fin K) (n C : ℕ) (ω : ℕ → Fin K × ℝ) :

0 commit comments

Comments
 (0)