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

Commit baab5d3

Browse files
committed
refactor(data/matrix): reverse the direction of matrix.minor_mul_equiv (#10657)
In #10350 this change was proposed, since we apparently use that backwards way more than we use it forwards. We also change `reindex_linear_equiv_mul`, which is similarly much more popular backwards than forwards. Closes: #10638
1 parent 2ea1fb6 commit baab5d3

5 files changed

Lines changed: 13 additions & 12 deletions

File tree

src/algebra/lie/matrix.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ types, `matrix.reindex`, is an equivalence of Lie algebras. -/
7373
def matrix.reindex_lie_equiv : matrix n n R ≃ₗ⁅R⁆ matrix m m R :=
7474
{ to_fun := matrix.reindex e e,
7575
map_lie' := λ M N, by simp only [lie_ring.of_associative_ring_bracket, matrix.reindex_apply,
76-
matrix.minor_mul_equiv _ _ _ _, matrix.mul_eq_mul, matrix.minor_sub, pi.sub_apply],
76+
matrix.minor_mul_equiv, matrix.mul_eq_mul, matrix.minor_sub, pi.sub_apply],
7777
..(matrix.reindex_linear_equiv R R e e) }
7878

7979
@[simp] lemma matrix.reindex_lie_equiv_apply (M : matrix n n R) :

