Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Proof of Theorem 8 — the expected test average loss equals the expected loss

Proved
XuMannorRobust.WeakRobust.theorem8_first_equality

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

generalizationlearning-theoryp2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1

Let Z\mathcal ZZ be a measurable space with a probability measure μ\muμ, H\mathcal HH a set of hypotheses, and l:H×Z→[0,M]l : \mathcal H \times \mathcal Z \to [0, M]l:H×Z→[0,M] a loss measurable in its sample argument. Let n≥1n \ge 1n≥1 and let t(n)=(t1,…,tn)∼μn\mathbf t(n) = (t_1, \dots, t_n) \sim \mu^nt(n)=(t1​,…,tn​)∼μn be nnn i.i.d. samples. Then for every hypothesis h∈Hh \in \mathcal Hh∈H

Et(n)[L(h,t(n))]=L(h),\mathbb E_{\mathbf t(n)}\big[ L(h, \mathbf t(n)) \big] = \mathcal L(h),Et(n)​[L(h,t(n))]=L(h),

where L(h,t(n))=1n∑i=1nl(h,ti)L(h, \mathbf t(n)) = \frac1n \sum_{i=1}^n l(h, t_i)L(h,t(n))=n1​∑i=1n​l(h,ti​) and L(h)=Ez∼μl(h,z)\mathcal L(h) = \mathbb E_{z \sim \mu} l(h, z)L(h)=Ez∼μ​l(h,z).

In the proof of Theorem 8 this is applied to the fixed hypothesis h=As∗(n)h = \mathcal A_{\mathbf s^*(n)}h=As∗(n)​, turning the generalization gap ∣L(As∗(n))−L(As∗(n),s∗(n))∣|\mathcal L(\mathcal A_{\mathbf s^*(n)}) - L(\mathcal A_{\mathbf s^*(n)}, \mathbf s^*(n))|∣L(As∗(n)​)−L(As∗(n)​,s∗(n))∣ into ∣Et(n)L(As∗(n),t(n))−L(As∗(n),s∗(n))∣|\mathbb E_{\mathbf t(n)} L(\mathcal A_{\mathbf s^*(n)}, \mathbf t(n)) - L(\mathcal A_{\mathbf s^*(n)}, \mathbf s^*(n))|∣Et(n)​L(As∗(n)​,t(n))−L(As∗(n)​,s∗(n))∣.

Formalization Note The law of t(n)\mathbf t(n)t(n) is the product measure Measure.pi (fun _ : Fin n => μ). Measurability of l(h,⋅)l(h, \cdot)l(h,⋅) is added (the paper ignores measurability). The case n=0n = 0n=0 is excluded, where the average loss is 000 in Lean.

Preamble
import Mathlib
import Definitions.Def_XuMannorRobust_WeakRobust_Setup

open MeasureTheory
Formal statement
namespace XuMannorRobust.WeakRobust

/-- Xu & Mannor 2012, p. 410, proof of Theorem 8, first equality: since the test samples
`t(n)` are `n` i.i.d. draws from `μ`, `E_{t(n)} L(h, t(n)) = 𝓛(h)` for every hypothesis `h`
(`n ≥ 1`; loss measurable with values in `[0, M]`). -/
theorem theorem8_first_equality {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) (h : H) :
    ∫ t, avgLoss l h t ∂(Measure.pi fun _ : Fin n => μ) = expectedLoss μ l h := by sorry

end XuMannorRobust.WeakRobust
Source
Xu & Mannor, Robustness and Generalization, Mach Learn 86 (2012), DOI 10.1007/s10994-011-5268-1, p. 410, proof of Theorem 8, first equality of the sufficiency display
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