LeanMachineLearning

Bandits.UCB.expectation_pullCount_le🔗

Lemma

From the authors

Bound on the expectation of the number of pulls of each arm by the UCB algorithm.

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
  • a : Fin K
  • n :
Assuming
Then
 (x : Ω), (fun ω => ↑(Learning.pullCount A a n ω)) xP8 * c * ↑σ2 * Real.log (↑n + 1) / gap ν a ^ 2 + 2 + 2 * constSum c n
Code
lemma expectation_pullCount_le (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 : 0 < c) (a : Fin K) (h_gap : 0 < gap ν a) (n : ℕ) :
    P[fun ω ↦ (pullCount A a n ω : ℝ)] ≤
      8 * c * σ2 * log (n + 1) / gap ν a ^ 2 + 2 + 2 * constSum c n
Proof
by
  have hA := h.measurable_action
  have h := expectation_pullCount_le' h hν hσ2 hc a h_gap n
  simp_rw [← ENNReal.ofReal_natCast] at h
  rw [← ofReal_integral_eq_lintegral_ofReal] at h
  rotate_left
  · exact integrable_pullCount hA _ _
  · exact ae_of_all _ fun _ ↦ by simp
  simp only
  have : 0 ≤ log (n + 1) := log_nonneg (by simp)
  have h_nonneg : 0 ≤ 2 * constSum c n := mul_nonneg zero_le_two (constSum_nonneg c n)
  rw [← ENNReal.ofReal_one, ← ENNReal.ofReal_ofNat 2, ← ENNReal.ofReal_mul zero_le_two,
    ← ENNReal.ofReal_add (by positivity) zero_le_one, ← ENNReal.ofReal_add (by positivity) h_nonneg,
    ENNReal.ofReal_le_ofReal_iff (add_nonneg (by positivity) h_nonneg)] at h
  refine h.trans_eq ?_
  ring

Meaning last changed in v4.34.0-rc2-90-gdde3322 (2026-09-16), the 9th recorded change.

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, 131 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.