Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 1 — expectation of X(j, s, y)

Proved
AgrawalGoyalTS.NArmed.expected_firstExceed_eq

by mikedeng1 · Oct 4, 2026 · Mathlib 0df444a (Lean v4.33.1)

banditsbeta-distributionbinomial-distributionp2o-batch-pfp1bp2o-gran-per-chapterp2o-plan-paperp2o-v1

Let j,sj,sj,s be non-negative integers with s≤js\le js≤j and let y∈[0,1]y\in[0,1]y∈[0,1]. Let X(j,s,y)X(j,s,y)X(j,s,y) be the number of trials before an independent sequence of Beta(s+1,j−s+1)\mathrm{Beta}(s+1,j-s+1)Beta(s+1,j−s+1) random variables first exceeds yyy, and let Fn,pBF^B_{n,p}Fn,pB​ be the cdf of Binomial(n,p)\mathrm{Binomial}(n,p)Binomial(n,p). Then

E[X(j,s,y)]=1Fj+1,yB(s)−1.\mathbb E\big[X(j,s,y)\big]=\frac{1}{F^B_{j+1,y}(s)}-1 .E[X(j,s,y)]=Fj+1,yB​(s)1​−1.

The lemma converts the expected waiting time of a geometric variable with a Beta-cdf parameter into a binomial cdf, which is the form in which the waiting times of the first arm enter the regret bound.

Formalization Note Both sides are in [0,∞][0,\infty][0,∞]. At y=1y=1y=1 every trial fails, so X=∞X=\inftyX=∞, and Fj+1,1B(s)=0F^B_{j+1,1}(s)=0Fj+1,1B​(s)=0 for s≤js\le js≤j, so the right side is 1/0−1=∞1/0-1=\infty1/0−1=∞ as well: the degenerate case is the identity ∞=∞\infty=\infty∞=∞, not a junk equation.

Preamble
import Mathlib
import Definitions.Def_AgrawalGoyalTS_NArmed_BetaBinomial

open MeasureTheory
Formal statement
namespace AgrawalGoyalTS.NArmed

/-- Lemma 1 (p. 6): for all natural `j`, `s ≤ j` and `y ∈ [0,1]`,
`E[X(j, s, y)] = 1 / F^B_{j+1,y}(s) - 1`, where `X(j, s, y)` is the number of trials before an
i.i.d. `Beta(s+1, j-s+1)` sequence first exceeds `y`. Stated in `ℝ≥0∞`, so that at `y = 1`
both sides are `∞`. -/
theorem expected_firstExceed_eq (j s : ℕ) (hs : s ≤ j) (y : ℝ) (hy0 : 0 ≤ y) (hy1 : y ≤ 1) :
    ∫⁻ ω, ENat.toENNReal (AgrawalGoyalTS.TwoArmed.firstExceed y ω) ∂(AgrawalGoyalTS.TwoArmed.betaTrials s (j - s)) =
      1 / ENNReal.ofReal (AgrawalGoyalTS.TwoArmed.binomCDF (j + 1) y (s : ℝ)) - 1 := by sorry

end AgrawalGoyalTS.NArmed
Source
Agrawal and Goyal, Analysis of Thompson Sampling for the Multi-armed Bandit Problem, arXiv:1111.1797v3, p. 6, Lemma 1
Human review
  • Endorsed by Shuze Chen · Oct 5, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 5, 2026

    Confirmed by the mission captain (proposal self-audit).

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