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.Swaps

5 declarations. Mathlib docs · Source

Permutations from lists of swaps

This file defines the permutations of a list of swaps and provides tactic utilities to certify row permutations of matrix literals corresponding to those swaps.

Main definitions

  • permOfSwaps: the permutation swap a₀ b₀ * swap a₁ b₁ * ⋯ of a list of swaps, with its sign intCast_sign_permOfSwaps.
  • mkSwapsLitQ: build the list literal of the swaps.
  • certifyPermSign, certify the sign of the permutation of swaps.
  • certifyPermEq: certify the row arrangement A.submatrix σ id = Aσ of a matrix literal.

def Mathlib.Tactic.Matrix.permOfSwaps E3 #

{m : Type u_1} → [DecidableEq m] → List (m × m) → Equiv.Perm m

The permutation swap a₀ b₀ * swap a₁ b₁ * ⋯ of the swaps in l.

theorem Mathlib.Tactic.Matrix.intCast_sign_permOfSwaps E3 #

∀ {α : Type u_1} [inst : Ring α] {m : Type u_2} [inst_1 : DecidableEq m] [inst_2 : Fintype m] {l : List (m × m)}
  {k : ℕ},
  (l.all fun p ↦ p.1 != p.2) = true →
    l.length = k → ↑↑(Equiv.Perm.sign (Mathlib.Tactic.Matrix.permOfSwaps l)) = (-1) ^ k

def Mathlib.Tactic.Matrix.mkSwapsLitQ E3 #

(m : ℕ) → Array (ℕ × ℕ) → Lean.MetaM Q(List (Fin «$m» × Fin «$m»))

Build the list literal of the recorded swaps, the argument of permOfSwaps.

def Mathlib.Tactic.Matrix.certifyPermSign E3 #

{u : Lean.Level} →
  {α : Q(Type u)} →
    (rα : Q(CommRing «$α»)) →
      {m : ℕ} →
        (swaps : Q(List (Fin «$m» × Fin «$m»))) →
          ℕ → (s : Q(«$α»)) × Q(↑↑(Equiv.Perm.sign (Mathlib.Tactic.Matrix.permOfSwaps «$swaps»)) = «$s»)

Compute the sign of the permutation of the k swaps swaps with the corresponding proof. The swaps must be between distinct rows, which an elimination guarantees.

def Mathlib.Tactic.Matrix.certifyPermEq E3 #

{u : Lean.Level} →
  {m n : ℕ} →
    {α : Q(Type u)} →
      (A Aσ : Q(Matrix (Fin «$m») (Fin «$n») «$α»)) →
        (σ : Q(Equiv.Perm (Fin «$m»))) → Q(«$A».submatrix (⇑«$σ») id = «$Aσ»)

Prove the row arrangement A.submatrix σ id = Aσ.