Farkas' lemma and linear programming duality #
Finitely generated cones are closed, which gives Farkas' lemma for cones and matrices and the
duality theorem of linear programming, with all feasibility cases, attainment on both sides and
complementary slackness. Linear programs are stated with matrices on m → ℝ (see DESIGN.md,
section 1).
Main statements #
ConvexAnalysis.exists_linearIndepOn_of_mem_finiteCone: Carathéodory's theorem for cones, a point of a finitely generated cone is a nonnegative combination of linearly independent generators.ConvexAnalysis.isClosed_finiteCone: a finitely generated cone{∑ j, l j • v j | l ≥ 0}in a Hausdorff real topological vector space is closed. Mathlib's Farkas lemmas (ProperCone.hyperplane_separation) are stated for closed cones; Mathlib does not yet have the Minkowski–Weyl theorem, which would give this.ConvexAnalysis.exists_strongDual_of_notMem_finiteCone: Farkas' lemma, a point outside a finitely generated cone is separated from it by a linear functional.ConvexAnalysis.exists_nonneg_mulVec_eq_iff: Farkas' lemma for matrices,(∃ x ≥ 0, A x = b) ↔ ∀ y, yᵀ A ≥ 0 → b ⬝ᵥ y ≥ 0.ConvexAnalysis.isClosed_of_fg,ConvexAnalysis.properConeOfFG: the bridge to Mathlib'sPointedCone.FGandProperCone, to which Mathlib's Farkas and double-dual theorems apply.- Farkas variants
ConvexAnalysis.exists_nonneg_mulVec_le_iffandConvexAnalysis.exists_mulVec_le_iff. - For the linear program
min c ⬝ᵥ xs.t.A x = b,x ≥ 0and its dualmax b ⬝ᵥ ys.t.yᵀ A ≤ c, the LP duality theorem with all cases (ConvexAnalysis.lp_feasible_and_dual_feasible_iff,ConvexAnalysis.not_bddBelow_lp_of_dual_infeasible,ConvexAnalysis.not_bddAbove_lp_dual_of_infeasible,ConvexAnalysis.lp_sInf_eq_sSup), the inequality formConvexAnalysis.exists_lp_strong_duality_le, and: -ConvexAnalysis.lp_weak_duality:b ⬝ᵥ y ≤ c ⬝ᵥ xfor feasiblexandy; -ConvexAnalysis.exists_isMinOn_lp: a feasible primal bounded below has a minimizer; -ConvexAnalysis.exists_lp_strong_duality: then the dual has a solution with the same value; -ConvexAnalysis.lp_complementary_slackness: feasiblex,yhave equal values iffx j (c j - (yᵀ A) j) = 0for allj.
Implementation notes #
Carathéodory's theorem is proved by induction on the set of generators: if they are linearly
dependent, a linear relation with a positive coefficient removes one generator from every
representation. So a finitely generated cone is the finite union of the cones of its linearly
independent sets of generators, and each of these is the image of the closed orthant under an
injective linear map, a closed embedding; hence the cone is closed. LP
duality then needs no Slater condition: the primal minimum is attained because the cone
{(A x, c ⬝ᵥ x + s) | x ≥ 0, s ≥ 0} is closed, and the dual solution comes from Farkas' lemma
for the system yᵀ A ≤ c, b ⬝ᵥ y ≥ min.
References #
- S. Boyd, L. Vandenberghe, Convex Optimization, Cambridge University Press, 2004, Chapters 2 and 5.
- R. T. Rockafellar, Convex Analysis, Princeton University Press, 1970, Corollary 17.1.2, Theorem 19.1, Theorem 22.1 and Corollary 22.3.1. Rockafellar has no numbered LP duality theorem; the dual pair of linear programs is in Section 30.
Tags #
linear programming, LP duality, Farkas' lemma, finitely generated cone, Carathéodory's theorem, complementary slackness, strong duality
Carathéodory's theorem for cones: a point of the cone generated by finitely many vectors
v j is a nonnegative combination of linearly independent ones among them. This is the case of
finitely many points in R, Corollary 17.1.2, which Rockafellar states on ℝⁿ for the cone
generated by a union of convex sets; here E is any real vector space.
A finitely generated cone is closed in a Hausdorff real topological vector space; on ℝⁿ
this is part of R, Theorem 19.1 ((c) ⇒ (b)), proved there with Carathéodory's theorem as
here (exists_linearIndepOn_of_mem_finiteCone).
The ad hoc cone of isClosed_finiteCone is Mathlib's PointedCone.hull ℝ (range v).
A finitely generated pointed cone is closed: the PointedCone.FG form.
A finitely generated pointed cone as a ProperCone, to which Mathlib's Farkas lemmas
(ProperCone.hyperplane_separation_point) and double-dual theorems apply.
Equations
- ConvexAnalysis.properConeOfFG hC = { toSubmodule := C, isClosed' := ⋯ }
Instances For
Farkas' lemma R, Corollary 22.3.1 (there in ℝⁿ, in the form K°° = K): in a
Hausdorff locally convex space, a point b outside the cone generated by finitely many vectors
v j is separated from it: some continuous linear functional is ≤ 0 on every v j and > 0 at
b. Local convexity is needed: Lᵖ with p < 1 has no nonzero continuous functionals.
Farkas' lemma for matrices BV, Chapter 5, a reformulation of
R, Corollary 22.3.1: A x = b has a solution x ≥ 0 iff b ⬝ᵥ y ≥ 0 for every y with
yᵀ A ≥ 0.
Farkas' lemma, inequality form (Gale) R, Theorem 22.1: A x ≤ b has a solution iff
b ⬝ᵥ y ≥ 0 for every y ≥ 0 with yᵀ A = 0.
Weak duality for linear programs: b ⬝ᵥ y ≤ c ⬝ᵥ x for x ≥ 0 with A x = b and y
with yᵀ A ≤ c.
Complementary slackness BV, Chapter 5: feasible x and y have equal values iff
(c j - (yᵀ A) j) x j = 0 for every j; then both are optimal by weak duality.
Existence of a primal solution: a feasible linear program whose objective is bounded below on the feasible set has a minimizer BV, Chapter 5. No Slater condition is needed.
Strong duality for linear programs BV, Chapter 5: if the primal min c ⬝ᵥ x s.t.
A x = b, x ≥ 0 is feasible and bounded below, then it has a solution x, the dual
max b ⬝ᵥ y s.t. yᵀ A ≤ c has a solution y, and the values are equal.
Feasible x, y with equal values are optimal.
Weak duality: if the dual program is feasible, the primal objective is bounded below on the primal feasible set.
Weak duality: if the primal program is feasible, the dual objective is bounded above on the dual feasible set.
Primal infeasible, dual feasible ⇒ dual unbounded (Farkas).
Strong duality from the dual side: a feasible dual bounded above has a solution.
Primal feasible, dual infeasible ⇒ primal unbounded (contrapositive of strong duality).
Strong duality for the inequality form max c ⬝ᵥ x s.t. A x ≤ b, whose dual is
min b ⬝ᵥ y s.t. y ≥ 0, yᵀ A = c: the dual is a program in standard form, so this is
exists_lp_strong_duality_of_dual.