Documentation

CslibFrontier.Foundations.LinearAlgebra.Matrix.Copositive

Copositive Matrices and Polynomial-Size Integer Witnesses #

A symmetric integer or rational matrix M is copositive if x ⬝ᵥ M *ᵥ x ≥ 0 for all entrywise nonnegative vectors x. By minimizing the quadratic form x ⬝ᵥ M *ᵥ x over the compact standard simplex (Convexity.StdSimplex), KKT stationarity forces M *ᵥ x* to be constant and strictly negative on the support of any negative minimizer x*. Applying Matrix.exists_int_nonneg_mulVec_eq to the principal submatrix on that support produces a nonnegative integer vector p with p ⬝ᵥ M *ᵥ p < 0 whose entries are singly exponentially bounded in the dimension and entry bit-length, hence of polynomial bit-length.

As a consequence, copositivity over ℝ, ℚ, and ℕ coincides for symmetric rational matrices. [MK87] is cited at paper level from bibliographic metadata only without inspecting the published text; the KKT + Matrix.exists_int_nonneg_mulVec_eq proof and the explicit witness bound Nat.factorial (Fintype.card V) * (Fintype.card V * (max B 1) ^ 2 + 1) ^ Fintype.card V are original to this library.

Main definitions #

Main results #

References #

def Matrix.IsCopositive {V : Type u_1} {K : Type u_2} [Fintype V] [CommSemiring K] [PartialOrder K] (M : Matrix V V K) :

A square matrix M over an ordered commutative semiring is copositive if x ⬝ᵥ M *ᵥ x ≥ 0 for every entrywise nonnegative vector x.

theorem Matrix.dotProduct_add_smul_symm {V : Type u_1} {K : Type u_2} [Fintype V] [CommRing K] {M : Matrix V V K} (hSymm : M.IsSymm) (x d : V → K) (t : K) :
(x + t • d) ⬝ᵥ M.mulVec (x + t • d) = x ⬝ᵥ M.mulVec x + 2 * t * d ⬝ᵥ M.mulVec x + t ^ 2 * d ⬝ᵥ M.mulVec d

Expansion of the quadratic form of a symmetric matrix along x + t • d.

theorem Matrix.dotProduct_submatrix_equiv {V : Type u_1} {W : Type u_2} {K : Type u_3} [Fintype V] [Fintype W] [CommSemiring K] (M : Matrix V V K) (e : W ≃ V) (x : W → K) :
x ⬝ᵥ (M.submatrix ⇑e ⇑e).mulVec x = x ∘ ⇑e.symm ⬝ᵥ M.mulVec (x ∘ ⇑e.symm)

Reindexing the quadratic form of a matrix along an equivalence e : W ≃ V.

theorem Matrix.IsCopositive.submatrix_equiv_iff {V : Type u_1} {W : Type u_2} {K : Type u_3} [Fintype V] [Fintype W] [CommSemiring K] [PartialOrder K] (M : Matrix V V K) (e : W ≃ V) :

Copositivity is invariant under simultaneous row-and-column reindexing by an equivalence.

theorem Matrix.exists_nonneg_dotProduct_lt_zero_iff_stdSimplex {V : Type u_1} {K : Type u_2} [Fintype V] [Field K] [LinearOrder K] [IsStrictOrderedRing K] (M : Matrix V V K) :
(∃ (x : V → K), (∀ (v : V), 0 ≤ x v) ∧ x ⬝ᵥ M.mulVec x < 0) ↔ ∃ (x : Convexity.StdSimplex K V), ⇑x.weights ⬝ᵥ M.mulVec ⇑x.weights < 0

Non-copositivity over a linearly ordered field is witnessed on the standard simplex Convexity.StdSimplex K V.

theorem Matrix.dotProduct_scale_of_eq {V : Type u_1} {K : Type u_2} [Fintype V] [CommSemiring K] {c : K} {M₁ M₂ : Matrix V V K} (hM : ∀ (i j : V), c * M₁ i j = M₂ i j) (x : V → K) :
c * x ⬝ᵥ M₁.mulVec x = x ⬝ᵥ M₂.mulVec x

