The sign of a permutation vector, computed from inversion parity.
Equations
- Hex.Matrix.detSign perm = if Hex.Matrix.inversionCount perm.toList % 2 = 0 then 1 else -1
Instances For
def
Hex.Matrix.detTerm
{R : Type u}
[Lean.Grind.Ring R]
{n : Nat}
(M : Matrix R n n)
(perm : Vector (Fin n) n)
:
R
The Leibniz summand associated to a permutation vector.
Equations
- M.detTerm perm = Hex.Matrix.detSign perm * M.detProduct perm
Instances For
The determinant of a dense square matrix, defined by the Leibniz formula.
Equations
- M.det = List.foldl (fun (acc : R) (perm : Vector (Fin n) n) => acc + M.detTerm perm) 0 (Hex.Matrix.permutationVectors n)
Instances For
theorem
Hex.Matrix.det_mapEntries
{S : Type v}
{R : Type u}
[Lean.Grind.CommRing R]
[Lean.Grind.CommRing S]
{n : Nat}
(M : Matrix R n n)
(f : R → S)
(hzero : f 0 = 0)
(hone : f 1 = 1)
(hadd : ∀ (a b : R), f (a + b) = f a + f b)
(hmul : ∀ (a b : R), f (a * b) = f a * f b)
:
The Leibniz determinant commutes with an entrywise ring homomorphism. The homomorphism laws are explicit to keep this statement Mathlib-free.
@[simp]
theorem
Hex.Matrix.det_principalSubmatrix_zero
{n : Nat}
{R : Type u}
[Lean.Grind.Ring R]
(M : Matrix R n n)
:
The determinant of the empty leading prefix is the Bareiss previous-pivot
convention 1.