The areas / V07. Linear algebra
Mathlib.LinearAlgebra.Matrix.Swap
21 declarations. Mathlib docs · Source
Swap matrices
A swap matrix indexed by i and j is the matrix that, when multiplying another matrix
on the left (resp. on the right), swaps the i-th row with the j-th row
(resp. the i-th column with the j-th column).
Swap matrices are a special case of elementary matrices. For transvections see
Mathlib/LinearAlgebra/Matrix/Transvection.lean.
Implementation detail
This is a thin wrapper around (Equiv.swap i j).permMatrix.
theorem Matrix.swap.congr_simp E1 #
∀ (R : Type u_1) {n : Type u_2} [inst : Zero R] [inst_1 : One R] {inst_2 : DecidableEq n} [inst_3 : DecidableEq n]
(i i_1 : n),
i = i_1 →
∀ (j j_1 : n),
j = j_1 →
∀ (a a_1 : n), a = a_1 → ∀ (a_2 a_3 : n), a_2 = a_3 → Matrix.swap R i j a a_2 = Matrix.swap R i_1 j_1 a_1 a_3
def Matrix.swap E1 #
(R : Type u_1) → {n : Type u_2} → [Zero R] → [One R] → [DecidableEq n] → n → n → Matrix n n R
The swap matrix swap R i j is the identity matrix with the
i-th and j-th rows modified such that multiplying by it on the
left (resp. right) corresponds to swapping the i-th and j-th row (resp. column).
theorem Matrix.swap_comm E1 #
∀ {R : Type u_1} {n : Type u_2} [inst : Zero R] [inst_1 : One R] [inst_2 : DecidableEq n] (i j : n),
Matrix.swap R i j = Matrix.swap R j i
theorem Matrix.transpose_swap E0 #
∀ {R : Type u_1} {n : Type u_2} [inst : Zero R] [inst_1 : One R] [inst_2 : DecidableEq n] (i j : n),
(Matrix.swap R i j).transpose = Matrix.swap R i j
theorem Matrix.isSymm_swap E1 #
∀ {R : Type u_1} {n : Type u_2} [inst : Zero R] [inst_1 : One R] [inst_2 : DecidableEq n] (i j : n),
(Matrix.swap R i j).IsSymm
theorem Matrix.conjTranspose_swap E0 #
∀ {n : Type u_2} [inst : DecidableEq n] {R : Type u_3} [inst_1 : NonAssocSemiring R] [inst_2 : StarRing R] (i j : n),
(Matrix.swap R i j).conjTranspose = Matrix.swap R i j
theorem Matrix.map_swap E0 #
∀ {R : Type u_1} {n : Type u_2} [inst : Semiring R] [inst_1 : DecidableEq n] {S : Type u_4}
[inst_2 : NonAssocSemiring S] (f : R →+* S) (i j : n), (Matrix.swap R i j).map ⇑f = Matrix.swap S i j
theorem Matrix.swap_mulVec E1 #
∀ {R : Type u_1} {n : Type u_2} [inst : Semiring R] [inst_1 : DecidableEq n] [inst_2 : Fintype n] (i j : n) (a : n → R),
(Matrix.swap R i j).mulVec a = a ∘ ⇑(Equiv.swap i j)
theorem Matrix.vecMul_swap E1 #
∀ {R : Type u_1} {n : Type u_2} [inst : Semiring R] [inst_1 : DecidableEq n] [inst_2 : Fintype n] (i j : n) (a : n → R),
Matrix.vecMul a (Matrix.swap R i j) = a ∘ ⇑(Equiv.swap i j)
theorem Matrix.swap_mulVec_apply E0 #
∀ {R : Type u_1} {n : Type u_2} [inst : Semiring R] [inst_1 : DecidableEq n] [inst_2 : Fintype n] (i j : n) (a : n → R),
(Matrix.swap R i j).mulVec a i = a j
theorem Matrix.vecMul_swap_apply E0 #
∀ {R : Type u_1} {n : Type u_2} [inst : Semiring R] [inst_1 : DecidableEq n] [inst_2 : Fintype n] (i j : n) (a : n → R),
Matrix.vecMul a (Matrix.swap R i j) i = a j
theorem Matrix.swap_mul_apply_left E0 #
∀ {R : Type u_1} {n : Type u_2} {m : Type u_3} [inst : Semiring R] [inst_1 : DecidableEq n] [inst_2 : Fintype n]
(i j : n) (a : m) (g : Matrix n m R), (Matrix.swap R i j * g) i a = g j a
Multiplying with swap R i j on the left swaps the i-th row with the j-th row.
theorem Matrix.swap_mul_apply_right E0 #
∀ {R : Type u_1} {n : Type u_2} {m : Type u_3} [inst : Semiring R] [inst_1 : DecidableEq n] [inst_2 : Fintype n]
(i j : n) (a : m) (g : Matrix n m R), (Matrix.swap R i j * g) j a = g i a
Multiplying with swap R i j on the left swaps the j-th row with the i-th row.
theorem Matrix.swap_mul_of_ne E1 #
∀ {R : Type u_1} {n : Type u_2} {m : Type u_3} [inst : Semiring R] [inst_1 : DecidableEq n] [inst_2 : Fintype n]
{i j a : n} {b : m}, a ≠ i → a ≠ j → ∀ (g : Matrix n m R), (Matrix.swap R i j * g) a b = g a b
theorem Matrix.mul_swap_apply_left E0 #
∀ {R : Type u_1} {n : Type u_2} {m : Type u_3} [inst : Semiring R] [inst_1 : DecidableEq n] [inst_2 : Fintype n]
(i j : n) (a : m) (g : Matrix m n R), (g * Matrix.swap R i j) a i = g a j
Multiplying with swap R i j on the right swaps the i-th column with the j-th column.
theorem Matrix.mul_swap_apply_right E0 #
∀ {R : Type u_1} {n : Type u_2} {m : Type u_3} [inst : Semiring R] [inst_1 : DecidableEq n] [inst_2 : Fintype n]
(i j : n) (a : m) (g : Matrix m n R), (g * Matrix.swap R i j) a j = g a i
Multiplying with swap R i j on the right swaps the j-th column with the i-th column.
theorem Matrix.mul_swap_of_ne E1 #
∀ {R : Type u_1} {n : Type u_2} {m : Type u_3} [inst : Semiring R] [inst_1 : DecidableEq n] [inst_2 : Fintype n]
{i j b : n} {a : m}, b ≠ i → b ≠ j → ∀ (g : Matrix m n R), (g * Matrix.swap R i j) a b = g a b
theorem Matrix.swap_mul_self E1 #
∀ {R : Type u_1} {n : Type u_2} [inst : Semiring R] [inst_1 : DecidableEq n] [inst_2 : Fintype n] (i j : n),
Matrix.swap R i j * Matrix.swap R i j = 1
Swap matrices are self inverse.
def Matrix.GeneralLinearGroup.swap E1 #
(R : Type u_1) → {n : Type u_2} → [inst : CommRing R] → [inst_1 : DecidableEq n] → [inst_2 : Fintype n] → n → n → GL n R
Matrix.swap as an element of GL n R.
theorem Matrix.GeneralLinearGroup.val_swap E0 #
∀ (R : Type u_1) {n : Type u_2} [inst : CommRing R] [inst_1 : DecidableEq n] [inst_2 : Fintype n] (i j : n),
↑(Matrix.GeneralLinearGroup.swap R i j) = Matrix.swap R i j
theorem Matrix.GeneralLinearGroup.map_swap E0 #
∀ {R : Type u_1} {n : Type u_2} [inst : CommRing R] [inst_1 : DecidableEq n] [inst_2 : Fintype n] {S : Type u_3}
[inst_3 : CommRing S] (f : R →+* S) (i j : n),
(Matrix.GeneralLinearGroup.map f) (Matrix.GeneralLinearGroup.swap R i j) = Matrix.GeneralLinearGroup.swap S i j