Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Zhang's inequality relating the hinge risk and the classification risk

Disproved
SupportVectorMachines.LossFunctions.zhang_inequality

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

machine-learningprobabilitystatistics

This is Theorem 2.31 (Zhang's inequality) of Steinwart & Christmann, Support Vector Machines (Springer 2008, p. 37), the book's sharpest calibration result relating a convex surrogate loss to the classification loss it stands in for.

Let PPP be a distribution on X×YX \times YX×Y with Y:={−1,1}Y := \{-1,1\}Y:={−1,1}, and write η(x):=P(y=1∣x)\eta(x) := P(y=1 \mid x)η(x):=P(y=1∣x) for the conditional probability of the positive label, and fLclass,P∗(x):=sgn⁡(2η(x)−1)f^*_{L_{\mathrm{class}},P}(x) := \operatorname{sgn}(2\eta(x)-1)fLclass​,P∗​(x):=sgn(2η(x)−1) for the associated Bayes classification function (sgn⁡(0):=1\operatorname{sgn}(0):=1sgn(0):=1). Then:

  1. For every measurable f:X→[−1,1]f : X \to [-1,1]f:X→[−1,1] with finite hinge risk,
RLhinge,P(f)−RLhinge,P∗=∫X∣f(x)−fLclass,P∗(x)∣⋅∣2η(x)−1∣ dPX(x),R_{L_{\mathrm{hinge}},P}(f) - R^*_{L_{\mathrm{hinge}},P} = \int_X \big|f(x) - f^*_{L_{\mathrm{class}},P}(x)\big| \cdot |2\eta(x)-1| \, dP_X(x),RLhinge​,P​(f)−RLhinge​,P∗​=∫X​​f(x)−fLclass​,P∗​(x)​⋅∣2η(x)−1∣dPX​(x),

an exact equality, where PXP_XPX​ is the XXX-marginal of PPP. 2. For every measurable f:X→Rf : X \to \mathbb Rf:X→R with finite hinge and classification risk,

RLclass,P(f)−RLclass,P∗  ≤  RLhinge,P(f)−RLhinge,P∗.R_{L_{\mathrm{class}},P}(f) - R^*_{L_{\mathrm{class}},P} \;\le\; R_{L_{\mathrm{hinge}},P}(f) - R^*_{L_{\mathrm{hinge}},P}.RLclass​,P​(f)−RLclass​,P∗​≤RLhinge​,P​(f)−RLhinge​,P∗​.

The first assertion identifies the excess hinge risk with a weighted L1L^1L1-distance to the Bayes classifier; the second shows that making the (convex, tractable) excess hinge risk small is always at least as hard as making the excess classification risk small, which is exactly what makes the hinge loss a valid surrogate for classification.

Formalization Note η\etaη is represented via its defining disintegration property: for every measurable A⊆XA \subseteq XA⊆X, P(A×{1})=∫x∈Aη(x) dPX(x)P(A \times \{1\}) = \int_{x \in A} \eta(x) \, dP_X(x)P(A×{1})=∫x∈A​η(x)dPX​(x) where PX:=P.map Prod.fstP_X := P.\mathrm{map}\ \mathrm{Prod.fst}PX​:=P.map Prod.fst. Because the book's risks are extended-real valued while risk/bayesRisk here are ordinary (junk-at-non-integrable) Bochner integrals, finiteness of the relevant risk is added as an explicit integrability hypothesis on f in each assertion — automatic in the book's own argument (bounded losses on a probability space), stated here so the real-valued difference is never a vacuous 0 - 0.


Retired. Retired because η was not required to be measurable or [0,1]-valued, so a non-measurable η satisfied its (Bochner-integral) defining identity vacuously (disproved); replaced by SupportVectorMachines.LossFunctions.zhang_inequality_v2.

Preamble
import Mathlib
import Definitions.Def_SupportVectorMachines_LossFunctions_RiskBasics
import Definitions.Def_SupportVectorMachines_LossFunctions_ClassificationLosses

open MeasureTheory
Formal statement
namespace SupportVectorMachines.LossFunctions

/-- Theorem 2.31 (Zhang's inequality), p. 37: given a distribution `P` on `X × Y` (`Y := {-1,1}`)
with `η(x) := P(y=1|x)` and Bayes classifier `f*_{L_class,P}(x) := sign(2η(x)-1)`:

* for every measurable `f : X → [-1,1]` with finite hinge risk,
  `R_{L_hinge,P}(f) - R*_{L_hinge,P} = ∫_X |f(x) - f*_{L_class,P}(x)| · |2η(x) - 1| dP_X(x)`
  (an exact equality);
* for every measurable `f : X → ℝ` with finite hinge and classification risk,
  `R_{L_class,P}(f) - R*_{L_class,P} ≤ R_{L_hinge,P}(f) - R*_{L_hinge,P}`.

`η` is represented via its defining disintegration property: for every measurable `A ⊆ X`,
`P(A × {1}) = ∫_{x ∈ A} η(x) dP_X(x)`, where `P_X := P.map Prod.fst` is the `X`-marginal. The
finite-risk hypotheses guard the real-valued (junk-at-non-integrable) Bochner integral used for
`risk`/`bayesRisk`: the book's risks are extended-real-valued and the difference is understood
whenever the risks involved are finite, which is automatic for `L_class` (bounded by 1) and for
`L_hinge` on `f` valued in `[-1,1]` (bounded by 2), and is stated explicitly for the general `f`
of the second assertion. -/
theorem zhang_inequality {X : Type*} [MeasurableSpace X] (P : Measure (X × ℝ))
    [IsProbabilityMeasure P] (hY : P (Set.univ ×ˢ ({-1, 1} : Set ℝ)) = 1) (η : X → ℝ)
    (hη : ∀ A, MeasurableSet A →
      (P (A ×ˢ ({1} : Set ℝ))).toReal = ∫ x in A, η x ∂(P.map Prod.fst)) :
    (∀ f : X → ℝ, Measurable f → (∀ x, f x ∈ Set.Icc (-1 : ℝ) 1) →
        Integrable (fun p : X × ℝ => hingeLoss p.1 p.2 (f p.1)) P →
        risk hingeLoss P f - bayesRisk hingeLoss P =
          ∫ x, |f x - bayesClassifier η x| * |2 * η x - 1| ∂(P.map Prod.fst)) ∧
      ∀ f : X → ℝ, Measurable f →
        Integrable (fun p : X × ℝ => hingeLoss p.1 p.2 (f p.1)) P →
        Integrable (fun p : X × ℝ => classLoss p.1 p.2 (f p.1)) P →
        risk classLoss P f - bayesRisk classLoss P ≤
          risk hingeLoss P f - bayesRisk hingeLoss P := by sorry

end SupportVectorMachines.LossFunctions
Source
Steinwart & Christmann, Support Vector Machines, Springer 2008, p. 37, Theorem 2.31 (Zhang's inequality)
Human review
  • Endorsed by Shuze Chen · Sep 28, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 28, 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