Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 9.1 (Perceptron): for a separable sample with B = min{‖w‖ : yᵢ⟨w,xᵢ⟩ ≥ 1} and R = maxᵢ‖xᵢ‖, the Batch Perceptron stops after at most (RB)² iterations with all yᵢ⟨w,xᵢ⟩ > 0

Proved
UnderstandingML.perceptron_convergence

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

convergencehalfspacesmistake-boundperceptron

Theorem 9.1. Assume that (x1,y1),…,(xm,ym)(x_1, y_1), \dots, (x_m, y_m)(x1​,y1​),…,(xm​,ym​) is separable, let B=min⁡{∥w∥:∀i∈[m], yi⟨w,xi⟩≥1}B = \min\{\|w\| : \forall i \in [m],\ y_i\langle w, x_i\rangle \ge 1\}B=min{∥w∥:∀i∈[m], yi​⟨w,xi​⟩≥1}, and let R=max⁡i∥xi∥R = \max_i \|x_i\|R=maxi​∥xi​∥. Then the Perceptron algorithm stops after at most (RB)2(RB)^2(RB)2 iterations, and when it stops it holds that ∀i∈[m], yi⟨w(t),xi⟩>0\forall i \in [m],\ y_i\langle w^{(t)}, x_i\rangle > 0∀i∈[m], yi​⟨w(t),xi​⟩>0.

Formally (labels in {±1}\{\pm 1\}{±1}): every run of the Batch Perceptron of TTT iterations has T≤(RB)2T \le (RB)^2T≤(RB)2; and there is a run of at most (RB)2(RB)^2(RB)2 iterations after which every example satisfies yi⟨w(T),xi⟩>0y_i\langle w^{(T)}, x_i\rangle > 0yi​⟨w(T),xi​⟩>0.

Preamble
import Definitions.Def_UnderstandingML_Linear

open MeasureTheory
open scoped InnerProductSpace
Formal statement
namespace UnderstandingML

/-- **Theorem 9.1** (p. 120). Assume that `(x₁, y₁), …, (x_m, y_m)` is separable, let
`B = min{‖w‖ : ∀ i ∈ [m], yᵢ⟨w, xᵢ⟩ ≥ 1}` and let `R = maxᵢ ‖xᵢ‖`. Then the Perceptron algorithm
stops after at most `(RB)²` iterations, and when it stops it holds that
`∀ i ∈ [m], yᵢ⟨w⁽ᵗ⁾, xᵢ⟩ > 0`. Stated as: every run of the Batch Perceptron has at most `(RB)²`
iterations, and some run of at most `(RB)²` iterations ends with all examples correctly
classified (the stopping condition). -/
theorem perceptron_convergence {d m : ℕ} (x : Fin m → Vec d) (y : Fin m → ℝ)
    (hy : ∀ i, y i = 1 ∨ y i = -1) (hsep : Separable x y) :
    (∀ (w : ℕ → Vec d) (T : ℕ), IsPerceptronRun x y w T →
        (T : ℝ) ≤ (radius x * marginNorm x y) ^ 2) ∧
    ∃ (w : ℕ → Vec d) (T : ℕ), IsPerceptronRun x y w T ∧
      (T : ℝ) ≤ (radius x * marginNorm x y) ^ 2 ∧ ∀ i, 0 < y i * ⟪w T, x i⟫_ℝ := 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, §9.1.2 pp. 120-121, Theorem 9.1 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