Documentation

CslibFrontier.Foundations.LinearAlgebra.Matrix.BasicSolution

Basic solutions and small integer solutions of linear systems #

A nonnegative solution of A *ᵥ x = b over a linearly ordered field can be moved along kernel directions until no nonzero kernel vector of A is supported inside its support: it becomes a basic solution. For an integer matrix this pins the solution down as the unique solution of the Gram system of its support columns, so Cramer's rule writes it as p / d with integers p and d that are determinants of integer matrices; Mathlib's Matrix.det_le bounds them. The usual reduction of A *ᵥ x ≤ b to equality form with nonnegative variables, and of a Farkas certificate (Matrix.not_exists_mulVec_le_iff) to a nonnegative solution of [Aᵀ; bᵀ] y = (0, -1), give bounds of the same form for inequality systems and for certificates of infeasibility. These are the size bounds behind the membership of rational linear-programming feasibility in NP ∩ coNP (Cslib.Complexity.LPFeasibility.mem_NP, Cslib.Complexity.LPFeasibility.mem_coNP).

Matrix.det_le is the bound |det M| ≤ (card n)! * c ^ card n from the Leibniz expansion rather than Hadamard's inequality. It is weaker by a factor of at most (card n)!, still polynomial in bit length, which is all the complexity bounds need.

Main results #

References #

theorem Matrix.exists_nonneg_mulVec_eq_forall_mulVec_eq_zero {m : Type u_1} {n : Type u_2} {K : Type u_3} [Fintype n] [Field K] [LinearOrder K] [IsStrictOrderedRing K] {A : Matrix m n K} {b : m → K} {x : n → K} (hx : 0 ≤ x) (hAx : A.mulVec x = b) :
∃ (y : n → K), 0 ≤ y ∧ A.mulVec y = b ∧ (∀ (j : n), x j = 0 → y j = 0) ∧ ∀ (w : n → K), (∀ (j : n), y j = 0 → w j = 0) → A.mulVec w = 0 → w = 0

Basic solutions. A nonnegative solution of A *ᵥ x = b can be replaced by one whose support lies in that of x and carries no nonzero kernel vector of A, so the columns of A on its support are linearly independent.

theorem Matrix.exists_int_nonneg_mulVec_eq {m : Type u_1} {n : Type u_2} {K : Type u_3} [Fintype m] [Fintype n] [Field K] [LinearOrder K] [IsStrictOrderedRing K] {A : Matrix m n ℤ} {b : m → ℤ} {B : ℕ} (hA : ∀ (i : m) (j : n), |A i j| ≤ ↑B) (hb : ∀ (i : m), |b i| ≤ ↑B) {x : n → K} (hx : 0 ≤ x) (hAx : (A.map Int.cast).mulVec x = fun (i : m) => ↑(b i)) :
∃ (d : ℤ) (p : n → ℤ), 0 < d ∧ 0 ≤ p ∧ A.mulVec p = d • b ∧ d ≤ ↑((Fintype.card n).factorial * (Fintype.card m * B ^ 2 + 1) ^ Fintype.card n) ∧ ∀ (j : n), p j ≤ ↑((Fintype.card n).factorial * (Fintype.card m * B ^ 2 + 1) ^ Fintype.card n)

Small basic solutions. If an integer system A *ᵥ x = b with entries of absolute value at most B has a nonnegative solution over some linearly ordered field, then it has a nonnegative rational solution p / d with p and d integers bounded by (card n)! * (card m * B ^ 2 + 1) ^ card n.

theorem Matrix.exists_int_mulVec_le {m : Type u_1} {n : Type u_2} {K : Type u_3} [Fintype m] [Fintype n] [Field K] [LinearOrder K] [IsStrictOrderedRing K] {A : Matrix m n ℤ} {b : m → ℤ} {B : ℕ} (hA : ∀ (i : m) (j : n), |A i j| ≤ ↑B) (hb : ∀ (i : m), |b i| ≤ ↑B) {x : n → K} (hAx : (A.map Int.cast).mulVec x ≤ fun (i : m) => ↑(b i)) :
∃ (d : ℤ) (p : n → ℤ), 0 < d ∧ A.mulVec p ≤ d • b ∧ d ≤ ↑((2 * Fintype.card n + Fintype.card m).factorial * (Fintype.card m * (B + 1) ^ 2 + 1) ^ (2 * Fintype.card n + Fintype.card m)) ∧ ∀ (j : n), |p j| ≤ ↑((2 * Fintype.card n + Fintype.card m).factorial * (Fintype.card m * (B + 1) ^ 2 + 1) ^ (2 * Fintype.card n + Fintype.card m))

Small solutions of integer inequality systems. If A *ᵥ x ≤ b, with integer entries of absolute value at most B, has a solution over some linearly ordered field, then it has a rational solution p / d with p and d integers of absolute value at most (2 * card n + card m)! * (card m * (B + 1) ^ 2 + 1) ^ (2 * card n + card m).

theorem Matrix.exists_int_farkas_certificate {m : Type u_1} {n : Type u_2} {K : Type u_3} [Fintype m] [Fintype n] [Field K] [LinearOrder K] [IsStrictOrderedRing K] {A : Matrix m n ℤ} {b : m → ℤ} {B : ℕ} (hA : ∀ (i : m) (j : n), |A i j| ≤ ↑B) (hb : ∀ (i : m), |b i| ≤ ↑B) (h : ¬∃ (x : n → K), (A.map Int.cast).mulVec x ≤ fun (i : m) => ↑(b i)) :
∃ (y : m → ℤ), 0 ≤ y ∧ vecMul y A = 0 ∧ y ⬝ᵥ b < 0 ∧ ∀ (i : m), y i ≤ ↑((Fintype.card m).factorial * ((Fintype.card n + 1) * (B + 1) ^ 2 + 1) ^ Fintype.card m)

Small Farkas certificates. If A *ᵥ x ≤ b, with integer entries of absolute value at most B, has no solution over a linearly ordered field, then an integer vector y ≥ 0 with y ᵥ* A = 0 and y ⬝ᵥ b < 0 certifies it, with entries at most (card m)! * ((card n + 1) * (B + 1) ^ 2 + 1) ^ card m.