Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Zero duality gap certifies optimality

Proved
LinearOptimization.lp_optimal_certificate

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

certificatedualitylinear-programmingoptimality

(Corollary 4.2) Let xxx and ppp be feasible solutions to the primal and the dual, respectively, and suppose that

p′b=c′x.p'b = c'x.p′b=c′x.

Then, xxx and ppp are optimal solutions to the primal and the dual, respectively.

Preamble
import Definitions.Def_LinearOptimization_DualLP


open Matrix

/-- **Bertsimas & Tsitsiklis, Corollary 4.2 (p. 148).** Feasible `x` and `p` with
`p'b = c'x` are automatically optimal for the primal and the dual,
respectively. -/
Formal statement
theorem LinearOptimization.lp_optimal_certificate {m n : ℕ} (P : GeneralFormLP m n)
    (x : Fin n → ℝ) (hx : x ∈ generalFeasibleSet P)
    (p : Fin m → ℝ) (hp : p ∈ generalFeasibleSet (dualLP P))
    (heq : p ⬝ᵥ P.b = P.c ⬝ᵥ x) :
    IsLpOptimal P.c (generalFeasibleSet P) x ∧
    IsLpDualOptimal P.b (generalFeasibleSet (dualLP P)) p := by
  sorry
Source
Bertsimas & Tsitsiklis, Introduction to Linear Optimization, Athena Scientific, 1997, Corollary 4.2, p. 148
Read-back

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

Here a general-form linear program PPP with mmm rows and nnn variables (m,n≥0m, n \ge 0m,n≥0 arbitrary natural numbers) is a data record consisting of an m×nm\times nm×n real matrix AAA, vectors b∈Rmb \in \mathbb{R}^mb∈Rm and c∈Rnc \in \mathbb{R}^nc∈Rn, a relation symbol from {≥,≤,=}\{\ge, \le, =\}{≥,≤,=} attached to each row iii, and a sign restriction from {nonnegative, nonpositive, free} attached to each variable jjj. A point x∈Rnx \in \mathbb{R}^nx∈Rn is feasible for PPP iff for every row iii the number Ai⋅xA_i \cdot xAi​⋅x (dot product of row iii with xxx) stands in that row's relation to bib_ibi​ (Ai⋅x≥biA_i \cdot x \ge b_iAi​⋅x≥bi​, ≤bi\le b_i≤bi​, or =bi= b_i=bi​), and every coordinate xjx_jxj​ obeys its sign restriction (xj≥0x_j \ge 0xj​≥0, xj≤0x_j \le 0xj​≤0, or unrestricted). The dual of PPP is again a general-form LP: matrix −AT-A^{\mathsf T}−AT (nnn rows, mmm variables), right-hand side −c-c−c, cost vector −b-b−b; its row jjj carries relation ≥\ge≥ / ≤\le≤ / === according as variable jjj of PPP is nonnegative / nonpositive / free, and its variable iii is nonnegative / nonpositive / free according as row iii of PPP has relation ≥\ge≥ / ≤\le≤ / ===. Unwinding, p∈Rmp \in \mathbb{R}^mp∈Rm is dual-feasible iff for every jjj: (ATp)j≤cj(A^{\mathsf T}p)_j \le c_j(ATp)j​≤cj​ when variable jjj of PPP is nonnegative, (ATp)j≥cj(A^{\mathsf T}p)_j \ge c_j(ATp)j​≥cj​ when nonpositive, (ATp)j=cj(A^{\mathsf T}p)_j = c_j(ATp)j​=cj​ when free (the row constraint of the dual literally reads −(ATp)jR−cj-(A^{\mathsf T}p)_j \mathrel{R} -c_j−(ATp)j​R−cj​); and for every iii: pi≥0p_i \ge 0pi​≥0 when row iii of PPP is a ≥\ge≥-row, pi≤0p_i \le 0pi​≤0 when a ≤\le≤-row, pip_ipi​ unrestricted when an ===-row. Here “xxx is primal-optimal” means: xxx is feasible for PPP and c⋅x≤c⋅yc \cdot x \le c \cdot yc⋅x≤c⋅y for every feasible yyy (a global minimizer of the primal objective), and “ppp is dual-optimal” means: ppp is dual-feasible and q⋅b≤p⋅bq \cdot b \le p \cdot bq⋅b≤p⋅b for every dual-feasible qqq (a global maximizer of q↦q⋅bq \mapsto q \cdot bq↦q⋅b). The theorem asserts: for every general-form LP PPP, every primal-feasible xxx, and every dual-feasible ppp, if p⋅b=c⋅xp \cdot b = c \cdot xp⋅b=c⋅x (exact equality of objective values) then xxx is primal-optimal and ppp is dual-optimal. This is a one-way implication from the equality certificate to the pair of optimality claims; no converse is asserted.

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

  • Endorsed by Shuze Chen · Aug 5, 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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me