Scaling a quadratic form when c * M₁ i j = M₂ i j entrywise.

theorem Matrix.intCast_dotProduct_mulVec_nat {V : Type u_1} {K : Type u_2} [Fintype V] [Ring K] (M : Matrix V V ℤ) (p : V → ℕ) :
↑((fun (i : V) => ↑(p i)) ⬝ᵥ M.mulVec fun (i : V) => ↑(p i)) = (fun (i : V) => ↑(p i)) ⬝ᵥ (M.map Int.cast).mulVec fun (i : V) => ↑(p i)

Casting an integer quadratic form evaluated on a ℕ-vector to any ring K.

theorem Matrix.exists_nat_dotProduct_lt_zero_of_isSymm {V : Type u_1} [Fintype V] {B : ℕ} {M : Matrix V V ℤ} (hSymm : M.IsSymm) (hB : ∀ (i j : V), |M i j| ≤ ↑B) (hnc : ¬(M.map Int.cast).IsCopositive) :
∃ (p : V → ℕ), (∀ (v : V), p v ≤ (Fintype.card V).factorial * (Fintype.card V * max B 1 ^ 2 + 1) ^ Fintype.card V) ∧ ((fun (v : V) => ↑(p v)) ⬝ᵥ M.mulVec fun (v : V) => ↑(p v)) < 0

If a symmetric integer matrix M has a nonnegative real vector with negative quadratic form, then it has a nonnegative integer vector p with p ⬝ᵥ M *ᵥ p < 0 and entries bounded by Nat.factorial (Fintype.card V) * (Fintype.card V * (max B 1) ^ 2 + 1) ^ Fintype.card V, where B bounds |M i j|. (The KKT + Matrix.exists_int_nonneg_mulVec_eq proof and this explicit bound are this library's formulation, not verified against [MK87].)

theorem Matrix.isCopositive_int_real_iff_nat {V : Type u_1} [Fintype V] {M : Matrix V V ℤ} (hSymm : M.IsSymm) :
(M.map Int.cast).IsCopositive ↔ ∀ (p : V → ℕ), 0 ≤ (fun (i : V) => ↑(p i)) ⬝ᵥ M.mulVec fun (i : V) => ↑(p i)

For a symmetric integer matrix, copositivity over ℝ coincides with nonnegativity on all nonnegative integer vectors.

theorem Matrix.exists_nat_dotProduct_lt_zero_of_rat {V : Type u_1} [Fintype V] {d B : ℕ} {M : Matrix V V ℚ} {M_Z : Matrix V V ℤ} (hd : 0 < d) (hSymm : M.IsSymm) (hMZ : ∀ (i j : V), ↑d * M i j = ↑(M_Z i j)) (hB : ∀ (i j : V), |M_Z i j| ≤ ↑B) (hnc : ¬M.IsCopositive) :
∃ (p : V → ℕ), (∀ (i : V), p i ≤ (Fintype.card V).factorial * (Fintype.card V * max B 1 ^ 2 + 1) ^ Fintype.card V) ∧ ((fun (i : V) => ↑(p i)) ⬝ᵥ M.mulVec fun (i : V) => ↑(p i)) < 0

Given a symmetric rational matrix M and an integer scaling (d : ℚ) * M = M_Z with 0 < d and |M_Z i j| ≤ B, non-copositivity of M yields a nonnegative integer certificate p with p ⬝ᵥ M *ᵥ p < 0 and entries bounded by Nat.factorial (Fintype.card V) * (Fintype.card V * (max B 1) ^ 2 + 1) ^ Fintype.card V (library proof and bound, not verified against [MK87]).

For a symmetric rational matrix, copositivity over ℚ and over ℝ coincide.

theorem Matrix.isCopositive_rat_iff_nat {V : Type u_1} [Fintype V] {M : Matrix V V ℚ} (hSymm : M.IsSymm) :
M.IsCopositive ↔ ∀ (p : V → ℕ), 0 ≤ (fun (i : V) => ↑(p i)) ⬝ᵥ M.mulVec fun (i : V) => ↑(p i)

For a symmetric rational matrix, copositivity over ℚ coincides with nonnegativity on all nonnegative integer vectors.