Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 4 (Freedman) — Bernstein-type tail bound for martingales

Proved
StochLinOpt.LowerBound.freedman

by mikedeng1 · Sep 26, 2026 · Mathlib 0df444a (Lean v4.33.1)

concentrationmartingalesp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1probability

Let (Ω,F,P)(\Omega,\mathcal F,P)(Ω,F,P) be a probability space with a filtration (Fi)i≥0(\mathcal F_i)_{i\ge0}(Fi​)i≥0​, and let X1,…,XTX_1,\dots,X_TX1​,…,XT​ be real random variables such that for each iii:

  1. XiX_iXi​ is Fi\mathcal F_iFi​-measurable, integrable and square-integrable;
  2. E[Xi∣Fi−1]=0\mathbb E[X_i\mid\mathcal F_{i-1}]=0E[Xi​∣Fi−1​]=0 almost surely (a martingale difference sequence);
  3. Xi≤bX_i\le bXi​≤b almost surely, for a constant bbb.

Let V=∑i=1TE[Xi2∣Fi−1]V=\sum_{i=1}^T\mathbb E[X_i^2\mid\mathcal F_{i-1}]V=∑i=1T​E[Xi2​∣Fi−1​] be the sum of conditional variances. Then for every a>0a>0a>0 and v>0v>0v>0,

P(∑i=1TXi≥a  and  V≤v)≤exp⁡(−a22v+2ab/3).P\Big(\sum_{i=1}^T X_i\ge a\ \text{ and }\ V\le v\Big)\le\exp\Big(\frac{-a^2}{2v+2ab/3}\Big).P(i=1∑T​Xi​≥a  and  V≤v)≤exp(2v+2ab/3−a2​).

This is Freedman's Bernstein-type inequality (Freedman 1975; McDiarmid 1998, Theorem 3.15). In Section 6.1 it is applied to the stopped bias martingale and its negative to show that the bias rarely leaves [−1/2,1/2][-1/2,1/2][−1/2,1/2] while the accumulated conditional variance is small.

