Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Farkas' lemma

Proved
LinearOptimization.farkas_lemma

by Shuze Chen · Aug 5, 2026 · Mathlib 0df444a (Lean v4.33.1)

dualityfarkaslinear-programming

(Theorem 4.6, Farkas' lemma — GOAL) Let AAA be a matrix of dimensions m×nm \times nm×n and let bbb be a vector in Rm\mathbb{R}^mRm. Then, exactly one of the following two alternatives holds:

  • (a) there exists some x≥0x \ge 0x≥0 such that Ax=bAx = bAx=b;
  • (b) there exists some vector ppp such that p′A≥0′p'A \ge 0'p′A≥0′ and p′b<0p'b < 0p′b<0.
Preamble
import Mathlib.Data.Matrix.Mul
import Mathlib.Data.Real.Basic


open Matrix

/-- **Bertsimas & Tsitsiklis, Theorem 4.6 (p. 165).** Farkas' lemma: exactly one of
(a) `∃ x ≥ 0, Ax = b` and (b) `∃ p, p'A ≥ 0' ∧ p'b < 0` holds. -/
Formal statement
theorem LinearOptimization.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
Bertsimas & Tsitsiklis, Introduction to Linear Optimization, Athena Scientific, 1997, 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).

  • Endorsed by iris · Oct 31, 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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me