The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V34. The tactics of Mathlib

Mathlib.Tactic.Determinant.Echelon.Cert

4 declarations. Mathlib docs · Source

Determinants of matrix literals by echelon decomposition

proveEchelonDet evaluates the determinant of a square matrix literal with non-symbolic entries through the certificate Echelon.Decomposition A L σ pivot of its echelon decomposition.

Main definitions

  • proveEchelonDet: proves A.det = v for a square matrix literal A from its echelon decomposition.
  • detValue: computes the value of the determinant from the decomposition data.
  • certifyDiagProd: computes the product of the diagonal of a list-based matrix literal with its proof.

Implementation notes

The determinant is the quotient of the diagonal products of U and L, up to the sign of the row permutation. The model computes it in its carrier by exact division. Where the division is not exact, as under the rational model's row scaling, the value is the fraction of the two products in norm_num's normal form when possible.

def Mathlib.Tactic.Determinant.certifyDiagProdList E1 #

{u : Lean.Level} →
  {α : Q(Type u)} →
    (rα : Q(CommRing «$α»)) →
      (k c : ℕ) →
        (rows : Q(List (List «$α»))) →
          Lean.MetaM ((e : Q(«$α»)) × Q(Mathlib.Tactic.Determinant.diagProd «$k» «$c» «$rows» = «$e»))

Compute diagProd k c rows with a proof of the equality.

def Mathlib.Tactic.Determinant.certifyDiagProd E3 #

{u : Lean.Level} →
  {m : ℕ} →
    {α : Q(Type u)} →
      (rα : Q(CommRing «$α»)) →
        (M : Mathlib.Tactic.Matrix.ListMatrixLit α m m) →
          Lean.MetaM
            ((e : Q(«$α»)) ×
              have a := M.lit;
              Q(Mathlib.Tactic.Determinant.diagProd 0 «$m» «$a» = «$e»))

Compute the product diagProd 0 m M.lit of the diagonal of M with a proof of the equality.

def Mathlib.Tactic.Determinant.detValue E3 #

{u : Lean.Level} →
  {α : Q(Type u)} →
    ℕ →
      {V : Type} →
        Mathlib.Tactic.Echelon.ModelAux α V → Mathlib.Tactic.Echelon.BareissData V → Lean.MetaM (Option Q(«$α»))

The value of the determinant read off the decomposition data, computed by s * u / l, where u and l are the diagonal products of U and L and s is the sign of the swaps.

def Mathlib.Tactic.Determinant.proveEchelonDet E3 #

{u : Lean.Level} →
  {α : Q(Type u)} →
    (rα : Q(CommRing «$α»)) →
      Q(IsDomain «$α») →
        (m : ℕ) →
          (A : Q(Matrix (Fin «$m») (Fin «$m») «$α»)) →
            Array (Array Q(«$α»)) → Lean.MetaM (Option ((v : Q(«$α»)) × Q(«$A».det = «$v»)))

Construct the value v and a proof that A.det = v by computing the echelon decomposition.