Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 5(b) — w.p. ≥ 1 − δ, every ±1 classifier f in F has P(Y ≠ f(X)) ≤ P̂_n(Y ≠ f(X)) + R_n(F)/2 + √(ln(1/δ)/(2n))

Proved
RadGauss.Classification.theorem_5b

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

classificationgeneralization-boundlearning-theoryp2o-batch-pfp2bp2o-gran-per-chapterp2o-plan-paperp2o-v1rademacher-complexity

Let PPP be a probability distribution on X×{±1}\mathcal X \times \{\pm1\}X×{±1}, let FFF be a set of (measurable) {±1}\{\pm1\}{±1}-valued functions defined on X\mathcal XX, and let (Xi,Yi)i=1n(X_i, Y_i)_{i=1}^n(Xi​,Yi​)i=1n​, n≥1n \ge 1n≥1, be training samples drawn according to PnP^nPn. Write P^n(Y≠f(X))=1n#{i:Yi≠f(Xi)}\hat P_n(Y \ne f(X)) = \frac1n\#\{i : Y_i \ne f(X_i)\}P^n​(Y=f(X))=n1​#{i:Yi​=f(Xi​)} for the training error of fff, and Rn(F)=Esup⁡f∈F∣2n∑i=1nσif(Xi)∣R_n(F) = \mathbb E\sup_{f\in F}\big|\frac2n\sum_{i=1}^n\sigma_i f(X_i)\big|Rn​(F)=Esupf∈F​​n2​∑i=1n​σi​f(Xi​)​ for the Rademacher complexity (Definition 2) of FFF, viewed as a class of real functions, with respect to the marginal of PPP on X\mathcal XX. Then for every 0<δ<10 < \delta < 10<δ<1, with probability at least 1−δ1 - \delta1−δ, every function fff in FFF satisfies

P(Y≠f(X))≤P^n(Y≠f(X))+Rn(F)2+ln⁡(1/δ)2n.P(Y \ne f(X)) \le \hat P_n(Y \ne f(X)) + \frac{R_n(F)}{2} + \sqrt{\frac{\ln(1/\delta)}{2n}} .P(Y=f(X))≤P^n​(Y=f(X))+2Rn​(F)​+2nln(1/δ)​​.

The bound is uniform: the probability that some f∈Ff \in Ff∈F violates it is at most δ\deltaδ. It is a data-dependent alternative to the VC bound for classification, with the class's complexity measured by its Rademacher complexity rather than its VC dimension.

Formalization Note Values are compared in [0,∞][0, \infty][0,∞], so an infinite Rn(F)R_n(F)Rn​(F) makes the bound trivially true, as in the paper. The bad event is a union over FFF and is measured by the outer measure of PnP^nPn. Added hypotheses, all disclosed: n≥1n \ge 1n≥1 (at n=0n = 0n=0 the Lean statement would be false, since 2/0=02/0 = 02/0=0); 0<δ<10 < \delta < 10<δ<1; measurability of the members of FFF; and measurability of the three random variables the proof integrates — S↦sup⁡f(P(Y≠f(X))−P^n(Y≠f(X)))S \mapsto \sup_f(P(Y\ne f(X)) - \hat P_n(Y\ne f(X)))S↦supf​(P(Y=f(X))−P^n​(Y=f(X))), the double-sample supremum (S,S′)↦sup⁡f(P^n′−P^n)(Y≠f(X))(S,S') \mapsto \sup_f (\hat P'_n - \hat P_n)(Y \ne f(X))(S,S′)↦supf​(P^n′​−P^n​)(Y=f(X)), and x↦R^n(F)(x)x \mapsto \hat R_n(F)(x)x↦R^n​(F)(x) on Xn\mathcal X^nXn. Labels are Z×={1,−1}\mathbb Z^\times = \{1,-1\}Z×={1,−1}.

Preamble
import Mathlib
import Definitions.Def_RadGauss_Classification_Complexity
import Definitions.Def_RadGauss_Classification_Classifier

open MeasureTheory
Formal statement
namespace RadGauss.Classification

/-- **Theorem 5 (b)** (Bartlett–Mendelson 2002, p. 465). Let `P` be a probability distribution
on `X × {±1}`, `F` a set of `{±1}`-valued (measurable) functions on `X`, and
`(X_i, Y_i)_{i=1}^n ∼ P^n`. With probability at least `1 − δ`, every `f ∈ F` satisfies
`P(Y ≠ f(X)) ≤ P̂_n(Y ≠ f(X)) + R_n(F)/2 + √(ln(1/δ)/(2n))`,
where `R_n(F)` is the Rademacher complexity (Definition 2) of `F` as a class of real functions,
with respect to the marginal of `P` on `X`. The bad event (some `f ∈ F` violates the bound) has
`P^n`-(outer) measure at most `δ`. Added hypotheses: `0 < n`, `0 < δ < 1`, and the measurability
of the three random variables the proof integrates (`gapSup`, `ghostGapSup`, `R̂_n(F)`). -/
theorem theorem_5b {X : Type*} [MeasurableSpace X]
    (P : Measure (X × ℤˣ)) [IsProbabilityMeasure P] (F : Set (X → ℤˣ))
    (hF : ∀ f ∈ F, Measurable f) (n : ℕ) (hn : 0 < n) (δ : ℝ) (hδ0 : 0 < δ) (hδ1 : δ < 1)
    (hgap : Measurable (fun S : Fin n → X × ℤˣ => gapSup P F S))
    (hghost : Measurable (fun p : (Fin n → X × ℤˣ) × (Fin n → X × ℤˣ) =>
      ghostGapSup F p.1 p.2))
    (hrad : Measurable (fun x : Fin n → X => empiricalRademacher (realClass F) n x)) :
    (Measure.pi fun _ : Fin n => P)
        {S | ∃ f ∈ F, ¬ (ENNReal.ofReal (classError P f) ≤ ENNReal.ofReal (trainError S f)
            + rademacherComplexity (P.map Prod.fst) n (realClass F) / 2
            + ENNReal.ofReal (Real.sqrt (Real.log (1 / δ) / (2 * n))))}
      ≤ ENNReal.ofReal δ := by sorry

end RadGauss.Classification
Source
Bartlett, Mendelson, Rademacher and Gaussian Complexities: Risk Bounds and Structural Results, J. Mach. Learn. Res. 3 (2002), p. 465 (PDF p. 3), Theorem 5 (b)
Human review
  • Endorsed by Shuze Chen · Oct 5, 2026

    Confirmed by the moderator at approval.

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