Documentation

CslibFrontier.Foundations.LinearAlgebra.Matrix.NonnegRank

Nonnegative factorizations and nonnegative rank #

A nonnegative factorization of a matrix M : Matrix m n R over an ordered semiring, with inner index type ρ, writes M = T * U with T : Matrix m ρ R and U : Matrix ρ n R entrywise nonnegative (Matrix.HasNonnegFactorization). The nonnegative rank rank₊ M is the least r for which M has a nonnegative factorization with inner dimension r, or ⊤ if there is none (Matrix.nonnegRank); equivalently, it is the least number of nonnegative rank-one matrices summing to M [FioriniMassarPokuttaTiwaryDeWolf2015, Section 3.1]. A matrix has finite nonnegative rank exactly when it is entrywise nonnegative (Matrix.nonnegRank_ne_top_iff), and then at most its number of rows and of columns (Matrix.nonnegRank_le_card_height, Matrix.nonnegRank_le_card_width). Over a commutative semiring with the strong rank condition, such as an ordered field, the rank is at most the nonnegative rank (Matrix.rank_le_nonnegRank).

In a nonnegative factorization, an entry of T * U is nonzero exactly when some inner index k has T i k ≠ 0 and U k j ≠ 0 (Matrix.mul_apply_ne_zero_iff_of_nonneg). So the support of M is the union of the r combinatorial rectangles {i | T i k ≠ 0} × {j | U k j ≠ 0}, which is the rectangle-covering lower bound on the nonnegative rank (Cslib.Communication.Nondeterministic.coverNumberFun_ne_zero_le_nonnegRank).

The nonnegative rank of a slack matrix of a polytope is its extension complexity (extensionComplexity_eq_nonnegRank_slackMatrix), by Yannakakis's factorization theorem.

Main definitions #

Main results #

References #

def Matrix.HasNonnegFactorization {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] (M : Matrix m n R) (ρ : Type u_6) [Fintype ρ] :

M has a nonnegative factorization with inner index type ρ: M = T * U for entrywise nonnegative matrices T : Matrix m ρ R and U : Matrix ρ n R [FioriniMassarPokuttaTiwaryDeWolf2015, Section 3.1].

noncomputable def Matrix.nonnegRank {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] (M : Matrix m n R) :

The nonnegative rank rank₊ M: the least r such that M = T * U with T and U entrywise nonnegative of inner dimension r, or ⊤ if M has no nonnegative factorization [FioriniMassarPokuttaTiwaryDeWolf2015, Section 3.1].

