Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 2.1 — the key theorem: ERM is consistent iff uniform one-sided convergence holds

Proved
NatureSLT.Consistency.key_theorem

by Shuze Chen · Oct 20, 2026 · Mathlib 0df444a (Lean v4.33.1)

consistencyempirical-risk-minimizationstatistical-learning-theoryuniform-convergence

Let FFF be a probability measure on ZZZ and let Q(z,α)Q(z,\alpha)Q(z,α), α∈Λ\alpha\in\Lambdaα∈Λ, be a set of FFF-integrable real functions whose risks are bounded:

A≤∫Q(z,α) dF(z)≤B(A≤R(α)≤B)for all α∈Λ.A \le \int Q(z,\alpha)\,dF(z) \le B \qquad (A\le R(\alpha)\le B) \quad\text{for all } \alpha\in\Lambda.A≤∫Q(z,α)dF(z)≤B(A≤R(α)≤B)for all α∈Λ.

Write Remp(α)=1ℓ∑i=1ℓQ(zi,α)R_{\mathrm{emp}}(\alpha)=\frac1\ell\sum_{i=1}^\ell Q(z_i,\alpha)Remp​(α)=ℓ1​∑i=1ℓ​Q(zi​,α) for the empirical risk on an i.i.d. sample z1,…,zℓz_1,\dots,z_\ellz1​,…,zℓ​ from FFF. Then the ERM principle is (nontrivially) consistent — for every ccc with Λ(c)={α:R(α)>c}\Lambda(c)=\{\alpha : R(\alpha)>c\}Λ(c)={α:R(α)>c} nonempty, inf⁡Λ(c)Remp→inf⁡Λ(c)R\inf_{\Lambda(c)}R_{\mathrm{emp}}\to\inf_{\Lambda(c)}RinfΛ(c)​Remp​→infΛ(c)​R in probability — if and only if the empirical risk converges uniformly to the actual risk in the one-sided sense

lim⁡ℓ→∞P{sup⁡α∈Λ(R(α)−Remp(α))>ε}=0∀ε>0.(2.4)\lim_{\ell\to\infty}P\Bigl\{\sup_{\alpha\in\Lambda}\bigl(R(\alpha)-R_{\mathrm{emp}}(\alpha)\bigr)>\varepsilon\Bigr\}=0\qquad\forall\varepsilon>0. \tag{2.4}ℓ→∞lim​P{α∈Λsup​(R(α)−Remp​(α))>ε}=0∀ε>0.(2.4)

This is the key theorem of learning theory (Vapnik and Chervonenkis, 1989): consistency of empirical risk minimization is determined by the worst function of the set, so any analysis of the ERM principle must be a worst-case analysis.

Formalization Note Integrability of each Q(⋅,α)Q(\cdot,\alpha)Q(⋅,α) is assumed so that R(α)R(\alpha)R(α) is the book's integral. The book takes probabilities of the events {sup⁡α(R−Remp)>ε}\{\sup_\alpha(R-R_{\mathrm{emp}})>\varepsilon\}{supα​(R−Remp​)>ε} and {∣inf⁡Λ(c)Remp−inf⁡Λ(c)R∣>ε}\{|\inf_{\Lambda(c)}R_{\mathrm{emp}}-\inf_{\Lambda(c)}R|>\varepsilon\}{∣infΛ(c)​Remp​−infΛ(c)​R∣>ε} without comment; the theorem assumes, for every ℓ\ellℓ and ccc, that sup⁡α(R(α)−Remp(α))\sup_\alpha(R(\alpha)-R_{\mathrm{emp}}(\alpha))supα​(R(α)−Remp​(α)) and inf⁡α∈Λ(c)Remp(α)\inf_{\alpha\in\Lambda(c)}R_{\mathrm{emp}}(\alpha)infα∈Λ(c)​Remp​(α) are measurable functions of the sample. Suprema and the empirical infimum are taken in the extended reals; probabilities are values of the product measure FℓF^\ellFℓ.

Preamble
import Mathlib
import Definitions.Def_NatureSLT_Consistency_risk
import Definitions.Def_NatureSLT_Consistency_nontriviallyConsistent
import Definitions.Def_NatureSLT_Consistency_uniformConvergence

open MeasureTheory Filter Topology
Formal statement
namespace NatureSLT.Consistency

