Skip to content

Commit 83a8be6

Browse files
committed
refactor: @[simp] for e.conj f x = e (f (e.symm x)) (#34183)
This came up while reviewing PR #33615. Not only `LinearMap` & `LinearEquiv` but also other bundled maps often simplify when applied. So it's natural to have a simp lemma for `e.conj f x`. This simp lemma has lower priority, because it should rewrite after unapplied `conj` lemmas for performance reason (e.g. `e.conj LinearMap.id x => LinearMap.id x` => `x` rather than `e.conj LinearMap.id x => e (LinearMap.id (e.symm x)) => e (e.symm x) => x`) Co-authored-by: Komyyy <pol_tta@outlook.jp>
1 parent 6c39be5 commit 83a8be6

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

Mathlib/Algebra/Algebra/Equiv.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,15 +551,15 @@ theorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :
551551

552552
@[simp] theorem linearEquivConj_mulLeft (f : A₁ ≃ₐ[R] A₂) (x : A₁) :
553553
f.toLinearEquiv.conj (.mulLeft R x) = .mulLeft R (f x) := by
554-
ext; simp [LinearEquiv.conj_apply]
554+
ext; simp
555555

556556
@[simp] theorem linearEquivConj_mulRight (f : A₁ ≃ₐ[R] A₂) (x : A₁) :
557557
f.toLinearEquiv.conj (.mulRight R x) = .mulRight R (f x) := by
558-
ext; simp [LinearEquiv.conj_apply]
558+
ext; simp
559559

560560
@[simp] theorem linearEquivConj_mulLeftRight (f : A₁ ≃ₐ[R] A₂) (x : A₁ × A₁) :
561561
f.toLinearEquiv.conj (.mulLeftRight R x) = .mulLeftRight R (Prod.map f f x) := by
562-
cases x; ext; simp [LinearEquiv.conj_apply]
562+
cases x; ext; simp
563563

564564
/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/
565565
noncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=

Mathlib/Algebra/Module/Equiv/Basic.lean

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,10 @@ theorem conj_apply (e : M₁' ≃ₛₗ[σ₁'₂'] M₂') (f : Module.End R₁'
683683
e.conj f = ((↑e : M₁' →ₛₗ[σ₁'₂'] M₂').comp f).comp (e.symm : M₂' →ₛₗ[σ₂'₁'] M₁') :=
684684
rfl
685685

686+
-- Note this has lower `simp` priority for performance reasons, so that we rewrite as
687+
-- `e.conj LinearMap.id x => LinearMap.id x` => `x` rather than
688+
-- `e.conj LinearMap.id x => e (LinearMap.id (e.symm x)) => e (e.symm x) => x`.
689+
@[simp 900]
686690
theorem conj_apply_apply (e : M₁' ≃ₛₗ[σ₁'₂'] M₂') (f : Module.End R₁' M₁') (x : M₂') :
687691
e.conj f x = e (f (e.symm x)) :=
688692
rfl
@@ -700,14 +704,13 @@ theorem conj_trans (e₁ : M₁' ≃ₛₗ[σ₁'₂'] M₂') (e₂ : M₂' ≃
700704
rfl
701705

702706
@[simp] lemma conj_conj_symm (e : M₁' ≃ₛₗ[σ₁'₂'] M₂') (f : Module.End R₂' M₂') :
703-
e.conj (e.symm.conj f) = f := by ext; simp [conj_apply]
707+
e.conj (e.symm.conj f) = f := by ext; simp
704708

705709
@[simp] lemma conj_symm_conj (e : M₁' ≃ₛₗ[σ₁'₂'] M₂') (f : Module.End R₁' M₁') :
706-
e.symm.conj (e.conj f) = f := by ext; simp [conj_apply]
710+
e.symm.conj (e.conj f) = f := by ext; simp
707711

708712
@[simp]
709-
theorem conj_id (e : M₁' ≃ₛₗ[σ₁'₂'] M₂') : e.conj LinearMap.id = LinearMap.id := by
710-
simp [conj_apply]
713+
theorem conj_id (e : M₁' ≃ₛₗ[σ₁'₂'] M₂') : e.conj LinearMap.id = LinearMap.id := by ext; simp
711714

712715
@[simp]
713716
theorem conj_refl (f : Module.End R M) : (refl R M).conj f = f := rfl

Mathlib/LinearAlgebra/Charpoly/ToMatrix.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ lemma LinearEquiv.charpoly_conj (e : M₁ ≃ₗ[R] M₂) (φ : Module.End R M
7979
rw [← LinearMap.charpoly_toMatrix φ b, ← LinearMap.charpoly_toMatrix (e.conj φ) (b.map e)]
8080
congr 1
8181
ext i j : 1
82-
simp [LinearMap.toMatrix, LinearEquiv.conj_apply]
82+
simp [LinearMap.toMatrix]
8383

8484
namespace Matrix
8585

Mathlib/LinearAlgebra/RootSystem/Defs.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ lemma pairing_reflectionPerm (i j k : ι) :
379379
lemma toPerfPair_conj_reflection :
380380
P.toPerfPair.conj (P.reflection i) = (P.coreflection i).toLinearMap.dualMap := by
381381
ext f n
382-
simp [LinearEquiv.conj_apply, reflection_apply, coreflection_apply, mul_comm (f <| P.coroot i)]
382+
simp [reflection_apply, coreflection_apply, mul_comm (f <| P.coroot i)]
383383

384384
@[simp]
385385
lemma toPerfPair_flip_conj_coreflection :

Mathlib/RingTheory/Trace/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ lemma Algebra.trace_eq_of_algEquiv {A B C : Type*} [CommRing A] [CommRing B] [Co
175175
[Algebra A B] [Algebra A C] (e : B ≃ₐ[A] C) (x) :
176176
Algebra.trace A C (e x) = Algebra.trace A B x := by
177177
simp_rw [Algebra.trace_apply, ← LinearMap.trace_conj' _ e.toLinearEquiv]
178-
congr; ext; simp [LinearEquiv.conj_apply]
178+
congr; ext; simp
179179

180180
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
181181
[Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :

0 commit comments

Comments
 (0)