Complementary slackness
ProvedSmaleNinth.lp_complementary_slacknessLet satisfy and let satisfy , so that is primal feasible and dual feasible for
Then their objective values agree if and only if
that is, no constraint is simultaneously slack and carrying a positive dual variable.
The identity behind it is that the duality gap decomposes into the individual slacks:
obtained by substituting and exchanging the order of summation. Every summand is nonnegative, being a product of with a nonnegative slack, so the sum vanishes precisely when each term does. By weak duality the equal value is then the common optimum, so complementary slackness is the pointwise optimality criterion for a primal-dual pair.
This is the condition that primal-dual and interior-point algorithms drive to zero, and it is the certificate an algorithm checks when it stops. Together with SmaleNinth.lp_strong_duality, which guarantees that such a pair exists whenever the primal is feasible and bounded, it says that optimality in linear programming is witnessed by a finite, locally checkable condition rather than by a comparison against all feasible points.
import Definitions.Def_Polyhedron /-! Complementary slackness for the inequality form of linear programming: a feasible primal solution and a feasible dual solution have equal objective values exactly when every dual variable vanishes on a slack constraint. Source: G. B. Dantzig, D. Gale, H. W. Kuhn and A. W. Tucker (1951); see Bertsimas-Tsitsiklis, *Introduction to Linear Optimization*, Athena Scientific 1997, Theorem 4.5, and A. Schrijver, *Theory of Linear and Integer Programming*, Wiley 1986, Section 7.9. -/ open Matrix LinearOptimization /-- **Complementary slackness.** For a feasible `x` and a dual feasible `y`, the objective values agree if and only if `yᵢ = 0` whenever the `i`-th constraint is slack. -/
theorem SmaleNinth.lp_complementary_slackness {m n : ℕ} (A : Matrix (Fin m) (Fin n) ℝ)
(b : Fin m → ℝ) (c : Fin n → ℝ) {x : Fin n → ℝ} {y : Fin m → ℝ}
(hx : x ∈ polyhedron A b) (hy0 : ∀ i, 0 ≤ y i) (hyA : ∀ k, ∑ i, y i * A i k = c k) :
(∑ k, c k * x k = ∑ i, y i * b i) ↔ ∀ i, y i * ((A.mulVec x) i - b i) = 0 := by sorry