Documentation

CslibFrontier.Foundations.LinearAlgebra.Matrix.Farkas

Farkas' lemma over linearly ordered fields #

A finite system of linear inequalities over a linearly ordered field has no solution exactly when some nonnegative combination of its rows reads 0 ≤ c with c < 0. The proofs eliminate all variables by Fourier–Motzkin elimination (Matrix.FourierMotzkin.exists_projection), so they hold over every linearly ordered field, including ℚ, and need no topology.

Mathlib proves a topological Farkas lemma for closed convex cones in real locally convex spaces (ProperCone.hyperplane_separation). Its algebraic cone duality PointedCone.dual has no Farkas or Minkowski–Weyl theorem for finitely generated cones. The polyhedral statements below cover that gap for matrices over an arbitrary linearly ordered field.

See also [DK24], an independent Lean 4 formalization of Farkas-type theorems and linear-programming duality over linearly ordered fields, with extensions to infinite values.

Main results #

References #

theorem Matrix.exists_mulVec_le_iff {K : Type u_1} [Field K] [LinearOrder K] [IsStrictOrderedRing K] {ι : Type u_2} {κ : Type u_3} [Fintype ι] [Fintype κ] (A : Matrix ι κ K) (b : ι → K) :
(∃ (x : κ → K), A.mulVec x ≤ b) ↔ ∀ (y : ι → K), 0 ≤ y → vecMul y A = 0 → 0 ≤ y ⬝ᵥ b

Farkas' lemma for systems of inequalities: A *ᵥ x ≤ b has a solution iff every nonnegative combination y of the rows with y ᵥ* A = 0 satisfies 0 ≤ y ⬝ᵥ b [Schrijver1986, Corollary 7.1e].

theorem Matrix.not_exists_mulVec_le_iff {K : Type u_1} [Field K] [LinearOrder K] [IsStrictOrderedRing K] {ι : Type u_2} {κ : Type u_3} [Fintype ι] [Fintype κ] (A : Matrix ι κ K) (b : ι → K) :
(¬∃ (x : κ → K), A.mulVec x ≤ b) ↔ ∃ (y : ι → K), 0 ≤ y ∧ vecMul y A = 0 ∧ y ⬝ᵥ b < 0

Farkas' lemma, certificate form: A *ᵥ x ≤ b is infeasible iff some y ≥ 0 has y ᵥ* A = 0 and y ⬝ᵥ b < 0 [Schrijver1986, Corollary 7.1e].

theorem Matrix.exists_nonneg_mulVec_eq_iff {K : Type u_1} [Field K] [LinearOrder K] [IsStrictOrderedRing K] {ι : Type u_2} {κ : Type u_3} [Fintype ι] [Fintype κ] (A : Matrix ι κ K) (b : ι → K) :
(∃ (x : κ → K), 0 ≤ x ∧ A.mulVec x = b) ↔ ∀ (y : ι → K), 0 ≤ vecMul y A → 0 ≤ y ⬝ᵥ b

Farkas' lemma, equality form: A *ᵥ x = b has a solution x ≥ 0 iff 0 ≤ y ⬝ᵥ b for every y with 0 ≤ y ᵥ* A [Schrijver1986, Corollary 7.1d].

theorem Matrix.not_exists_nonneg_mulVec_eq_iff {K : Type u_1} [Field K] [LinearOrder K] [IsStrictOrderedRing K] {ι : Type u_2} {κ : Type u_3} [Fintype ι] [Fintype κ] (A : Matrix ι κ K) (b : ι → K) :
(¬∃ (x : κ → K), 0 ≤ x ∧ A.mulVec x = b) ↔ ∃ (y : ι → K), 0 ≤ vecMul y A ∧ y ⬝ᵥ b < 0

Farkas' lemma, equality certificate form: A *ᵥ x = b has no solution x ≥ 0 iff some y has 0 ≤ y ᵥ* A and y ⬝ᵥ b < 0 [Schrijver1986, Corollary 7.1d].