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

16 declarations. Mathlib docs · Source

theorem Mathlib.Tactic.Matrix.ListMatrix.transpose.match_1.congr_eq_2 E1 #

∀ {α : Type u_1} (motive : List (List α) → Sort u_2) (x : List (List α)) (h_1 : Unit → motive [])
  (h_2 : (row : List α) → (rows : List (List α)) → motive (row :: rows)) (row : List α) (rows : List (List α)),
  x = row :: rows →
    (match x with
      | [] => h_1 ()
      | row :: rows => h_2 row rows) ≍
      h_2 row rows

theorem Mathlib.Tactic.Matrix.ListMatrix.consPad.match_1.congr_eq_1 E1 #

∀ {α : Type u_1} (motive : List α → List (List α) → Sort u_2) (x : List α) (x_1 : List (List α))
  (h_1 : (x : List α) → motive x [])
  (h_2 : (a : α) → (row col : List α) → (cols : List (List α)) → motive (a :: row) (col :: cols))
  (h_3 : (col : List α) → (cols : List (List α)) → motive [] (col :: cols)) (x_2 : List α),
  x = x_2 →
    x_1 = [] →
      (match x, x_1 with
        | x, [] => h_1 x
        | a :: row, col :: cols => h_2 a row col cols
        | [], col :: cols => h_3 col cols) ≍
        h_1 x_2

theorem Mathlib.Tactic.Matrix.ListMatrix.transpose.match_1.congr_eq_1 E1 #

∀ {α : Type u_1} (motive : List (List α) → Sort u_2) (x : List (List α)) (h_1 : Unit → motive [])
  (h_2 : (row : List α) → (rows : List (List α)) → motive (row :: rows)),
  x = [] →
    (match x with
      | [] => h_1 ()
      | row :: rows => h_2 row rows) ≍
      h_1 ()

theorem Mathlib.Tactic.Matrix.ListMatrix.consPad.match_1.congr_eq_3 E1 #

∀ {α : Type u_1} (motive : List α → List (List α) → Sort u_2) (x : List α) (x_1 : List (List α))
  (h_1 : (x : List α) → motive x [])
  (h_2 : (a : α) → (row col : List α) → (cols : List (List α)) → motive (a :: row) (col :: cols))
  (h_3 : (col : List α) → (cols : List (List α)) → motive [] (col :: cols)) (col : List α) (cols : List (List α)),
  x = [] →
    x_1 = col :: cols →
      (match x, x_1 with
        | x, [] => h_1 x
        | a :: row, col :: cols => h_2 a row col cols
        | [], col :: cols => h_3 col cols) ≍
        h_3 col cols

theorem Mathlib.Tactic.Matrix.ListMatrix.consPad.match_1.congr_eq_2 E1 #

∀ {α : Type u_1} (motive : List α → List (List α) → Sort u_2) (x : List α) (x_1 : List (List α))
  (h_1 : (x : List α) → motive x [])
  (h_2 : (a : α) → (row col : List α) → (cols : List (List α)) → motive (a :: row) (col :: cols))
  (h_3 : (col : List α) → (cols : List (List α)) → motive [] (col :: cols)) (a : α) (row col : List α)
  (cols : List (List α)),
  x = a :: row →
    x_1 = col :: cols →
      (match x, x_1 with
        | x, [] => h_1 x
        | a :: row, col :: cols => h_2 a row col cols
        | [], col :: cols => h_3 col cols) ≍
        h_2 a row col cols

def Mathlib.Tactic.Matrix.ListMatrix.dotProduct E1 #

{α : Type u_1} → [Mul α] → [Add α] → [Zero α] → ℕ → List α → List α → α

A term for the sum of exactly n pointwise products of l₁ and l₂ padded with 0. This allows its bridge lemma to be provable without zero_mul, which minimises the instance strength.

theorem Mathlib.Tactic.Matrix.ListMatrix.dotProduct_zero E1 #

