Skip to content

Commit

Permalink
feat: Norm and trace under isomorphisms. (#8682)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Yang <[email protected]>
  • Loading branch information
erdOne and erdOne committed Dec 13, 2023
1 parent 6bb383b commit d85330e
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Mathlib/LinearAlgebra/Trace.lean
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,19 @@ lemma trace_comp_cycle' (f : M →ₗ[R] N) (g : N →ₗ[R] P) (h : P →ₗ[R]

@[simp]
theorem trace_conj' (f : M →ₗ[R] M) (e : M ≃ₗ[R] N) : trace R N (e.conj f) = trace R M f := by
rw [e.conj_apply, trace_comp_comm', ← comp_assoc, LinearEquiv.comp_coe,
LinearEquiv.self_trans_symm, LinearEquiv.refl_toLinearMap, id_comp]
classical
by_cases hM : ∃ s : Finset M, Nonempty (Basis s R M)
· obtain ⟨s, ⟨b⟩⟩ := hM
haveI := Module.Finite.of_basis b
haveI := (Module.free_def R M).mpr ⟨_, ⟨b⟩⟩
haveI := Module.Finite.of_basis (b.map e)
haveI := (Module.free_def R N).mpr ⟨_, ⟨(b.map e).reindex (e.toEquiv.image _)⟩⟩
rw [e.conj_apply, trace_comp_comm', ← comp_assoc, LinearEquiv.comp_coe,
LinearEquiv.self_trans_symm, LinearEquiv.refl_toLinearMap, id_comp]
· rw [trace, trace, dif_neg hM, dif_neg]; rfl
rintro ⟨s, ⟨b⟩⟩
exact hM ⟨s.image e.symm, ⟨(b.map e.symm).reindex
((e.symm.toEquiv.image s).trans (Equiv.Set.ofEq Finset.coe_image.symm))⟩⟩
#align linear_map.trace_conj' LinearMap.trace_conj'

theorem IsProj.trace {p : Submodule R M} {f : M →ₗ[R] M} (h : IsProj p f) [Module.Free R p]
Expand Down
37 changes: 37 additions & 0 deletions Mathlib/RingTheory/Norm.lean
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,43 @@ theorem isIntegral_norm [Algebra R L] [Algebra R K] [IsScalarTower R K L] [IsSep
· apply IsAlgClosed.splits_codomain
#align algebra.is_integral_norm Algebra.isIntegral_norm

lemma norm_eq_of_algEquiv [Ring T] [Algebra R T] (e : S ≃ₐ[R] T) (x) :
Algebra.norm R (e x) = Algebra.norm R x := by
simp_rw [Algebra.norm_apply, ← LinearMap.det_conj _ e.toLinearEquiv]; congr; ext; simp

lemma norm_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [Ring C]
[Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C)
(x : C) :
e (Algebra.norm A x) = Algebra.norm B x := by
classical
by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
· obtain ⟨s, ⟨b⟩⟩ := h
letI : Algebra A B := RingHom.toAlgebra e
letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
rw [Algebra.norm_eq_matrix_det b,
Algebra.norm_eq_matrix_det (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he])),
e.map_det]
congr
ext i j
simp [leftMulMatrix_apply, LinearMap.toMatrix_apply]
rw [norm_eq_one_of_not_exists_basis _ h, norm_eq_one_of_not_exists_basis, _root_.map_one]
intro ⟨s, ⟨b⟩⟩
exact h ⟨s, ⟨b.mapCoeffs e (by simp [Algebra.smul_def, ← he])⟩⟩

lemma norm_eq_of_equiv_equiv {A₁ B₁ A₂ B₂ : Type*} [CommRing A₁] [Ring B₁]
[CommRing A₂] [Ring B₂] [Algebra A₁ B₁] [Algebra A₂ B₂] (e₁ : A₁ ≃+* A₂) (e₂ : B₁ ≃+* B₂)
(he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp ↑e₂ (algebraMap A₁ B₁)) (x) :
Algebra.norm A₁ x = e₁.symm (Algebra.norm A₂ (e₂ x)) := by
letI := (RingHom.comp (e₂ : B₁ →+* B₂) (algebraMap A₁ B₁)).toAlgebra' ?_
let e' : B₁ ≃ₐ[A₁] B₂ := { e₂ with commutes' := fun _ ↦ rfl }
rw [← Algebra.norm_eq_of_ringEquiv e₁ he, ← Algebra.norm_eq_of_algEquiv e',
RingEquiv.symm_apply_apply]
rfl
intros c x
apply e₂.symm.injective
simp only [RingHom.coe_comp, RingHom.coe_coe, Function.comp_apply, _root_.map_mul,
RingEquiv.symm_apply_apply, commutes]

variable {F} (L)

-- TODO. Generalize this proof to rings
Expand Down
36 changes: 36 additions & 0 deletions Mathlib/RingTheory/Trace.lean
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,42 @@ theorem Algebra.isIntegral_trace [FiniteDimensional L F] {x : F} (hx : IsIntegra
· apply IsAlgClosed.splits_codomain
#align algebra.is_integral_trace Algebra.isIntegral_trace

lemma Algebra.trace_eq_of_algEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
[Algebra A B] [Algebra A C] (e : B ≃ₐ[A] C) (x) :
Algebra.trace A C (e x) = Algebra.trace A B x := by
simp_rw [Algebra.trace_apply, ← LinearMap.trace_conj' _ e.toLinearEquiv]
congr; ext; simp [LinearEquiv.conj_apply]

lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
[Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
e (Algebra.trace A C x) = Algebra.trace B C x := by
classical
by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
· obtain ⟨s, ⟨b⟩⟩ := h
letI : Algebra A B := RingHom.toAlgebra e
letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
rw [Algebra.trace_eq_matrix_trace b,
Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he]))]
show e.toAddMonoidHom _ = _
rw [AddMonoidHom.map_trace]
congr
ext i j
simp [leftMulMatrix_apply, LinearMap.toMatrix_apply]
rw [trace_eq_zero_of_not_exists_basis _ h, trace_eq_zero_of_not_exists_basis,
LinearMap.zero_apply, LinearMap.zero_apply, map_zero]
intro ⟨s, ⟨b⟩⟩
exact h ⟨s, ⟨b.mapCoeffs e (by simp [Algebra.smul_def, ← he])⟩⟩

lemma Algebra.trace_eq_of_equiv_equiv {A₁ B₁ A₂ B₂ : Type*} [CommRing A₁] [CommRing B₁]
[CommRing A₂] [CommRing B₂] [Algebra A₁ B₁] [Algebra A₂ B₂] (e₁ : A₁ ≃+* A₂) (e₂ : B₁ ≃+* B₂)
(he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp ↑e₂ (algebraMap A₁ B₁)) (x) :
Algebra.trace A₁ B₁ x = e₁.symm (Algebra.trace A₂ B₂ (e₂ x)) := by
letI := (RingHom.comp (e₂ : B₁ →+* B₂) (algebraMap A₁ B₁)).toAlgebra
let e' : B₁ ≃ₐ[A₁] B₂ := { e₂ with commutes' := fun _ ↦ rfl }
rw [← Algebra.trace_eq_of_ringEquiv e₁ he, ← Algebra.trace_eq_of_algEquiv e',
RingEquiv.symm_apply_apply]
rfl

section EqSumEmbeddings

variable [Algebra K F] [IsScalarTower K L F]
Expand Down

0 comments on commit d85330e

Please sign in to comment.