Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 1: a (K,ϵ(⋅))(K,\epsilon(\cdot))(K,ϵ(⋅))-robust algorithm has ∣L(As)−lemp(As)∣≤ϵ(s)+M(2Kln⁡2+2ln⁡(1/δ))/n|\mathcal L(\mathcal A_s) - l_{\mathrm{emp}}(\mathcal A_s)| \le \epsilon(s) + M\sqrt{(2K\ln 2 + 2\ln(1/\delta))/n}∣L(As​)−lemp​(As​)∣≤ϵ(s)+M(2Kln2+2ln(1/δ))/n​ w.p. ≥1−δ\ge 1-\delta≥1−δ

Proved
XuMannorRobust.Standard.theorem1_robust_generalization_bound

by mikedeng1 · Sep 29, 2026 · Mathlib 0df444a (Lean v4.33.1)

algorithmic-robustnessgeneralizationlearning-theoryp2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1

Let μ\muμ be a probability measure on a measurable space Z\mathcal ZZ, H\mathcal HH a set of hypotheses and l:H×Z→Rl : \mathcal H \times \mathcal Z \to \mathbb Rl:H×Z→R a loss with 0≤l(h,z)≤M0 \le l(h,z) \le M0≤l(h,z)≤M for all h,zh, zh,z and l(h,⋅)l(h, \cdot)l(h,⋅) measurable for every hhh. Let n≥1n \ge 1n≥1 and let A:Zn→H\mathcal A : \mathcal Z^n \to \mathcal HA:Zn→H be a learning algorithm that is (K,ϵ(⋅))(K, \epsilon(\cdot))(K,ϵ(⋅))-robust (Definition 2). Let the training set s\mathbf ss consist of nnn i.i.d. draws from μ\muμ. Then for every δ>0\delta > 0δ>0, with probability at least 1−δ1 - \delta1−δ,

∣L(As)−lemp(As)∣≤ϵ(s)+M2Kln⁡2+2ln⁡(1/δ)n,|\mathcal L(\mathcal A_{\mathbf s}) - l_{\mathrm{emp}}(\mathcal A_{\mathbf s})| \le \epsilon(\mathbf s) + M \sqrt{\frac{2K\ln 2 + 2\ln(1/\delta)}{n}},∣L(As​)−lemp​(As​)∣≤ϵ(s)+Mn2Kln2+2ln(1/δ)​​,

where L(As)=Ez∼μ l(As,z)\mathcal L(\mathcal A_{\mathbf s}) = \mathbb E_{z\sim\mu}\, l(\mathcal A_{\mathbf s}, z)L(As​)=Ez∼μ​l(As​,z) is the expected error and lemp(As)=1n∑i=1nl(As,si)l_{\mathrm{emp}}(\mathcal A_{\mathbf s}) = \frac1n\sum_{i=1}^n l(\mathcal A_{\mathbf s}, s_i)lemp​(As​)=n1​∑i=1n​l(As​,si​) the training error.

This is the main generalization bound of Xu and Mannor's robustness framework: an algorithm whose loss varies by at most ϵ(s)\epsilon(\mathbf s)ϵ(s) within each cell of a fixed partition of the sample space into KKK cells generalizes, with a complexity term depending only on KKK and not on the hypothesis class.

Formalization Note "With probability at least 1−δ1-\delta1−δ" is stated as: the outer measure under μn\mu^nμn (on Fin n → Z) of the set of training sets violating the inequality is at most δ\deltaδ; this requires no measurability of s↦As\mathbf s \mapsto \mathcal A_{\mathbf s}s↦As​. Measurability of l(h,⋅)l(h,\cdot)l(h,⋅) and of the partition cells is added to the paper's model, which ignores measurability. n≥1n \ge 1n≥1 is assumed (the paper's "n IID draws"); at n=0n = 0n=0 Lean's 1/0=01/0 = 01/0=0 would make the claim false. For δ>2K\delta > 2^Kδ>2K the radicand is negative and the square root is 000; the statement stays true there.

Preamble
import Mathlib
import Definitions.Def_XuMannorRobust_Standard_Losses
import Definitions.Def_XuMannorRobust_Standard_IsRobust

open MeasureTheory
Formal statement
namespace XuMannorRobust.Standard

/-- **Theorem 1** (Xu & Mannor 2012, p. 396). If the learning algorithm `A` is
`(K, ε(·))`-robust, the loss takes values in `[0, M]` (and each `l h` is measurable), and the
training set `s` consists of `n ≥ 1` i.i.d. draws from the probability measure `μ`, then for every
`δ > 0`, with probability at least `1 − δ`,
`|𝓛(A_s) − l_emp(A_s)| ≤ ε(s) + M √((2K ln 2 + 2 ln(1/δ))/n)`: the outer measure under `μⁿ` of
the set of training sets where this fails is at most `δ`. -/
theorem theorem1_robust_generalization_bound {Z H : Type*} [MeasurableSpace Z] (μ : Measure Z)
    [IsProbabilityMeasure μ] (l : H → Z → ℝ) (M : ℝ) (hl_bound : ∀ h z, 0 ≤ l h z ∧ l h z ≤ M)
    (hl_meas : ∀ h, Measurable (l h)) {n : ℕ} (hn : 0 < n) (A : (Fin n → Z) → H) (K : ℕ)
    (ε : (Fin n → Z) → ℝ) (hA : IsRobust l A K ε) (δ : ℝ) (hδ : 0 < δ) :
    (Measure.pi fun _ : Fin n => μ)
        {s | ¬ (|expectedLoss μ l (A s) - empiricalLoss l (A s) s|
            ≤ ε s + M * Real.sqrt ((2 * (K : ℝ) * Real.log 2 + 2 * Real.log (1 / δ)) / (n : ℝ)))}
      ≤ ENNReal.ofReal δ := by sorry

end XuMannorRobust.Standard
Source
Xu & Mannor, Robustness and Generalization, Mach Learn 86 (2012), DOI 10.1007/s10994-011-5268-1, p. 396, Theorem 1
Human review
  • Endorsed by Shuze Chen · Oct 1, 2026

    Confirmed by the moderator at approval.

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