src/data/matrix/basic.lean

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,18 +1382,19 @@ lemma minor_one_equiv [has_zero α] [has_one α] [decidable_eq m] [decidable_eq
13821382
(1 : matrix m m α).minor e e = 1 :=
13831383
minor_one e e.injective
13841384

1385+
@[simp]
13851386
lemma minor_mul_equiv [fintype n] [fintype o] [semiring α] {p q : Type*}
13861387
(M : matrix m n α) (N : matrix n p α) (e₁ : l → m) (e₂ : o ≃ n) (e₃ : q → p) :
1387-
(M ⬝ N).minor e₁ e₃ = (M.minor e₁ e₂) ⬝ (N.minor e e₃) :=
1388-
minor_mul M N e₁ e₂ e₃ e₂.bijective
1388+
(M.minor e₁ e₂) ⬝ (N.minor e₂ e₃) = (M ⬝ N).minor e e₃ :=
1389+
(minor_mul M N e₁ e₂ e₃ e₂.bijective).symm
13891390

13901391
lemma mul_minor_one [fintype n] [fintype o] [semiring α] [decidable_eq o] (e₁ : n ≃ o) (e₂ : l → o)
13911392
(M : matrix m n α) : M ⬝ (1 : matrix o o α).minor e₁ e₂ = minor M id (e₁.symm ∘ e₂) :=
13921393
begin
13931394
let A := M.minor id e₁.symm,
13941395
have : M = A.minor id e₁,
13951396
{ simp only [minor_minor, function.comp.right_id, minor_id_id, equiv.symm_comp_self], },
1396-
rw [this, minor_mul_equiv],
1397+
rw [this, minor_mul_equiv],
13971398
simp only [matrix.mul_one, minor_minor, function.comp.right_id, minor_id_id,
13981399
equiv.symm_comp_self],
13991400
end
@@ -1404,7 +1405,7 @@ begin
14041405
let A := M.minor e₂.symm id,
14051406
have : M = A.minor e₂ id,
14061407
{ simp only [minor_minor, function.comp.right_id, minor_id_id, equiv.symm_comp_self], },
1407-
rw [this, minor_mul_equiv],
1408+
rw [this, minor_mul_equiv],
14081409
simp only [matrix.one_mul, minor_minor, function.comp.right_id, minor_id_id,
14091410
equiv.symm_comp_self],
14101411
end

src/linear_algebra/charpoly/to_matrix.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ begin
5050
set Q := b'.to_matrix b,
5151

5252
have hPQ : C.map_matrix (φ₁ P) ⬝ (C.map_matrix (φ₃ Q)) = 1,
53-
{ rw [ring_hom.map_matrix_apply, ring_hom.map_matrix_apply, ← matrix.map_mul,
53+
{ rw [ring_hom.map_matrix_apply, ring_hom.map_matrix_apply, ← matrix.map_mul,
5454
@reindex_linear_equiv_mul _ ι' _ _ _ _ R R, basis.to_matrix_mul_to_matrix_flip,
5555
reindex_linear_equiv_one, ← ring_hom.map_matrix_apply, ring_hom.map_one] },
5656

@@ -59,7 +59,7 @@ begin
5959
... = (scalar ι' X - C.map_matrix (φ (P ⬝ A' ⬝ Q))).det :
6060
by rw [basis_to_matrix_mul_linear_map_to_matrix_mul_basis_to_matrix]
6161
... = (scalar ι' X - C.map_matrix (φ₁ P ⬝ φ₂ A' ⬝ φ₃ Q)).det :
62-
by rw [reindex_linear_equiv_mul R R _ _ e, reindex_linear_equiv_mul R R e _ _]
62+
by rw [reindex_linear_equiv_mul, reindex_linear_equiv_mul]
6363
... = (scalar ι' X - (C.map_matrix (φ₁ P) ⬝ C.map_matrix A' ⬝ C.map_matrix (φ₃ Q))).det : by simp
6464
... = (scalar ι' X ⬝ C.map_matrix (φ₁ P) ⬝ (C.map_matrix (φ₃ Q)) -
6565
(C.map_matrix (φ₁ P) ⬝ C.map_matrix A' ⬝ C.map_matrix (φ₃ Q))).det :

src/linear_algebra/determinant.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ lemma det_comm' [is_domain A] [decidable_eq m] [decidable_eq n]
8383
-- Although `m` and `n` are different a priori, we will show they have the same cardinality.
8484
-- This turns the problem into one for square matrices, which is easy.
8585
let e := index_equiv_of_inv hMM' hM'M in
86-
by rw [← det_minor_equiv_self e, minor_mul_equiv _ _ _ (equiv.refl n) _, det_comm,
87-
minor_mul_equiv, equiv.coe_refl, minor_id_id]
86+
by rw [← det_minor_equiv_self e, minor_mul_equiv _ _ _ (equiv.refl n) _, det_comm,
87+
minor_mul_equiv, equiv.coe_refl, minor_id_id]
8888

8989
/-- If `M'` is a two-sided inverse for `M` (indexed differently), `det (M ⬝ N ⬝ M') = det N`. -/
9090
lemma det_conj [is_domain A] [decidable_eq m] [decidable_eq n]

src/linear_algebra/matrix/reindex.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ variables [semiring R] [semiring A] [module R A]
8686

8787
lemma reindex_linear_equiv_mul [fintype n] [fintype n']
8888
(eₘ : m ≃ m') (eₙ : n ≃ n') (eₒ : o ≃ o') (M : matrix m n A) (N : matrix n o A) :
89-
reindex_linear_equiv R A eₘ eₒ (M ⬝ N) =
90-
reindex_linear_equiv R A eₘ eₙ M ⬝ reindex_linear_equiv R A eₙ eₒ N :=
89+
reindex_linear_equiv R A eₘ eₙ M ⬝ reindex_linear_equiv R A eₙ eₒ N =
90+
reindex_linear_equiv R A eₘ eₒ (M ⬝ N) :=
9191
minor_mul_equiv M N _ _ _
9292

9393
lemma mul_reindex_linear_equiv_one [fintype n] [fintype o] [decidable_eq o] (e₁ : o ≃ n)
@@ -107,7 +107,7 @@ a matrix's rows and columns with equivalent types, `matrix.reindex`, is an equiv
107107
-/
108108
def reindex_alg_equiv (e : m ≃ n) : matrix m m R ≃ₐ[R] matrix n n R :=
109109
{ to_fun := reindex e e,
110-
map_mul' := reindex_linear_equiv_mul R R e e e,
110+
map_mul' := λ a b, (reindex_linear_equiv_mul R R e e e a b).symm,
111111
commutes' := λ r, by simp [algebra_map, algebra.to_ring_hom, minor_smul],
112112
..(reindex_linear_equiv R R e e) }
113113

0 commit comments

Comments
 (0)