LeanMachineLearning

Bandits.UCB.regret_le'πŸ”—

Lemma

From the authors

Regret bound for the UCB algorithm with exploration constant c, for Οƒ2-subgaussian rewards.

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 x βˆ‚P ≀ βˆ‘ a, (8 * c * Real.log (↑n + 1) / gap Ξ½ a + gap Ξ½ a * (2 + 2 * constSum (c / ↑σ2) n))
Code
lemma regret_le' (h : IsAlgEnvSeq O A R (ucbAlgorithm K c) (stationaryEnv Ξ½) P)
    (hΞ½ : βˆ€ a, HasSubgaussianMGF (fun x ↦ x - (Ξ½ a)[id]) Οƒ2 (Ξ½ a))
    (hσ2 : σ2 ≠ 0) (hc : 0 < c) (n : ℕ) :
    P[regret Ξ½ A n] ≀
      βˆ‘ a, (8 * c * log (n + 1) / gap Ξ½ a + gap Ξ½ a * (2 + 2 * constSum (c / Οƒ2) n))
Proof
by
  have hΟƒ2' : (0 : ℝ) < Οƒ2 := NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr hΟƒ2)
  have h' : IsAlgEnvSeq O A R (ucbAlgorithm K (c / Οƒ2 * Οƒ2)) (stationaryEnv Ξ½) P := by
    rwa [div_mul_cancel₀ _ hσ2'.ne']
  refine (regret_le h' hν hσ2 (div_pos hc hσ2') n).trans_eq ?_
  rw [show (8 : ℝ) * (c / Οƒ2) * Οƒ2 = 8 * c by rw [mul_assoc, div_mul_cancelβ‚€ _ hΟƒ2'.ne']]

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: 24 project declarations, 128 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.