The areas / V07. Linear algebra
Mathlib.LinearAlgebra.Matrix.Determinant.Bird.Correctness
1 declarations. Mathlib docs · Source
Correctness of Bird's determinant algorithm
This file contains a proof that Bird's division-free algorithm computes
Matrix.det, in both its matrix form BirdDet.Spec.birdDet
(birdDetSpec_eq_det) and its flat-array form BirdDet.birdDet
(det_eq_birdDet), formalizing the combinatorial argument of
[Richard S. Bird, A simple division-free algorithm for computing determinants][bird2011].
Correspondence with the paper
- A word of length
pis a tupleFin p → Fin n, using the indexing convention above (NB: Indices in Bird's paper start at 1). f[α, β], the minor on rowsαand columnsβ, is(A.submatrix α β).det.f[iα, jα], a bordered minor, isbminor A i j α, with the wordiαspelledFin.cons i α.f[α, α], a principal minor, ispminor A α.- If
i : Fin nrepresents Bird's symbolr = i.val + 1, then Bird'sβᵣ = [r + 1, ..., n]is represented byFinset.Ioi i. - Bird's
Sₚ(βᵣ), the lengthpsubsequences ofβᵣ, is represented byS p i.
The theorem names paper_eq1, ..., paper_eq5 follow Bird's numbering.
Main results
BirdDet.birdDetSpec_eq_det:Matrix.detcomputes the same determinant asBirdDet.Spec.birdDetBirdDet.det_eq_birdDet:Matrix.detcomputes the same determinant asBirdDet.birdDet
Decomposition S_{p+1}(βᵢ) = { kα | k ∈ βᵢ, α ∈ S_p(β_k) }
Equations (2) and (3): substituting the induction hypothesis
Equation (5): first-column Laplace expansion
Comparing equations (3) and (5): reindex by sorted insert/delete
Bird's Equation (1)
instantiating equation (1) to prove Theorem 1
theorem BirdDet.det_eq_birdDet E3 #
∀ {R : Type u_1} [inst : CommRing R] {n : ℕ} (A : Array R) (hA : A.size = n * n),
(Matrix.ofArray A hA).det = BirdDet.birdDet n A
BirdDet.birdDet n A computes the determinant of the n × n matrix whose
entries are stored in row-major order in A.