Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Fourier-Motzkin elimination in two variables

Proved
SmaleNinth.two_variable_lp_fourier_motzkin

by Zexuan Liu · Sep 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

eliminationfourier-motzkinlinear-programmingpolyhedra

Write the constraints of a two-variable system as aix+biy≥cia_i x + b_i y \ge c_iai​x+bi​y≥ci​ for i<mi < mi<m, where ai=Ai0a_i = A_{i0}ai​=Ai0​ and bi=Ai1b_i = A_{i1}bi​=Ai1​. Then the system has a solution (x,y)∈R2(x,y) \in \mathbb{R}^2(x,y)∈R2 if and only if the following one-variable system in the unknown ttt has a solution:

ait≥ci(bi=0),(biaj−bjai) t ≥ bicj−bjci(bi>0>bj).a_i t \ge c_i \quad (b_i = 0), \qquad (b_i a_j - b_j a_i)\, t \ \ge\ b_i c_j - b_j c_i \quad (b_i > 0 > b_j).ai​t≥ci​(bi​=0),(bi​aj​−bj​ai​)t ≥ bi​cj​−bj​ci​(bi​>0>bj​).

This is Fourier–Motzkin elimination of the variable yyy. In one direction, each inequality of the reduced system is a nonnegative combination of the original ones: the pair inequality is (−bj)(-b_j)(−bj​) times constraint iii plus bib_ibi​ times constraint jjj, in which the yyy terms cancel. In the other direction, a solution ttt of the reduced system is extended to a solution of the original one by choosing yyy between the largest lower bound max⁡bi>0(ci−ait)/bi\max_{b_i>0}(c_i - a_i t)/b_imaxbi​>0​(ci​−ai​t)/bi​ and the smallest upper bound min⁡bj<0(cj−ajt)/bj\min_{b_j<0}(c_j - a_j t)/b_jminbj​<0​(cj​−aj​t)/bj​; the pair inequalities say exactly that every lower bound is at most every upper bound, and the degenerate cases where one or both families are empty are immediate.

The reduced system has at most m+m2/4m + m^2/4m+m2/4 inequalities in one variable, so the elimination turns a two-variable feasibility question into a one-variable one at quadratic cost. Combined with a one-variable decision procedure it gives a polynomial-time algorithm for two-variable linear programming in a machine model with indirect addressing, which is the first nontrivial case of the fixed-dimension results of Megiddo and Dyer. For the general problem the elimination is of no use, since eliminating nnn variables in turn can square the number of constraints each time; that blow-up is precisely why Smale's ninth problem is not settled by this classical method.

Preamble
import Definitions.Def_Polyhedron

/-!
Fourier-Motzkin elimination in two variables: feasibility of a two-variable
system is equivalent to feasibility of a one-variable system built from the
constraints with zero second coefficient and from the pairs of constraints
with opposite second coefficients.

Source: J. B. J. Fourier (1826) and T. Motzkin (1936); see A. Schrijver,
*Theory of Linear and Integer Programming*, Wiley 1986, Section 12.2, and
Bertsimas-Tsitsiklis, *Introduction to Linear Optimization*, Athena
Scientific 1997, Section 2.8.
-/

open Matrix LinearOptimization

/-- **Fourier-Motzkin elimination, two variables.** The system `Ax >= c` in two
variables is feasible if and only if the one-variable system obtained by
eliminating the second variable is feasible. -/
Formal statement
theorem SmaleNinth.two_variable_lp_fourier_motzkin {m : ℕ} (A : Matrix (Fin m) (Fin 2) ℝ)
    (c : Fin m → ℝ) :
    (polyhedron A c).Nonempty ↔
      ∃ t : ℝ,
        (∀ i : Fin m, A i 1 = 0 → c i ≤ A i 0 * t) ∧
        (∀ i j : Fin m, 0 < A i 1 → A j 1 < 0 →
          A i 1 * c j - A j 1 * c i ≤ (A i 1 * A j 0 - A j 1 * A i 0) * t) := by sorry
Source
J. B. J. Fourier (1826); T. Motzkin, Beitraege zur Theorie der linearen Ungleichungen, Dissertation, Basel 1936. See A. Schrijver, Theory of Linear and Integer Programming, Wiley 1986, Section 12.2, and Bertsimas-Tsitsiklis, Introduction to Linear Optimization, Athena Scientific 1997, Section 2.8 (elimination of a variable from a system of linear inequalities).

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