Diagonal matrices #
This file defines diagonal matrices and the AddCommMonoidWithOne structure on matrices.
Main definitions #
Matrix.diagonal d: matrix with the vectordalong the diagonalMatrix.diag M: the diagonal of a square matrixMatrix.instAddCommMonoidWithOne: matrices are an additive commutative monoid with one
def
Matrix.diagonal
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
(d : n ā α)
:
Matrix n n α
diagonal d is the square matrix such that (diagonal d) i i = d i and (diagonal d) i j = 0
if i ā j.
Note that bundled versions exist as:
Instances For
theorem
Matrix.diagonal_apply
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
(d : n ā α)
(i j : n)
:
diagonal d i j = if i = j then d i else 0
@[simp]
theorem
Matrix.diagonal_apply_eq
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
(d : n ā α)
(i : n)
:
diagonal d i i = d i
@[simp]
theorem
Matrix.diagonal_apply_ne
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
(d : n ā α)
{i j : n}
(h : i ā j)
:
diagonal d i j = 0
theorem
Matrix.diagonal_apply_ne'
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
(d : n ā α)
{i j : n}
(h : j ā i)
:
diagonal d i j = 0
@[simp]
theorem
Matrix.diagonal_eq_diagonal_iff
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
{dā dā : n ā α}
:
theorem
Matrix.diagonal_injective
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
:
Function.Injective diagonal
@[simp]
theorem
Matrix.diagonal_zero
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
:
(diagonal fun (x : n) => 0) = 0
@[simp]
theorem
Matrix.diagonal_zero'
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
:
diagonal 0 = 0
@[simp]
theorem
Matrix.diagonal_eq_zero
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
{d : n ā α}
:
diagonal d = 0 ā d = 0
@[simp]
@[simp]
theorem
Matrix.diagonal_add
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddZeroClass α]
(dā dā : n ā α)
:
@[simp]
theorem
Matrix.diagonal_smul
{n : Type u_3}
{R : Type u_7}
{α : Type v}
[DecidableEq n]
[Zero α]
[SMulZeroClass R α]
(r : R)
(d : n ā α)
:
@[simp]
theorem
Matrix.diagonal_neg
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[NegZeroClass α]
(d : n ā α)
:
@[simp]
theorem
Matrix.diagonal_sub
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[SubNegZeroMonoid α]
(dā dā : n ā α)
:
@[implicit_reducible]
instance
Matrix.instNatCastOfZero
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[NatCast α]
:
NatCast (Matrix n n α)
theorem
Matrix.diagonal_natCast
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[NatCast α]
(m : ā)
:
(diagonal fun (x : n) => ām) = ām
theorem
Matrix.diagonal_natCast'
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[NatCast α]
(m : ā)
:
diagonal ām = ām
@[simp]
theorem
Matrix.diagonal_eq_natCast
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[NatCast α]
{d : n ā α}
{m : ā}
:
diagonal d = ām ā d = ām
theorem
Matrix.diagonal_ofNat
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[NatCast α]
(m : ā)
[m.AtLeastTwo]
:
(diagonal fun (x : n) => OfNat.ofNat m) = OfNat.ofNat m
theorem
Matrix.diagonal_ofNat'
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[NatCast α]
(m : ā)
[m.AtLeastTwo]
:
diagonal (OfNat.ofNat m) = OfNat.ofNat m
@[simp]
theorem
Matrix.diagonal_eq_ofNat
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[NatCast α]
{d : n ā α}
{m : ā}
[m.AtLeastTwo]
:
diagonal d = OfNat.ofNat m ā d = OfNat.ofNat m
@[implicit_reducible]
instance
Matrix.instIntCastOfZero
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[IntCast α]
:
IntCast (Matrix n n α)
theorem
Matrix.diagonal_intCast
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[IntCast α]
(m : ā¤)
:
(diagonal fun (x : n) => ām) = ām
theorem
Matrix.diagonal_intCast'
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[IntCast α]
(m : ā¤)
:
diagonal ām = ām
@[simp]
theorem
Matrix.diagonal_eq_intCast
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[IntCast α]
{d : n ā α}
{m : ā¤}
:
diagonal d = ām ā d = ām
@[simp]
theorem
Matrix.map_natCast
{n : Type u_3}
{α : Type v}
{β : Type w}
[DecidableEq n]
[AddMonoidWithOne α]
[Zero β]
{f : α ā β}
(h : f 0 = 0)
(d : ā)
:
theorem
Matrix.map_ofNat
{n : Type u_3}
{α : Type v}
{β : Type w}
[DecidableEq n]
[AddMonoidWithOne α]
[Zero β]
{f : α ā β}
(h : f 0 = 0)
(d : ā)
[d.AtLeastTwo]
:
theorem
Matrix.natCast_apply
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddMonoidWithOne α]
{i j : n}
{d : ā}
:
ād i j = ā(if i = j then d else 0)
theorem
Matrix.ofNat_apply
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddMonoidWithOne α]
{i j : n}
{d : ā}
[d.AtLeastTwo]
:
(OfNat.ofNat d) i j = ā(if i = j then d else 0)
theorem
Matrix.map_intCast
{n : Type u_3}
{α : Type v}
{β : Type w}
[DecidableEq n]
[AddGroupWithOne α]
[Zero β]
{f : α ā β}
(h : f 0 = 0)
(d : ā¤)
:
theorem
Matrix.intCast_apply
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddGroupWithOne α]
{i j : n}
{d : ā¤}
:
ād i j = ā(if i = j then d else 0)
@[simp]
@[simp]
@[implicit_reducible]
instance
Matrix.one
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[One α]
:
One (Matrix n n α)
@[simp]
theorem
Matrix.diagonal_one
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[One α]
:
(diagonal fun (x : n) => 1) = 1
@[simp]
theorem
Matrix.diagonal_one'
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[One α]
:
diagonal 1 = 1
@[simp]
theorem
Matrix.diagonal_eq_one
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[One α]
{d : n ā α}
:
diagonal d = 1 ā d = 1
theorem
Matrix.one_apply
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[One α]
{i j : n}
:
1 i j = if i = j then 1 else 0
@[simp]
theorem
Matrix.one_apply_eq
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[One α]
(i : n)
:
1 i i = 1
@[simp]
theorem
Matrix.one_apply_ne
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[One α]
{i j : n}
:
i ā j ā 1 i j = 0
theorem
Matrix.one_apply_ne'
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[One α]
{i j : n}
:
j ā i ā 1 i j = 0
@[simp]
theorem
Matrix.map_one
{n : Type u_3}
{α : Type v}
{β : Type w}
[DecidableEq n]
[Zero α]
[One α]
[Zero β]
[One β]
(f : α ā β)
(hā : f 0 = 0)
(hā : f 1 = 1)
:
map 1 f = 1
theorem
Matrix.one_eq_pi_single
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[One α]
{i j : n}
:
1 i j = Pi.single i 1 j
@[implicit_reducible]
instance
Matrix.instAddMonoidWithOne
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddMonoidWithOne α]
:
AddMonoidWithOne (Matrix n n α)
@[implicit_reducible]
instance
Matrix.instAddGroupWithOne
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddGroupWithOne α]
:
AddGroupWithOne (Matrix n n α)
@[implicit_reducible]
instance
Matrix.instAddCommMonoidWithOne
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddCommMonoidWithOne α]
:
AddCommMonoidWithOne (Matrix n n α)
@[implicit_reducible]
instance
Matrix.instAddCommGroupWithOne
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddCommGroupWithOne α]
:
AddCommGroupWithOne (Matrix n n α)
The diagonal of a square matrix.
Instances For
@[simp]
theorem
Matrix.diag_apply
{n : Type u_3}
{α : Type v}
(A : Matrix n n α)
(i : n)
:
A.diag i = A i i
@[simp]
theorem
Matrix.diag_diagonal
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
(a : n ā α)
:
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem
Matrix.transpose_one
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[One α]
:
transpose 1 = 1
@[simp]
theorem
Matrix.transpose_eq_one
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[Zero α]
[One α]
{M : Matrix n n α}
:
M.transpose = 1 ā M = 1
@[simp]
theorem
Matrix.transpose_natCast
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddMonoidWithOne α]
(d : ā)
:
(ād).transpose = ād
@[simp]
theorem
Matrix.transpose_eq_natCast
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddMonoidWithOne α]
{M : Matrix n n α}
{d : ā}
:
M.transpose = ād ā M = ād
@[simp]
theorem
Matrix.transpose_ofNat
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddMonoidWithOne α]
(d : ā)
[d.AtLeastTwo]
:
(OfNat.ofNat d).transpose = OfNat.ofNat d
@[simp]
theorem
Matrix.transpose_eq_ofNat
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddMonoidWithOne α]
{M : Matrix n n α}
{d : ā}
[d.AtLeastTwo]
:
M.transpose = OfNat.ofNat d ā M = OfNat.ofNat d
@[simp]
theorem
Matrix.transpose_intCast
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddGroupWithOne α]
(d : ā¤)
:
(ād).transpose = ād
@[simp]
theorem
Matrix.transpose_eq_intCast
{n : Type u_3}
{α : Type v}
[DecidableEq n]
[AddGroupWithOne α]
{M : Matrix n n α}
{d : ā¤}
:
M.transpose = ād ā M = ād
theorem
Matrix.submatrix_diagonal
{l : Type u_1}
{m : Type u_2}
{α : Type v}
[Zero α]
[DecidableEq m]
[DecidableEq l]
(d : m ā α)
(e : l ā m)
(he : Function.Injective e)
:
Given a (m Ć m) diagonal matrix defined by a map d : m ā α, if the reindexing map e is
injective, then the resulting matrix is again diagonal.
theorem
Matrix.submatrix_one
{l : Type u_1}
{m : Type u_2}
{α : Type v}
[Zero α]
[One α]
[DecidableEq m]
[DecidableEq l]
(e : l ā m)
(he : Function.Injective e)
:
submatrix 1 e e = 1
simp lemmas for Matrix.submatrixs interaction with Matrix.diagonal, 1, and Matrix.mul
for when the mappings are bundled.
@[simp]
@[simp]
@[simp]
@[simp]