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.Matrix.Cert

14 declarations. Mathlib docs · Source

Certificates for list-based matrix literals

This file contains common utilities for tactics that certify a computation on matrix literals from proofs about the lists of their rows.

Main definitions

  • certifyProductEq: certify that the product of two matrix literals equals a third, given the expansion of the product by MulExpand.
  • certifyRowsEq: certify the equality of two row literals from the equations of their entries.
  • certifyOfArray: certifies that the row-major array of a matrix literal is equal to the array of the matrix's entries.

theorem Mathlib.Tactic.Matrix.ListMatrixLit.mk.injEq E0 #

∀ {u : Lean.Level} {α : Q(Type u)} {m n : ℕ} (matrix : Q(Matrix (Fin «$m») (Fin «$n») «$α»)) (lit : Q(List (List «$α»)))
  (rows : List (List Q(«$α»))) (matrix_1 : Q(Matrix (Fin «$m») (Fin «$n») «$α»)) (lit_1 : Q(List (List «$α»)))
  (rows_1 : List (List Q(«$α»))),
  ({ matrix := matrix, lit := lit, rows := rows } = { matrix := matrix_1, lit := lit_1, rows := rows_1 }) =
    (matrix = matrix_1 ∧ lit = lit_1 ∧ rows = rows_1)

def Mathlib.Tactic.Matrix.ListMatrixLit.ctorIdx E1 #

{u : Lean.Level} → {α : Q(Type u)} → {m n : ℕ} → Mathlib.Tactic.Matrix.ListMatrixLit α m n → ℕ

theorem Mathlib.Tactic.Matrix.ListMatrixLit.mk.inj E1 #

∀ {u : Lean.Level} {α : Q(Type u)} {m n : ℕ} {matrix : Q(Matrix (Fin «$m») (Fin «$n») «$α»)} {lit : Q(List (List «$α»))}
  {rows : List (List Q(«$α»))} {matrix_1 : Q(Matrix (Fin «$m») (Fin «$n») «$α»)} {lit_1 : Q(List (List «$α»))}
  {rows_1 : List (List Q(«$α»))},
  { matrix := matrix, lit := lit, rows := rows } = { matrix := matrix_1, lit := lit_1, rows := rows_1 } →
    matrix = matrix_1 ∧ lit = lit_1 ∧ rows = rows_1

structure Mathlib.Tactic.Matrix.ListMatrixLit E1 #

{u : Lean.Level} → Q(Type u) → ℕ → ℕ → Type

Three forms of one list-based matrix literal. This makes the argument list more succinct when a cert construction function needs to use multiple representations.

ctor Mathlib.Tactic.Matrix.ListMatrixLit.mk E0 #

{u : Lean.Level} →
  {α : Q(Type u)} →
    {m n : ℕ} →
      Q(Matrix (Fin «$m») (Fin «$n») «$α») →
        Q(List (List «$α»)) → List (List Q(«$α»)) → Mathlib.Tactic.Matrix.ListMatrixLit α m n

abbrev Mathlib.Tactic.Matrix.ListMatrixLit.matrix E1 #

{u : Lean.Level} →
  {α : Q(Type u)} → {m n : ℕ} → Mathlib.Tactic.Matrix.ListMatrixLit α m n → Q(Matrix (Fin «$m») (Fin «$n») «$α»)

The matrix, the ofLists term on lit.

abbrev Mathlib.Tactic.Matrix.ListMatrixLit.lit E1 #

{u : Lean.Level} → {α : Q(Type u)} → {m n : ℕ} → Mathlib.Tactic.Matrix.ListMatrixLit α m n → Q(List (List «$α»))

The list literal of rows.

abbrev Mathlib.Tactic.Matrix.ListMatrixLit.rows E1 #

{u : Lean.Level} → {α : Q(Type u)} → {m n : ℕ} → Mathlib.Tactic.Matrix.ListMatrixLit α m n → List (List Q(«$α»))

The rows of the matrix.

def Mathlib.Tactic.Matrix.ListMatrixLit.ofRows E1 #

{u : Lean.Level} →
  {α : Q(Type u)} → Q(Zero «$α») → (m n : ℕ) → List (List Q(«$α»)) → Mathlib.Tactic.Matrix.ListMatrixLit α m n

The ListMatrixLit of the matrix with rows rows.

def Mathlib.Tactic.Matrix.ListMatrixLit.ofArray E1 #

{u : Lean.Level} →
  {α : Q(Type u)} → Q(Zero «$α») → (m n : ℕ) → Array (Array Q(«$α»)) → Mathlib.Tactic.Matrix.ListMatrixLit α m n

The ListMatrixLit of the matrix with rows rows, given as an array of rows.

def Mathlib.Tactic.Matrix.certifyRowsEq E3 #

{u : Lean.Level} →
  {α : Q(Type u)} →
    ((a b : Q(«$α»)) → Lean.MetaM Q(«$a» = «$b»)) →
      List (List Q(«$α»)) →
        List (List Q(«$α»)) → Lean.MetaM ((l₁ : Q(List (List «$α»))) × (l₂ : Q(List (List «$α»))) × Q(«$l₁» = «$l₂»))

Prove the row literals of rows₁ and rows₂ equal from the entrywise equations a = b, each proved by proveEq.

def Mathlib.Tactic.Matrix.certifyProductEq E3 #

{u : Lean.Level} →
  {m n : ℕ} →
    {α : Q(Type u)} →
      Option ((a b : Q(«$α»)) → Lean.MetaM Q(«$a» = «$b»)) →
        (cα : Q(AddCommMonoid «$α»)) →
          {zα : Q(Zero «$α»)} →
            {aα : Q(Add «$α»)} →
              {mα : Q(Mul «$α»)} →
                (mulEq : Mathlib.Tactic.Matrix.MulEq zα aα mα m m n) →
                  (U : Mathlib.Tactic.Matrix.ListMatrixLit α m n) →
                    Lean.MetaM
                      (have a := U.matrix;
                      have a_1 := mulEq.B;
                      have a_2 := mulEq.A;
                      Q(Mathlib.Tactic.Matrix.ofLists «$m» «$m» «$a_2» *
                            Mathlib.Tactic.Matrix.ofLists «$m» «$n» «$a_1» =
                          «$a»))

Prove the product ofLists mulEq.A * ofLists mulEq.B = U from the list-based expansion of mulEq.

def Mathlib.Tactic.Matrix.ListMatrixLit.array E1 #

{u : Lean.Level} → {m n : ℕ} → {α : Q(Type u)} → Mathlib.Tactic.Matrix.ListMatrixLit α m n → Q(Array «$α»)

The literal of the row-major array of the entries of the matrix literal L.

def Mathlib.Tactic.Matrix.certifyOfArray E3 #

{u : Lean.Level} →
  {m n : ℕ} →
    {α : Q(Type u)} →
      Q(Zero «$α») →
        (L : Mathlib.Tactic.Matrix.ListMatrixLit α m n) →
          Lean.MetaM
            (have a := L.array;
            have a_1 := L.matrix;
            Q(«$a_1».toArray = «$a»))

Prove that the row-major array of the m × n matrix literal L is the literal L.array.