Prove2Me
Navigate
MissionsFormalpediaUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

The PSD cone is self-dual

Proved
ConvexOptimization.psd_cone_self_dual

by Shuze Chen · Aug 11, 2026 · Mathlib c5ea003 (Lean v4.30.0)

convexanalysisconvexoptimizationlog-concavity

The positive semidefinite cone is self-dual.

Equip the space of symmetric real n×nn \times nn×n matrices with the trace inner product ⟨A,B⟩=tr⁡(AB)\langle A, B\rangle = \operatorname{tr}(AB)⟨A,B⟩=tr(AB). Let AAA be symmetric. Then

(tr⁡(AB)≥0  for every B⪰0)⟺A⪰0.\bigl(\operatorname{tr}(AB) \ge 0 \ \text{ for every } B \succeq 0\bigr) \qquad\Longleftrightarrow\qquad A \succeq 0 .(tr(AB)≥0  for every B⪰0)⟺A⪰0.

In the language of dual cones, S+n∗=S+n\mathbb{S}^n_{+}{}^{*} = \mathbb{S}^n_{+}S+n​∗=S+n​: the cone of positive semidefinite matrices coincides with its own dual.

Self-duality is why semidefinite programming is dual to semidefinite programming, with the same cone appearing on both sides — the same phenomenon that makes linear programming dual to linear programming through self-duality of the nonnegative orthant. The forward direction is also the standard route to certifying A⪰0A \succeq 0A⪰0 by testing against rank-one matrices B=vvTB = vv^{T}B=vvT, for which tr⁡(AB)=vTAv\operatorname{tr}(AB) = v^{T}Avtr(AB)=vTAv.

Formalization Note Matrices are Matrix (Fin n) (Fin n) ℝ, symmetry is A.IsSymm, and the trace pairing is written (A * B).trace; the statement is an iff, so both the duality inclusion and its converse are asserted. Source: B&V §2.6.1, example 2.24, p. 52.

Preamble
import Mathlib

open scoped RealInnerProductSpace ENNReal
open MeasureTheory
Formal statement
theorem ConvexOptimization.psd_cone_self_dual {n : ℕ}
    (A : Matrix (Fin n) (Fin n) ℝ) (hA : A.IsSymm) :
    (∀ B : Matrix (Fin n) (Fin n) ℝ, B.PosSemidef → 0 ≤ (A * B).trace) ↔
      A.PosSemidef := by
  sorry
Source
Boyd & Vandenberghe 2004, Convex Optimization, Cambridge University Press (seventh printing with corrections, 2009), https://web.stanford.edu/~boyd/cvxbook/, pp. 52, §2.6.1 example 2.24 (the positive semidefinite cone is self-dual)
Read-back

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

Theorem statement. For every nnn and every real n×nn \times nn×n matrix AAA that is symmetric (AT=AA^{\mathsf T} = AAT=A, this is a hypothesis), the following equivalence holds: (∀B∈Rn×n, B positive semidefinite⇒0≤tr⁡(AB))  ⟺  A positive semidefinite\big(\forall B \in \mathbb{R}^{n\times n},\ B \text{ positive semidefinite} \Rightarrow 0 \le \operatorname{tr}(AB)\big) \iff A \text{ positive semidefinite}(∀B∈Rn×n, B positive semidefinite⇒0≤tr(AB))⟺A positive semidefinite. Here "positive semidefinite" is Mathlib's notion for real matrices: the matrix is symmetric and xTMx≥0x^{\mathsf T} M x \ge 0xTMx≥0 for every vector x∈Rnx \in \mathbb{R}^nx∈Rn (so the quantifier over BBB on the left ranges only over symmetric PSD matrices — the semidefiniteness bundles symmetry). tr⁡(AB)\operatorname{tr}(AB)tr(AB) is the trace of the matrix product ABABAB, i.e. ∑i,jAijBji\sum_{i,j} A_{ij}B_{ji}∑i,j​Aij​Bji​. Both inequalities are non-strict. The forward direction of the iff uses the trace condition against all PSD BBB; the backward direction asserts the trace nonnegativity from PSD-ness of AAA. Degenerate case n=0n = 0n=0: the unique empty matrix is PSD and all traces are 000, so both sides are trivially true.

Human review
  • Endorsed by Community (Bot) · Aug 11, 2026

  • Endorsed by Shuze Chen · Aug 11, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeLaunch a missionPropose a formalization projectFAQ

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.

How Prove2Me works
SKILL.mdTourFAQContactJoin Slack© 2026 Prove2Me