Documentation

CslibFrontier.Foundations.LinearAlgebra.Matrix.Rigidity

Matrix rigidity #

The rigidity Matrix.rigidity A r of a matrix A over a field is the least number of entries of A that must be changed to bring its rank down to at most r: the Hamming distance from A to the set of matrices of rank at most r. This is [Lok09], Definition 2.1, R_A(r) = min {|C| : rank (A + C) ≤ r}, where |C| is the number of nonzero entries of C. Here B = A + C is the changed matrix, so |C| is the number of entries where A and B differ (Matrix.diffCount). The target is rank at most r, as in [Lok09], not rank exactly r. Valiant introduced rigidity [Val77] to prove lower bounds on linear circuits: highly rigid matrices have no linear circuits of linear size and logarithmic depth (Cslib.Circuits.Circuit.Computes.rigidity_le).

Changing one entry changes the rank by at most one, so A must lose rank A - r rank and every matrix needs at least rank A - r changes (Matrix.rank_sub_le_rigidity). For the identity matrix of size n this is exact: rigidity 1 r = n - r (Matrix.rigidity_one). Conversely, when r ≤ rank A, choosing an invertible r × r submatrix and replacing the complementary (|m| - r) × (|n| - r) block by the Schur-complement product of the bordering blocks brings the rank down to r, so A.rigidity r ≤ (|m| - r) (|n| - r) (Matrix.rigidity_le_mul_sub, and (|n| - r) ^ 2 for square matrices in Matrix.rigidity_le_sq_sub; [Lok09], §2.1, p. 11).

Main definitions #

Main results #

References #

noncomputable def Matrix.diffCount {m : Type u_1} {n : Type u_2} {α : Type u_4} (A B : Matrix m n α) :

The number of entries where the matrices A and B differ.

This counts differing positions with Set.ncard, which returns 0 on infinite sets. Matrix.rigidity and the rigidity results below are therefore meant for finite m and n, where diffCount equals the true Hamming distance on m × n; each result assumes as much finiteness ([Finite _] or [Fintype _]) as its proof needs.

theorem Matrix.diffCount_comm {m : Type u_1} {n : Type u_2} {α : Type u_4} (A B : Matrix m n α) :
@[simp]
theorem Matrix.diffCount_self {m : Type u_1} {n : Type u_2} {α : Type u_4} (A : Matrix m n α) :
A.diffCount A = 0
theorem Matrix.diffCount_le_card {m : Type u_1} {n : Type u_2} {α : Type u_4} [Fintype n] [Fintype m] (A B : Matrix m n α) :

Two matrices differ in at most all of their entries.

theorem Matrix.diffCount_eq_card_filter {m : Type u_1} {n : Type u_2} {α : Type u_4} [Fintype n] [Fintype m] [DecidableEq α] (A B : Matrix m n α) :
A.diffCount B = {p : m × n | A p.1 p.2 ≠ B p.1 p.2}.card

For finite matrices, diffCount is the size of a filtered Finset of positions.

theorem Matrix.diffCount_eq_sum {m : Type u_1} {n : Type u_2} {α : Type u_4} [Fintype n] [Fintype m] [DecidableEq α] (A B : Matrix m n α) :
A.diffCount B = ∑ i : m, {j : n | A i j ≠ B i j}.card

The number of differing entries is the sum over the rows of the number of differing entries in each row.

noncomputable def Matrix.rigidity {m : Type u_1} {n : Type u_2} {K : Type u_3} [Field K] [Finite m] (A : Matrix m n K) (r : ℕ) :

Matrix rigidity ([Lok09], Definition 2.1): the least number of entries of A that must be changed to make its rank at most r.

theorem Matrix.rigidity_le {m : Type u_1} {n : Type u_2} {K : Type u_3} [Field K] [Finite m] {A B : Matrix m n K} {r : ℕ} (hB : B.rank ≤ r) :

A matrix B of rank at most r that differs from A in diffCount A B entries bounds the rigidity of A.

