Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Bandit history prefix before a round

Definition
banditHistoryPrefix

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

banditsprobabilityucb

For a completed length-nnn history h=((A1,X1),…,(An,Xn))h=((A_1,X_1),\ldots,(A_n,X_n))h=((A1​,X1​),…,(An​,Xn​)) and an index r<nr<nr<n, banditHistoryPrefixAt returns the length-rrr history ((A1,X1),…,(Ar,Xr))((A_1,X_1),\ldots,(A_r,X_r))((A1​,X1​),…,(Ar​,Xr​)) available immediately before round r+1r+1r+1. It is the input to the policy kernel and UCB indices at that round.

Definition code
import Definitions.Def_BanditPolicy

/-!
The history visible immediately before a round of a fixed finite bandit run.
This is the canonical prefix map used implicitly throughout Lattimore and
Szepesvári, *Bandit Algorithms* (CUP 2020), §4.6 and explicitly in the
time-indexed empirical means in Theorem 8.1, Eq. (8.4), printed p. 119.
-/

namespace BanditAlgorithm

/-- For a completed history `h` and round index `r`, retain precisely the
observations from rounds strictly before `r`. -/
def banditHistoryPrefixAt {k n : ℕ} (h : BanditHistory k n) (r : Fin n) :
    BanditHistory k r.val :=
  fun s ↦ h ⟨s.val, lt_trans s.isLt r.isLt⟩

end BanditAlgorithm
Source
Lattimore and Szepesvári, Bandit Algorithms (CUP 2020), canonical model §4.6 and Theorem 8.1 Eq. (8.4), printed p. 119 / PDF p. 128.

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