Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 4.3.3 — S-lemma

Proved
ModernConvex.SLemma.s_lemma

by Shuze Chen · Oct 20, 2026 · Mathlib 0df444a (Lean v4.33.1)

quadratic-formss-lemmasemidefinite-programming

Let A,BA, BA,B be symmetric n×nn\times nn×n real matrices, and assume that the quadratic inequality xTAx≥0x^TAx \ge 0xTAx≥0 is strictly feasible: there is xˉ∈Rn\bar x \in \mathbb R^nxˉ∈Rn with xˉTAxˉ>0\bar x^TA\bar x > 0xˉTAxˉ>0. Then xTBx≥0x^TBx \ge 0xTBx≥0 is a consequence of xTAx≥0x^TAx \ge 0xTAx≥0 (it holds at every xxx satisfying xTAx≥0x^TAx \ge 0xTAx≥0) if and only if it is a linear consequence of it, i.e., if and only if there exists λ≥0\lambda \ge 0λ≥0 such that

B⪰λA.B \succeq \lambda A.B⪰λA.

The S-lemma (Yakubovich, 1971) is the quadratic counterpart of the homogeneous Farkas lemma for a single inequality, and underlies the semidefinite reformulation of many robust and control problems. The "if" direction is the case m=1m = 1m=1 of Proposition 4.3.4.

Formalization Note Vectors are Fin n → ℝ, xTAxx^TAxxTAx is x ⬝ᵥ (A *ᵥ x), symmetry is Matrix.IsHermitian, and B⪰λAB \succeq \lambda AB⪰λA is (B - lam • A).PosSemidef. "Consequence" is the pointwise implication over all of Rn\mathbb R^nRn. The platform's ConvexOptimization.s_procedure is the inhomogeneous S-procedure in another sign convention; this theorem is a special case of it but not the same statement, so it is drafted here.

Preamble
import Mathlib

open Matrix
Formal statement
namespace ModernConvex.SLemma

/-- Ben-Tal–Nemirovski, Theorem 4.3.3 (S-lemma), p. 176: let `A, B` be symmetric `n × n`
matrices such that `xᵀAx ≥ 0` is strictly feasible (`x̄ᵀAx̄ > 0` for some `x̄`). Then `xᵀBx ≥ 0`
is a consequence of `xᵀAx ≥ 0` if and only if `B ⪰ λA` for some `λ ≥ 0`. -/
theorem s_lemma {n : ℕ} (A B : Matrix (Fin n) (Fin n) ℝ) (hA : A.IsHermitian)
    (hB : B.IsHermitian) (hfeas : ∃ x : Fin n → ℝ, 0 < x ⬝ᵥ (A *ᵥ x)) :
    (∀ x : Fin n → ℝ, 0 ≤ x ⬝ᵥ (A *ᵥ x) → 0 ≤ x ⬝ᵥ (B *ᵥ x)) ↔
      ∃ lam : ℝ, 0 ≤ lam ∧ (B - lam • A).PosSemidef := by sorry

end ModernConvex.SLemma
Source
Ben-Tal & Nemirovski, Lectures on Modern Convex Optimization, SIAM 2001, p. 176, Theorem 4.3.3
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Let nnn be a natural number and A,BA, BA,B real n×nn \times nn×n matrices.

Assumptions:

  • AAA is symmetric.
  • BBB is symmetric.
  • Strict feasibility: some xˉ∈Rn\bar{x} \in \mathbb{R}^nxˉ∈Rn has xˉ⊤Axˉ>0\bar{x}^\top A \bar{x} > 0xˉ⊤Axˉ>0.

Conclusion: the following two statements are equivalent.

  1. For every x∈Rnx \in \mathbb{R}^nx∈Rn,   x⊤Ax≥0  ⟹  x⊤Bx≥0\;x^\top A x \ge 0 \implies x^\top B x \ge 0x⊤Ax≥0⟹x⊤Bx≥0.
  2. There is a real λ≥0\lambda \ge 0λ≥0 such that B−λAB - \lambda AB−λA is positive semidefinite, that is, symmetric with y⊤(B−λA)y≥0y^\top (B - \lambda A) y \ge 0y⊤(B−λA)y≥0 for all y∈Rny \in \mathbb{R}^ny∈Rn.

Here x⊤Mxx^\top M xx⊤Mx is the dot product of xxx with MxMxMx.

Degenerate cases:

  • n=0n = 0n=0: the only vector is empty and every quadratic form is 000. The strict-feasibility hypothesis cannot hold, so the statement is vacuous.
  • Any nnn with AAA negative semidefinite (for example A=0A = 0A=0): the strict-feasibility hypothesis likewise cannot be satisfied.
Human review
  • Endorsed by Community (Bot) · Oct 20, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Shuze Chen · Oct 20, 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