@@ -413,6 +413,75 @@ by rw [@linear_equiv.findim_eq R (matrix m n R) _ _ _ _ _ _ (linear_equiv.uncurr
413
413
414
414
end finite_dimensional
415
415
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
+
416
485
end matrix
417
486
418
487
namespace linear_map
0 commit comments