theorem Matrix.rigidity_le_card {m : Type u_1} {n : Type u_2} {K : Type u_3} [Fintype n] [Field K] [Fintype m] (A : Matrix m n K) (r : ℕ) :

Rigidity is at most the number of entries.

theorem Matrix.exists_rigidity_eq {m : Type u_1} {n : Type u_2} {K : Type u_3} [Field K] [Finite m] (A : Matrix m n K) (r : ℕ) :
∃ (B : Matrix m n K), B.rank ≤ r ∧ A.diffCount B = A.rigidity r

Some matrix of rank at most r differs from A in exactly A.rigidity r entries.

theorem Matrix.le_rigidity_iff {m : Type u_1} {n : Type u_2} {K : Type u_3} [Field K] [Finite m] {A : Matrix m n K} {r s : ℕ} :
s ≤ A.rigidity r ↔ ∀ (B : Matrix m n K), B.rank ≤ r → s ≤ A.diffCount B

s ≤ A.rigidity r exactly when every matrix of rank at most r differs from A in at least s entries.

theorem Matrix.rigidity_antitone {m : Type u_1} {n : Type u_2} {K : Type u_3} [Field K] [Finite m] (A : Matrix m n K) :

Rigidity decreases as the target rank grows.

theorem Matrix.rigidity_zero {m : Type u_1} {n : Type u_2} {K : Type u_3} [Field K] [Finite m] [Finite n] (A : Matrix m n K) :

At target rank zero, the rigidity is the number of nonzero entries.

theorem Matrix.rigidity_eq_zero_iff {m : Type u_1} {n : Type u_2} {K : Type u_3} [Field K] [Finite m] [Finite n] {A : Matrix m n K} {r : ℕ} :
A.rigidity r = 0 ↔ A.rank ≤ r

No changes are needed when the rank is already at most r.

theorem Matrix.rank_le_diffCount_zero {m : Type u_1} {n : Type u_2} {K : Type u_3} [Field K] [Finite m] [Finite n] (C : Matrix m n K) :

The rank of a matrix is at most the number of its nonzero entries.

theorem Matrix.rank_sub_diffCount_le_rank {m : Type u_1} {n : Type u_2} {K : Type u_3} [Field K] [Finite m] [Finite n] (A B : Matrix m n K) :

Each change lowers the rank by at most one: the rank of B is at least the rank of A minus the number of entries where they differ.

theorem Matrix.rank_sub_le_rigidity {m : Type u_1} {n : Type u_2} {K : Type u_3} [Field K] [Finite m] [Finite n] (A : Matrix m n K) (r : ℕ) :
A.rank - r ≤ A.rigidity r

Rigidity is at least the rank deficit: at least rank A - r entries must be changed to bring the rank of A down to r.

theorem Matrix.rigidity_le_mul_sub {m : Type u_1} {n : Type u_2} {K : Type u_3} [Fintype n] [Field K] [Fintype m] (A : Matrix m n K) (r : ℕ) :

Upper bound on matrix rigidity ([Val77]; [Lok09], §2.1, p. 11, for square matrices). Every m × n matrix over a field has rigidity at most (|m| - r) (|n| - r) at target rank r: if rank A ≤ r no changes are needed, and if r < rank A then A contains an invertible r × r submatrix A_{I, J}, so A_{·, J} A_{I, J}⁻¹ A_{I, ·} has rank at most r and agrees with A on all of I × n and m × J.

theorem Matrix.rigidity_le_sq_sub {n : Type u_2} {K : Type u_3} [Fintype n] [Field K] (A : Matrix n n K) (r : ℕ) :

Upper bound on the rigidity of a square matrix ([Val77]; [Lok09], §2.1, p. 11). Every n × n matrix over a field has rigidity at most (|n| - r) ^ 2 at target rank r.

theorem Matrix.rigidity_one {n : Type u_2} {K : Type u_3} [Fintype n] [Field K] [DecidableEq n] (r : ℕ) :

The identity matrix of size n has rigidity exactly n - r: zeroing all but r diagonal entries attains the lower bound Matrix.rank_sub_le_rigidity.