Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 29.3(1), upper bound: uniform convergence with O((dlog⁡k+log⁡(1/δ))/ϵ2)O((d\log k + \log(1/\delta))/\epsilon^2)O((dlogk+log(1/δ))/ϵ2) examples

Proved
UnderstandingML.multiclass_uc_upper_bound

by Gabewhigham · Sep 25, 2026 · Mathlib 0df444a (Lean v4.33.1)

machine-learningmulticlass

This is the upper half of item 1 of the Multiclass Fundamental Theorem.

Let XXX be a domain with a σ\sigmaσ-algebra containing all singletons, let YYY be a finite label set with k=∣Y∣k = |Y|k=∣Y∣ (also with measurable singletons), and let H⊆YXH \subseteq Y^XH⊆YX be a class of measurable hypotheses with Natarajan dimension Ndim⁡(H)=d\operatorname{Ndim}(H) = dNdim(H)=d (Definition 29.2). The loss is the multiclass 000–111 loss ℓ(h,(x,y))=1[h(x)≠y]\ell(h,(x,y)) = \mathbb{1}[h(x) \ne y]ℓ(h,(x,y))=1[h(x)=y]. Assume moreover that HHH is nonempty, has the countable-approximation property (Remark 3.1), and that d≥1d \ge 1d≥1.

There is an absolute constant C2>0C_2 > 0C2​>0 (independent of XXX, YYY, HHH and ddd) such that HHH has the uniform convergence property (Definition 4.3) with sample complexity

mHUC(ϵ,δ)≤⌈C2 dlog⁡k+log⁡(1/δ)ϵ2⌉.m^{UC}_H(\epsilon,\delta) \le \left\lceil C_2\,\frac{d \log k + \log(1/\delta)}{\epsilon^2} \right\rceil .mHUC​(ϵ,δ)≤⌈C2​ϵ2dlogk+log(1/δ)​⌉.

That is, for all ϵ,δ∈(0,1)\epsilon, \delta \in (0,1)ϵ,δ∈(0,1), every probability distribution D\mathcal DD over X×YX \times YX×Y and every mmm at least this number, a sample S∼DmS \sim \mathcal D^mS∼Dm is ϵ\epsilonϵ-representative for HHH (Definition 4.1) with probability at least 1−δ1-\delta1−δ.

Together with Corollary 4.4 this gives the agnostic upper bound of item 2 for every ERM learner.

Formalization Note The failure probability is an outer measure under the product law. The restriction d≥1d \ge 1d≥1 is necessary: for d=0d = 0d=0 the bound reaches m=1m = 1m=1 as δ→1\delta \to 1δ→1, and one example is not 14\tfrac1441​-representative.

Preamble
import Definitions.Def_UnderstandingML_MulticlassLearnability

open MeasureTheory
open scoped InnerProductSpace
Formal statement
universe u v

namespace UnderstandingML

/-- **Theorem 29.3, part 1 (upper bound)** (p. 403). There is an absolute constant `C₂ > 0` such
that every nonempty measurable class `H` of functions from `X` to a finite label set `Y` with the
countable-approximation property and Natarajan dimension `d ≥ 1` has the uniform convergence
property (for the multiclass 0–1 loss) with sample complexity
`m^{UC}_H(ε, δ) ≤ ⌈C₂ (d log |Y| + log(1/δ))/ε²⌉`. -/
theorem multiclass_uc_upper_bound :
    ∃ C₂ : ℝ, 0 < C₂ ∧
      ∀ {X : Type u} {Y : Type v} [MeasurableSpace X] [MeasurableSingletonClass X]
        [MeasurableSpace Y] [MeasurableSingletonClass Y] [Fintype Y]
        (H : Set (X → Y)) (d : ℕ), H.Nonempty → (∀ h ∈ H, Measurable h) →
        NPointwiseSeparable H → ndim H = d → 1 ≤ d →
        HasUniformConvergenceWith lossMulti H (fun ε δ ↦
          ⌈C₂ * (d * Real.log (Fintype.card Y) + Real.log (1 / δ)) / ε ^ 2⌉₊) := by sorry

end UnderstandingML
Source
S. Shalev-Shwartz, S. Ben-David, Understanding Machine Learning: From Theory to Algorithms, Cambridge University Press 2014, doi:10.1017/CBO9781107298019, Chapter 29, Theorem 29.3 (The Multiclass Fundamental Theorem), p. 403, item 1 (upper bound on the uniform-convergence sample complexity)

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