/-- **Theorem 2.1** (the key theorem of learning theory; Vapnik 2000, p. 38). Let `Q(z, α)`,
`α ∈ Λ`, be a set of functions with `A ≤ ∫ Q(z, α) dF(z) ≤ B` for all `α`. Then the ERM principle
is (nontrivially) consistent iff the empirical risk converges uniformly one-sidedly to the risk,
`lim_{ℓ→∞} P{sup_{α ∈ Λ} (R(α) − R_emp(α)) > ε} = 0` for all `ε > 0` (2.4).
`hint`: each `Q(·, α)` is integrable, so that `R(α)` is the book's integral. `hsup`, `hinf`: the
book's tacit measurability — the sample functions `sup_α (R(α) − R_emp(α))` and
`inf_{α ∈ Λ(c)} R_emp(α)` whose probabilities are taken are measurable. -/
theorem key_theorem {Z Λ : Type*} [MeasurableSpace Z] (F : Measure Z) [IsProbabilityMeasure F]
    (Q : Λ → Z → ℝ) (hint : ∀ α, Integrable (Q α) F) (A B : ℝ)
    (hAB : ∀ α, A ≤ risk F Q α ∧ risk F Q α ≤ B)
    (hsup : ∀ ℓ : ℕ, Measurable (fun z : Fin ℓ → Z => supOneSidedDeviation F Q z))
    (hinf : ∀ (c : ℝ) (ℓ : ℕ),
      Measurable (fun z : Fin ℓ → Z => infEmpiricalRisk Q (levelSet F Q c) z)) :
    NontriviallyConsistent F Q ↔ UniformOneSidedConvergence F Q := by sorry

end NatureSLT.Consistency
Source
Vapnik, The Nature of Statistical Learning Theory, 2nd ed., Springer 2000, p. 38, Theorem 2.1, Eqs. (2.3), (2.4)
Read-back

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

The statement concerns the following objects, all universally quantified:

  • ZZZ and Λ\LambdaΛ are arbitrary types. ZZZ carries a σ\sigmaσ-algebra. Λ\LambdaΛ carries no structure: no topology, no measurability, no countability and no nonemptiness requirement.
  • FFF is a probability measure on ZZZ.
  • Q:Λ×Z→RQ : \Lambda \times Z \to \mathbb{R}Q:Λ×Z→R is a family of real-valued functions Q(α,⋅)Q(\alpha, \cdot)Q(α,⋅) on ZZZ, one for each index α∈Λ\alpha \in \Lambdaα∈Λ.
  • A,B∈RA, B \in \mathbb{R}A,B∈R are two real constants.

Imported definitions. The statement relies on six names that come from imported definition files: risk\mathrm{risk}risk, supOneSidedDeviation\mathrm{supOneSidedDeviation}supOneSidedDeviation, infEmpiricalRisk\mathrm{infEmpiricalRisk}infEmpiricalRisk, levelSet\mathrm{levelSet}levelSet, NontriviallyConsistent\mathrm{NontriviallyConsistent}NontriviallyConsistent and UniformOneSidedConvergence\mathrm{UniformOneSidedConvergence}UniformOneSidedConvergence. Their bodies are not shown in the code under audit, so this read-back cannot unfold them. They appear below under their own names, written RF(α)R_F(\alpha)RF​(α) for risk F Q α\mathrm{risk}\,F\,Q\,\alphariskFQα and so on. Everything said about them comes only from the arguments they take in this statement. The docstring above the theorem is commentary. It is not part of what is asserted, and it is not used here to interpret these names.

Hypotheses.

  1. Integrability. For every α∈Λ\alpha \in \Lambdaα∈Λ, the function z↦Q(α,z)z \mapsto Q(\alpha, z)z↦Q(α,z) is integrable with respect to FFF.
  2. Two-sided bound. For every α∈Λ\alpha \in \Lambdaα∈Λ,
A≤RF(α)≤B,A \le R_F(\alpha) \le B,A≤RF​(α)≤B,

where RF(α)=risk(F,Q,α)R_F(\alpha) = \mathrm{risk}(F, Q, \alpha)RF​(α)=risk(F,Q,α) is a real number defined in an imported file. 3. Measurability of the deviation. For every sample size ℓ∈N\ell \in \mathbb{N}ℓ∈N, the map

