Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 21.16: the online Perceptron's update rounds satisfy |M| ≤ ∑ₜ fₜ(w⋆) + R‖w⋆‖√(∑ₜ fₜ(w⋆)) + R²‖w⋆‖², and |M| ≤ R²‖w⋆‖² under margin 1

Proved
UnderstandingML.online_perceptron_bound

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

mistake-boundonline-learningperceptronsurrogate-loss

Theorem 21.16. Suppose that the Perceptron algorithm runs on a sequence (x1,y1),…,(xT,yT)(x_1, y_1), \dots, (x_T, y_T)(x1​,y1​),…,(xT​,yT​) and let R=max⁡t∥xt∥R = \max_t\|x_t\|R=maxt​∥xt​∥. Let MMM be the rounds on which the Perceptron errs and let ft(w)=1[t∈M] [1−yt⟨w,xt⟩]+f_t(w) = \mathbb{1}[t \in M]\,[1 - y_t\langle w, x_t\rangle]_+ft​(w)=1[t∈M][1−yt​⟨w,xt​⟩]+​. Then, for every w⋆w^\starw⋆,

∣M∣≤∑tft(w⋆)+R∥w⋆∥∑tft(w⋆)+R2∥w⋆∥2.|M| \le \sum_t f_t(w^\star) + R\|w^\star\|\sqrt{\sum_t f_t(w^\star)} + R^2\|w^\star\|^2.∣M∣≤t∑​ft​(w⋆)+R∥w⋆∥t∑​ft​(w⋆)​+R2∥w⋆∥2.

In particular, if there exists w⋆w^\starw⋆ such that yt⟨w⋆,xt⟩≥1y_t\langle w^\star, x_t\rangle \ge 1yt​⟨w⋆,xt​⟩≥1 for all ttt then ∣M∣≤R2∥w⋆∥2|M| \le R^2\|w^\star\|^2∣M∣≤R2∥w⋆∥2.

Formally: yt∈{±1}y_t \in \{\pm1\}yt​∈{±1}, MMM the set of update rounds yt⟨w(t),xt⟩≤0y_t\langle w^{(t)}, x_t\rangle \le 0yt​⟨w(t),xt​⟩≤0 (which contains every prediction mistake), and RRR any bound on ∥xt∥\|x_t\|∥xt​∥, t<Tt < Tt<T.

Preamble
import Definitions.Def_UnderstandingML_Online

open MeasureTheory
open scoped InnerProductSpace
Formal statement
namespace UnderstandingML

/-- **Theorem 21.16** (p. 304). Suppose that the Perceptron algorithm runs on a sequence
`(x₁, y₁), …, (x_T, y_T)` and let `R = maxₜ ‖xₜ‖`. Let `M` be the rounds on which the Perceptron
errs and let `fₜ(w) = 𝟙[t ∈ M] [1 − yₜ⟨w, xₜ⟩]₊`. Then, for every `w⋆`,
`|M| ≤ ∑ₜ fₜ(w⋆) + R‖w⋆‖ √(∑ₜ fₜ(w⋆)) + R²‖w⋆‖²`. In particular, if there exists `w⋆` such
that `yₜ⟨w⋆, xₜ⟩ ≥ 1` for all `t` then `|M| ≤ R²‖w⋆‖²`.
`M` is the set of update rounds `yₜ⟨w⁽ᵗ⁾, xₜ⟩ ≤ 0`; `R` is any bound on the norms. -/
theorem online_perceptron_bound {d : ℕ} (T : ℕ) (x : ℕ → Vec d) (y : ℕ → ℝ)
    (hy : ∀ t, y t = 1 ∨ y t = -1) (R : ℝ) (hR : ∀ t < T, ‖x t‖ ≤ R) (wstar : Vec d) :
    ((perceptronRounds x y T).card : ℝ) ≤
      (∑ t ∈ perceptronRounds x y T, max 0 (1 - y t * ⟪wstar, x t⟫_ℝ)) +
        R * ‖wstar‖ * Real.sqrt (∑ t ∈ perceptronRounds x y T, max 0 (1 - y t * ⟪wstar, x t⟫_ℝ)) +
        R ^ 2 * ‖wstar‖ ^ 2 ∧
    ((∀ t < T, 1 ≤ y t * ⟪wstar, x t⟫_ℝ) →
      ((perceptronRounds x y T).card : ℝ) ≤ R ^ 2 * ‖wstar‖ ^ 2) := 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, §21.4 pp. 303-304, Equation (21.6) and Theorem 21.16
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