Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 5.3 — Complementary Slackness Theorem

Proved
VanderbeiLP.StrictComp.complementary_slackness

by mikedeng1 · Oct 1, 2026 · Mathlib 0df444a (Lean v4.33.1)

complementary-slacknessdualitylinear-programmingp2o-batch-b23ap2o-gran-per-chapterp2o-plan-bookp2o-v1

Consider the standard-form linear program "maximize cTxc^T xcTx subject to Ax≤bAx \le bAx≤b, x≥0x \ge 0x≥0" with A∈Rm×nA \in \mathbb{R}^{m \times n}A∈Rm×n, b∈Rmb \in \mathbb{R}^mb∈Rm, c∈Rnc \in \mathbb{R}^nc∈Rn, and its dual "minimize bTyb^T ybTy subject to ATy≥cA^T y \ge cATy≥c, y≥0y \ge 0y≥0". Suppose x=(x1,…,xn)x = (x_1, \dots, x_n)x=(x1​,…,xn​) is primal feasible and y=(y1,…,ym)y = (y_1, \dots, y_m)y=(y1​,…,ym​) is dual feasible, and let

  • wi=bi−∑jaijxjw_i = b_i - \sum_j a_{ij} x_jwi​=bi​−∑j​aij​xj​ (i=1,…,mi = 1, \dots, mi=1,…,m) be the corresponding primal slack variables,
  • zj=∑iyiaij−cjz_j = \sum_i y_i a_{ij} - c_jzj​=∑i​yi​aij​−cj​ (j=1,…,nj = 1, \dots, nj=1,…,n) be the corresponding dual slack variables.

Then xxx and yyy are optimal for their respective problems if and only if

xjzj=0  (j=1,…,n),wiyi=0  (i=1,…,m).(5.7)x_j z_j = 0 \ \ (j = 1, \dots, n), \qquad w_i y_i = 0 \ \ (i = 1, \dots, m). \qquad (5.7)xj​zj​=0  (j=1,…,n),wi​yi​=0  (i=1,…,m).(5.7)

The theorem turns optimality into a finite system of equations, which is how an optimal dual solution is recovered from an optimal primal one.

Preamble
import Mathlib
import Definitions.Def_VanderbeiLP_StrictComp_PrimalDualPair

open Matrix
Formal statement
namespace VanderbeiLP.StrictComp

/-- **Vanderbei, Theorem 5.3 (p. 63).** Complementary slackness: for primal feasible `x` with
slack `w = b - Ax` and dual feasible `y` with slack `z = Aᵀy - c`, `x` and `y` are optimal
for their respective problems iff `xⱼzⱼ = 0` for all `j` and `wᵢyᵢ = 0` for all `i` (5.7). -/
theorem complementary_slackness {m n : ℕ} (A : Matrix (Fin m) (Fin n) ℝ) (b : Fin m → ℝ)
    (c : Fin n → ℝ) (x : Fin n → ℝ) (y : Fin m → ℝ)
    (hx : PrimalFeasible A b x) (hy : DualFeasible A c y) :
    (PrimalOptimal A b c x ∧ DualOptimal A b c y) ↔
      ((∀ j, x j * dualSlack A c y j = 0) ∧ ∀ i, primalSlack A b x i * y i = 0) := by sorry

end VanderbeiLP.StrictComp
Source
Vanderbei, Linear Programming: Foundations and Extensions, 4th ed., Springer 2014, p. 63, Theorem 5.3, Eq. (5.7) (PDF p. 79)
Human review
  • Endorsed by Shuze Chen · Oct 2, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 2, 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