EconCSLib.Math.LinearAlgebra.FourierMotzkin #
Formalises the Theorem of the Alternative [MFoGT, Section 2.8, Exercise 7]
over any linearly ordered field ([Field ๐] [LinearOrder ๐] [IsStrictOrderedRing ๐]). We prove the Fin m ร Fin n version directly;
a general Fintype I form would transport via Fintype.equivFin.
For a finite system of weak linear inequalities A x โฅ b with
A : Fin m โ Fin n โ ๐, b : Fin m โ ๐, exactly one of:
- the primal set
S = { x : Fin n โ ๐ | โ i, โจA i, xโฉ โฅ b i }, or - the Farkas certificate set
T = { u : Fin m โ ๐ | u โฅ 0, uแตA = 0, โจu, bโฉ > 0 }
is nonempty.
Blueprint #
The primal feasibility set and Farkas certificate set #
We parameterise the row index by an abstract Fintype I (rather than Fin m)
because the Fourier-Motzkin reduction produces a row index of the form
Iโฐ โ (Iโบ ร Iโป), which is naturally a Fintype but does not stay Fin m.
A user typically instantiates I := Fin m at the application boundary.
Evaluate the LHS of row i of the matrix A : I โ Fin n โ ๐ at the
point x : Fin n โ ๐.
Equations
- EconCSLib.LinearAlgebra.rowEval A i x = โ j : Fin n, A i j * x j
Instances For
Primal feasibility of the system A x โฅ b.
Equations
- EconCSLib.LinearAlgebra.IsFeasible A b = โ (x : Fin n โ ๐), โ (i : I), b i โค EconCSLib.LinearAlgebra.rowEval A i x
Instances For
Existence of a Farkas certificate.
Equations
- EconCSLib.LinearAlgebra.HasCertificate A b = โ (u : I โ ๐), EconCSLib.LinearAlgebra.IsCertificate A b u
Instances For
Disjointness: IsFeasible and HasCertificate cannot both hold #
Sign partition of rows by the last-column coefficient #
For an (n+1)-column matrix A : I โ Fin (n+1) โ ๐ over a Fintype row
index I, partition I into the three sign-of-A i (Fin.last n) cases.
We use abbrev so Lean's Subtype.fintype instances are transparent.
The generic-I formulation (rather than Fin m) is needed for the
induction in theorem_of_alternative_aux: after FM, the row index becomes
ZeroRows โ (PosRows ร NegRows), which is itself a Fintype but not a
Fin _.
Rows where the last-column coefficient is strictly positive.
Instances For
Rows where the last-column coefficient is strictly negative.
Instances For
Reduced row index after Fourier-Motzkin elimination of the last column.
Equations
Instances For
Fourier-Motzkin reduced matrix and RHS #
Per blueprint
docs/knowledge/nodes/core/linear_algebra.theorem_of_alternative.fourier_motzkin.md:
Reduced matrix coefficient.
Equations
Instances For
Reduced right-hand side.
Equations
Instances For
Feasibility transfer (โ direction) #
If (x_0, ..., x_n) satisfies the original (n+1)-variable system, then
(x_0, ..., x_{n-1}) satisfies the reduced n-variable system.
Reduced-pair lower-upper bound #
From the reduced inequality at (p, q) โ PosRows ร NegRows, derive that
the lower bound L_p(x') is at most the upper bound U_q(x'). This is
the algebraic content of "max lower โค min upper" needed to construct
x_last.
Feasibility transfer (โ direction) #
If a solution x' of the reduced system exists, construct an x_last
such that Fin.snoc x' x_last solves the original (n+1)-variable
system.
Certificate lift via the transposed FM matrix #
The FM reduction can be encoded as a matrix L : FMRowIndex A โ Fin m โ ๐
whose rows are the nonneg coefficients of the original rows feeding into
each reduced row. The Farkas certificate of the reduced system lifts to
the original via u := L^T u', i.e. u i = โ idx, L idx i * u' idx.
The FM lift coefficient L idx i: the weight with which original row
i enters the reduced row idx.
Equations
Instances For
The lifted certificate u i = โ idx, L idx i * u'(idx).
Equations
- EconCSLib.LinearAlgebra.liftCert A u' i = โ idx : EconCSLib.LinearAlgebra.FMRowIndex A, EconCSLib.LinearAlgebra.liftCoeff A idx i * u' idx
Instances For
Pointwise nonneg lift.
Farkas certificate lift: if u' certifies the reduced system,
liftCert A u' certifies the original.
Base case n = 0 #
For a 0-variable system, rowEval A i x = โ j : Fin 0, โฆ = 0 for every i,
so feasibility collapses to โ i, b i โค 0. Negation yields a single i
with 0 < b i, and the indicator at that i is the Farkas certificate.
Strong induction on the number of columns #
Combine: feasibility transfer (feasible_of_fm_feasible) is the contrapositive
direction that brings ยฌ IsFeasible A b to ยฌ IsFeasible (fmA A) (fmB A b);
the inductive hypothesis then yields the reduced certificate, and fm_cert_lift
lifts it back to the original system.
Final packaged theorem #
Theorem of the Alternative [MFoGT, Section 2.8, Exercise 7]: for a
finite system of weak linear inequalities A x โฅ b over a linearly ordered
field, exactly one of the primal S = {x | Ax โฅ b} and the Farkas
certificate set T = {u โฅ 0 | uแตA = 0, โจu, bโฉ > 0} is nonempty.
Combines feas_cert_disjoint (disjointness) with the existence direction
proved by Fourier-Motzkin elimination + induction on the number of
variables (theorem_of_alternative_aux).