LeanMachineLearning

Bandits.UCB.regret_le_of_gt_two🔗

Lemma

From the authors

Regret bound for the UCB algorithm with an explicit constant, for c > 2.

Types
  • Ω : Type u_1mΩ : MeasurableSpace ΩA measurable space is a space equipped with a σ-algebra.
Given
  • K : NeZero K
  • c :
  • ν : ProbabilityTheory.Kernel (Fin K) A kernel from a measurable space α to another measurable space β is a measurable function κ : α → Measure β.ProbabilityTheory.IsMarkovKernel νA kernel is a Markov kernel if every measure in its image is a probability measure.
  • P : MeasureTheory.Measure ΩA measure is defined to be an outer measure that is countably additive on measurable sets, with the additional assumption that the outer measure is the canonical extension of the restricted measure.MeasureTheory.IsProbabilityMeasure PA measure μ is called a probability measure if μ univ = 1.
  • O : → Ω → Unit
  • A : → Ω → Fin K
  • R : → Ω →
  • σ2 : NNReal
  • n :
Assuming
Then
 (x : Ω), regret ν A n xP∑ a, (8 * c * ↑σ2 * Real.log (↑n + 1) / gap ν a + gap ν a * (4 + 2 / (c - 2)))
Code
lemma regret_le_of_gt_two (h : IsAlgEnvSeq O A R (ucbAlgorithm K (c * σ2)) (stationaryEnv ν) P)
    (hν : ∀ a, HasSubgaussianMGF (fun x ↦ x - (ν a)[id]) σ2 (ν a))
    (hσ2 : σ2 ≠ 0) (hc : 2 < c) (n : ℕ) :
    P[regret ν A n] ≤
      ∑ a, (8 * c * σ2 * log (n + 1) / gap ν a + gap ν a * (4 + 2 / (c - 2)))
Proof
by
  refine (regret_le h hν hσ2 (by linarith) n).trans (Finset.sum_le_sum fun a _ ↦ ?_)
  have h_le : 2 + 2 * constSum c n ≤ 4 + 2 / (c - 2) := by
    have := constSum_le hc n
    rw [show (4 : ℝ) + 2 / (c - 2) = 2 + 2 * (1 + 1 / (c - 2)) by ring]
    gcongr
  exact add_le_add le_rfl (mul_le_mul_of_nonneg_left h_le (gap_nonneg (ν := ν) (a := a)))

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: 23 project declarations, 124 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.