Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Lemma 15.2: the normalized Hard-SVM output (w₀/‖w₀‖, b₀/‖w₀‖) has unit norm and maximizes the margin minᵢ yᵢ(⟨w,xᵢ⟩ + b) over ‖w‖ = 1

Proved
UnderstandingML.hard_svm_max_margin

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

hard-svmmarginsupport-vector-machines

Lemma 15.2. The output of Hard-SVM is a solution of Equation (15.1): argmax⁡(w,b):∥w∥=1min⁡i∈[m]yi(⟨w,xi⟩+b)\operatorname{argmax}_{(w,b) : \|w\| = 1} \min_{i \in [m]} y_i(\langle w, x_i\rangle + b)argmax(w,b):∥w∥=1​mini∈[m]​yi​(⟨w,xi​⟩+b).

Formally: for labels in {±1}\{\pm 1\}{±1} with both labels present, a solution (w0,b0)(w_0, b_0)(w0​,b0​) of (15.2) has w0≠0w_0 \ne 0w0​=0, its normalization has unit norm, and its margin is at least the margin of every halfspace with ∥w∥=1\|w\| = 1∥w∥=1.

Preamble
import Definitions.Def_UnderstandingML_SVM

open MeasureTheory
open scoped InnerProductSpace
Formal statement
namespace UnderstandingML

/-- **Lemma 15.2** (p. 204). The output of Hard-SVM is a solution of Equation (15.1): for a
solution `(w₀, b₀)` of (15.2) on a sample with both labels present, `w₀ ≠ 0`, the normalized
`(ŵ, b̂) = (w₀/‖w₀‖, b₀/‖w₀‖)` has `‖ŵ‖ = 1`, and its margin `minᵢ yᵢ(⟨ŵ, xᵢ⟩ + b̂)` is
maximal among all halfspaces with `‖w‖ = 1`. -/
theorem hard_svm_max_margin {d m : ℕ} (x : Fin m → Vec d) (y : Fin m → ℝ)
    (hy : ∀ i, y i = 1 ∨ y i = -1) (hboth : ∃ i j, y i = 1 ∧ y j = -1) (w₀ : Vec d) (b₀ : ℝ)
    (h : IsHardSVM x y w₀ b₀) :
    w₀ ≠ 0 ∧ ‖‖w₀‖⁻¹ • w₀‖ = 1 ∧
    ∀ (w : Vec d) (b : ℝ), ‖w‖ = 1 →
      sampleMargin x y w b ≤ sampleMargin x y (‖w₀‖⁻¹ • w₀) (b₀ / ‖w₀‖) := 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, §15.1 pp. 204-205, Lemma 15.2 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