∀ {α : Type u_1} [inst : Mul α] [inst_1 : Add α] [inst_2 : Zero α] (l₁ l₂ : List α),
  Mathlib.Tactic.Matrix.ListMatrix.dotProduct 0 l₁ l₂ = 0

theorem Mathlib.Tactic.Matrix.ListMatrix.dotProduct_add_one E1 #

∀ {α : Type u_1} [inst : Mul α] [inst_1 : Add α] [inst_2 : Zero α] (n : ℕ) (l₁ l₂ : List α),
  Mathlib.Tactic.Matrix.ListMatrix.dotProduct (n + 1) l₁ l₂ =
    l₁.headD 0 * l₂.headD 0 + Mathlib.Tactic.Matrix.ListMatrix.dotProduct n l₁.tail l₂.tail

theorem Mathlib.Tactic.Matrix.ListMatrix.dotProduct_add_one_cons_cons E1 #

∀ {α : Type u_1} [inst : Mul α] [inst_1 : Add α] [inst_2 : Zero α] {n : ℕ} (a b : α) {l₁ l₂ : List α} {c : α},
  Mathlib.Tactic.Matrix.ListMatrix.dotProduct n l₁ l₂ = c →
    Mathlib.Tactic.Matrix.ListMatrix.dotProduct (n + 1) (a :: l₁) (b :: l₂) = a * b + c

def Mathlib.Tactic.Matrix.ListMatrix.consPad E1 #

{α : Type u_1} → [Zero α] → List α → List (List α) → List (List α)

A one-pass recursion that prepends the entries of row to the rows of cols, with row padded with 0 when it is shorter. This can be done using List.zipWith + row.rightpad, but that version requires 3 traversals.

theorem Mathlib.Tactic.Matrix.ListMatrix.consPad_eq_zipWith E1 #

∀ {α : Type u_1} [inst : Zero α] (row : List α) (cols : List (List α)),
  Mathlib.Tactic.Matrix.ListMatrix.consPad row cols = List.zipWith List.cons (List.rightpad cols.length 0 row) cols

def Mathlib.Tactic.Matrix.ListMatrix.transpose E1 #

{α : Type u_1} → [Zero α] → ℕ → List (List α) → List (List α)

The transpose of a list of rows as n rows, where row j collects the j-th entries of the input rows padded with 0. Defined by recursion on the rows with explicit padding rather than through Batteries' List.transpose, so that it reduces in the kernel. This is also more efficient as it gives an O(nm) transposition without any random access.

theorem Mathlib.Tactic.Matrix.ListMatrix.length_transpose E0 #

∀ {α : Type u_1} [inst : Zero α] (n : ℕ) (rows : List (List α)),
  (Mathlib.Tactic.Matrix.ListMatrix.transpose n rows).length = n

theorem Mathlib.Tactic.Matrix.ListMatrix.getD_transpose E1 #

∀ {α : Type u_1} [inst : Zero α] {n j : ℕ} (rows : List (List α)) (i : ℕ),
  j < n → ((Mathlib.Tactic.Matrix.ListMatrix.transpose n rows).getD j []).getD i 0 = (rows.getD i []).getD j 0

def Mathlib.Tactic.Matrix.ListMatrix.mul E1 #

{α : Type u_1} → [Mul α] → [Add α] → [Zero α] → ℕ → ℕ → ℕ → List (List α) → List (List α) → List (List α)

The product of two lists of rows as l rows of n entries. Each entry is a dot product of m terms, with A and B read as an l × m and an m × n matrix respectively.

theorem Mathlib.Tactic.Matrix.ListMatrix.getD_mul E1 #

∀ {α : Type u_1} [inst : Mul α] [inst_1 : Add α] [inst_2 : Zero α] {l m n i j : ℕ} (A B : List (List α)),
  i < l →
    j < n →
      ((Mathlib.Tactic.Matrix.ListMatrix.mul l m n A B).getD i []).getD j 0 =
        Mathlib.Tactic.Matrix.ListMatrix.dotProduct m (A.getD i [])
          ((Mathlib.Tactic.Matrix.ListMatrix.transpose n B).getD j [])