Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Farkas' lemma: exactly one of Ax = b, x ≥ 0 and Aᵀp ≥ 0, pᵀb < 0 is solvable

Proved
Polyhedral.farkas_lemma

by Hartmann_Psi · Sep 27, 2026 · Mathlib 0df444a (Lean v4.33.1)

convex-geometrylinear-optimizationoperations-researchoptimization

Farkas' lemma. Let A∈Rm×nA \in \mathbb{R}^{m \times n}A∈Rm×n and b∈Rmb \in \mathbb{R}^mb∈Rm. Exactly one of the following two systems is solvable:

(a)Ax=b, x≥0or(b)ATp≥0, pTb<0.\text{(a)}\quad Ax = b,\ x \ge 0 \qquad\text{or}\qquad \text{(b)}\quad A^{\mathsf T} p \ge 0,\ p^{\mathsf T} b < 0 .(a)Ax=b, x≥0or(b)ATp≥0, pTb<0.

Equivalently, bbb lies in the cone generated by the columns of AAA precisely when every vector ppp having nonnegative inner product with each column also has nonnegative inner product with bbb.

This transposition theorem is the algebraic core of linear programming: duality, the optimality conditions for a linear program in standard form, and the description of the normal cone of {x:Ax=b, x≥0}\{x : Ax=b,\ x \ge 0\}{x:Ax=b, x≥0} all follow from it. It is Theorem 4.6 (p. 165) of Bertsimas & Tsitsiklis, Introduction to Linear Optimization.

Formalization note. Xor is exclusive disjunction, so the statement asserts both that the alternatives are incompatible and that one of them holds. Vectors are functions out of Fin n, and 0 ≤ x is the pointwise order. The statement is the finitely generated (column) form of Farkas' lemma; it is not a specialization of the Hilbert-space separation theorem for closed convex cones, because closedness of the column cone is part of what has to be established.

Preamble
import Mathlib

open Matrix
Formal statement
theorem Polyhedral.farkas_lemma {m n : ℕ} (A : Matrix (Fin m) (Fin n) ℝ)
    (b : Fin m → ℝ) :
    Xor (∃ x : Fin n → ℝ, 0 ≤ x ∧ A.mulVec x = b)
      (∃ p : Fin m → ℝ, 0 ≤ Aᵀ.mulVec p ∧ p ⬝ᵥ b < 0) := by sorry
Source
D. Bertsimas and J. N. Tsitsiklis, Introduction to Linear Optimization, Athena Scientific 1997, Section 4.6, Theorem 4.6, p. 165
Human review
  • Endorsed by Shuze Chen · Oct 5, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 5, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me