Documentation

CslibFrontier.Foundations.LinearAlgebra.Matrix.NonnegativeForm

Nonnegative equality form of a linear inequality system #

Matrix.nonnegForm A = [A, -A, I] replaces unrestricted variables by positive and negative parts and inequalities by equalities with nonnegative slack variables. The transformation works over ordered rings, including the integers, without division.

def Matrix.nonnegForm {m : Type u_1} {n : Type u_2} {R : Type u_3} [DecidableEq m] [Ring R] (A : Matrix m n R) :
Matrix m (n ⊕ n ⊕ m) R

The matrix [A, -A, I], with columns for positive parts, negative parts, and slacks.

theorem Matrix.nonnegForm_mulVec {m : Type u_1} {n : Type u_2} {R : Type u_3} [Fintype m] [Fintype n] [DecidableEq m] [Ring R] (A : Matrix m n R) (z : n ⊕ n ⊕ m → R) :
A.nonnegForm.mulVec z = (A.mulVec fun (j : n) => z (Sum.inl j) - z (Sum.inr (Sum.inl j))) + fun (i : m) => z (Sum.inr (Sum.inr i))

Multiplication by [A, -A, I] subtracts the two variable blocks and adds the slack block.

theorem Matrix.nonnegForm_map {m : Type u_1} {n : Type u_2} {R : Type u_3} [DecidableEq m] [Ring R] {S : Type u_4} [Ring S] (A : Matrix m n R) (f : R →+* S) :
A.nonnegForm.map ⇑f = (A.map ⇑f).nonnegForm

Changing coefficients by a ring homomorphism commutes with the nonnegative-form matrix.

theorem Matrix.abs_nonnegForm_le {m : Type u_1} {n : Type u_2} [DecidableEq m] {A : Matrix m n ℤ} {B : ℕ} (hA : ∀ (i : m) (j : n), |A i j| ≤ ↑B) (i : m) (j : n ⊕ n ⊕ m) :
|A.nonnegForm i j| ≤ ↑(B + 1)

The split-variable and slack transformation increases an integer entry bound by at most one.

theorem Matrix.nonnegForm_solution {m : Type u_1} {n : Type u_2} {R : Type u_3} [Fintype m] [Fintype n] [DecidableEq m] [Ring R] [LinearOrder R] [IsStrictOrderedRing R] {A : Matrix m n R} {b : m → R} {x : n → R} (hx : A.mulVec x ≤ b) :
∃ (z : n ⊕ n ⊕ m → R), 0 ≤ z ∧ A.nonnegForm.mulVec z = b

An inequality solution yields a nonnegative equality solution by splitting variables into positive and negative parts and introducing the residual as slack.