Documentation

CslibFrontier.Computability.Complexity.Problems.LinearProgramming

Rational linear-programming feasibility is in NP ∩ coNP #

LPFeasibility is the set of finite systems of linear inequalities ∑ j, a j * x j ≤ t with integer coefficients (Cslib.Complexity.LinearInequality) that have a rational solution, encoded by LPFeasibility.encSystem (encList encLinearInequality) as lists of inequalities with signed-binary integers. A system with rational coefficients is equivalent to an integer one after clearing denominators row by row.

Both a solution and a proof of infeasibility have polynomial-size certificates:

The verifiers are integer computations, proved polynomial-time with the plain ComputableInPolyTime calculus. Whether LPFeasibility is in P (Khachiyan's ellipsoid method, or interior-point methods) is not formalized here.

Main definitions #

Main results #

References #

A linear inequality ∑ j < coeffs.length, coeffs[j] * x j ≤ bound with integer coefficients and right-hand side, missing coefficients read as zero.

  • coeffs : List ℤ

    The integer coefficients a[0], …, a[m - 1] of the variables x 0, …, x (m - 1).

  • bound : ℤ

    The integer upper bound t on the linear form.

theorem Cslib.Complexity.LinearInequality.ext {x y : LinearInequality} (coeffs : x.coeffs = y.coeffs) (bound : x.bound = y.bound) :
x = y

Signed-binary encoding of LinearInequality: a framed signed-binary list of coefficients (encList encIntBin) followed by the signed-binary bound (encIntBin), preserving the exact encoded words of encPair (encList encIntBin) encIntBin.

theorem Cslib.Complexity.encLinearInequality_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List ℤ} {T0 S0 : γ → ℕ} {x1 : γ → ℤ} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encIntBin) T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encIntBin T1 S1) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { coeffs := x0 x, bound := x1 x }) encIn encLinearInequality (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
theorem Cslib.Complexity.encLinearInequality_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → List ℤ} {x1 : γ → ℤ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encIntBin) budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encIntBin budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { coeffs := x0 x, bound := x1 x }) encIn encLinearInequality budget
@[reducible, inline]

The tuple of the fields of encLinearInequality.

theorem Cslib.Complexity.encLinearInequality_bound_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → LinearInequality} :

Rational linear-programming feasibility: the systems of linear inequalities with integer coefficients that have a rational solution. A constraint ⟨a, t⟩ asks for ∑ j < a.length, a[j] * x j ≤ t; missing coefficients are zero.

@[reducible, inline]

The instance encoding of LPFeasibility: a framed list of rows encoded by encLinearInequality.

The constraint matrix of C with n columns, missing coefficients read as zero.

theorem Cslib.Complexity.LPFeasibility.mem_iff_exists_mulVec_le {C : List LinearInequality} {n : ℕ} (hn : ∀ c ∈ C, c.coeffs.length ≤ n) :
C ∈ LPFeasibility ↔ ∃ (x : Fin n → ℚ), ((matrix C n).map Int.cast).mulVec x ≤ fun (i : Fin C.length) => ↑(rhs C i)

The matrix form. When every row has at most n coefficients, C is feasible iff matrix C n *ᵥ x ≤ rhs C has a rational solution.

The NP check: d > 0 and w / d satisfies every constraint, as ∑ j < a.length, a[j] * w[j] ≤ d * t.

Soundness of the NP check.

The coNP check: q ≥ 0, every column of ∑ i, q[i] * C[i] vanishes and ∑ i, q[i] * t[i] < 0, the integer Farkas certificate of infeasibility.

Polynomial-time checks #

Rational LP feasibility is in NP ∩ coNP [Schrijver1986, Section 10.1].