theorem Matrix.HasNonnegFactorization.of_equiv {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] {M : Matrix m n R} {ρ : Type u_6} {ρ' : Type u_7} [Fintype ρ] [Fintype ρ'] (e : ρ ≃ ρ') (h : M.HasNonnegFactorization ρ) :

A nonnegative factorization can be transported along an equivalence of inner index types.

theorem Matrix.HasNonnegFactorization.of_embedding {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] {M : Matrix m n R} {ρ : Type u_6} {ρ' : Type u_7} [Fintype ρ] [Fintype ρ'] (e : ρ ↪ ρ') (h : M.HasNonnegFactorization ρ) :

A nonnegative factorization through ρ gives one through any ρ' into which ρ embeds: pad T with zero columns and U with zero rows.

theorem Matrix.HasNonnegFactorization.nonnegRank_le {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] {M : Matrix m n R} {ρ : Type u_6} [Fintype ρ] (h : M.HasNonnegFactorization ρ) :

A nonnegative factorization through ρ bounds the nonnegative rank by |ρ|.

theorem Matrix.le_nonnegRank_iff {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] {M : Matrix m n R} {c : ℕ∞} :
c ≤ M.nonnegRank ↔ ∀ (r : ℕ), M.HasNonnegFactorization (Fin r) → c ≤ ↑r

Lower bounds on the nonnegative rank are lower bounds on the inner dimension of every nonnegative factorization.

theorem Matrix.nonnegRank_le_iff {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] {M : Matrix m n R} {r : ℕ} :

M has nonnegative rank at most r exactly when it has a nonnegative factorization with inner dimension r.

@[simp]
theorem Matrix.nonnegRank_zero {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] :

The zero matrix has nonnegative rank zero.

theorem Matrix.nonnegRank_eq_zero_iff {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] {M : Matrix m n R} :
M.nonnegRank = 0 ↔ M = 0

Only the zero matrix has nonnegative rank zero.

theorem Matrix.nonnegRank_submatrix_le {R : Type u_1} {l : Type u_2} {m : Type u_3} {n : Type u_4} {o : Type u_5} [Semiring R] [PartialOrder R] (M : Matrix m n R) (e₁ : l → m) (e₂ : o → n) :

Restricting the rows and columns does not increase the nonnegative rank.

theorem Matrix.HasNonnegFactorization.transpose {R : Type u_1} {m : Type u_3} {n : Type u_4} [CommSemiring R] [PartialOrder R] {M : Matrix m n R} {ρ : Type u_6} [Fintype ρ] (h : M.HasNonnegFactorization ρ) :

A nonnegative factorization of M transposes to one of Mᵀ.

@[simp]
theorem Matrix.nonnegRank_transpose {R : Type u_1} {m : Type u_3} {n : Type u_4} [CommSemiring R] [PartialOrder R] {M : Matrix m n R} :

Transposition preserves the nonnegative rank.

theorem Matrix.rank_le_nonnegRank {R : Type u_1} {m : Type u_3} {n : Type u_4} [CommSemiring R] [PartialOrder R] {M : Matrix m n R} [StrongRankCondition R] [Finite n] :

Rank is at most nonnegative rank: a nonnegative factorization with inner dimension r is in particular a factorization through R ^ r.

theorem Matrix.HasNonnegFactorization.nonneg {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix m n R} {ρ : Type u_6} [Fintype ρ] (h : M.HasNonnegFactorization ρ) (i : m) (j : n) :
0 ≤ M i j

Only entrywise nonnegative matrices have nonnegative factorizations.

theorem Matrix.hasNonnegFactorization_height {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix m n R} [Fintype m] (hM : ∀ (i : m) (j : n), 0 ≤ M i j) :

A nonnegative matrix factors trivially through its rows: M = 1 * M.

theorem Matrix.hasNonnegFactorization_width {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix m n R} [Fintype n] (hM : ∀ (i : m) (j : n), 0 ≤ M i j) :

A nonnegative matrix factors trivially through its columns: M = M * 1.

theorem Matrix.nonnegRank_le_card_height {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix m n R} [Fintype m] (hM : ∀ (i : m) (j : n), 0 ≤ M i j) :

The nonnegative rank of a nonnegative matrix is at most its number of rows.

theorem Matrix.nonnegRank_le_card_width {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix m n R} [Fintype n] (hM : ∀ (i : m) (j : n), 0 ≤ M i j) :

The nonnegative rank of a nonnegative matrix is at most its number of columns.

theorem Matrix.nonnegRank_ne_top_iff {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix m n R} [Finite m] :
M.nonnegRank ≠ ⊤ ↔ ∀ (i : m) (j : n), 0 ≤ M i j

A matrix with finitely many rows has finite nonnegative rank exactly when it is entrywise nonnegative.

theorem Matrix.mul_apply_ne_zero_iff_of_nonneg {R : Type u_1} {m : Type u_3} {n : Type u_4} [Semiring R] [PartialOrder R] [IsOrderedRing R] [NoZeroDivisors R] {ρ : Type u_6} [Fintype ρ] {T : Matrix m ρ R} {U : Matrix ρ n R} (hT : ∀ (i : m) (k : ρ), 0 ≤ T i k) (hU : ∀ (k : ρ) (j : n), 0 ≤ U k j) (i : m) (j : n) :
(T * U) i j ≠ 0 ↔ ∃ (k : ρ), T i k ≠ 0 ∧ U k j ≠ 0

The support of a product of nonnegative matrices: an entry of T * U is nonzero exactly when some inner index k has T i k ≠ 0 and U k j ≠ 0.