Formalization Note The paper writes the variance sum as ∑i=1n\sum_{i=1}^n∑i=1n​ and conditions on X1,…,Xi−1X_1,\dots,X_{i-1}X1​,…,Xi−1​; here the sum runs to TTT (the paper's nnn is a typo) and the conditioning is on a general filtration to which the XiX_iXi​ are adapted, which contains the natural one and is the form used in Section 6.1 (the filtration of histories Ht\mathcal H_tHt​). Because E[Xi∣Fi−1]=0\mathbb E[X_i\mid\mathcal F_{i-1}]=0E[Xi​∣Fi−1​]=0, the conditional variance equals the conditional second moment. Square-integrability is assumed so that Lean's conditional expectation of Xi2X_i^2Xi2​ is not the junk value 000; it holds in every application here (bounded steps).

Preamble
import Mathlib

open MeasureTheory
Formal statement
namespace StochLinOpt.LowerBound

theorem freedman {Ω : Type*} {mΩ : MeasurableSpace Ω} (P : Measure Ω) [IsProbabilityMeasure P]
    (ℱ : Filtration ℕ mΩ) (X : ℕ → Ω → ℝ) (T : ℕ) (b : ℝ)
    (hmeas : ∀ i ∈ Finset.Icc 1 T, Measurable[ℱ i] (X i))
    (hint : ∀ i ∈ Finset.Icc 1 T, Integrable (X i) P)
    (hint_sq : ∀ i ∈ Finset.Icc 1 T, Integrable (fun ω => X i ω ^ 2) P)
    (hmds : ∀ i ∈ Finset.Icc 1 T, P[X i | ℱ (i - 1)] =ᵐ[P] 0)
    (hb : ∀ i ∈ Finset.Icc 1 T, ∀ᵐ ω ∂P, X i ω ≤ b)
    (a v : ℝ) (ha : 0 < a) (hv : 0 < v) :
    P.real {ω | a ≤ ∑ i ∈ Finset.Icc 1 T, X i ω ∧
        ∑ i ∈ Finset.Icc 1 T, P[fun ω' => X i ω' ^ 2 | ℱ (i - 1)] ω ≤ v} ≤
      Real.exp (-a ^ 2 / (2 * v + 2 * a * b / 3)) := by sorry

end StochLinOpt.LowerBound
Source
Dani, Hayes, Kakade, Stochastic Linear Optimization under Bandit Feedback, COLT 2008, PDF p. 6, Theorem 4 (Freedman)
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Setting.

  • (Ω,F,P)(\Omega,\mathcal{F},P)(Ω,F,P) is a probability space.
  • (Fi)i∈N(\mathcal{F}_i)_{i\in\mathbb{N}}(Fi​)i∈N​ is a filtration of sub-σ-algebras. F0\mathcal{F}_0F0​ is not required to be trivial.
  • (Xi)i∈N(X_i)_{i\in\mathbb{N}}(Xi​)i∈N​ are real random variables.
  • T∈NT\in\mathbb{N}T∈N, and b∈Rb\in\mathbb{R}b∈R is arbitrary: it may be zero or negative.

Hypotheses. For every iii with 1≤i≤T1\le i\le T1≤i≤T (nothing is assumed about X0X_0X0​ or XiX_iXi​ for i>Ti>Ti>T):

  1. XiX_iXi​ is Fi\mathcal{F}_iFi​-measurable.
  2. XiX_iXi​ is integrable.
  3. Xi2X_i^2Xi2​ is integrable.
  4. E[Xi∣Fi−1]=0\mathbb{E}[X_i\mid\mathcal{F}_{i-1}] = 0E[Xi​∣Fi−1​]=0 PPP-almost surely.
  5. Xi≤bX_i \le bXi​≤b PPP-almost surely. This is a one-sided upper bound only.

Claim. For every a>0a>0a>0 and v>0v>0v>0,

P(∑i=1TXi≥a  and  ∑i=1TE[Xi2∣Fi−1]≤v)  ≤  exp⁡ ⁣(−a22v+2ab3).P\Big(\sum_{i=1}^T X_i \ge a \ \text{ and } \ \sum_{i=1}^T \mathbb{E}[X_i^2\mid\mathcal{F}_{i-1}] \le v\Big) \;\le\; \exp\!\Big(\frac{-a^2}{2v + \tfrac{2ab}{3}}\Big).P(i=1∑T​Xi​≥a  and  i=1∑T​E[Xi2​∣Fi−1​]≤v)≤exp(2v+32ab​−a2​).

The event is defined pointwise, using the one version of each conditional expectation E[Xi2∣Fi−1]\mathbb{E}[X_i^2\mid\mathcal{F}_{i-1}]E[Xi2​∣Fi−1​] that the library fixes.

Degenerate cases.

  • Zero horizon. If T=0T=0T=0, every hypothesis is vacuous. Both sums are 000, so the event requires 0≥a>00\ge a>00≥a>0 and is empty; the claim reads 0≤exp⁡(⋅)0\le\exp(\cdot)0≤exp(⋅).
  • Negative bbb. If T≥1T\ge1T≥1 and b<0b<0b<0, hypotheses 4 and 5 contradict each other: a variable that is almost surely ≤b<0\le b<0≤b<0 cannot have conditional mean 000. The statement is then vacuous.
  • Zero bbb. If b=0b=0b=0, hypotheses 4 and 5 force Xi=0X_i=0Xi​=0 almost surely for 1≤i≤T1\le i\le T1≤i≤T.
  • Division by zero in the exponent. If 2v+2ab/3=02v + 2ab/3 = 02v+2ab/3=0, the quotient is 000 by convention and the bound is e0=1e^0=1e0=1. This can only happen when b<0b<0b<0.
Human review
  • Endorsed by Shuze Chen · Sep 27, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 27, 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