Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Exp4 analysis processes

Definition
exp4Analysis

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

bandit-algorithmsonline-learning

For Exp4 with exploration parameter γ=0\gamma=0γ=0, let Qt,mQ_{t,m}Qt,m​ be the exponential weight of expert mmm, let Pt,a=∑mQt,mEt,m,aP_{t,a}=\sum_m Q_{t,m}E_{t,m,a}Pt,a​=∑m​Qt,m​Et,m,a​ be the induced arm distribution, and let (At,Xt)(A_t,X_t)(At​,Xt​) be the selected arm and observed reward.

The one-round score propagated to expert mmm is

X~t,m=∑a=1kEt,m,a(1−1{At=a}(1−Xt)Pt,a).\widetilde X_{t,m} = \sum_{a=1}^{k}E_{t,m,a} \left(1-\frac{\mathbf 1\{A_t=a\}(1-X_t)}{P_{t,a}}\right).Xt,m​=a=1∑k​Et,m,a​(1−Pt,a​1{At​=a}(1−Xt​)​).

The analysis records the cumulative mixture score and cumulative quadratic mass

∑t=1n∑m=1MQt,mX~t,m,∑t=1n∑m=1MQt,m(1−X~t,m)2.\sum_{t=1}^{n}\sum_{m=1}^{M}Q_{t,m}\widetilde X_{t,m}, \qquad \sum_{t=1}^{n}\sum_{m=1}^{M}Q_{t,m}(1-\widetilde X_{t,m})^2.t=1∑n​m=1∑M​Qt,m​Xt,m​,t=1∑n​m=1∑M​Qt,m​(1−Xt,m​)2.

These are the two process-level quantities occurring in the Exp4 potential inequality and its second-moment estimate, so they can be reused in regret analyses before expectation and optimization of the learning rate.

Formalization Note exp4RewardIncrement, exp4MixtureEstimate, and exp4QuadraticMass define the displayed quantities recursively on finite bandit histories.

Definition code
import Definitions.Def_exp4Policy

open MeasureTheory ProbabilityTheory

namespace BanditAlgorithm

/-!
Analysis quantities from Lattimore--Szepesvári, *Bandit Algorithms*,
Algorithm 11 and the proof of Theorem 18.1, printed pp. 229--230.
-/

/-- The one-round reward estimate propagated by Exp4 from the selected arm to
expert `m` (Algorithm 11, lines 7--8). -/
noncomputable def exp4RewardIncrement {k M : ℕ} (η : ℝ)
    (E : ℕ → Fin M → Fin k → ℝ) (r : ℕ)
    (h : BanditHistory k r) (m : Fin M) (z : Fin k × ℝ) : ℝ :=
  ∑ a, E r m a *
    (1 - if z.1 = a then
      (1 - z.2) / exp4Prob η 0 E r h a
    else 0)

/-- The cumulative Exp4 mixture score
`∑ₜ ∑ₘ Qₜₘ X̃ₜₘ` in Eqs. (18.9)--(18.11). -/
noncomputable def exp4MixtureEstimate {k M : ℕ} (η : ℝ)
    (E : ℕ → Fin M → Fin k → ℝ) :
    (n : ℕ) → BanditHistory k n → ℝ
  | 0, _ => 0
  | r + 1, h =>
      exp4MixtureEstimate η E r (Fin.init h) +
        ∑ m, exp4ExpertWeights η 0 E r (Fin.init h) m *
          exp4RewardIncrement η E r (Fin.init h) m (h (Fin.last r))

/-- The cumulative quadratic term
`∑ₜ ∑ₘ Qₜₘ (1-X̃ₜₘ)²` in Eqs. (18.9)--(18.12). -/
noncomputable def exp4QuadraticMass {k M : ℕ} (η : ℝ)
    (E : ℕ → Fin M → Fin k → ℝ) :
    (n : ℕ) → BanditHistory k n → ℝ
  | 0, _ => 0
  | r + 1, h =>
      exp4QuadraticMass η E r (Fin.init h) +
        ∑ m, exp4ExpertWeights η 0 E r (Fin.init h) m *
          (1 - exp4RewardIncrement η E r (Fin.init h) m
            (h (Fin.last r))) ^ 2

end BanditAlgorithm
Source
Lattimore and Szepesvári, Bandit Algorithms (Cambridge University Press, 2020), Algorithm 11, printed p. 229, lines 7–9, and Theorem 18.1 proof, printed p. 230, Eqs. (18.9)–(18.12). https://tor-lattimore.com/downloads/book/book.pdf

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