Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Thompson-sampling pull-count decomposition with exact realized ranks

Proved
BanditAlgorithm.thompson_sampling_pull_count_bound_exact_ranks

by Harry_Xu · Jul 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

banditsprobabilitythompson-sampling

Assume arm i0i_0i0​ is optimal, let i≠i0i\ne i_0i=i0​, and fix a separating parameter ε\varepsilonε. For Gaussian follow-the-perturbed-leader / Thompson sampling, the expected number of pulls of arm iii is bounded by

E[Ti(n)]≤1+E ⁣[∑s=0Ti0(n)−1(1Gi0s−1)]+E ⁣[∑s=0Ti(n)−11{Gis>1/n}].\mathbb E[T_i(n)]\le 1+ \mathbb E\!\left[\sum_{s=0}^{T_{i_0}(n)-1}\left(\frac1{G_{i_0s}}-1\right)\right] + \mathbb E\!\left[\sum_{s=0}^{T_i(n)-1}\mathbf 1\{G_{is}>1/n\}\right].E[Ti​(n)]≤1+E​s=0∑Ti0​​(n)−1​(Gi0​s​1​−1)​+E​s=0∑Ti​(n)−1​1{Gis​>1/n}​.

Here GjsG_{js}Gjs​ is the Gaussian perturbation tail probability above μi0−ε\mu_{i_0}-\varepsilonμi0​​−ε after the first sss observations of arm jjj. Unlike the looser published platform version, each sum stops at the realized pull count. Thus every empirical mean appearing in GjsG_{js}Gjs​ is based on exactly sss actual observations, matching the reward-stack rank argument in the proof of Theorem 36.2.

Preamble
import Definitions.Def_BanditPolicy
import Definitions.Def_ThompsonSampling

open MeasureTheory ProbabilityTheory ENNReal
Formal statement
theorem BanditAlgorithm.thompson_sampling_pull_count_bound_exact_ranks {k : ℕ} [NeZero k]
    (ν : StochasticBandit k) {π : BanditPolicy k} (hπ : IsGaussianTSPolicy π)
    (i₀ : Fin k) (h₀ : banditArmMean ν i₀ = banditOptimalMean ν)
    (i : Fin k) (hi : i ≠ i₀) (ε : ℝ) (n : ℕ) :
    ∫⁻ h, (armPullCount i h : ℝ≥0∞) ∂banditMeasure ν π n ≤
      1 + (∫⁻ h, ∑ s ∈ Finset.range (armPullCount i₀ h),
            ENNReal.ofReal (1 / gaussianTSTailProb i₀ s
              (banditArmMean ν i₀ - ε) h - 1)
            ∂banditMeasure ν π n)
        + ∫⁻ h, ∑ s ∈ Finset.range (armPullCount i h),
            (if 1 / (n : ℝ) <
                gaussianTSTailProb i s (banditArmMean ν i₀ - ε) h
              then (1 : ℝ≥0∞) else 0)
            ∂banditMeasure ν π n := by
  sorry
Source
Lattimore and Szepesvari, Bandit Algorithms (CUP 2020), proof of Theorem 36.2, Eqs. (36.4)-(36.6), printed pp.464-465. This is the exact rank-sum inequality before enlarging the realized rank ranges to 0,...,n-1 in Eq. (36.3).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me