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 / V07. Linear algebra

Mathlib.LinearAlgebra.Matrix.Integer

28 declarations. Mathlib docs · Source

Lemmas on integer matrices

Here we collect some results about matrices over ℚ and ℤ.

Main definitions and results

  • Matrix.num, Matrix.den: express a rational matrix A as the quotient of an integer matrix by a (non-zero) natural.

TODO

Consider generalizing these constructions to matrices over localizations of rings (or semirings).

Casts

These results are useful shortcuts because the canonical casting maps out of ℕ, ℤ, and ℚ to suitable types are bare functions, not ring homs, so we cannot apply Matrix.map_mul directly to them.

Denominator of a rational matrix

Compatibility with map

Casts from scalar types

theorem Matrix.map_mul_natCast E0 #

∀ {l : Type u_1} {m : Type u_2} {n : Type u_3} [inst : Fintype m] {α : Type u_4} [inst_1 : NonAssocSemiring α]
  (A : Matrix l m ℕ) (B : Matrix m n ℕ), (A * B).map Nat.cast = A.map Nat.cast * B.map Nat.cast

theorem Matrix.map_mul_intCast E0 #

∀ {l : Type u_1} {m : Type u_2} {n : Type u_3} [inst : Fintype m] {α : Type u_4} [inst_1 : NonAssocRing α]
  (A : Matrix l m ℤ) (B : Matrix m n ℤ), (A * B).map Int.cast = A.map Int.cast * B.map Int.cast

theorem Matrix.map_mul_ratCast E0 #

∀ {l : Type u_1} {m : Type u_2} {n : Type u_3} [inst : Fintype m] {α : Type u_4} [inst_1 : DivisionRing α] [CharZero α]
  (A : Matrix l m ℚ) (B : Matrix m n ℚ), (A * B).map Rat.cast = A.map Rat.cast * B.map Rat.cast

def Matrix.den E1 #

{m : Type u_2} → {n : Type u_3} → [Fintype m] → [Fintype n] → Matrix m n ℚ → ℕ

The denominator of a matrix of rationals (as a Nat, defined as the LCM of the denominators of the entries).

def Matrix.num E1 #

{m : Type u_2} → {n : Type u_3} → [Fintype m] → [Fintype n] → Matrix m n ℚ → Matrix m n ℤ

The numerator of a matrix of rationals (a matrix of integers, defined so that A.num / A.den = A).

theorem Matrix.den_ne_zero E1 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℚ), A.den ≠ 0

theorem Matrix.num_eq_zero_iff E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℚ), A.num = 0 ↔ A = 0

theorem Matrix.den_dvd_iff E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] {A : Matrix m n ℚ} {r : ℕ},
  A.den ∣ r ↔ ∀ (i : m) (j : n), (A i j).den ∣ r

theorem Matrix.num_div_den E1 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℚ) (i : m) (j : n),
  ↑(A.num i j) / ↑A.den = A i j

theorem Matrix.inv_denom_smul_num E1 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℚ),
  (↑A.den)⁻¹ • A.num.map Int.cast = A

theorem Matrix.den_neg E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℚ), (-A).den = A.den

theorem Matrix.num_neg E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℚ), (-A).num = -A.num

theorem Matrix.den_transpose E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℚ), A.transpose.den = A.den

theorem Matrix.num_transpose E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℚ),
  A.transpose.num = A.num.transpose

theorem Matrix.den_map_intCast E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℤ), (A.map Int.cast).den = 1

theorem Matrix.num_map_intCast E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℤ), (A.map Int.cast).num = A

theorem Matrix.den_map_natCast E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℕ), (A.map Nat.cast).den = 1

theorem Matrix.num_map_natCast E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n] (A : Matrix m n ℕ),
  (A.map Nat.cast).num = A.map Nat.cast

theorem Matrix.den_natCast E0 #

∀ {m : Type u_2} [inst : Fintype m] [inst_1 : DecidableEq m] (a : ℕ), (↑a).den = 1

theorem Matrix.num_natCast E0 #

∀ {m : Type u_2} [inst : Fintype m] [inst_1 : DecidableEq m] (a : ℕ), (↑a).num = ↑a

theorem Matrix.den_ofNat E0 #

∀ {m : Type u_2} [inst : Fintype m] [inst_1 : DecidableEq m] (a : ℕ) [inst_2 : a.AtLeastTwo], (OfNat.ofNat a).den = 1

theorem Matrix.num_ofNat E0 #

∀ {m : Type u_2} [inst : Fintype m] [inst_1 : DecidableEq m] (a : ℕ) [inst_2 : a.AtLeastTwo], (OfNat.ofNat a).num = ↑a

theorem Matrix.den_intCast E0 #

∀ {m : Type u_2} [inst : Fintype m] [inst_1 : DecidableEq m] (a : ℤ), (↑a).den = 1

theorem Matrix.num_intCast E0 #

∀ {m : Type u_2} [inst : Fintype m] [inst_1 : DecidableEq m] (a : ℤ), (↑a).num = ↑a

theorem Matrix.den_zero E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n], Matrix.den 0 = 1

theorem Matrix.num_zero E0 #

∀ {m : Type u_2} {n : Type u_3} [inst : Fintype m] [inst_1 : Fintype n], Matrix.num 0 = 0

theorem Matrix.den_one E0 #

∀ {m : Type u_2} [inst : Fintype m] [inst_1 : DecidableEq m], Matrix.den 1 = 1

theorem Matrix.num_one E0 #

∀ {m : Type u_2} [inst : Fintype m] [inst_1 : DecidableEq m], Matrix.num 1 = 1