Reusable layer: linear algebra #
Stable names for matrix results of the archive: rank bounds, the Cauchy–Binet formula and Jacobi's formula. Each theorem is proved by the archive theorem it re-exposes (no proof is copied). The modules imported here are general linear algebra; none is a paper of the archive.
Main results #
Formalizations.Reusable.derivative_coe_charpolyRev: Newton's identity for traces,d/dX (charpolyRev M) = − charpolyRev M · ∑ₖ trace (Mᵏ⁺¹) XᵏinR⟦X⟧(archive:Matrix.derivative_coe_charpolyRev).Formalizations.Reusable.hua_identity: Hua's identitya − (a⁻¹ + (b⁻¹ − a)⁻¹)⁻¹ = a b ain a division ring (archive:DGH.hua_classical).Formalizations.Reusable.schur_commuting_finrank_le: a commutative subspace ofM_n(K)has dimension≤ n² / 4 + 1(archive:SchurCommuting.finrank_le).Formalizations.Reusable.schur_commuting_finrank_attained: forn ≥ 1some commutative subspace ofM_n(K)has dimension exactlyn² / 4 + 1, so Schur's bound is sharp (archive:SchurCommuting.exists_finrank_eq).Formalizations.Reusable.int_columns_of_transpose_mul_self: the columns of an integer matrix withAᵀ A = 1are signed unit vectors in distinct rows (archive:IntOrthonormal.columns_of_transpose_mul_self).Formalizations.Reusable.biquadratic_sos_transport: sums of squares of bilinear forms representingP_Htransport toP_{Dᵀ H D}whenDᵀ D = 1(archive:BiquadraticSOS.sos_transport).Formalizations.Reusable.rank_fromBlocks_zero₂₁_le_card_add_rank: the rank offromBlocks A B 0 Dis at most the number of rows ofAplus the rank ofD(archive:Matrix.rank_fromBlocks_zero₂₁_le_right).Formalizations.Reusable.matrix_rank_add_le:rank (A + B) ≤ rank A + rank Bover a field (archive:Matrix.rank_add_le).Formalizations.Reusable.det_mul_eq_sum_det_submatrix_mul_det_submatrix: the Cauchy–Binet formula (archive:Matrix.det_mul_cauchyBinet).Formalizations.Reusable.derivative_det_eq_trace_adjugate_mul: Jacobi's formula for a matrix of polynomials (archive:Matrix.derivative_det).Formalizations.Reusable.matrix_rank_add_rank_le_rank_fromBlocks:rank A + rank Dis at most the rank offromBlocks A B 0 D(archive:Matrix.rank_add_rank_le_rank_fromBlocks_zero₂₁).Formalizations.Reusable.matrix_rank_kronecker:rank (A ⊗ₖ B) = rank A · rank Bover a field (archive:Matrix.rank_kronecker).Formalizations.Reusable.adjugate_apply_self_eq_det_principal_submatrix:adjugate A i iis the principal minor withouti(archive:Matrix.adjugate_apply_self_eq_det_submatrix).
Rank of a block upper-triangular matrix. Over a field K, for blocks A : l × n,
B : l × o and D : p × o, rank !![A, B; 0, D] ≤ |l| + rank D. The proof splits the block matrix
as fromBlocks A B 0 0 + fromBlocks 0 0 0 D and uses subadditivity of the rank (also in the
archive, Matrix.rank_add_le, which Mathlib states only for linear maps).
- Archive:
Matrix.rank_fromBlocks_zero₂₁_le_right(Formalizations.LinearAlgebra.Matrix.BlockRank, used by the free-locus certificates of the same archive). - Classical reference: a textbook consequence of the subadditivity of the rank (no single source).
- Example: with
A = 1 : Matrix (Fin 1) (Fin 1) ℚ, anyBandD : Matrix (Fin 2) (Fin 2) ℚ,rank_fromBlocks_zero₂₁_le_card_add_rank A B D : (fromBlocks A B 0 D).rank ≤ 1 + D.rank.
Subadditivity of the rank. Over a field K, for matrices A B : Matrix m n K,
rank (A + B) ≤ rank A + rank B. Mathlib states this for linear maps (LinearMap.rank_add_le);
this is the Matrix.rank form.
- Archive:
Matrix.rank_add_le(Formalizations.LinearAlgebra.Matrix.BlockRank, a shared lemma of the free-locus certificates of the same archive). - Classical reference: textbook (the image of
A + Blies in the sum of the images). - Example: with
B = −A,matrix_rank_add_le A (-A)givesrank 0 ≤ rank A + rank (−A).
The Cauchy–Binet formula. Over a commutative ring R, for A : Matrix m n R and
B : Matrix n m R with n linearly ordered, det (A * B) is the sum, over the subsets S of n
with |S| = |m|, of det A[:, S] · det B[S, :], the columns of A and the rows of B taken in
the increasing order of S (S.orderEmbOfFin) and the rows of A, columns of B through
Fintype.equivFin m. When |n| < |m| the sum is empty and det (A * B) = 0.
- Archive:
Matrix.det_mul_cauchyBinet(Formalizations.LinearAlgebra.Matrix.CauchyBinet, the tool for Kirchhoff's matrix-tree theorem in the same archive); the module cites no paper DOI of ours. - Classical reference: A.-L. Cauchy (1815), J. Binet (1815); F. R. Gantmacher, The Theory of Matrices, vol. 1.
- Example: for
A : Matrix (Fin 1) (Fin 2) ℚ,B : Matrix (Fin 2) (Fin 1) ℚit givesdet (A * B) = A 0 0 * B 0 0 + A 0 1 * B 1 0, a sum of two1 × 1minors.
Jacobi's formula. For a square matrix A with entries in R[X] (R a commutative ring),
derivative (det A) = trace (adjugate A * A.map derivative). With A = X • 1 − M it gives
charpoly′ = trace (adjugate (X − M)), the sum of the characteristic polynomials of the principal
submatrices. Mathlib has only the special case derivative_det_one_add_X_smul (the first-order
term of det (1 + X M)).
- Archive:
Matrix.derivative_det(Formalizations.LinearAlgebra.Matrix.Charpoly.Jacobi, a tool for the Ihara trace formula in the same archive); the module cites no paper DOI of ours. - Classical reference: C. G. J. Jacobi, De formatione et proprietatibus determinantium, J. Reine Angew. Math. 22 (1841); R. A. Horn, C. R. Johnson, Matrix Analysis, 2nd ed. (2013).
- Example: for
A = !![X, 1; 0, X]overℚ, it givesderivative (X²) = 2 X.
Lower bound for the rank of a block upper-triangular matrix. Over a field K, for blocks
A : l × n, B : l × o and D : p × o, rank A + rank D ≤ rank !![A, B; 0, D]. Together with
rank_fromBlocks_zero₂₁_le_card_add_rank it pins the rank of a block-triangular certificate
between rank A + rank D and |l| + rank D; with A invertible both bounds agree.
- Archive:
Matrix.rank_add_rank_le_rank_fromBlocks_zero₂₁(Formalizations.LinearAlgebra.Matrix.Rank, used by the free-locus certificates of the same archive); proved through the nullity bound for block triangular matrices. - Classical reference: textbook (e.g. G. Marsaglia, G. P. H. Styan, Equalities and inequalities for ranks of matrices, Linear and Multilinear Algebra 2 (1974) 269–292).
- Example: with
A = D = 1 : Matrix (Fin 2) (Fin 2) ℚ, anyBgives4 ≤ rank !![1, B; 0, 1], so the4 × 4block matrix is invertible.
The rank of a Kronecker product is the product of the ranks. Over a field K, for
A : Matrix m n K and B : Matrix p q K, rank (A ⊗ₖ B) = rank A · rank B. The proof identifies
A ⊗ₖ B with the tensor product of the linear maps of A and B and uses that vector spaces are
flat.
- Archive:
Matrix.rank_kronecker(Formalizations.LinearAlgebra.Matrix.Rank.Kronecker, used by the free-locus certificates and the orbifold products of the same archive); the module cites no paper DOI of ours. - Classical reference: R. A. Horn, C. R. Johnson, Topics in Matrix Analysis (1991), ch. 4.
- Example: the adjacency matrix of a tensor product of graphs is a Kronecker product, so its rank is the product of the ranks of the factors.
Diagonal entries of the adjugate are principal minors. For a square matrix A over a
commutative ring, indexed by any finite type n, adjugate A i i is the determinant of the
principal submatrix obtained by deleting row and column i (indexed by the subtype
{j // j ≠ i}). Mathlib has the statement for all entries when n = Fin k.succ
(Matrix.adjugate_fin_succ_eq_det_submatrix); this form needs no reindexing. With Jacobi's
formula (derivative_det_eq_trace_adjugate_mul) it gives
charpoly′ = Σᵢ charpoly (A with row and column i deleted).
- Archive:
Matrix.adjugate_apply_self_eq_det_submatrix(Formalizations.LinearAlgebra.Matrix.Adjugate, a tool for the Ihara trace formula in the same archive); the module cites no paper DOI of ours. - Classical reference: textbook (Laplace expansion of the cofactor).
- Example: for
A = !![a, b; c, d],adjugate A 0 0 = d, the1 × 1minor left after deleting row and column0.
Alternating characteristic polynomial ⇒ positive semidefinite. A real symmetric matrix whose
characteristic polynomial has coefficients alternating in sign, (-1)^(n-k) · c_k ≥ 0, is positive
semidefinite. The polynomial rule behind it (alternating coefficients ⇒ no negative root) is a corollary
of Descartes' rule of signs in Mathlib (Polynomial.roots_countP_pos_le_signVariations).
- Archive:
AlternatingRoots.posSemidef_of_charpoly_alternating(Formalizations.Analysis.Polynomial.RealRoots.AlternatingRoots); a piece of the design table (artefact P006, SOS certificates); the module cites no paper DOI of ours. - Classical reference: textbook (spectral theorem; Descartes' rule of signs).
- Example: an exact PSD check of a rational Gram matrix without pivoting: compute its characteristic polynomial and read the signs.
A positive semidefinite matrix of rank k is a sum of k squares. Its quadratic form is a sum
of exactly k squares of linear forms: uᵀ A u = Σ_{i < k} (v_i · u)². Mathlib only factors a PSD
matrix as Bᴴ B with B square; this keeps exactly rank A terms. The same statement, as a
factorization B = Aᴴ A with rank B ≤ card m rows, is in TauCeti
(Matrix.PosSemidef.exists_eq_conjTranspose_mul_self_of_rank_le, TauCeti/Analysis/Matrix/
GramFactorization.lean); ours depends on Mathlib only.
- Archive:
PosSemidefRankSquares.quadForm_eq_sum_sq(Formalizations.LinearAlgebra.Matrix.PosSemidefRankSquares); a piece of the design table (artefact P006: a rational PSD Gram matrix of rankkcertifieskREAL squares, not rational ones). - Classical reference: textbook (spectral theorem).
- Example: the Gram matrix
! of(x + y)²gives one square.
Rank through the Schur complement. Over a field, if the top-left block A of a block matrix
is invertible, then rank (fromBlocks A B C D) = card m + rank (D - C * A⁻¹ * B). With A ≻ 0 and a
zero Schur complement this is the exact certificate "this PSD Gram matrix has rank card m"
(Matrix.posSemidef_rank_of_schur_eq_zero in the archive). Mathlib has the PSD half
(Matrix.PosDef.fromBlocks₁₁) and the LDU factorization, not the rank.
- Archive:
Matrix.rank_fromBlocks_of_isUnit₁₁(Formalizations.LinearAlgebra.Matrix.SchurRank; alsoMatrix.rank_fromBlocks_diagonal); a piece of the design table (Schur certificates of sums of squares); the module cites no paper DOI of ours. - Classical reference: textbook (Guttman rank additivity; F. Zhang, The Schur Complement and Its Applications, Springer 2005, §0.9).
- Example:
!![1, 1; 1, 1]hasA = 1and Schur complement1 - 1 * 1 * 1 = 0, so rank1.
Sums of squares of bilinear forms under orthogonal congruence. For the biquadratic form
P_H(x, y) = (x₀² + x₁²) (y ⬝ᵥ y) + 2 x₀ x₁ (y ⬝ᵥ H y) over a commutative ring and Dᵀ D = 1,
every representation P_H = ∑ i (x ⬝ᵥ B i y)² gives P_{Dᵀ H D} = ∑ i (x ⬝ᵥ (B i D) y)² with the same
number of squares; so the sum-of-squares length of P_H is invariant under H ↦ Dᵀ H D (signed-graph
switching is D = diagonal s, s i² = 1: BiquadraticSOS.P_switching).
- Archive:
BiquadraticSOS.sos_transport(Formalizations.LinearAlgebra.Matrix.BiquadraticOrthogonal; alsoBiquadraticSOS.P_mulVec_orthogonal,BiquadraticSOS.P_switching); a piece of the design table (lengths ofP_H, signed graphs). - Classical reference: change of variables
y ↦ D y(textbook); the formP_His that of Blekherman–Plaumann–Sinn–Vinzant and Hanselka–Sinn. - Example: with
D = diagonal ![1, -1]the two-square representation ofP_Htransports to one ofP_{D H D}.
Integer orthonormal columns are signed unit vectors. If an integer m × n matrix satisfies
Aᵀ A = 1, then every column j is ± Pi.single (f j) 1 for an injective f : n → m: the nonzero
entries of distinct columns lie in distinct rows. The one-vector case (an integer vector with
v ⬝ᵥ v = 1 is ± Pi.single i 1) is IntOrthonormal.eq_single_of_dotProduct_self_eq_one. False over
ℚ: (3/5, 4/5) has norm one.
- Archive:
IntOrthonormal.columns_of_transpose_mul_self(Formalizations.LinearAlgebra.Matrix.IntOrthonormal; alsoIntOrthonormal.eq_single_of_dotProduct_self_eq_one); a piece of the design table (first step of the integer lengths ofP_H, signed graphs). - Classical reference: textbook (sums of integer squares).
- Example: the columns of
!![0, 1; -1, 0]are-e₁ande₀.
Schur's bound on commutative subspaces. A subspace S of M_n(K) over a field K whose elements
pairwise commute has dim S ≤ ⌊n² / 4⌋ + 1. The bound is attained for n ≥ 1
(SchurCommuting.finrank_le_and_attained).
- Archive:
SchurCommuting.finrank_le(Formalizations.LinearAlgebra.Matrix.SchurCommuting; the sharpness isSchurCommuting.finrank_le_and_attained); the module cites no paper DOI of ours. - Classical reference: I. Schur, Zur Theorie der vertauschbaren Matrizen, J. Reine Angew. Math. 130 (1905) 66–76 66–76; N. Jacobson, Schur's theorems on commutative matrices, Bull. Amer. Math. Soc. 50 (1944) 431–436; M. Mirzakhani, A simple proof of a theorem of Schur, Amer. Math. Monthly 105 (1998) 260–262.
- Example: a commutative subspace of
M₂(ℚ)has dimension at most2.
Schur's bound is sharp. For every field K and n ≥ 1 there is a subspace of M_n(K) whose elements
pairwise commute and whose dimension is exactly ⌊n² / 4⌋ + 1: the scalar matrices plus the block of matrices
supported on a ⌈n/2⌉ × ⌊n/2⌋ corner (any two of them multiply to zero).
- Archive:
SchurCommuting.exists_finrank_eq(Formalizations.LinearAlgebra.Matrix.SchurCommuting); the module cites no paper DOI of ours. - Classical reference: I. Schur, Zur Theorie der vertauschbaren Matrizen, J. Reine Angew. Math. 130 (1905) 66–76.
- Example: over
ℚa commutative subspace ofM₂(ℚ)of dimension2exists.
Hua's identity. In a division ring K, for a ≠ 0, b ≠ 0 and a b ≠ 1,
a − (a⁻¹ + (b⁻¹ − a)⁻¹)⁻¹ = a b a. It holds with no commutativity assumption.
- Archive:
DGH.hua_classical(Formalizations.RingTheory.DGH.Absorb); the module cites no paper DOI of ours. - Classical reference: L.-K. Hua, On the automorphisms of a sfield, Proc. Nat. Acad. Sci. USA 35 (1949) 386–389.
- Example: over
ℚwitha = 2,b = 1:2 − (1/2 + (1 − 2)⁻¹)⁻¹ = 4 = 2 · 1 · 2.
Newton's identity for traces. For a square matrix M over a commutative ring R, with charpolyRev M = det (1 − X • M) viewed in R⟦X⟧, d/dX (charpolyRev M) = − charpolyRev M · ∑ₖ trace (Mᵏ⁺¹) Xᵏ: the
logarithmic derivative of the reversed characteristic polynomial is minus the generating function of the traces
of the powers of M. No eigenvalues and no hypothesis on R.
- Archive:
Matrix.derivative_coe_charpolyRev(Formalizations.LinearAlgebra.Matrix.Charpoly.Jacobi: Jacobi's formula plus the resolvent series(1 − X • M)⁻¹ = ∑ₖ Mᵏ Xᵏ); the module cites no paper DOI of ours. - Classical reference: Newton's identities between power sums and elementary symmetric functions; no source verified (unverified).
- Example: the identity for a
2 × 2integer matrix.
The polarized Cayley–Hamilton identity for two-by-two matrices over a commutative ring.
Archive: Matrix.mul_add_mul_eq_trace_smul_add_trace_smul_fin_two.
The diagonal series of matrix powers times the reversed characteristic polynomial equals the
reversed characteristic polynomial of the principal submatrix with that index removed.
Archive: Matrix.resolventSeries_diag_mul_coe_charpolyRev.