Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 7.4: with probability ≥ 1 − δ, |L_D(h) − L_S(h)| ≤ εₙ(m, w(n)δ) simultaneously for every n and h ∈ Hₙ

Proved
UnderstandingML.srm_bound

by naimengye · Sep 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

structural-risk-minimizationuniform-convergenceunion-bound

Theorem 7.4. Let w:N→[0,1]w : \mathbb{N} \to [0,1]w:N→[0,1] be a function such that ∑nw(n)≤1\sum_n w(n) \le 1∑n​w(n)≤1. Let HHH be a hypothesis class that can be written as H=⋃nHnH = \bigcup_n H_nH=⋃n​Hn​, where for each nnn, HnH_nHn​ satisfies the uniform convergence property with a sample complexity function mHnUCm^{UC}_{H_n}mHn​UC​. Let ϵn\epsilon_nϵn​ be as defined in Equation (7.1). Then for every δ∈(0,1)\delta \in (0,1)δ∈(0,1) and distribution DDD, with probability of at least 1−δ1-\delta1−δ over the choice of S∼DmS \sim D^mS∼Dm, the following bound holds simultaneously for every nnn and h∈Hnh \in H_nh∈Hn​: ∣LD(h)−LS(h)∣≤ϵn(m,w(n)⋅δ)|L_D(h) - L_S(h)| \le \epsilon_n(m, w(n)\cdot\delta)∣LD​(h)−LS​(h)∣≤ϵn​(m,w(n)⋅δ).

Formally: the DmD^mDm-probability that for some nnn with w(n)>0w(n) > 0w(n)>0 at which ϵn(m,w(n)δ)\epsilon_n(m, w(n)\delta)ϵn​(m,w(n)δ) is defined some h∈Hnh \in H_nh∈Hn​ has ∣LD(h)−LS(h)∣>ϵn(m,w(n)δ)|L_D(h) - L_S(h)| > \epsilon_n(m, w(n)\delta)∣LD​(h)−LS​(h)∣>ϵn​(m,w(n)δ) is at most δ\deltaδ; the condition ∑nw(n)≤1\sum_n w(n) \le 1∑n​w(n)≤1 is stated on partial sums.

Preamble
import Definitions.Def_UnderstandingML_Nonuniform

open MeasureTheory
Formal statement
namespace UnderstandingML

/-- **Theorem 7.4** (p. 86). Let `w : ℕ → [0,1]` be a function such that `∑ₙ w(n) ≤ 1`. Let
`H = ⋃ₙ Hₙ`, where each `Hₙ` satisfies the uniform convergence property with a sample
complexity function `m^{UC}_{Hₙ}`, and let `εₙ` be as in Equation (7.1). Then for every
`δ ∈ (0,1)` and distribution `D`, with probability of at least `1 − δ` over the choice of
`S ∼ D^m`, the following holds simultaneously for every `n` and `h ∈ Hₙ`:
`|L_D(h) − L_S(h)| ≤ εₙ(m, w(n)·δ)`. The bound is asserted for the indices `n` with
`w(n) > 0` at which `εₙ(m, w(n)·δ)` is defined (the set in (7.1) is nonempty); the sum
condition is stated on the partial sums. -/
theorem srm_bound {Z : Type*} [MeasurableSpace Z] {Hyp : Type*} (loss : Hyp → Z → ℝ)
    (Hn : ℕ → Set Hyp) (mUC : ℕ → ℝ → ℝ → ℕ)
    (hUC : ∀ n, HasUniformConvergenceWith loss (Hn n) (mUC n)) (w : ℕ → ℝ)
    (hw : ∀ n, 0 ≤ w n ∧ w n ≤ 1) (hsum : ∀ N, ∑ n ∈ Finset.range N, w n ≤ 1) {δ : ℝ}
    (hδ0 : 0 < δ) (hδ1 : δ < 1) (D : Measure Z) [IsProbabilityMeasure D] (m : ℕ) :
    iidLaw D m {S | ∃ n, 0 < w n ∧ RateDefined (mUC n) m (w n * δ) ∧
        ∃ h ∈ Hn n, epsRate (mUC n) m (w n * δ) < |risk loss D h - empRisk loss S h|} ≤
      ENNReal.ofReal δ := by sorry

end UnderstandingML
Source
Shalev-Shwartz and Ben-David, Understanding Machine Learning: From Theory to Algorithms, Cambridge University Press 2014, doi:10.1017/CBO9781107298019, §7.2 pp. 86-87, Theorem 7.4 with its proof
Human review
  • Endorsed by Shuze Chen · Sep 25, 2026

    Confirmed by the moderator at approval.

  • Endorsed by naimengye · Sep 25, 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