Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Complementary slackness

Proved
LinearOptimization.lp_complementary_slackness

by Shuze Chen · Aug 5, 2026 · Mathlib 0df444a (Lean v4.33.1)

complementary-slacknessdualitylinear-programmingoptimality

(Theorem 4.5, complementary slackness) Let xxx and ppp be feasible solutions to the primal and the dual problem, respectively. The vectors xxx and ppp are optimal solutions for the two respective problems if and only if:

  • pi(ai′x−bi)=0p_i(a_i'x - b_i) = 0pi​(ai′​x−bi​)=0 for all iii, and
  • (cj−p′Aj)xj=0(c_j - p'A_j)x_j = 0(cj​−p′Aj​)xj​=0 for all jjj.
Preamble
import Definitions.Def_LinearOptimization_DualLP


open Matrix

/-- **Bertsimas & Tsitsiklis, Theorem 4.5 (p. 151).** Complementary slackness: feasible `x`
and `p` are simultaneously optimal iff `pᵢ(aᵢ'x − bᵢ) = 0` for every
constraint `i` and `(cⱼ − p'Aⱼ)xⱼ = 0` for every variable `j`. -/
Formal statement
theorem LinearOptimization.lp_complementary_slackness {m n : ℕ} (P : GeneralFormLP m n)
    (x : Fin n → ℝ) (hx : x ∈ generalFeasibleSet P)
    (p : Fin m → ℝ) (hp : p ∈ generalFeasibleSet (dualLP P)) :
    (IsLpOptimal P.c (generalFeasibleSet P) x ∧
      IsLpDualOptimal P.b (generalFeasibleSet (dualLP P)) p) ↔
    ((∀ i, p i * (P.A i ⬝ᵥ x - P.b i) = 0) ∧
      ∀ j, (P.c j - p ⬝ᵥ (fun i => P.A i j)) * x j = 0) := by
  sorry
Source
Bertsimas & Tsitsiklis, Introduction to Linear Optimization, Athena Scientific, 1997, Theorem 4.5, p. 151

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