Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 11: polynomial generalization bounds from hypothesis stability

Proved
StabGen.Hypothesis.hypothesis_stability_generalization_bound

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

algorithmic-stabilitygeneralization-boundslearning-theoryp2o-batch-pfp1ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Let DDD be a probability distribution on Z=X×YZ = X \times YZ=X×Y and let the cost function satisfy 0≤c(y′,y)≤M0 \le c(y', y) \le M0≤c(y′,y)≤M. Let AAA be a symmetric deterministic learning algorithm whose losses are measurable, and suppose that at sample size m≥1m \ge 1m≥1 it has hypothesis stability β1\beta_1β1​ (Definition 3) and pointwise hypothesis stability β2\beta_2β2​ (Definition 4). Draw the training set S∼DmS \sim D^mS∼Dm. Then for every δ>0\delta > 0δ>0, with probability at least 1−δ1 - \delta1−δ,

R(A,S)≤Remp(A,S)+M2+6Mm(β1+β2)2mδ,R(A,S) \le R_{\mathrm{emp}}(A,S) + \sqrt{\frac{M^2 + 6Mm(\beta_1 + \beta_2)}{2m\delta}},R(A,S)≤Remp​(A,S)+2mδM2+6Mm(β1​+β2​)​​,

and, with probability at least 1−δ1 - \delta1−δ,

R(A,S)≤Rloo(A,S)+M2+6Mmβ12mδ.R(A,S) \le R_{\mathrm{loo}}(A,S) + \sqrt{\frac{M^2 + 6Mm\beta_1}{2m\delta}}.R(A,S)≤Rloo​(A,S)+2mδM2+6Mmβ1​​​.

Here RRR is the generalization error, RempR_{\mathrm{emp}}Remp​ the empirical error and RlooR_{\mathrm{loo}}Rloo​ the leave-one-out error of ASA_SAS​. The theorem shows that the two classical estimators of the risk deviate from it by O(1/mδ)O(1/\sqrt{m\delta})O(1/mδ​) whenever the algorithm's stability decays like 1/m1/m1/m, without any capacity measure of the hypothesis space.

Formalization Note The two bounds are stated separately: the probability, under DmD^mDm, of the failure event {R>Remp+⋯ }\{R > R_{\mathrm{emp}} + \cdots\}{R>Remp​+⋯} is at most δ\deltaδ, and likewise for RlooR_{\mathrm{loo}}Rloo​. The paper prints the empirical bound with 12Mmβ212Mm\beta_212Mmβ2​ in place of 6Mm(β1+β2)6Mm(\beta_1+\beta_2)6Mm(β1​+β2​). Its proof bounds the replace-one term of Lemma 9, eq. (8), by 2β22\beta_22β2​, but one of the two summands is a hypothesis-stability term bounded by β1\beta_1β1​; the bound the proof establishes is the one stated here, which coincides with the printed one when β1=β2\beta_1 = \beta_2β1​=β2​. The leave-one-out bound is as printed. The sample size is m≥1m \ge 1m≥1 (a training set has at least one point; at m=0m = 0m=0 the stability hypotheses are vacuous and the statement fails). The paper's proof goes through Lemmas 9 and 25, which need two distinct indices; at m=1m = 1m=1 the bounds still hold, by comparing ASA_SAS​ with A∅A_\emptysetA∅​ directly, so no restriction m≥2m \ge 2m≥2 is imposed.

Preamble
import Mathlib
import Definitions.Def_FoundationsML_Stability_Loss
import Definitions.Def_FoundationsML_Stability_EmpiricalError
import Definitions.Def_FoundationsML_Stability_GeneralizationError
import Definitions.Def_StabGen_Hypothesis_Setting
import Definitions.Def_StabGen_Hypothesis_Stability

open MeasureTheory
Formal statement
namespace StabGen.Hypothesis

open FoundationsML.Stability

theorem hypothesis_stability_generalization_bound {X Y Y' : Type*} [MeasurableSpace X] [MeasurableSpace Y]
    (D : Measure (X × Y)) [IsProbabilityMeasure D] (L : Y' → Y → ℝ) (M : ℝ)
    (hL : ∀ (y' : Y') (y : Y), 0 ≤ L y' y ∧ L y' y ≤ M)
    (A : LearningAlgorithm X Y Y')
    (hA : ∀ n : ℕ, Measurable (fun p : (Fin n → X × Y) × (X × Y) =>
      Loss L (A (trainingSet p.1)) p.2))
    (m : ℕ) (hm : 1 ≤ m) (β₁ β₂ : ℝ) (h₁ : HypothesisStable D L A m β₁)
    (h₂ : PointwiseHypothesisStable D L A m β₂) (δ : ℝ) (hδ : 0 < δ) :
    (Measure.pi fun _ : Fin m => D)
        {S | EmpiricalError L S (A (trainingSet S))
              + Real.sqrt ((M ^ 2 + 6 * M * (m : ℝ) * (β₁ + β₂)) / (2 * (m : ℝ) * δ))
            < GeneralizationError D L (A (trainingSet S))} ≤ ENNReal.ofReal δ ∧
    (Measure.pi fun _ : Fin m => D)
        {S | looError L A S
              + Real.sqrt ((M ^ 2 + 6 * M * (m : ℝ) * β₁) / (2 * (m : ℝ) * δ))
            < GeneralizationError D L (A (trainingSet S))} ≤ ENNReal.ofReal δ := by sorry

end StabGen.Hypothesis
Source
Bousquet & Elisseeff, Stability and Generalization, JMLR 2 (2002), p. 506, Theorem 11 (empirical constant 12Mmβ2 corrected to 6Mm(β1 + β2), per the proof on p. 506)
Human review
  • Endorsed by Shuze Chen · Oct 4, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 4, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me