Linear-programming duality over linearly ordered fields #
For a matrix A : Matrix ι κ K, a right-hand side b and an objective c over a linearly
ordered field K, the primal linear program in inequality form maximizes c ⬝ᵥ x subject to
A *ᵥ x ≤ b. Its dual minimizes y ⬝ᵥ b subject to 0 ≤ y and y ᵥ* A = c. The proofs use
Fourier–Motzkin elimination (Matrix.FourierMotzkin.exists_projection) and Farkas' lemma
(Matrix.not_exists_mulVec_le_iff), so they hold over every linearly ordered field, including
ℚ. See also [DK24] for an independent Lean 4 formalization of
linear-programming duality over linearly ordered fields. The closed leanprover-community/mathlib4
pull requests 7386, 9693, 10026 and 10159 (opened 2023–24) take other approaches to linear
programming; nothing here is copied from them or from [DK24].
Main results #
Matrix.dotProduct_le_dotProduct_add_parts_of_mulVec_le: residual-corrected weak duality, with bounds required only on the relevant end of each variable's range.Matrix.dotProduct_le_dotProduct_add_max_of_mulVec_le: residual-corrected weak duality for bounded variables.Matrix.dotProduct_le_dotProduct_of_mulVec_le: weak duality.Matrix.exists_dual_eq_of_bddAbove: a feasible primal with objective bounded above has a primal solution and a dual solution of equal value.Matrix.exists_isGreatest_of_bddAbove: a feasible primal with objective bounded above attains its maximum.Matrix.exists_isGreatest_isLeast_dotProduct: strong duality. If both programs are feasible, both optima are attained and they are equal.Matrix.bddAbove_image_dotProduct_iff,Matrix.bddBelow_image_dotProduct_iff: a feasible program is bounded iff the other program is feasible, so a feasible program whose dual is infeasible is unbounded.Matrix.dotProduct_eq_dotProduct_iff_of_mulVec_le: complementary slackness.Matrix.exists_dual_le_of_forall_le: the affine Farkas lemma.Matrix.exists_isGreatest_isLeast_dotProduct_of_nonneg: strong duality for the canonical pairmax {c ⬝ᵥ x | A *ᵥ x ≤ b, 0 ≤ x}andmin {y ⬝ᵥ b | c ≤ y ᵥ* A, 0 ≤ y}.
References #
Residual-corrected weak duality. For the residual d = c - y ᵥ* A, only the upper
bound on a variable with positive residual and the lower bound on a variable with negative
residual are needed. This is the exact-coefficient step towards interval LP bounds (#6981).
With two-sided variable bounds, the residual correction can equivalently be written
as the sum of the worse endpoint products. The vector y need not be dual feasible.
Weak duality: the value of a primal solution A *ᵥ x ≤ b is at most the value of any dual
solution 0 ≤ y, y ᵥ* A = c [Schrijver1986, Section 7.4].
A linear objective bounded above on a nonempty polyhedron A *ᵥ x ≤ b attains its maximum at
a point x, certified by a dual solution y of the same value [Schrijver1986, Section 7.4].
A linear objective bounded above on a nonempty polyhedron attains its supremum [Schrijver1986, Section 7.4].
Strong duality: if the primal max {c ⬝ᵥ x | A *ᵥ x ≤ b} and the dual
min {y ⬝ᵥ b | 0 ≤ y, y ᵥ* A = c} are both feasible, then both optima are attained and equal
[Schrijver1986, Corollary 7.1g].
A feasible primal program is bounded above iff its dual is feasible. In particular a feasible primal program with infeasible dual is unbounded [Schrijver1986, Section 7.4].
A feasible dual program is bounded below iff the primal is feasible. In particular a feasible dual program with infeasible primal is unbounded [Schrijver1986, Section 7.4].
A dual objective bounded below on a nonempty dual polyhedron attains its infimum [Schrijver1986, Section 7.4].
Complementary slackness: a primal solution x and a dual solution y have equal values
iff every constraint i with y i ≠ 0 is tight at x [Schrijver1986, Section 7.9].
Affine Farkas lemma: if the inequality c ⬝ᵥ x ≤ δ holds on a nonempty polyhedron
A *ᵥ x ≤ b, then it is implied by a nonnegative combination of the constraints
[Schrijver1986, Corollary 7.1h].
The canonical pair max {c ⬝ᵥ x | A *ᵥ x ≤ b, 0 ≤ x}, min {y ⬝ᵥ b | c ≤ y ᵥ* A, 0 ≤ y} #
Weak duality for the canonical pair [MatousekGartner2007, Chapter 6].
Strong duality for the canonical pair max {c ⬝ᵥ x | A *ᵥ x ≤ b, 0 ≤ x} and
min {y ⬝ᵥ b | c ≤ y ᵥ* A, 0 ≤ y}: if both are feasible, both optima are attained and equal
[MatousekGartner2007, Chapter 6].