Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 10 — Hoeffding–Bernstein inequality for sampling without replacement

Proved
DynamicOnlineLP.DLA.bernstein_without_replacement

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

concentration-inequalitiesprobabilitysampling-without-replacement

Let c1,…,cRc_1,\dots,c_Rc1​,…,cR​ be real numbers (R≥1R\ge1R≥1), with mean cˉ=1R∑ici\bar c=\frac1R\sum_i c_icˉ=R1​∑i​ci​, variance σR2=1R∑i=1R(ci−cˉ)2\sigma_R^2=\frac1R\sum_{i=1}^R(c_i-\bar c)^2σR2​=R1​∑i=1R​(ci​−cˉ)2 and range ΔR=max⁡ici−min⁡ici\Delta_R=\max_ic_i-\min_ic_iΔR​=maxi​ci​−mini​ci​. Let u1,…,uru_1,\dots,u_ru1​,…,ur​ (r≤Rr\le Rr≤R) be a sample drawn without replacement from {c1,…,cR}\{c_1,\dots,c_R\}{c1​,…,cR​}. Then for every t>0t>0t>0,

P(∣∑i=1rui−rcˉ∣≥t)≤2exp⁡(−t22rσR2+tΔR).\mathbb P\Big(\Big|\sum_{i=1}^r u_i-r\bar c\Big|\ge t\Big)\le 2\exp\Big(-\frac{t^2}{2r\sigma_R^2+t\Delta_R}\Big).P(​i=1∑r​ui​−rcˉ​≥t)≤2exp(−2rσR2​+tΔR​t2​).

The paper quotes this from van der Vaart and Wellner (1996, Theorem 2.14.19) and uses it for every concentration step of its analysis (Lemmas 2, 5, 6 and inequality (14)).

Formalization Note The sample is the first rrr entries cσ(1),…,cσ(r)c_{\sigma(1)},\dots,c_{\sigma(r)}cσ(1)​,…,cσ(r)​ of a uniformly random permutation σ\sigmaσ of {1,…,R}\{1,\dots,R\}{1,…,R}, and the probability is the fraction of the R!R!R! permutations at which the event holds. max⁡\maxmax and min⁡\minmin are finite suprema and infima over the nonempty index set. In the degenerate case ΔR=0\Delta_R=0ΔR​=0 the right-hand side's denominator is 000; Lean's convention x/0=0x/0=0x/0=0 then gives the bound 222, while the event has probability 000.

Preamble
import Mathlib
import Definitions.Def_DynamicOnlineLP_DLA_Instance
Formal statement
namespace DynamicOnlineLP.DLA

/-- Lemma 10 (Agrawal–Wang–Ye 2014, p. 887; van der Vaart and Wellner 1996, Theorem 2.14.19):
Hoeffding–Bernstein inequality for sampling without replacement. The `r` samples are the values
`c (σ 0), …, c (σ (r−1))` for a uniformly random permutation `σ` of `Fin R`. -/
theorem bernstein_without_replacement {R : ℕ} (hR : 0 < R) (c : Fin R → ℝ) (r : ℕ)
    (hr : r ≤ R) (t : ℝ) (ht : 0 < t) :
    let cbar : ℝ := (∑ j : Fin R, c j) / (R : ℝ)
    let σR2 : ℝ := (∑ j : Fin R, (c j - cbar) ^ 2) / (R : ℝ)
    let ΔR : ℝ := (⨆ j : Fin R, c j) - (⨅ j : Fin R, c j)
    probPerm (fun σ : Equiv.Perm (Fin R) =>
        t ≤ |∑ k ∈ firstTimes R r, c (σ k) - (r : ℝ) * cbar|) ≤
      2 * Real.exp (-(t ^ 2) / (2 * (r : ℝ) * σR2 + t * ΔR)) := by sorry

end DynamicOnlineLP.DLA
Source
Agrawal, Wang, Ye, A Dynamic Near-Optimal Algorithm for Online Linear Programming, Oper. Res. 62(4), 2014, p. 887, Appendix A.1, Lemma 10 (from van der Vaart and Wellner 1996, Theorem 2.14.19)
Read-back

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

Let R≥1R\ge1R≥1 be a natural number, c0,…,cR−1c_0,\dots,c_{R-1}c0​,…,cR−1​ real numbers, r∈Nr\in\mathbb{N}r∈N with r≤Rr\le Rr≤R, and t>0t>0t>0 real. Define:

  • the mean cˉ=1R∑jcj\bar c = \frac1R\sum_j c_jcˉ=R1​∑j​cj​;
  • the population variance σR2=1R∑j(cj−cˉ)2\sigma_R^2 = \frac1R\sum_j (c_j-\bar c)^2σR2​=R1​∑j​(cj​−cˉ)2;
  • the range ΔR=max⁡jcj−min⁡jcj\Delta_R = \max_j c_j - \min_j c_jΔR​=maxj​cj​−minj​cj​. These are genuine max and min, since R≥1R\ge1R≥1.

For a uniformly random permutation σ\sigmaσ of {0,…,R−1}\{0,\dots,R-1\}{0,…,R−1} (each of the R!R!R! permutations counted equally), the theorem asserts:

Pr⁡σ ⁣[ t≤∣∑k=0r−1cσ(k)−rcˉ∣ ] ≤ 2exp⁡ ⁣(−t22rσR2+tΔR).\Pr_\sigma\!\left[\ t\le\Big|\sum_{k=0}^{r-1}c_{\sigma(k)}-r\bar c\Big|\ \right]\ \le\ 2\exp\!\left(\frac{-t^2}{2r\sigma_R^2+t\Delta_R}\right).σPr​[ t≤​k=0∑r−1​cσ(k)​−rcˉ​ ] ≤ 2exp(2rσR2​+tΔR​−t2​).

The event is two-sided and uses a non-strict ≤\le≤. The sum is over the first rrr positions of the permutation.

Degenerate cases:

  • Zero denominator. If 2rσR2+tΔR=02r\sigma_R^2+t\Delta_R=02rσR2​+tΔR​=0, the division returns 000 and the right side equals 222. This happens when ccc is constant, since then σR2=ΔR=0\sigma_R^2=\Delta_R=0σR2​=ΔR​=0.
  • r=0r=0r=0. The sum is empty, the deviation is 000, and the event t≤0t\le0t≤0 never holds, so the probability is 000.
  • r=Rr=Rr=R. The deviation is exactly 000 and the probability is 000.
  • R=0R=0R=0. Excluded by hypothesis.
Human review
  • Endorsed by Shuze Chen · Oct 21, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 21, 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