The areas / V34. The tactics of Mathlib
Mathlib.Tactic.Echelon.Cert
17 declarations. Mathlib docs · Source
Certificate construction for the Bareiss decomposition
certifyDecomposition constructs a proof of Echelon.Decomposition A L σ pivot from the given
decomposition data.
It proves that L * A_σ has the given pivots (through the product L * A_σ = U), and that L
is lower triangular with nonzero diagonal entries.
The certify* functions assemble these proofs from facts about single entries, including the
arithmetic equalities for the product and the non-zeroness for the diagonal entries of L and
the pivots of U, which are established by the model's certifier (or the kernel).
Main definitions
certifyDecomposition: builds theEchelon.Decompositioncertificate from decomposition data.DecompositionCert: the internal certificate structure that includes the decomposition data,Uand the product equation for downstream tactics.
Implementation notes
The elimination records its echelon form U, making the product L * A_σ = U a certificate
obligation of its own.
The product is proved on the list representation which the kernel checks more cheaply.
def Mathlib.Tactic.Echelon.DecompositionCert.ctorIdx E1 #
{u : Lean.Level} →
{m n : ℕ} →
{α : Q(Type u)} →
{rα : Q(CommRing «$α»)} →
{A : Q(Matrix (Fin «$m») (Fin «$n») «$α»)} → Mathlib.Tactic.Echelon.DecompositionCert rα A → ℕ
theorem Mathlib.Tactic.Echelon.DecompositionCert.mk.injEq E0 #
∀ {u : Lean.Level} {m n : ℕ} {α : Q(Type u)} {rα : Q(CommRing «$α»)} {A : Q(Matrix (Fin «$m») (Fin «$n») «$α»)}
(L : Mathlib.Tactic.Matrix.ListMatrixLit α m m) (swaps : Q(List (Fin «$m» × Fin «$m»)))
(pivot : Q(Fin «$m» → WithTop (Fin «$n»)))
(decomp :
let a := L.matrix;
Q(Echelon.Decomposition «$A» unknown_1 (Mathlib.Tactic.Matrix.permOfSwaps «$swaps») «$pivot»))
(U : Mathlib.Tactic.Matrix.ListMatrixLit α m n)
(mul_eq :
let a := U.matrix;
let a_1 := L.matrix;
Q(unknown_1 * «$A».submatrix (⇑(Mathlib.Tactic.Matrix.permOfSwaps «$swaps»)) id = unknown_2))
(L_1 : Mathlib.Tactic.Matrix.ListMatrixLit α m m) (swaps_1 : Q(List (Fin «$m» × Fin «$m»)))
(pivot_1 : Q(Fin «$m» → WithTop (Fin «$n»)))
(decomp_1 :
let a := L_1.matrix;
Q(Echelon.Decomposition «$A» unknown_3 (Mathlib.Tactic.Matrix.permOfSwaps «$swaps_1») «$pivot_1»))
(U_1 : Mathlib.Tactic.Matrix.ListMatrixLit α m n)
(mul_eq_1 :
let a := U_1.matrix;
let a_1 := L_1.matrix;
Q(unknown_3 * «$A».submatrix (⇑(Mathlib.Tactic.Matrix.permOfSwaps «$swaps_1»)) id = unknown_4)),
({ L := L, swaps := swaps, pivot := pivot, decomp := decomp, U := U, mul_eq := mul_eq } =
{ L := L_1, swaps := swaps_1, pivot := pivot_1, decomp := decomp_1, U := U_1, mul_eq := mul_eq_1 }) =
(L = L_1 ∧ swaps = swaps_1 ∧ pivot = pivot_1 ∧ decomp = decomp_1 ∧ U = U_1 ∧ mul_eq = mul_eq_1)
theorem Mathlib.Tactic.Echelon.DecompositionCert.mk.inj E1 #
∀ {u : Lean.Level} {m n : ℕ} {α : Q(Type u)} {rα : Q(CommRing «$α»)} {A : Q(Matrix (Fin «$m») (Fin «$n») «$α»)}
{L : Mathlib.Tactic.Matrix.ListMatrixLit α m m} {swaps : Q(List (Fin «$m» × Fin «$m»))}
{pivot : Q(Fin «$m» → WithTop (Fin «$n»))}
{decomp :
let a := L.matrix;
Q(Echelon.Decomposition «$A» unknown_1 (Mathlib.Tactic.Matrix.permOfSwaps «$swaps») «$pivot»)}
{U : Mathlib.Tactic.Matrix.ListMatrixLit α m n}
{mul_eq :
let a := U.matrix;
let a_1 := L.matrix;
Q(unknown_1 * «$A».submatrix (⇑(Mathlib.Tactic.Matrix.permOfSwaps «$swaps»)) id = unknown_2)}
{L_1 : Mathlib.Tactic.Matrix.ListMatrixLit α m m} {swaps_1 : Q(List (Fin «$m» × Fin «$m»))}
{pivot_1 : Q(Fin «$m» → WithTop (Fin «$n»))}
{decomp_1 :
let a := L_1.matrix;
Q(Echelon.Decomposition «$A» unknown_3 (Mathlib.Tactic.Matrix.permOfSwaps «$swaps_1») «$pivot_1»)}
{U_1 : Mathlib.Tactic.Matrix.ListMatrixLit α m n}
{mul_eq_1 :
let a := U_1.matrix;
let a_1 := L_1.matrix;
Q(unknown_3 * «$A».submatrix (⇑(Mathlib.Tactic.Matrix.permOfSwaps «$swaps_1»)) id = unknown_4)},
{ L := L, swaps := swaps, pivot := pivot, decomp := decomp, U := U, mul_eq := mul_eq } =
{ L := L_1, swaps := swaps_1, pivot := pivot_1, decomp := decomp_1, U := U_1, mul_eq := mul_eq_1 } →
L = L_1 ∧ swaps = swaps_1 ∧ pivot = pivot_1 ∧ decomp = decomp_1 ∧ U = U_1 ∧ mul_eq = mul_eq_1
def Mathlib.Tactic.Echelon.decideCertifier E1 #
{u : Lean.Level} → (α : Q(Type u)) → Mathlib.Tactic.Echelon.EntryCertifier α
The certifier that leaves each fact to the kernel's decide.
def Mathlib.Tactic.Echelon.certifyLowerTriangularDiagList E1 #
{u : Lean.Level} →
{α : Q(Type u)} →
Mathlib.Tactic.Echelon.EntryCertifier α →
(zα : Q(Zero «$α»)) →
ℕ →
ℕ →
(kQ cQ : Q(ℕ)) →
(rows : Q(List (List «$α»))) →
Lean.MetaM Q(Mathlib.Tactic.Echelon.IsLowerTriangularDiagList «$kQ» «$cQ» «$rows»)
Construct the list-based IsLowerTriangularDiagList k c rows cert.
def Mathlib.Tactic.Echelon.certifyLowerTriangularDiag E1 #
{u : Lean.Level} →
{m : ℕ} →
{α : Q(Type u)} →
Mathlib.Tactic.Echelon.EntryCertifier α →
(zα : Q(Zero «$α»)) →
(L : Mathlib.Tactic.Matrix.ListMatrixLit α m m) →
Lean.MetaM
((have a := L.matrix;
Q(«$a».IsLowerTriangular)) ×
have a := L.matrix;
Q(∀ (i : Fin «$m»), «$a».diag i ≠ 0))
Prove that L is lower triangular with a nonzero diagonal.
def Mathlib.Tactic.Echelon.certifyPivotedList E1 #
{u : Lean.Level} →
{n : ℕ} →
{α : Q(Type u)} →
Mathlib.Tactic.Echelon.EntryCertifier α →
(zα : Q(Zero «$α»)) →
List ℕ →
(pivots : Q(List (Fin «$n»))) →
(rows : Q(List (List «$α»))) → Lean.MetaM Q(Mathlib.Tactic.Echelon.IsPivotedList «$pivots» «$rows»)
Construct the list-based IsPivotedList pivots rows cert.
def Mathlib.Tactic.Echelon.certifyPivotedBy E1 #
{u : Lean.Level} →
{m n : ℕ} →
{α : Q(Type u)} →
Mathlib.Tactic.Echelon.EntryCertifier α →
(zα : Q(Zero «$α»)) →
(U : Mathlib.Tactic.Matrix.ListMatrixLit α m n) →
List ℕ →
(pivots : Q(List (Fin «$n»))) →
Lean.MetaM
(have a := U.matrix;
Q(«$a».IsPivotedBy fun i ↦ Mathlib.Tactic.Echelon.pivotOfList «$pivots» ↑i))
Prove that U is pivoted by pivotOfList pivots from the rows of U, with certifier
proving the pivot entries nonzero.
structure Mathlib.Tactic.Echelon.DecompositionCert E3 #
{u : Lean.Level} → {m n : ℕ} → {α : Q(Type u)} → Q(CommRing «$α») → Q(Matrix (Fin «$m») (Fin «$n») «$α») → Type
An internal structure recording the Echelon.Decomposition certificate of A with its data,
together with the intermediate certificates that downstream tactics reuse (the echelon form U
and the product equation stated on it).
ctor Mathlib.Tactic.Echelon.DecompositionCert.mk E0 #
{u : Lean.Level} →
{m n : ℕ} →
{α : Q(Type u)} →
{rα : Q(CommRing «$α»)} →
{A : Q(Matrix (Fin «$m») (Fin «$n») «$α»)} →
(L : Mathlib.Tactic.Matrix.ListMatrixLit α m m) →
(swaps : Q(List (Fin «$m» × Fin «$m»))) →
(pivot : Q(Fin «$m» → WithTop (Fin «$n»))) →
(let a := L.matrix;
Q(Echelon.Decomposition «$A» unknown_1 (Mathlib.Tactic.Matrix.permOfSwaps «$swaps») «$pivot»)) →
(U : Mathlib.Tactic.Matrix.ListMatrixLit α m n) →
(let a := U.matrix;
let a_1 := L.matrix;
Q(unknown_1 * «$A».submatrix (⇑(Mathlib.Tactic.Matrix.permOfSwaps «$swaps»)) id = unknown_2)) →
Mathlib.Tactic.Echelon.DecompositionCert rα A
abbrev Mathlib.Tactic.Echelon.DecompositionCert.L E1 #
{u : Lean.Level} →
{m n : ℕ} →
{α : Q(Type u)} →
{rα : Q(CommRing «$α»)} →
{A : Q(Matrix (Fin «$m») (Fin «$n») «$α»)} →
Mathlib.Tactic.Echelon.DecompositionCert rα A → Mathlib.Tactic.Matrix.ListMatrixLit α m m
The transformation matrix.
abbrev Mathlib.Tactic.Echelon.DecompositionCert.swaps E1 #
{u : Lean.Level} →
{m n : ℕ} →
{α : Q(Type u)} →
{rα : Q(CommRing «$α»)} →
{A : Q(Matrix (Fin «$m») (Fin «$n») «$α»)} →
Mathlib.Tactic.Echelon.DecompositionCert rα A → Q(List (Fin «$m» × Fin «$m»))
The row swaps.
abbrev Mathlib.Tactic.Echelon.DecompositionCert.pivot E1 #
{u : Lean.Level} →
{m n : ℕ} →
{α : Q(Type u)} →
{rα : Q(CommRing «$α»)} →
{A : Q(Matrix (Fin «$m») (Fin «$n») «$α»)} →
Mathlib.Tactic.Echelon.DecompositionCert rα A → Q(Fin «$m» → WithTop (Fin «$n»))
The pivot of the resulting echelon form.
abbrev Mathlib.Tactic.Echelon.DecompositionCert.decomp E1 #
{u : Lean.Level} →
{m n : ℕ} →
{α : Q(Type u)} →
{rα : Q(CommRing «$α»)} →
{A : Q(Matrix (Fin «$m») (Fin «$n») «$α»)} →
(self : Mathlib.Tactic.Echelon.DecompositionCert rα A) →
let a := self.L.matrix;
Q(Echelon.Decomposition «$A» unknown_1 (Mathlib.Tactic.Matrix.permOfSwaps unknown_2) unknown_3)
The decomposition certificate from the theory.
abbrev Mathlib.Tactic.Echelon.DecompositionCert.U E1 #
{u : Lean.Level} →
{m n : ℕ} →
{α : Q(Type u)} →
{rα : Q(CommRing «$α»)} →
{A : Q(Matrix (Fin «$m») (Fin «$n») «$α»)} →
Mathlib.Tactic.Echelon.DecompositionCert rα A → Mathlib.Tactic.Matrix.ListMatrixLit α m n
The echelon form.
abbrev Mathlib.Tactic.Echelon.DecompositionCert.mul_eq E0 #
{u : Lean.Level} →
{m n : ℕ} →
{α : Q(Type u)} →
{rα : Q(CommRing «$α»)} →
{A : Q(Matrix (Fin «$m») (Fin «$n») «$α»)} →
(self : Mathlib.Tactic.Echelon.DecompositionCert rα A) →
let a := self.U.matrix;
let a_1 := self.L.matrix;
Q(unknown_1 * «$A».submatrix (⇑(Mathlib.Tactic.Matrix.permOfSwaps unknown_2)) id = unknown_3)
The product equation.
def Mathlib.Tactic.Echelon.certifyDecomposition E3 #
{u : Lean.Level} →
{m n : ℕ} →
{α : Q(Type u)} →
Option (Mathlib.Tactic.Echelon.EntryCertifier α) →
(rα : Q(CommRing «$α»)) →
(A : Q(Matrix (Fin «$m») (Fin «$n») «$α»)) →
Array (Array Q(«$α»)) →
Mathlib.Tactic.Echelon.BareissData Q(«$α») → Lean.MetaM (Mathlib.Tactic.Echelon.DecompositionCert rα A)
Build the DecompositionCert of A from the decomposition data and the parsed entries
of A.