LeanMachineLearning

Bandits.UCB.pullCount_le_of_ucbIndex_le🔗

Lemma

From the authors

If the means of the best arm and of arm b lie in their confidence intervals and the UCB index of b is at least that of the best arm, then the number of pulls of b is at most 8 * c * log (n + 1) / gap ν b ^ 2.

Types
  • Ω : Type u_1
Given
  • K : NeZero K
  • c :
  • ν : ProbabilityTheory.Kernel (Fin K) A kernel from a measurable space α to another measurable space β is a measurable function κ : α → Measure β.
  • A : → Ω → Fin K
  • R : → Ω →
  • n :
  • ω : Ω
  • b : Fin K
Assuming
  • hc : 0c
  • h_best : (x : ), id xν (bestArm ν)Learning.empMean A R (bestArm ν) n ω + ucbWidth A c (bestArm ν) n ω
  • h_arm : Learning.empMean A R b n ω - ucbWidth A c b n ω (x : ), id xν b
  • h_le : Learning.empMean A R (bestArm ν) n ω + ucbWidth A c (bestArm ν) n ωLearning.empMean A R b n ω + ucbWidth A c b n ω
  • h_gap_pos : 0 < gap ν b
  • h_pull_pos : 0 < Learning.pullCount A b n ω
Then
↑(Learning.pullCount A b n ω)8 * c * Real.log (↑n + 1) / gap ν b ^ 2
Code
lemma pullCount_le_of_ucbIndex_le (hc : 0 ≤ c) {b : Fin K}
    (h_best : (ν (bestArm ν))[id] ≤ empMean A R (bestArm ν) n ω + ucbWidth A c (bestArm ν) n ω)
    (h_arm : empMean A R b n ω - ucbWidth A c b n ω ≤ (ν b)[id])
    (h_le : empMean A R (bestArm ν) n ω + ucbWidth A c (bestArm ν) n ω ≤
      empMean A R b n ω + ucbWidth A c b n ω)
    (h_gap_pos : 0 < gap ν b) (h_pull_pos : 0 < pullCount A b n ω) :
    pullCount A b n ω ≤ 8 * c * log (n + 1) / gap ν b ^ 2
Proof
by
  have h_gap_le := gap_le_two_mul_ucbWidth h_best h_arm h_le
  rw [ucbWidth] at h_gap_le
  have h2 : (gap ν b) ^ 2 ≤ (2 * √(2 * c * log (n + 1) / pullCount A b n ω)) ^ 2 := by
    gcongr
  rw [mul_pow, sq_sqrt] at h2
  · have : (2 : ℝ) ^ 2 = 4 := by norm_num
    rw [this] at h2
    field_simp at h2 ⊢
    grind
  · have : 0 ≤ log (n + 1) := by simp [log_nonneg]
    positivity

New in v4.34.0-rc2-90-gdde3322 (2026-09-16), and its meaning has not changed since.

Self-contained, with its dependencies inlined and proofs replaced by sorry: download the raw file · open it in the Lean web editor.

Dependency graph

Audit surface: 6 project declarations, 99 external constants

✓ Proved: no sorry anywhere in its closure

This is the tool's own reading of one build's recorded axioms, and it is not robust against an author who wants it to pass. Checking meant to be relied on should go through Comparator, which replays the proof through the kernel from an export against an explicit list of permitted axioms.