Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proposition 6.4.3 — the Farkas lemma in three variants

Proved
MatousekLP.Duality.farkas_three_variants

by mikedeng1 · Oct 3, 2026 · Mathlib 0df444a (Lean v4.33.1)

farkas-lemmalinear-programmingp2o-batch-b23bp2o-gran-per-chapterp2o-plan-bookp2o-v1

Let AAA be a real matrix with mmm rows and nnn columns and let b∈Rmb\in\mathbb{R}^mb∈Rm. All vector inequalities are componentwise.

  1. The system Ax=bAx=bAx=b has a solution x≥0x\ge 0x≥0 if and only if every y∈Rmy\in\mathbb{R}^my∈Rm with yTA≥0Ty^{T}A\ge 0^{T}yTA≥0T also satisfies yTb≥0y^{T}b\ge 0yTb≥0.
  2. The system Ax≤bAx\le bAx≤b has a solution x≥0x\ge 0x≥0 if and only if every y∈Rmy\in\mathbb{R}^my∈Rm with y≥0y\ge 0y≥0 and yTA≥0Ty^{T}A\ge 0^{T}yTA≥0T also satisfies yTb≥0y^{T}b\ge 0yTb≥0.
  3. The system Ax≤bAx\le bAx≤b has a solution x∈Rnx\in\mathbb{R}^nx∈Rn if and only if every y∈Rmy\in\mathbb{R}^my∈Rm with y≥0y\ge 0y≥0 and yTA=0Ty^{T}A=0^{T}yTA=0T also satisfies yTb≥0y^{T}b\ge 0yTb≥0.

In each part the condition on the right is a certificate-of-infeasibility test: a vector yyy violating it combines the constraints into an obviously unsatisfiable inequality. Part (ii) is the form used in the proof of the duality theorem from the Farkas lemma.

Formalization Note The row vector yTAy^{T}AyTA is represented as the column vector ATyA^{T}yATy, so yTA≥0Ty^{T}A\ge 0^{T}yTA≥0T is 0 ≤ Aᵀ *ᵥ y and yTA=0Ty^{T}A=0^{T}yTA=0T is Aᵀ *ᵥ y = 0; yTby^{T}byTb is the dot product y ⬝ᵥ b. The three parts are stated as one conjunction.

Preamble
import Mathlib
Formal statement
namespace MatousekLP.Duality

open Matrix

/-- Matoušek & Gärtner, Proposition 6.4.3 (pp. 90–91), the Farkas lemma in three variants.
`yᵀA ≥ 0ᵀ` is written `0 ≤ Aᵀ *ᵥ y` and `yᵀA = 0ᵀ` is `Aᵀ *ᵥ y = 0`.
(i) `Ax = b` has a nonnegative solution iff every `y` with `yᵀA ≥ 0ᵀ` has `yᵀb ≥ 0`;
(ii) `Ax ≤ b` has a nonnegative solution iff every `y ≥ 0` with `yᵀA ≥ 0ᵀ` has `yᵀb ≥ 0`;
(iii) `Ax ≤ b` has a solution iff every `y ≥ 0` with `yᵀA = 0ᵀ` has `yᵀb ≥ 0`. -/
theorem farkas_three_variants {m n : ℕ} (A : Matrix (Fin m) (Fin n) ℝ) (b : Fin m → ℝ) :
    ((∃ x : Fin n → ℝ, 0 ≤ x ∧ A *ᵥ x = b) ↔
        ∀ y : Fin m → ℝ, 0 ≤ Aᵀ *ᵥ y → 0 ≤ y ⬝ᵥ b) ∧
    ((∃ x : Fin n → ℝ, 0 ≤ x ∧ A *ᵥ x ≤ b) ↔
        ∀ y : Fin m → ℝ, 0 ≤ y → 0 ≤ Aᵀ *ᵥ y → 0 ≤ y ⬝ᵥ b) ∧
    ((∃ x : Fin n → ℝ, A *ᵥ x ≤ b) ↔
        ∀ y : Fin m → ℝ, 0 ≤ y → Aᵀ *ᵥ y = 0 → 0 ≤ y ⬝ᵥ b) := by sorry

end MatousekLP.Duality
Source
Matoušek & Gärtner, Understanding and Using Linear Programming, Springer 2007, pp. 90–91, Proposition 6.4.3
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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me