Zℓ∋(z1,…,zℓ)  ↦  supOneSidedDeviation(F,Q,(z1,…,zℓ))Z^{\ell} \ni (z_1, \dots, z_\ell) \;\mapsto\; \mathrm{supOneSidedDeviation}(F, Q, (z_1,\dots,z_\ell))Zℓ∋(z1​,…,zℓ​)↦supOneSidedDeviation(F,Q,(z1​,…,zℓ​))

is measurable. Here ZℓZ^\ellZℓ (functions from {0,…,ℓ−1}\{0, \dots, \ell-1\}{0,…,ℓ−1} to ZZZ) carries the product σ\sigmaσ-algebra. The codomain carries the standard σ\sigmaσ-algebra of whatever type this imported function returns, which is not visible here. 4. Measurability of the infimum. For every real level ccc and every ℓ∈N\ell \in \mathbb{N}ℓ∈N, the map

Zℓ∋z  ↦  infEmpiricalRisk(Q,levelSet(F,Q,c),z)Z^{\ell} \ni z \;\mapsto\; \mathrm{infEmpiricalRisk}\big(Q, \mathrm{levelSet}(F, Q, c), z\big)Zℓ∋z↦infEmpiricalRisk(Q,levelSet(F,Q,c),z)

is measurable. In this map, levelSet(F,Q,c)\mathrm{levelSet}(F, Q, c)levelSet(F,Q,c) is an imported object determined by FFF, QQQ and ccc, presumably a subset of Λ\LambdaΛ. infEmpiricalRisk\mathrm{infEmpiricalRisk}infEmpiricalRisk takes QQQ, that object and the sample, but not FFF.

Conclusion. Under these hypotheses,

NontriviallyConsistent(F,Q)  ⟺  UniformOneSidedConvergence(F,Q).\mathrm{NontriviallyConsistent}(F, Q) \iff \mathrm{UniformOneSidedConvergence}(F, Q).NontriviallyConsistent(F,Q)⟺UniformOneSidedConvergence(F,Q).

This is a two-sided equivalence of two imported propositions, each depending only on FFF and QQQ. The constants AAA and BBB appear only in hypothesis 2 and in neither side of the conclusion. No condition is placed on how AAA and BBB compare, and no finiteness, positivity or boundedness condition is placed on QQQ itself beyond hypotheses 1 and 2.

Degenerate cases.

  • ZZZ cannot be empty. A probability measure on ZZZ forces ZZZ to be nonempty.
  • Empty Λ\LambdaΛ. Hypotheses 1 and 2 hold vacuously, and AAA and BBB may be any reals, including A>BA > BA>B. The theorem still asserts the equivalence. Whether either side is true for empty Λ\LambdaΛ depends entirely on the imported definitions, for example on how a supremum or infimum over an empty index set is evaluated.
  • A>BA > BA>B is only possible for empty Λ\LambdaΛ. If Λ\LambdaΛ is nonempty and A>BA > BA>B, hypothesis 2 cannot be satisfied, so the theorem says nothing in that case.
  • One-element Λ\LambdaΛ. All hypotheses reduce to statements about a single function Q(α0,⋅)Q(\alpha_0, \cdot)Q(α0​,⋅), and the equivalence is asserted for that single function.
  • Sample size ℓ=0\ell = 0ℓ=0. The sample space Z0Z^0Z0 has exactly one point, so every function on it is measurable. Hypotheses 3 and 4 therefore hold automatically at ℓ=0\ell = 0ℓ=0.
  • Empty level sets. For levels ccc at which levelSet(F,Q,c)\mathrm{levelSet}(F, Q, c)levelSet(F,Q,c) is empty, hypothesis 4 concerns whatever value infEmpiricalRisk\mathrm{infEmpiricalRisk}infEmpiricalRisk assigns to an empty set. That could be a default "junk" value, such as 000 for a real infimum or +∞+\infty+∞ in the extended reals, and this read-back cannot tell which.
  • Measurability. Hypotheses 3 and 4 are assumed, not derived. They are not automatically satisfied when Λ\LambdaΛ is uncountable.
  • Integrals of non-integrable functions. The junk value 000 that an integral takes for a non-integrable function cannot arise for Q(α,⋅)Q(\alpha, \cdot)Q(α,⋅) itself, because hypothesis 1 rules it out. Whether RFR_FRF​ is actually such an integral is not visible here.
Human review
  • Endorsed by Community (Bot) · Oct 20, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Shuze Chen · Oct 20, 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