Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Stopped centered sum equals the realized first-rank sample mean

Proved
BanditAlgorithm.armStoppedCenteredSum_eq_firstRewardsMean

by Harry_Xu · Jul 31, 2026 · Mathlib c5ea003 (Lean v4.30.0)

banditsprobabilityreward-stackthompson-sampling

Fix an arm iii and a positive rank sss. For any finite bandit history in which arm iii has been pulled at least sss times, let μ^i,s\widehat\mu_{i,s}μ​i,s​ be the mean of its first sss realized rewards and let μi\mu_iμi​ be the arm mean. Then the centered reward sum stopped after the first sss pulls satisfies

Si,s=s(μ^i,s−μi).S_{i,s}=s\bigl(\widehat\mu_{i,s}-\mu_i\bigr).Si,s​=s(μ​i,s​−μi​).

This identity connects the canonical stopped-sum process used for adaptive concentration with the exact realized-rank empirical mean used in Thompson-sampling posterior calculations.

Preamble
import Definitions.Def_ThompsonSampling
import Definitions.Def_ucbStoppedCenteredSum

open MeasureTheory ProbabilityTheory
Formal statement
namespace BanditAlgorithm

/-- Once rank s has been realized, the stopped centered sum is s times the centered first-s reward mean. -/
theorem armStoppedCenteredSum_eq_firstRewardsMean
    {k m : ℕ} (ν : StochasticBandit k) (i : Fin k) (s : ℕ)
    (h : BanditHistory k m) (hs : 0 < s)
    (hcount : s ≤ armPullCount i h) :
    armStoppedCenteredSum ν i s m h =
      (s : ℝ) *
        (armFirstRewardsMean i s h - banditArmMean ν i) := by
  sorry

end BanditAlgorithm
Source
Lattimore and Szepesvári, Bandit Algorithms (CUP 2020), reward-stack convention in Section 4.6, printed p. 65 / PDF p. 74, and the first-sample empirical means in Section 36.2, printed pp. 463–465 / PDF pp. 472–474. This is a purely formal bridge between those two source-backed representations.

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