Farkas' lemma
ProvedSmaleNinth.farkas_lemmaLet and . Then exactly one of the following holds:
The two alternatives exclude each other for a one-line reason: if and then . The content of the lemma is that one of them always holds, so that infeasibility of a linear system always admits a finite, checkable certificate: a nonnegative combination of the inequalities whose left-hand side cancels identically while the right-hand side stays positive, that is, an explicit derivation of .
The vector is the reason linear programming lies in NP co-NP, it is the dual solution in linear programming duality, and it is what an algorithm exhibits when it reports that a system has no solution. In the setting of Smale's ninth problem it makes the decision problem symmetric: both answers can be certified, so the question is entirely one of finding a certificate in a number of arithmetic operations polynomial in and , not one of verifying it.
Formalization note. The proof is the classical constructive one by Fourier–Motzkin elimination, carried out by induction on the number of variables. Eliminating the last variable replaces the rows by those with vanishing last coefficient together with the pairwise combinations of rows whose last coefficients have opposite signs; multipliers for the reduced system lift to nonnegative multipliers for the original one, and the base case of zero variables is immediate. Both the elimination and the lifting are performed over an arbitrary finite index type, so that the pair index set of one step is available as the index type of the next.
import Definitions.Def_Polyhedron /-! Farkas' lemma in the form used for linear inequalities: a system `Ax >= b` is either feasible, or carries a nonnegative combination of its rows that is identically zero with positive right-hand side, and never both. Source: J. Farkas, *Theorie der einfachen Ungleichungen*, J. Reine Angew. Math. 124 (1902) 1-27; see A. Schrijver, *Theory of Linear and Integer Programming*, Wiley 1986, Corollary 7.1d, and Bertsimas-Tsitsiklis, *Introduction to Linear Optimization*, Athena Scientific 1997, Section 4.6. -/ open Matrix LinearOptimization /-- **Farkas' lemma.** The system `Ax >= b` has a solution if and only if there is no vector `y >= 0` with `y' A = 0` and `y' b > 0`. -/
theorem SmaleNinth.farkas_lemma {m n : ℕ} (A : Matrix (Fin m) (Fin n) ℝ) (b : Fin m → ℝ) :
(polyhedron A b).Nonempty ↔
¬ ∃ y : Fin m → ℝ, (∀ i, 0 ≤ y i) ∧ (∀ k, ∑ i, y i * A i k = 0) ∧
0 < ∑ i, y i * b i := by sorry