Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 907147a

Browse files
author
Oliver Nash
committed
feat(linear_algebra/matrix): define equivalences for reindexing matrices with equivalent types (#3409)
1 parent 06823d6 commit 907147a

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

src/algebra/lie_algebra.lean

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,24 @@ by simp [linear_equiv.conj_apply, matrix.lie_conj, matrix.comp_to_matrix_mul, to
813813
(P.lie_conj h).symm A = P⁻¹ ⬝ A ⬝ P :=
814814
by simp [linear_equiv.symm_conj_apply, matrix.lie_conj, matrix.comp_to_matrix_mul, to_lin_to_matrix]
815815

816+
/-- For square matrices, the natural map that reindexes a matrix's rows and columns with equivalent
817+
types is an equivalence of Lie algebras. -/
818+
def matrix.reindex_lie_equiv {m : Type w₁} [fintype m] [decidable_eq m]
819+
(e : n ≃ m) : matrix n n R ≃ₗ⁅R⁆ matrix m m R :=
820+
{ map_lie := λ M N, by simp only [lie_ring.of_associative_ring_bracket, matrix.reindex_mul,
821+
matrix.mul_eq_mul, linear_equiv.map_sub, linear_equiv.to_fun_apply],
822+
..(matrix.reindex_linear_equiv e e) }
823+
824+
@[simp] lemma matrix.reindex_lie_equiv_apply {m : Type w₁} [fintype m] [decidable_eq m]
825+
(e : n ≃ m) (M : matrix n n R) :
826+
matrix.reindex_lie_equiv e M = λ i j, M (e.symm i) (e.symm j) :=
827+
rfl
828+
829+
@[simp] lemma matrix.reindex_lie_equiv_symm_apply {m : Type w₁} [fintype m] [decidable_eq m]
830+
(e : n ≃ m) (M : matrix m m R) :
831+
(matrix.reindex_lie_equiv e).symm M = λ i j, M (e i) (e j) :=
832+
rfl
833+
816834
end matrices
817835

818836
section skew_adjoint_endomorphisms

src/linear_algebra/matrix.lean

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,75 @@ by rw [@linear_equiv.findim_eq R (matrix m n R) _ _ _ _ _ _ (linear_equiv.uncurr
413413

414414
end finite_dimensional
415415

416+
section reindexing
417+
418+
variables {l' m' n' : Type w} [fintype l'] [fintype m'] [fintype n']
419+
variables {R : Type v}
420+
421+
/-- The natural map that reindexes a matrix's rows and columns with equivalent types is an
422+
equivalence. -/
423+
def reindex (eₘ : m ≃ m') (eₙ : n ≃ n') : matrix m n R ≃ matrix m' n' R :=
424+
{ to_fun := λ M i j, M (eₘ.symm i) (eₙ.symm j),
425+
inv_fun := λ M i j, M (eₘ i) (eₙ j),
426+
left_inv := λ M, by simp,
427+
right_inv := λ M, by simp, }
428+
429+
@[simp] lemma reindex_apply (eₘ : m ≃ m') (eₙ : n ≃ n') (M : matrix m n R) :
430+
reindex eₘ eₙ M = λ i j, M (eₘ.symm i) (eₙ.symm j) :=
431+
rfl
432+
433+
@[simp] lemma reindex_symm_apply (eₘ : m ≃ m') (eₙ : n ≃ n') (M : matrix m' n' R) :
434+
(reindex eₘ eₙ).symm M = λ i j, M (eₘ i) (eₙ j) :=
435+
rfl
436+
437+
/-- The natural map that reindexes a matrix's rows and columns with equivalent types is a linear
438+
equivalence. -/
439+
def reindex_linear_equiv [semiring R] (eₘ : m ≃ m') (eₙ : n ≃ n') :
440+
matrix m n R ≃ₗ[R] matrix m' n' R :=
441+
{ map_add' := λ M N, rfl,
442+
map_smul' := λ M N, rfl,
443+
..(reindex eₘ eₙ)}
444+
445+
@[simp] lemma reindex_linear_equiv_apply [semiring R]
446+
(eₘ : m ≃ m') (eₙ : n ≃ n') (M : matrix m n R) :
447+
reindex_linear_equiv eₘ eₙ M = λ i j, M (eₘ.symm i) (eₙ.symm j) :=
448+
rfl
449+
450+
@[simp] lemma reindex_linear_equiv_symm_apply [semiring R]
451+
(eₘ : m ≃ m') (eₙ : n ≃ n') (M : matrix m' n' R) :
452+
(reindex_linear_equiv eₘ eₙ).symm M = λ i j, M (eₘ i) (eₙ j) :=
453+
rfl
454+
455+
lemma reindex_mul [semiring R]
456+
(eₘ : m ≃ m') (eₙ : n ≃ n') (eₗ : l ≃ l') (M : matrix m n R) (N : matrix n l R) :
457+
(reindex_linear_equiv eₘ eₙ M) ⬝ (reindex_linear_equiv eₙ eₗ N) = reindex_linear_equiv eₘ eₗ (M ⬝ N) :=
458+
begin
459+
ext i j,
460+
dsimp only [matrix.mul, matrix.dot_product],
461+
rw [←finset.univ_map_equiv_to_embedding eₙ, finset.sum_map finset.univ eₙ.to_embedding],
462+
simp,
463+
end
464+
465+
/-- For square matrices, the natural map that reindexes a matrix's rows and columns with equivalent
466+
types is an equivalence of algebras. -/
467+
def reindex_alg_equiv [comm_semiring R] [decidable_eq m] [decidable_eq n]
468+
(e : m ≃ n) : matrix m m R ≃ₐ[R] matrix n n R :=
469+
{ map_mul' := λ M N, by simp only [reindex_mul, linear_equiv.to_fun_apply, mul_eq_mul],
470+
commutes' := λ r, by { ext, simp [algebra_map, algebra.to_ring_hom], by_cases h : i = j; simp [h], },
471+
..(reindex_linear_equiv e e) }
472+
473+
@[simp] lemma reindex_alg_equiv_apply [comm_semiring R] [decidable_eq m] [decidable_eq n]
474+
(e : m ≃ n) (M : matrix m m R) :
475+
reindex_alg_equiv e M = λ i j, M (e.symm i) (e.symm j) :=
476+
rfl
477+
478+
@[simp] lemma reindex_alg_equiv_symm_apply [comm_semiring R] [decidable_eq m] [decidable_eq n]
479+
(e : m ≃ n) (M : matrix n n R) :
480+
(reindex_alg_equiv e).symm M = λ i j, M (e i) (e j) :=
481+
rfl
482+
483+
end reindexing
484+
416485
end matrix
417486

418487
namespace linear_map

0 commit comments

Comments
 (0)