state
stringlengths
0
159k
srcUpToTactic
stringlengths
387
167k
nextTactic
stringlengths
3
9k
declUpToTactic
stringlengths
22
11.5k
declId
stringlengths
38
95
decl
stringlengths
16
1.89k
file_tag
stringlengths
17
73
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X₁✝ X₂✝ : Mon_ C ⊢ (𝟙 X₁✝ ⊗ 𝟙 X₂✝).hom = (𝟙 (X₁✝ ⊗ X₂✝)).hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext;
apply tensor_id
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C ⊢ ∀ {X₁ Y₁ Z₁ X₂ Y₂ Z₂ : Mon_ C} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (g₁ : Y₁ ⟶ Z₁) (g₂ : Y₂ ⟶ Z₂), f₁ ≫ g₁ ⊗ f₂ ≫ g₂ = (f₁ ⊗ f₂) ≫ (g₁ ⊗ g₂)
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by
intros
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X₁✝ Y₁✝ Z₁✝ X₂✝ Y₂✝ Z₂✝ : Mon_ C f₁✝ : X₁✝ ⟶ Y₁✝ f₂✝ : X₂✝ ⟶ Y₂✝ g₁✝ : Y₁✝ ⟶ Z₁✝ g₂✝ : Y₂✝ ⟶ Z₂✝ ⊢ f₁✝ ≫ g₁✝ ⊗ f₂✝ ≫ g₂✝ = (f₁✝ ⊗ f₂✝) ≫ (g₁✝ ⊗ g₂✝)
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros;
ext
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X₁✝ Y₁✝ Z₁✝ X₂✝ Y₂✝ Z₂✝ : Mon_ C f₁✝ : X₁✝ ⟶ Y₁✝ f₂✝ : X₂✝ ⟶ Y₂✝ g₁✝ : Y₁✝ ⟶ Z₁✝ g₂✝ : Y₂✝ ⟶ Z₂✝ ⊢ (f₁✝ ≫ g₁✝ ⊗ f₂✝ ≫ g₂✝).hom = ((f₁✝ ⊗ f₂✝) ≫ (g₁✝ ⊗ g₂✝)).hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext;
apply tensor_comp
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C ⊢ ∀ {X₁ X₂ X₃ Y₁ Y₂ Y₃ : Mon_ C} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (f₃ : X₃ ⟶ Y₃), ((f₁ ⊗ f₂) ⊗ f₃) ≫ (α_ Y₁ Y₂ Y₃).hom = (α_ X₁ X₂ X₃).hom ≫ (f₁ ⊗ f₂ ⊗ f₃)
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by
intros
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X₁✝ X₂✝ X₃✝ Y₁✝ Y₂✝ Y₃✝ : Mon_ C f₁✝ : X₁✝ ⟶ Y₁✝ f₂✝ : X₂✝ ⟶ Y₂✝ f₃✝ : X₃✝ ⟶ Y₃✝ ⊢ ((f₁✝ ⊗ f₂✝) ⊗ f₃✝) ≫ (α_ Y₁✝ Y₂✝ Y₃✝).hom = (α_ X₁✝ X₂✝ X₃✝).hom ≫ (f₁✝ ⊗ f₂✝ ⊗ f₃✝)
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros;
ext
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X₁✝ X₂✝ X₃✝ Y₁✝ Y₂✝ Y₃✝ : Mon_ C f₁✝ : X₁✝ ⟶ Y₁✝ f₂✝ : X₂✝ ⟶ Y₂✝ f₃✝ : X₃✝ ⟶ Y₃✝ ⊢ (((f₁✝ ⊗ f₂✝) ⊗ f₃✝) ≫ (α_ Y₁✝ Y₂✝ Y₃✝).hom).hom = ((α_ X₁✝ X₂✝ X₃✝).hom ≫ (f₁✝ ⊗ f₂✝ ⊗ f₃✝)).hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext;
dsimp
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X₁✝ X₂✝ X₃✝ Y₁✝ Y₂✝ Y₃✝ : Mon_ C f₁✝ : X₁✝ ⟶ Y₁✝ f₂✝ : X₂✝ ⟶ Y₂✝ f₃✝ : X₃✝ ⟶ Y₃✝ ⊢ ((f₁✝ ⊗ f₂✝) ⊗ f₃✝).hom ≫ (α_ Y₁✝ Y₂✝ Y₃✝).hom.hom = (α_ X₁✝ X₂✝ X₃✝).hom.hom ≫ (f₁✝ ⊗ f₂✝ ⊗ f₃✝).hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp;
apply associator_naturality
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C ⊢ ∀ {X Y : Mon_ C} (f : X ⟶ Y), (𝟙 (𝟙_ (Mon_ C)) ⊗ f) ≫ (λ_ Y).hom = (λ_ X).hom ≫ f
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by
intros
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X✝ Y✝ : Mon_ C f✝ : X✝ ⟶ Y✝ ⊢ (𝟙 (𝟙_ (Mon_ C)) ⊗ f✝) ≫ (λ_ Y✝).hom = (λ_ X✝).hom ≫ f✝
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros;
ext
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X✝ Y✝ : Mon_ C f✝ : X✝ ⟶ Y✝ ⊢ ((𝟙 (𝟙_ (Mon_ C)) ⊗ f✝) ≫ (λ_ Y✝).hom).hom = ((λ_ X✝).hom ≫ f✝).hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext;
dsimp
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X✝ Y✝ : Mon_ C f✝ : X✝ ⟶ Y✝ ⊢ (𝟙 (𝟙_ (Mon_ C)) ⊗ f✝).hom ≫ (λ_ Y✝).hom.hom = (λ_ X✝).hom.hom ≫ f✝.hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp;
apply leftUnitor_naturality
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C ⊢ ∀ {X Y : Mon_ C} (f : X ⟶ Y), (f ⊗ 𝟙 (𝟙_ (Mon_ C))) ≫ (ρ_ Y).hom = (ρ_ X).hom ≫ f
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by
intros
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X✝ Y✝ : Mon_ C f✝ : X✝ ⟶ Y✝ ⊢ (f✝ ⊗ 𝟙 (𝟙_ (Mon_ C))) ≫ (ρ_ Y✝).hom = (ρ_ X✝).hom ≫ f✝
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros;
ext
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X✝ Y✝ : Mon_ C f✝ : X✝ ⟶ Y✝ ⊢ ((f✝ ⊗ 𝟙 (𝟙_ (Mon_ C))) ≫ (ρ_ Y✝).hom).hom = ((ρ_ X✝).hom ≫ f✝).hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext;
dsimp
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X✝ Y✝ : Mon_ C f✝ : X✝ ⟶ Y✝ ⊢ (f✝ ⊗ 𝟙 (𝟙_ (Mon_ C))).hom ≫ (ρ_ Y✝).hom.hom = (ρ_ X✝).hom.hom ≫ f✝.hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp;
apply rightUnitor_naturality
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C ⊢ ∀ (W X Y Z : Mon_ C), ((α_ W X Y).hom ⊗ 𝟙 Z) ≫ (α_ W (X ⊗ Y) Z).hom ≫ (𝟙 W ⊗ (α_ X Y Z).hom) = (α_ (W ⊗ X) Y Z).hom ≫ (α_ W X (Y ⊗ Z)).hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by
intros
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C W✝ X✝ Y✝ Z✝ : Mon_ C ⊢ ((α_ W✝ X✝ Y✝).hom ⊗ 𝟙 Z✝) ≫ (α_ W✝ (X✝ ⊗ Y✝) Z✝).hom ≫ (𝟙 W✝ ⊗ (α_ X✝ Y✝ Z✝).hom) = (α_ (W✝ ⊗ X✝) Y✝ Z✝).hom ≫ (α_ W✝ X✝ (Y✝ ⊗ Z✝)).hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros;
ext
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C W✝ X✝ Y✝ Z✝ : Mon_ C ⊢ (((α_ W✝ X✝ Y✝).hom ⊗ 𝟙 Z✝) ≫ (α_ W✝ (X✝ ⊗ Y✝) Z✝).hom ≫ (𝟙 W✝ ⊗ (α_ X✝ Y✝ Z✝).hom)).hom = ((α_ (W✝ ⊗ X✝) Y✝ Z✝).hom ≫ (α_ W✝ X✝ (Y✝ ⊗ Z✝)).hom).hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext;
dsimp
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C W✝ X✝ Y✝ Z✝ : Mon_ C ⊢ ((α_ W✝ X✝ Y✝).hom ⊗ 𝟙 Z✝).hom ≫ (α_ W✝ (X✝ ⊗ Y✝) Z✝).hom.hom ≫ (𝟙 W✝ ⊗ (α_ X✝ Y✝ Z✝).hom).hom = (α_ (W✝ ⊗ X✝) Y✝ Z✝).hom.hom ≫ (α_ W✝ X✝ (Y✝ ⊗ Z✝)).hom.hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext; dsimp;
apply pentagon
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext; dsimp;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C ⊢ ∀ (X Y : Mon_ C), (α_ X (𝟙_ (Mon_ C)) Y).hom ≫ (𝟙 X ⊗ (λ_ Y).hom) = (ρ_ X).hom ⊗ 𝟙 Y
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext; dsimp; apply pentagon) (triangle := by
intros
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext; dsimp; apply pentagon) (triangle := by
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X✝ Y✝ : Mon_ C ⊢ (α_ X✝ (𝟙_ (Mon_ C)) Y✝).hom ≫ (𝟙 X✝ ⊗ (λ_ Y✝).hom) = (ρ_ X✝).hom ⊗ 𝟙 Y✝
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext; dsimp; apply pentagon) (triangle := by intros;
ext
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext; dsimp; apply pentagon) (triangle := by intros;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X✝ Y✝ : Mon_ C ⊢ ((α_ X✝ (𝟙_ (Mon_ C)) Y✝).hom ≫ (𝟙 X✝ ⊗ (λ_ Y✝).hom)).hom = ((ρ_ X✝).hom ⊗ 𝟙 Y✝).hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext; dsimp; apply pentagon) (triangle := by intros; ext;
dsimp
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext; dsimp; apply pentagon) (triangle := by intros; ext;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
case w C : Type u₁ inst✝² : Category.{v₁, u₁} C inst✝¹ : MonoidalCategory C inst✝ : BraidedCategory C X✝ Y✝ : Mon_ C ⊢ (α_ X✝ (𝟙_ (Mon_ C)) Y✝).hom.hom ≫ (𝟙 X✝ ⊗ (λ_ Y✝).hom).hom = ((ρ_ X✝).hom ⊗ 𝟙 Y✝).hom
/- Copyright (c) 2020 Scott Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Scott Morrison -/ import Mathlib.CategoryTheory.Monoidal.Braided import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.Algebra.PUnitInstances #align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c" /-! # The category of monoids in a monoidal category. We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if `C` is braided, then the category of monoids is naturally monoidal. -/ set_option linter.uppercaseLean3 false universe v₁ v₂ u₁ u₂ u open CategoryTheory MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] /-- A monoid object internal to a monoidal category. When the monoidal category is preadditive, this is also sometimes called an "algebra object". -/ structure Mon_ where X : C one : 𝟙_ C ⟶ X mul : X ⊗ X ⟶ X one_mul : (one ⊗ 𝟙 X) ≫ mul = (λ_ X).hom := by aesop_cat mul_one : (𝟙 X ⊗ one) ≫ mul = (ρ_ X).hom := by aesop_cat -- Obviously there is some flexibility stating this axiom. -- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`, -- and chooses to place the associator on the right-hand side. -- The heuristic is that unitors and associators "don't have much weight". mul_assoc : (mul ⊗ 𝟙 X) ≫ mul = (α_ X X X).hom ≫ (𝟙 X ⊗ mul) ≫ mul := by aesop_cat #align Mon_ Mon_ attribute [reassoc] Mon_.one_mul Mon_.mul_one -- We prove a more general `@[simp]` lemma below. attribute [reassoc (attr := simp)] Mon_.mul_assoc namespace Mon_ /-- The trivial monoid object. We later show this is initial in `Mon_ C`. -/ @[simps] def trivial : Mon_ C where X := 𝟙_ C one := 𝟙 _ mul := (λ_ _).hom mul_assoc := by coherence mul_one := by coherence #align Mon_.trivial Mon_.trivial instance : Inhabited (Mon_ C) := ⟨trivial C⟩ variable {C} variable {M : Mon_ C} @[simp] theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by rw [← id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] #align Mon_.one_mul_hom Mon_.one_mul_hom @[simp] theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by rw [← tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] #align Mon_.mul_one_hom Mon_.mul_one_hom theorem assoc_flip : (𝟙 M.X ⊗ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ⊗ 𝟙 M.X) ≫ M.mul := by simp #align Mon_.assoc_flip Mon_.assoc_flip /-- A morphism of monoid objects. -/ @[ext] structure Hom (M N : Mon_ C) where hom : M.X ⟶ N.X one_hom : M.one ≫ hom = N.one := by aesop_cat mul_hom : M.mul ≫ hom = (hom ⊗ hom) ≫ N.mul := by aesop_cat #align Mon_.hom Mon_.Hom attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom /-- The identity morphism on a monoid object. -/ @[simps] def id (M : Mon_ C) : Hom M M where hom := 𝟙 M.X #align Mon_.id Mon_.id instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) := ⟨id M⟩ #align Mon_.hom_inhabited Mon_.homInhabited /-- Composition of morphisms of monoid objects. -/ @[simps] def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom #align Mon_.comp Mon_.comp instance : Category (Mon_ C) where Hom M N := Hom M N id := id comp f g := comp f g -- Porting note: added, as `Hom.ext` does not apply to a morphism. @[ext] lemma ext {X Y : Mon_ C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext _ _ w @[simp] theorem id_hom' (M : Mon_ C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl #align Mon_.id_hom' Mon_.id_hom' @[simp] theorem comp_hom' {M N K : Mon_ C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g : Hom M K).hom = f.hom ≫ g.hom := rfl #align Mon_.comp_hom' Mon_.comp_hom' section variable (C) /-- The forgetful functor from monoid objects to the ambient category. -/ @[simps] def forget : Mon_ C ⥤ C where obj A := A.X map f := f.hom #align Mon_.forget Mon_.forget end instance forget_faithful : Faithful (@forget C _ _) where #align Mon_.forget_faithful Mon_.forget_faithful instance {A B : Mon_ C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/ instance : ReflectsIsomorphisms (forget C) where reflects f e := ⟨⟨{ hom := inv f.hom mul_hom := by simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, ← tensor_comp_assoc, IsIso.inv_hom_id, tensor_id, Category.id_comp] }, by aesop_cat⟩⟩ /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects and checking compatibility with unit and multiplication only in the forward direction. -/ def isoOfIso {M N : Mon_ C} (f : M.X ≅ N.X) (one_f : M.one ≫ f.hom = N.one) (mul_f : M.mul ≫ f.hom = (f.hom ⊗ f.hom) ≫ N.mul) : M ≅ N where hom := { hom := f.hom one_hom := one_f mul_hom := mul_f } inv := { hom := f.inv one_hom := by rw [← one_f]; simp mul_hom := by rw [← cancel_mono f.hom] slice_rhs 2 3 => rw [mul_f] simp } #align Mon_.iso_of_iso Mon_.isoOfIso instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C ⟶ A) where default := { hom := A.one one_hom := by dsimp; simp mul_hom := by dsimp; simp [A.one_mul, unitors_equal] } uniq f := by ext; simp rw [← Category.id_comp f.hom] erw [f.one_hom] #align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial open CategoryTheory.Limits instance : HasInitial (Mon_ C) := hasInitial_of_unique (trivial C) end Mon_ namespace CategoryTheory.LaxMonoidalFunctor variable {C} {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A) /-- A lax monoidal functor takes monoid objects to monoid objects. That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon_ C ⥤ Mon_ D`. -/ @[simps] def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C ⥤ Mon_ D where obj A := { X := F.obj A.X one := F.ε ≫ F.map A.one mul := F.μ _ _ ≫ F.map A.mul one_mul := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.one_mul] rw [F.toFunctor.map_id] rw [F.left_unitality] mul_one := by conv_lhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_one] rw [F.toFunctor.map_id] rw [F.right_unitality] mul_assoc := by conv_lhs => rw [comp_tensor_id, ← F.toFunctor.map_id] slice_lhs 2 3 => rw [F.μ_natural] slice_lhs 3 4 => rw [← F.toFunctor.map_comp, A.mul_assoc] conv_lhs => rw [F.toFunctor.map_id] conv_lhs => rw [F.toFunctor.map_comp, F.toFunctor.map_comp] conv_rhs => rw [id_tensor_comp, ← F.toFunctor.map_id] slice_rhs 3 4 => rw [F.μ_natural] conv_rhs => rw [F.toFunctor.map_id] slice_rhs 1 3 => rw [← F.associativity] simp only [Category.assoc] } map f := { hom := F.map f.hom one_hom := by dsimp; rw [Category.assoc, ← F.toFunctor.map_comp, f.one_hom] mul_hom := by dsimp rw [Category.assoc, F.μ_natural_assoc, ← F.toFunctor.map_comp, ← F.toFunctor.map_comp, f.mul_hom] } map_id A := by ext; simp map_comp f g := by ext; simp #align category_theory.lax_monoidal_functor.map_Mon CategoryTheory.LaxMonoidalFunctor.mapMon variable (C D) /-- `mapMon` is functorial in the lax monoidal functor. -/ @[simps] -- Porting note: added this, not sure how it worked previously without. def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon_ C ⥤ Mon_ D where obj := mapMon map α := { app := fun A => { hom := α.app A.X } } #align category_theory.lax_monoidal_functor.map_Mon_functor CategoryTheory.LaxMonoidalFunctor.mapMonFunctor end CategoryTheory.LaxMonoidalFunctor namespace Mon_ open CategoryTheory.LaxMonoidalFunctor namespace EquivLaxMonoidalFunctorPUnit /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ⥤ Mon_ C where obj F := (F.mapMon : Mon_ _ ⥤ Mon_ C).obj (trivial (Discrete PUnit)) map α := ((mapMonFunctor (Discrete PUnit) C).map α).app _ #align Mon_.equiv_lax_monoidal_functor_punit.lax_monoidal_to_Mon Mon_.EquivLaxMonoidalFunctorPUnit.laxMonoidalToMon /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps] def monToLaxMonoidal : Mon_ C ⥤ LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C where obj A := { obj := fun _ => A.X map := fun _ => 𝟙 _ ε := A.one μ := fun _ _ => A.mul map_id := fun _ => rfl map_comp := fun _ _ => (Category.id_comp (𝟙 A.X)).symm } map f := { app := fun _ => f.hom naturality := fun _ _ _ => by dsimp; rw [Category.id_comp, Category.comp_id] unit := f.one_hom tensor := fun _ _ => f.mul_hom } #align Mon_.equiv_lax_monoidal_functor_punit.Mon_to_lax_monoidal Mon_.EquivLaxMonoidalFunctorPUnit.monToLaxMonoidal attribute [local aesop safe tactic (rule_sets [CategoryTheory])] CategoryTheory.Discrete.discreteCases attribute [local simp] eqToIso_map /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def unitIso : 𝟭 (LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C := NatIso.ofComponents (fun F => MonoidalNatIso.ofComponents (fun _ => F.toFunctor.mapIso (eqToIso (by ext))) (by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.unit_iso Mon_.EquivLaxMonoidalFunctorPUnit.unitIso /-- Implementation of `Mon_.equivLaxMonoidalFunctorPUnit`. -/ @[simps!] def counitIso : monToLaxMonoidal C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon_ C) := NatIso.ofComponents (fun F => { hom := { hom := 𝟙 _ } inv := { hom := 𝟙 _ } }) (by aesop_cat) #align Mon_.equiv_lax_monoidal_functor_punit.counit_iso Mon_.EquivLaxMonoidalFunctorPUnit.counitIso end EquivLaxMonoidalFunctorPUnit open EquivLaxMonoidalFunctorPUnit attribute [local simp] eqToIso_map /-- Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`. -/ @[simps] def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{u + 1}) C ≌ Mon_ C where functor := laxMonoidalToMon C inverse := monToLaxMonoidal C unitIso := unitIso C counitIso := counitIso C #align Mon_.equiv_lax_monoidal_functor_punit Mon_.equivLaxMonoidalFunctorPUnit end Mon_ namespace Mon_ /-! In this section, we prove that the category of monoids in a braided monoidal category is monoidal. Given two monoids `M` and `N` in a braided monoidal category `C`, the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way: it is the tensor product of the multiplications on `M` and `N`, except that the tensor factors in the source come in the wrong order, which we fix by pre-composing with a permutation isomorphism constructed from the braiding. (There is a subtlety here: in fact there are two ways to do these, using either the positive or negative crossing.) A more conceptual way of understanding this definition is the following: The braiding on `C` gives rise to a monoidal structure on the tensor product functor from `C × C` to `C`. A pair of monoids in `C` gives rise to a monoid in `C × C`, which the tensor product functor by being monoidal takes to a monoid in `C`. The permutation isomorphism appearing in the definition of the multiplication on the tensor product of two monoids is an instance of a more general family of isomorphisms which together form a strength that equips the tensor product functor with a monoidal structure, and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors plus the properties of the strength (i.e., monoidal functor axioms). The strength `tensor_μ` of the tensor product functor has been defined in `Mathlib.CategoryTheory.Monoidal.Braided`. Its properties, stated as independent lemmas in that module, are used extensively in the proofs below. Notice that we could have followed the above plan not only conceptually but also as a possible implementation and could have constructed the tensor product of monoids via `mapMon`, but we chose to give a more explicit definition directly in terms of `tensor_μ`. To complete the definition of the monoidal category structure on the category of monoids, we need to provide definitions of associator and unitors. The obvious candidates are the associator and unitors from `C`, but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication. These properties translate to the monoidality of the associator and unitors (with respect to the monoidal structures on the functors they relate), which have also been proved in `Mathlib.CategoryTheory.Monoidal.Braided`. -/ variable {C} -- The proofs that associators and unitors preserve monoid units don't require braiding. theorem one_associator {M N P : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ P.one)) ≫ (α_ M.X N.X P.X).hom = (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ (λ_ (𝟙_ C)).inv ≫ (N.one ⊗ P.one)) := by simp only [Category.assoc, Iso.cancel_iso_inv_left] slice_lhs 1 3 => rw [← Category.id_comp P.one, tensor_comp] slice_lhs 2 3 => rw [associator_naturality] slice_rhs 1 2 => rw [← Category.id_comp M.one, tensor_comp] slice_lhs 1 2 => rw [← leftUnitor_tensor_inv] rw [← cancel_epi (λ_ (𝟙_ C)).inv] slice_lhs 1 2 => rw [leftUnitor_inv_naturality] simp only [Category.assoc] #align Mon_.one_associator Mon_.one_associator theorem one_leftUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ M.one)) ≫ (λ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [leftUnitor_naturality] simp #align Mon_.one_left_unitor Mon_.one_leftUnitor theorem one_rightUnitor {M : Mon_ C} : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ 𝟙 (𝟙_ C))) ≫ (ρ_ M.X).hom = M.one := by slice_lhs 2 3 => rw [rightUnitor_naturality, ← unitors_equal] simp #align Mon_.one_right_unitor Mon_.one_rightUnitor variable [BraidedCategory C] theorem Mon_tensor_one_mul (M N : Mon_ C) : ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (λ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, one_mul M, one_mul N] symm exact tensor_left_unitality C M.X N.X #align Mon_.Mon_tensor_one_mul Mon_.Mon_tensor_one_mul theorem Mon_tensor_mul_one (M N : Mon_ C) : (𝟙 (M.X ⊗ N.X) ⊗ (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (ρ_ (M.X ⊗ N.X)).hom := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_one M, mul_one N] symm exact tensor_right_unitality C M.X N.X #align Mon_.Mon_tensor_mul_one Mon_.Mon_tensor_mul_one theorem Mon_tensor_mul_assoc (M N : Mon_ C) : (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ 𝟙 (M.X ⊗ N.X)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) = (α_ (M.X ⊗ N.X) (M.X ⊗ N.X) (M.X ⊗ N.X)).hom ≫ (𝟙 (M.X ⊗ N.X) ⊗ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul)) ≫ tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) := by rw [← Category.id_comp (𝟙 (M.X ⊗ N.X)), tensor_comp] slice_lhs 2 3 => rw [← tensor_id, tensor_μ_natural] slice_lhs 3 4 => rw [← tensor_comp, mul_assoc M, mul_assoc N, tensor_comp, tensor_comp] -- Porting note: needed to add `dsimp` here. slice_lhs 1 3 => dsimp; rw [tensor_associativity] slice_lhs 3 4 => rw [← tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, tensor_id] simp only [Category.assoc] #align Mon_.Mon_tensor_mul_assoc Mon_.Mon_tensor_mul_assoc theorem mul_associator {M N P : Mon_ C} : (tensor_μ C (M.X ⊗ N.X, P.X) (M.X ⊗ N.X, P.X) ≫ (tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) ⊗ P.mul)) ≫ (α_ M.X N.X P.X).hom = ((α_ M.X N.X P.X).hom ⊗ (α_ M.X N.X P.X).hom) ≫ tensor_μ C (M.X, N.X ⊗ P.X) (M.X, N.X ⊗ P.X) ≫ (M.mul ⊗ tensor_μ C (N.X, P.X) (N.X, P.X) ≫ (N.mul ⊗ P.mul)) := by simp only [tensor_obj, prodMonoidal_tensorObj, Category.assoc] slice_lhs 2 3 => rw [← Category.id_comp P.mul, tensor_comp] slice_lhs 3 4 => rw [associator_naturality] slice_rhs 3 4 => rw [← Category.id_comp M.mul, tensor_comp] slice_lhs 1 3 => rw [associator_monoidal] simp only [Category.assoc] #align Mon_.mul_associator Mon_.mul_associator theorem mul_leftUnitor {M : Mon_ C} : (tensor_μ C (𝟙_ C, M.X) (𝟙_ C, M.X) ≫ ((λ_ (𝟙_ C)).hom ⊗ M.mul)) ≫ (λ_ M.X).hom = ((λ_ M.X).hom ⊗ (λ_ M.X).hom) ≫ M.mul := by rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp M.mul, tensor_comp] slice_lhs 3 4 => rw [leftUnitor_naturality] slice_lhs 1 3 => rw [← leftUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_left_unitor Mon_.mul_leftUnitor theorem mul_rightUnitor {M : Mon_ C} : (tensor_μ C (M.X, 𝟙_ C) (M.X, 𝟙_ C) ≫ (M.mul ⊗ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M.X).hom = ((ρ_ M.X).hom ⊗ (ρ_ M.X).hom) ≫ M.mul := by rw [← Category.id_comp M.mul, ← Category.comp_id (λ_ (𝟙_ C)).hom, tensor_comp] slice_lhs 3 4 => rw [rightUnitor_naturality] slice_lhs 1 3 => rw [← rightUnitor_monoidal] simp only [Category.assoc, Category.id_comp] #align Mon_.mul_right_unitor Mon_.mul_rightUnitor instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) := let tensorObj (M N : Mon_ C) : Mon_ C := { X := M.X ⊗ N.X one := (λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one) mul := tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) one_mul := Mon_tensor_one_mul M N mul_one := Mon_tensor_mul_one M N mul_assoc := Mon_tensor_mul_assoc M N } let tensorHom {X₁ Y₁ X₂ Y₂ : Mon_ C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj _ _ ⟶ tensorObj _ _ := { hom := f.hom ⊗ g.hom one_hom := by dsimp slice_lhs 2 3 => rw [← tensor_comp, Hom.one_hom f, Hom.one_hom g] mul_hom := by dsimp slice_rhs 1 2 => rw [tensor_μ_natural] slice_lhs 2 3 => rw [← tensor_comp, Hom.mul_hom f, Hom.mul_hom g, tensor_comp] simp only [Category.assoc] } { tensorObj := tensorObj tensorHom := tensorHom whiskerRight := fun f Y => tensorHom f (𝟙 Y) whiskerLeft := fun X _ _ g => tensorHom (𝟙 X) g tensorUnit := trivial C associator := fun M N P ↦ isoOfIso (α_ M.X N.X P.X) one_associator mul_associator leftUnitor := fun M ↦ isoOfIso (λ_ M.X) one_leftUnitor mul_leftUnitor rightUnitor := fun M ↦ isoOfIso (ρ_ M.X) one_rightUnitor mul_rightUnitor } instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext; dsimp; apply pentagon) (triangle := by intros; ext; dsimp;
apply triangle
instance monMonoidal : MonoidalCategory (Mon_ C) := .ofTensorHom (tensor_id := by intros; ext; apply tensor_id) (tensor_comp := by intros; ext; apply tensor_comp) (associator_naturality := by intros; ext; dsimp; apply associator_naturality) (leftUnitor_naturality := by intros; ext; dsimp; apply leftUnitor_naturality) (rightUnitor_naturality := by intros; ext; dsimp; apply rightUnitor_naturality) (pentagon := by intros; ext; dsimp; apply pentagon) (triangle := by intros; ext; dsimp;
Mathlib.CategoryTheory.Monoidal.Mon_.506_0.NTUMzhXPwXsmsYt
instance monMonoidal : MonoidalCategory (Mon_ C)
Mathlib_CategoryTheory_Monoidal_Mon_
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocSemiring α f g : CentroidHom α h : (fun f => f.toFun) f = (fun f => f.toFun) g ⊢ f = g
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by
cases f
instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by
Mathlib.Algebra.Ring.CentroidHom.89_0.FQQ3LT1tg3cKlkH
instance : CentroidHomClass (CentroidHom α) α where coe f
Mathlib_Algebra_Ring_CentroidHom
case mk F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocSemiring α g : CentroidHom α toAddMonoidHom✝ : α →+ α map_mul_left'✝ : ∀ (a b : α), ZeroHom.toFun (↑toAddMonoidHom✝) (a * b) = a * ZeroHom.toFun (↑toAddMonoidHom✝) b map_mul_right'✝ : ∀ (a b : α), ZeroHom.toFun (↑toAddMonoidHom✝) (a * b) = ZeroHom.toFun (↑toAddMonoidHom✝) a * b h : (fun f => f.toFun) { toAddMonoidHom := toAddMonoidHom✝, map_mul_left' := map_mul_left'✝, map_mul_right' := map_mul_right'✝ } = (fun f => f.toFun) g ⊢ { toAddMonoidHom := toAddMonoidHom✝, map_mul_left' := map_mul_left'✝, map_mul_right' := map_mul_right'✝ } = g
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f
cases g
instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f
Mathlib.Algebra.Ring.CentroidHom.89_0.FQQ3LT1tg3cKlkH
instance : CentroidHomClass (CentroidHom α) α where coe f
Mathlib_Algebra_Ring_CentroidHom
case mk.mk F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocSemiring α toAddMonoidHom✝¹ : α →+ α map_mul_left'✝¹ : ∀ (a b : α), ZeroHom.toFun (↑toAddMonoidHom✝¹) (a * b) = a * ZeroHom.toFun (↑toAddMonoidHom✝¹) b map_mul_right'✝¹ : ∀ (a b : α), ZeroHom.toFun (↑toAddMonoidHom✝¹) (a * b) = ZeroHom.toFun (↑toAddMonoidHom✝¹) a * b toAddMonoidHom✝ : α →+ α map_mul_left'✝ : ∀ (a b : α), ZeroHom.toFun (↑toAddMonoidHom✝) (a * b) = a * ZeroHom.toFun (↑toAddMonoidHom✝) b map_mul_right'✝ : ∀ (a b : α), ZeroHom.toFun (↑toAddMonoidHom✝) (a * b) = ZeroHom.toFun (↑toAddMonoidHom✝) a * b h : (fun f => f.toFun) { toAddMonoidHom := toAddMonoidHom✝¹, map_mul_left' := map_mul_left'✝¹, map_mul_right' := map_mul_right'✝¹ } = (fun f => f.toFun) { toAddMonoidHom := toAddMonoidHom✝, map_mul_left' := map_mul_left'✝, map_mul_right' := map_mul_right'✝ } ⊢ { toAddMonoidHom := toAddMonoidHom✝¹, map_mul_left' := map_mul_left'✝¹, map_mul_right' := map_mul_right'✝¹ } = { toAddMonoidHom := toAddMonoidHom✝, map_mul_left' := map_mul_left'✝, map_mul_right' := map_mul_right'✝ }
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g
congr with x
instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g
Mathlib.Algebra.Ring.CentroidHom.89_0.FQQ3LT1tg3cKlkH
instance : CentroidHomClass (CentroidHom α) α where coe f
Mathlib_Algebra_Ring_CentroidHom
case mk.mk.e_toAddMonoidHom.h F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocSemiring α toAddMonoidHom✝¹ : α →+ α map_mul_left'✝¹ : ∀ (a b : α), ZeroHom.toFun (↑toAddMonoidHom✝¹) (a * b) = a * ZeroHom.toFun (↑toAddMonoidHom✝¹) b map_mul_right'✝¹ : ∀ (a b : α), ZeroHom.toFun (↑toAddMonoidHom✝¹) (a * b) = ZeroHom.toFun (↑toAddMonoidHom✝¹) a * b toAddMonoidHom✝ : α →+ α map_mul_left'✝ : ∀ (a b : α), ZeroHom.toFun (↑toAddMonoidHom✝) (a * b) = a * ZeroHom.toFun (↑toAddMonoidHom✝) b map_mul_right'✝ : ∀ (a b : α), ZeroHom.toFun (↑toAddMonoidHom✝) (a * b) = ZeroHom.toFun (↑toAddMonoidHom✝) a * b h : (fun f => f.toFun) { toAddMonoidHom := toAddMonoidHom✝¹, map_mul_left' := map_mul_left'✝¹, map_mul_right' := map_mul_right'✝¹ } = (fun f => f.toFun) { toAddMonoidHom := toAddMonoidHom✝, map_mul_left' := map_mul_left'✝, map_mul_right' := map_mul_right'✝ } x : α ⊢ toAddMonoidHom✝¹ x = toAddMonoidHom✝ x
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x
exact congrFun h x
instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x
Mathlib.Algebra.Ring.CentroidHom.89_0.FQQ3LT1tg3cKlkH
instance : CentroidHomClass (CentroidHom α) α where coe f
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocSemiring α f : CentroidHom α f' : α → α h : f' = ⇑f src✝ : α →+ α := AddMonoidHom.copy f.toAddMonoidHom f' h a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := { toFun := f', map_zero' := (_ : ZeroHom.toFun (↑src✝) 0 = 0) }, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := { toFun := f', map_zero' := (_ : ZeroHom.toFun (↑src✝) 0 = 0) }, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by
simp_rw [h, map_mul_left]
/-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.144_0.FQQ3LT1tg3cKlkH
/-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocSemiring α f : CentroidHom α f' : α → α h : f' = ⇑f src✝ : α →+ α := AddMonoidHom.copy f.toAddMonoidHom f' h a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := { toFun := f', map_zero' := (_ : ZeroHom.toFun (↑src✝) 0 = 0) }, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := { toFun := f', map_zero' := (_ : ZeroHom.toFun (↑src✝) 0 = 0) }, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by
simp_rw [h, map_mul_right]
/-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.144_0.FQQ3LT1tg3cKlkH
/-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocSemiring α g f₁ f₂ : CentroidHom α hg : Injective ⇑g h : comp g f₁ = comp g f₂ a : α ⊢ g (f₁ a) = g (f₂ a)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by
rw [← comp_apply, h, comp_apply]
@[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by
Mathlib.Algebra.Ring.CentroidHom.235_0.FQQ3LT1tg3cKlkH
@[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocSemiring α f g : CentroidHom α src✝ : α →+ α := ↑f + ↑g a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by
show f (a * b) + g (a * b) = a * (f b + g b)
instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.249_0.FQQ3LT1tg3cKlkH
instance : Add (CentroidHom α)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocSemiring α f g : CentroidHom α src✝ : α →+ α := ↑f + ↑g a b : α ⊢ f (a * b) + g (a * b) = a * (f b + g b)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b)
simp [map_mul_left, mul_add]
instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b)
Mathlib.Algebra.Ring.CentroidHom.249_0.FQQ3LT1tg3cKlkH
instance : Add (CentroidHom α)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocSemiring α f g : CentroidHom α src✝ : α →+ α := ↑f + ↑g a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by
show f (a * b) + g (a * b) = (f a + g a) * b
instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.249_0.FQQ3LT1tg3cKlkH
instance : Add (CentroidHom α)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocSemiring α f g : CentroidHom α src✝ : α →+ α := ↑f + ↑g a b : α ⊢ f (a * b) + g (a * b) = (f a + g a) * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b
simp [map_mul_right, add_mul]
instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b
Mathlib.Algebra.Ring.CentroidHom.249_0.FQQ3LT1tg3cKlkH
instance : Add (CentroidHom α)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α n : M f : CentroidHom α src✝ : α →+ α := n • ↑f a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by
change n • f (a * b) = a * n • f b
instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.267_0.FQQ3LT1tg3cKlkH
instance instSMul : SMul M (CentroidHom α) where smul n f
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α n : M f : CentroidHom α src✝ : α →+ α := n • ↑f a b : α ⊢ n • f (a * b) = a * n • f b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b
rw [map_mul_left f, ← mul_smul_comm]
instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b
Mathlib.Algebra.Ring.CentroidHom.267_0.FQQ3LT1tg3cKlkH
instance instSMul : SMul M (CentroidHom α) where smul n f
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α n : M f : CentroidHom α src✝ : α →+ α := n • ↑f a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by
change n • f (a * b) = n • f a * b
instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.267_0.FQQ3LT1tg3cKlkH
instance instSMul : SMul M (CentroidHom α) where smul n f
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α n : M f : CentroidHom α src✝ : α →+ α := n • ↑f a b : α ⊢ n • f (a * b) = n • f a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b
rw [map_mul_right f, ← smul_mul_assoc]
instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b
Mathlib.Algebra.Ring.CentroidHom.267_0.FQQ3LT1tg3cKlkH
instance instSMul : SMul M (CentroidHom α) where smul n f
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α n : ℕ src✝ : AddMonoid.End α := toEnd f ^ n a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by
induction' n with n ih
instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.291_0.FQQ3LT1tg3cKlkH
instance hasNPowNat : Pow (CentroidHom α) ℕ
Mathlib_Algebra_Ring_CentroidHom
case zero F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α a b : α src✝ : AddMonoid.End α := toEnd f ^ Nat.zero ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih ·
exact rfl
instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih ·
Mathlib.Algebra.Ring.CentroidHom.291_0.FQQ3LT1tg3cKlkH
instance hasNPowNat : Pow (CentroidHom α) ℕ
Mathlib_Algebra_Ring_CentroidHom
case succ F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α a b : α n : ℕ ih : let src := toEnd f ^ n; ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) b src✝ : AddMonoid.End α := toEnd f ^ Nat.succ n ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl ·
simp
instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl ·
Mathlib.Algebra.Ring.CentroidHom.291_0.FQQ3LT1tg3cKlkH
instance hasNPowNat : Pow (CentroidHom α) ℕ
Mathlib_Algebra_Ring_CentroidHom
case succ F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α a b : α n : ℕ ih : let src := toEnd f ^ n; ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) b src✝ : AddMonoid.End α := toEnd f ^ Nat.succ n ⊢ (toEnd f ^ Nat.succ n) (a * b) = a * (toEnd f ^ Nat.succ n) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp
rw [pow_succ]
instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp
Mathlib.Algebra.Ring.CentroidHom.291_0.FQQ3LT1tg3cKlkH
instance hasNPowNat : Pow (CentroidHom α) ℕ
Mathlib_Algebra_Ring_CentroidHom
case succ F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α a b : α n : ℕ ih : let src := toEnd f ^ n; ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) b src✝ : AddMonoid.End α := toEnd f ^ Nat.succ n ⊢ (toEnd f * toEnd f ^ n) (a * b) = a * (toEnd f * toEnd f ^ n) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ]
exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _)
instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ]
Mathlib.Algebra.Ring.CentroidHom.291_0.FQQ3LT1tg3cKlkH
instance hasNPowNat : Pow (CentroidHom α) ℕ
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α n : ℕ src✝ : AddMonoid.End α := toEnd f ^ n a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by
induction' n with n ih
instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.291_0.FQQ3LT1tg3cKlkH
instance hasNPowNat : Pow (CentroidHom α) ℕ
Mathlib_Algebra_Ring_CentroidHom
case zero F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α a b : α src✝ : AddMonoid.End α := toEnd f ^ Nat.zero ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih ·
exact rfl
instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih ·
Mathlib.Algebra.Ring.CentroidHom.291_0.FQQ3LT1tg3cKlkH
instance hasNPowNat : Pow (CentroidHom α) ℕ
Mathlib_Algebra_Ring_CentroidHom
case succ F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α a b : α n : ℕ ih : let src := toEnd f ^ n; ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) a * b src✝ : AddMonoid.End α := toEnd f ^ Nat.succ n ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl ·
simp
instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl ·
Mathlib.Algebra.Ring.CentroidHom.291_0.FQQ3LT1tg3cKlkH
instance hasNPowNat : Pow (CentroidHom α) ℕ
Mathlib_Algebra_Ring_CentroidHom
case succ F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α a b : α n : ℕ ih : let src := toEnd f ^ n; ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) a * b src✝ : AddMonoid.End α := toEnd f ^ Nat.succ n ⊢ (toEnd f ^ Nat.succ n) (a * b) = (toEnd f ^ Nat.succ n) a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp
rw [pow_succ]
instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp
Mathlib.Algebra.Ring.CentroidHom.291_0.FQQ3LT1tg3cKlkH
instance hasNPowNat : Pow (CentroidHom α) ℕ
Mathlib_Algebra_Ring_CentroidHom
case succ F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α a b : α n : ℕ ih : let src := toEnd f ^ n; ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }) a * b src✝ : AddMonoid.End α := toEnd f ^ Nat.succ n ⊢ (toEnd f * toEnd f ^ n) (a * b) = (toEnd f * toEnd f ^ n) a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ]
exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _)
instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ]
Mathlib.Algebra.Ring.CentroidHom.291_0.FQQ3LT1tg3cKlkH
instance hasNPowNat : Pow (CentroidHom α) ℕ
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α T S : CentroidHom α a b : α ⊢ (⇑T ∘ ⇑S) (a * b) = (⇑S ∘ ⇑T) (a * b)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by
simp only [Function.comp_apply]
theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by
Mathlib.Algebra.Ring.CentroidHom.424_0.FQQ3LT1tg3cKlkH
theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α T S : CentroidHom α a b : α ⊢ T (S (a * b)) = S (T (a * b))
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply]
rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left]
theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply]
Mathlib.Algebra.Ring.CentroidHom.424_0.FQQ3LT1tg3cKlkH
theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α ⊢ RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range ⇑L ∪ Set.range ⇑R)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by
ext T
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by
Mathlib.Algebra.Ring.CentroidHom.438_0.FQQ3LT1tg3cKlkH
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R)
Mathlib_Algebra_Ring_CentroidHom
case h F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α T : AddMonoid.End α ⊢ T ∈ RingHom.rangeS (toEndRingHom α) ↔ T ∈ Subsemiring.centralizer (Set.range ⇑L ∪ Set.range ⇑R)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T
refine ⟨?_, fun h ↦ ?_⟩
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T
Mathlib.Algebra.Ring.CentroidHom.438_0.FQQ3LT1tg3cKlkH
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R)
Mathlib_Algebra_Ring_CentroidHom
case h.refine_1 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α T : AddMonoid.End α ⊢ T ∈ RingHom.rangeS (toEndRingHom α) → T ∈ Subsemiring.centralizer (Set.range ⇑L ∪ Set.range ⇑R)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ ·
rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩)
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ ·
Mathlib.Algebra.Ring.CentroidHom.438_0.FQQ3LT1tg3cKlkH
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R)
Mathlib_Algebra_Ring_CentroidHom
case h.refine_1.intro.inl.intro F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α a : α ⊢ L a * (toEndRingHom α) f = (toEndRingHom α) f * L a
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) ·
exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) ·
Mathlib.Algebra.Ring.CentroidHom.438_0.FQQ3LT1tg3cKlkH
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R)
Mathlib_Algebra_Ring_CentroidHom
case h.refine_1.intro.inr.intro F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α f : CentroidHom α b : α ⊢ R b * (toEndRingHom α) f = (toEndRingHom α) f * R b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm ·
exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm ·
Mathlib.Algebra.Ring.CentroidHom.438_0.FQQ3LT1tg3cKlkH
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R)
Mathlib_Algebra_Ring_CentroidHom
case h.refine_2 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α T : AddMonoid.End α h : T ∈ Subsemiring.centralizer (Set.range ⇑L ∪ Set.range ⇑R) ⊢ T ∈ RingHom.rangeS (toEndRingHom α)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm ·
rw [Subsemiring.mem_centralizer_iff] at h
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm ·
Mathlib.Algebra.Ring.CentroidHom.438_0.FQQ3LT1tg3cKlkH
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R)
Mathlib_Algebra_Ring_CentroidHom
case h.refine_2 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α T : AddMonoid.End α h : ∀ g ∈ Set.range ⇑L ∪ Set.range ⇑R, g * T = T * g ⊢ T ∈ RingHom.rangeS (toEndRingHom α)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h
refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h
Mathlib.Algebra.Ring.CentroidHom.438_0.FQQ3LT1tg3cKlkH
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R)
Mathlib_Algebra_Ring_CentroidHom
case h.refine_2.refine_1 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α T : AddMonoid.End α h : ∀ g ∈ Set.range ⇑L ∪ Set.range ⇑R, g * T = T * g a b : α ⊢ ZeroHom.toFun (↑T) (a * b) = a * ZeroHom.toFun (↑T) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ ·
exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ ·
Mathlib.Algebra.Ring.CentroidHom.438_0.FQQ3LT1tg3cKlkH
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R)
Mathlib_Algebra_Ring_CentroidHom
case h.refine_2.refine_2 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α T : AddMonoid.End α h : ∀ g ∈ Set.range ⇑L ∪ Set.range ⇑R, g * T = T * g a b : α ⊢ ZeroHom.toFun (↑T) (a * b) = ZeroHom.toFun (↑T) a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm ·
exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm ·
Mathlib.Algebra.Ring.CentroidHom.438_0.FQQ3LT1tg3cKlkH
lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α z₁ z₂ : ↥(NonUnitalSubsemiring.center α) ⊢ (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) (z₁ * z₂) = (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₁ * (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₂
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by
ext a
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by
Mathlib.Algebra.Ring.CentroidHom.450_0.FQQ3LT1tg3cKlkH
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z
Mathlib_Algebra_Ring_CentroidHom
case h F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α z₁ z₂ : ↥(NonUnitalSubsemiring.center α) a : α ⊢ ((fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) (z₁ * z₂)) a = ((fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₁ * (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₂) a
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a
exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a
Mathlib.Algebra.Ring.CentroidHom.450_0.FQQ3LT1tg3cKlkH
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α ⊢ MulHom.toFun { toFun := fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }, map_mul' := (_ : ∀ (z₁ z₂ : ↥(NonUnitalSubsemiring.center α)), (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) (z₁ * z₂) = (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₁ * (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₂) } 0 = 0
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by
simp only [ZeroMemClass.coe_zero, map_zero]
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by
Mathlib.Algebra.Ring.CentroidHom.450_0.FQQ3LT1tg3cKlkH
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α ⊢ { toAddMonoidHom := { toZeroHom := ↑0, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑0) (x + y) = ZeroHom.toFun (↑0) x + ZeroHom.toFun (↑0) y) }, map_mul_left' := (_ : ∀ (a b : α), ZeroHom.toFun (↑{ toZeroHom := ↑0, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑0) (x + y) = ZeroHom.toFun (↑0) x + ZeroHom.toFun (↑0) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑0, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑0) (x + y) = ZeroHom.toFun (↑0) x + ZeroHom.toFun (↑0) y) }) b), map_mul_right' := (_ : ∀ (a b : α), ZeroHom.toFun (↑{ toZeroHom := ↑0, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑0) (x + y) = ZeroHom.toFun (↑0) x + ZeroHom.toFun (↑0) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑0, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑0) (x + y) = ZeroHom.toFun (↑0) x + ZeroHom.toFun (↑0) y) }) a * b) } = 0
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero]
exact rfl
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero]
Mathlib.Algebra.Ring.CentroidHom.450_0.FQQ3LT1tg3cKlkH
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α x✝¹ x✝ : ↥(NonUnitalSubsemiring.center α) ⊢ MulHom.toFun { toFun := fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }, map_mul' := (_ : ∀ (z₁ z₂ : ↥(NonUnitalSubsemiring.center α)), (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) (z₁ * z₂) = (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₁ * (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₂) } (x✝¹ + x✝) = MulHom.toFun { toFun := fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }, map_mul' := (_ : ∀ (z₁ z₂ : ↥(NonUnitalSubsemiring.center α)), (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) (z₁ * z₂) = (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₁ * (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₂) } x✝¹ + MulHom.toFun { toFun := fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }, map_mul' := (_ : ∀ (z₁ z₂ : ↥(NonUnitalSubsemiring.center α)), (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) (z₁ * z₂) = (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₁ * (fun z => let src := L ↑z; { toAddMonoidHom := { toZeroHom := ↑src, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑z * (b * c) = b * (↑z * c)), map_mul_right' := (_ : ∀ (b c : α), ↑z * (b * c) = ↑z * b * c) }) z₂) } x✝
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by
simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add]
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by
Mathlib.Algebra.Ring.CentroidHom.450_0.FQQ3LT1tg3cKlkH
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α x✝¹ x✝ : ↥(NonUnitalSubsemiring.center α) ⊢ { toAddMonoidHom := { toZeroHom := ↑(L ↑x✝¹ + L ↑x✝), map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) (x + y) = ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) x + ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) y) }, map_mul_left' := (_ : ∀ (a b : α), ZeroHom.toFun (↑{ toZeroHom := ↑(L ↑x✝¹ + L ↑x✝), map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) (x + y) = ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) x + ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑(L ↑x✝¹ + L ↑x✝), map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) (x + y) = ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) x + ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) y) }) b), map_mul_right' := (_ : ∀ (a b : α), ZeroHom.toFun (↑{ toZeroHom := ↑(L ↑x✝¹ + L ↑x✝), map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) (x + y) = ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) x + ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑(L ↑x✝¹ + L ↑x✝), map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) (x + y) = ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) x + ZeroHom.toFun (↑(L ↑x✝¹ + L ↑x✝)) y) }) a * b) } = { toAddMonoidHom := { toZeroHom := ↑(L ↑x✝¹), map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑(L ↑x✝¹)) (x + y) = ZeroHom.toFun (↑(L ↑x✝¹)) x + ZeroHom.toFun (↑(L ↑x✝¹)) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑x✝¹ * (b * c) = b * (↑x✝¹ * c)), map_mul_right' := (_ : ∀ (b c : α), ↑x✝¹ * (b * c) = ↑x✝¹ * b * c) } + { toAddMonoidHom := { toZeroHom := ↑(L ↑x✝), map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑(L ↑x✝)) (x + y) = ZeroHom.toFun (↑(L ↑x✝)) x + ZeroHom.toFun (↑(L ↑x✝)) y) }, map_mul_left' := (_ : ∀ (b c : α), ↑x✝ * (b * c) = b * (↑x✝ * c)), map_mul_right' := (_ : ∀ (b c : α), ↑x✝ * (b * c) = ↑x✝ * b * c) }
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add]
exact rfl
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add]
Mathlib.Algebra.Ring.CentroidHom.450_0.FQQ3LT1tg3cKlkH
/-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α ⊢ a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ L a ∈ Set.range toEnd
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by
constructor
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
case mp F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α ⊢ a ∈ NonUnitalSubsemiring.center α → L a = R a ∧ L a ∈ Set.range toEnd
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor ·
exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor ·
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
case mpr F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α ⊢ L a = R a ∧ L a ∈ Set.range toEnd → a ∈ NonUnitalSubsemiring.center α
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ ·
rintro ⟨hc, ⟨T, hT⟩⟩
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ ·
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
case mpr.intro.intro F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a ⊢ a ∈ NonUnitalSubsemiring.center α
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩
have e1 (d : α) : T d = a * d := congr($hT d)
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
case mpr.intro.intro F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d ⊢ a ∈ NonUnitalSubsemiring.center α
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d)
have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d)
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d)
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
case mpr.intro.intro F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ a ∈ NonUnitalSubsemiring.center α
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d)
constructor
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d)
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
case mpr.intro.intro.comm F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 : α), a * a_1 = a_1 * a case mpr.intro.intro.left_assoc F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (b c : α), a * (b * c) = a * b * c case mpr.intro.intro.mid_assoc F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 c : α), a_1 * a * c = a_1 * (a * c) case mpr.intro.intro.right_assoc F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 b : α), a_1 * b * a = a_1 * (b * a)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor
case comm => exact (congr($hc ·))
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 : α), a * a_1 = a_1 * a
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor
case comm => exact (congr($hc ·))
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 : α), a * a_1 = a_1 * a
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm =>
exact (congr($hc ·))
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm =>
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
case mpr.intro.intro.left_assoc F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (b c : α), a * (b * c) = a * b * c case mpr.intro.intro.mid_assoc F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 c : α), a_1 * a * c = a_1 * (a * c) case mpr.intro.intro.right_assoc F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 b : α), a_1 * b * a = a_1 * (b * a)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·))
case left_assoc => simpa [e1] using (map_mul_right T · ·)
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·))
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (b c : α), a * (b * c) = a * b * c
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·))
case left_assoc => simpa [e1] using (map_mul_right T · ·)
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·))
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (b c : α), a * (b * c) = a * b * c
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc =>
simpa [e1] using (map_mul_right T · ·)
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc =>
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
case mpr.intro.intro.mid_assoc F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 c : α), a_1 * a * c = a_1 * (a * c) case mpr.intro.intro.right_assoc F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 b : α), a_1 * b * a = a_1 * (b * a)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·)
case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·)
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 c : α), a_1 * a * c = a_1 * (a * c)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·)
case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·)
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 c : α), a_1 * a * c = a_1 * (a * c)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc =>
exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc =>
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a b c : α ⊢ b * a * c = b * (a * c)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by
simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
case mpr.intro.intro.right_assoc F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 b : α), a_1 * b * a = a_1 * (b * a)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c
case right_assoc => simpa [e2] using (map_mul_left T · ·)
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 b : α), a_1 * b * a = a_1 * (b * a)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c
case right_assoc => simpa [e2] using (map_mul_left T · ·)
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝¹² : NonUnitalNonAssocSemiring α inst✝¹¹ : Monoid M inst✝¹⁰ : Monoid N inst✝⁹ : Semiring R inst✝⁸ : DistribMulAction M α inst✝⁷ : SMulCommClass M α α inst✝⁶ : IsScalarTower M α α inst✝⁵ : DistribMulAction N α inst✝⁴ : SMulCommClass N α α inst✝³ : IsScalarTower N α α inst✝² : Module R α inst✝¹ : SMulCommClass R α α inst✝ : IsScalarTower R α α a : α hc : L a = R a T : CentroidHom α hT : toEnd T = L a e1 : ∀ (d : α), T d = a * d e2 : ∀ (d : α), T d = d * a ⊢ ∀ (a_1 b : α), a_1 * b * a = a_1 * (b * a)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc =>
simpa [e2] using (map_mul_left T · ·)
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc =>
Mathlib.Algebra.Ring.CentroidHom.469_0.FQQ3LT1tg3cKlkH
lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonAssocSemiring α src✝ : ↥(NonUnitalSubsemiring.center α) →ₙ+* CentroidHom α := centerToCentroid T : CentroidHom α ⊢ T 1 ∈ NonUnitalSubsemiring.center α
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by
refine ⟨?_, ?_, ?_, ?_⟩
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by
Mathlib.Algebra.Ring.CentroidHom.489_0.FQQ3LT1tg3cKlkH
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α
Mathlib_Algebra_Ring_CentroidHom
case refine_1 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonAssocSemiring α src✝ : ↥(NonUnitalSubsemiring.center α) →ₙ+* CentroidHom α := centerToCentroid T : CentroidHom α ⊢ ∀ (a : α), T 1 * a = a * T 1 case refine_2 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonAssocSemiring α src✝ : ↥(NonUnitalSubsemiring.center α) →ₙ+* CentroidHom α := centerToCentroid T : CentroidHom α ⊢ ∀ (b c : α), T 1 * (b * c) = T 1 * b * c case refine_3 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonAssocSemiring α src✝ : ↥(NonUnitalSubsemiring.center α) →ₙ+* CentroidHom α := centerToCentroid T : CentroidHom α ⊢ ∀ (a c : α), a * T 1 * c = a * (T 1 * c) case refine_4 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonAssocSemiring α src✝ : ↥(NonUnitalSubsemiring.center α) →ₙ+* CentroidHom α := centerToCentroid T : CentroidHom α ⊢ ∀ (a b : α), a * b * T 1 = a * (b * T 1)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩;
all_goals simp [← map_mul_left, ← map_mul_right]
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩;
Mathlib.Algebra.Ring.CentroidHom.489_0.FQQ3LT1tg3cKlkH
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α
Mathlib_Algebra_Ring_CentroidHom
case refine_1 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonAssocSemiring α src✝ : ↥(NonUnitalSubsemiring.center α) →ₙ+* CentroidHom α := centerToCentroid T : CentroidHom α ⊢ ∀ (a : α), T 1 * a = a * T 1
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals
simp [← map_mul_left, ← map_mul_right]
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals
Mathlib.Algebra.Ring.CentroidHom.489_0.FQQ3LT1tg3cKlkH
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α
Mathlib_Algebra_Ring_CentroidHom
case refine_2 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonAssocSemiring α src✝ : ↥(NonUnitalSubsemiring.center α) →ₙ+* CentroidHom α := centerToCentroid T : CentroidHom α ⊢ ∀ (b c : α), T 1 * (b * c) = T 1 * b * c
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals
simp [← map_mul_left, ← map_mul_right]
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals
Mathlib.Algebra.Ring.CentroidHom.489_0.FQQ3LT1tg3cKlkH
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α
Mathlib_Algebra_Ring_CentroidHom
case refine_3 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonAssocSemiring α src✝ : ↥(NonUnitalSubsemiring.center α) →ₙ+* CentroidHom α := centerToCentroid T : CentroidHom α ⊢ ∀ (a c : α), a * T 1 * c = a * (T 1 * c)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals
simp [← map_mul_left, ← map_mul_right]
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals
Mathlib.Algebra.Ring.CentroidHom.489_0.FQQ3LT1tg3cKlkH
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α
Mathlib_Algebra_Ring_CentroidHom
case refine_4 F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonAssocSemiring α src✝ : ↥(NonUnitalSubsemiring.center α) →ₙ+* CentroidHom α := centerToCentroid T : CentroidHom α ⊢ ∀ (a b : α), a * b * T 1 = a * (b * T 1)
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals
simp [← map_mul_left, ← map_mul_right]
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals
Mathlib.Algebra.Ring.CentroidHom.489_0.FQQ3LT1tg3cKlkH
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonAssocSemiring α src✝ : ↥(NonUnitalSubsemiring.center α) →ₙ+* CentroidHom α := centerToCentroid z : ↥(NonUnitalSubsemiring.center α) ⊢ ↑((fun T => { val := T 1, property := (_ : IsMulCentral (T 1)) }) (MulHom.toFun src✝.toMulHom z)) = ↑z
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals simp [← map_mul_left, ← map_mul_right]⟩ left_inv := fun z ↦ Subtype.ext <| by
simp [centerToCentroid_apply]
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals simp [← map_mul_left, ← map_mul_right]⟩ left_inv := fun z ↦ Subtype.ext <| by
Mathlib.Algebra.Ring.CentroidHom.489_0.FQQ3LT1tg3cKlkH
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonAssocSemiring α src✝ : ↥(NonUnitalSubsemiring.center α) →ₙ+* CentroidHom α := centerToCentroid T : CentroidHom α ⊢ ∀ (a : α), (MulHom.toFun src✝.toMulHom ((fun T => { val := T 1, property := (_ : IsMulCentral (T 1)) }) T)) a = T a
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals simp [← map_mul_left, ← map_mul_right]⟩ left_inv := fun z ↦ Subtype.ext <| by simp [centerToCentroid_apply] right_inv := fun T ↦ CentroidHom.ext <| by
simp [centerToCentroid_apply, ← map_mul_right]
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals simp [← map_mul_left, ← map_mul_right]⟩ left_inv := fun z ↦ Subtype.ext <| by simp [centerToCentroid_apply] right_inv := fun T ↦ CentroidHom.ext <| by
Mathlib.Algebra.Ring.CentroidHom.489_0.FQQ3LT1tg3cKlkH
/-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocRing α f : CentroidHom α src✝ : α →+ α := -↑f a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals simp [← map_mul_left, ← map_mul_right]⟩ left_inv := fun z ↦ Subtype.ext <| by simp [centerToCentroid_apply] right_inv := fun T ↦ CentroidHom.ext <| by simp [centerToCentroid_apply, ← map_mul_right] } end NonAssocSemiring section NonUnitalNonAssocRing variable [NonUnitalNonAssocRing α] /-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α) := ⟨fun f ↦ { (-f : α →+ α) with map_mul_left' := fun a b ↦ by
change -f (a * b) = a * (-f b)
/-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α) := ⟨fun f ↦ { (-f : α →+ α) with map_mul_left' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.503_0.FQQ3LT1tg3cKlkH
/-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocRing α f : CentroidHom α src✝ : α →+ α := -↑f a b : α ⊢ -f (a * b) = a * -f b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals simp [← map_mul_left, ← map_mul_right]⟩ left_inv := fun z ↦ Subtype.ext <| by simp [centerToCentroid_apply] right_inv := fun T ↦ CentroidHom.ext <| by simp [centerToCentroid_apply, ← map_mul_right] } end NonAssocSemiring section NonUnitalNonAssocRing variable [NonUnitalNonAssocRing α] /-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α) := ⟨fun f ↦ { (-f : α →+ α) with map_mul_left' := fun a b ↦ by change -f (a * b) = a * (-f b)
simp [map_mul_left]
/-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α) := ⟨fun f ↦ { (-f : α →+ α) with map_mul_left' := fun a b ↦ by change -f (a * b) = a * (-f b)
Mathlib.Algebra.Ring.CentroidHom.503_0.FQQ3LT1tg3cKlkH
/-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocRing α f : CentroidHom α src✝ : α →+ α := -↑f a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals simp [← map_mul_left, ← map_mul_right]⟩ left_inv := fun z ↦ Subtype.ext <| by simp [centerToCentroid_apply] right_inv := fun T ↦ CentroidHom.ext <| by simp [centerToCentroid_apply, ← map_mul_right] } end NonAssocSemiring section NonUnitalNonAssocRing variable [NonUnitalNonAssocRing α] /-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α) := ⟨fun f ↦ { (-f : α →+ α) with map_mul_left' := fun a b ↦ by change -f (a * b) = a * (-f b) simp [map_mul_left] map_mul_right' := fun a b ↦ by
change -f (a * b) = (-f a) * b
/-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α) := ⟨fun f ↦ { (-f : α →+ α) with map_mul_left' := fun a b ↦ by change -f (a * b) = a * (-f b) simp [map_mul_left] map_mul_right' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.503_0.FQQ3LT1tg3cKlkH
/-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocRing α f : CentroidHom α src✝ : α →+ α := -↑f a b : α ⊢ -f (a * b) = -f a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals simp [← map_mul_left, ← map_mul_right]⟩ left_inv := fun z ↦ Subtype.ext <| by simp [centerToCentroid_apply] right_inv := fun T ↦ CentroidHom.ext <| by simp [centerToCentroid_apply, ← map_mul_right] } end NonAssocSemiring section NonUnitalNonAssocRing variable [NonUnitalNonAssocRing α] /-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α) := ⟨fun f ↦ { (-f : α →+ α) with map_mul_left' := fun a b ↦ by change -f (a * b) = a * (-f b) simp [map_mul_left] map_mul_right' := fun a b ↦ by change -f (a * b) = (-f a) * b
simp [map_mul_right]
/-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α) := ⟨fun f ↦ { (-f : α →+ α) with map_mul_left' := fun a b ↦ by change -f (a * b) = a * (-f b) simp [map_mul_left] map_mul_right' := fun a b ↦ by change -f (a * b) = (-f a) * b
Mathlib.Algebra.Ring.CentroidHom.503_0.FQQ3LT1tg3cKlkH
/-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocRing α f g : CentroidHom α src✝ : α →+ α := ↑f - ↑g a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = a * ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals simp [← map_mul_left, ← map_mul_right]⟩ left_inv := fun z ↦ Subtype.ext <| by simp [centerToCentroid_apply] right_inv := fun T ↦ CentroidHom.ext <| by simp [centerToCentroid_apply, ← map_mul_right] } end NonAssocSemiring section NonUnitalNonAssocRing variable [NonUnitalNonAssocRing α] /-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α) := ⟨fun f ↦ { (-f : α →+ α) with map_mul_left' := fun a b ↦ by change -f (a * b) = a * (-f b) simp [map_mul_left] map_mul_right' := fun a b ↦ by change -f (a * b) = (-f a) * b simp [map_mul_right] }⟩ instance : Sub (CentroidHom α) := ⟨fun f g ↦ { (f - g : α →+ α) with map_mul_left' := fun a b ↦ by
change (⇑f - ⇑g) (a * b) = a * (⇑f - ⇑g) b
instance : Sub (CentroidHom α) := ⟨fun f g ↦ { (f - g : α →+ α) with map_mul_left' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.514_0.FQQ3LT1tg3cKlkH
instance : Sub (CentroidHom α)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocRing α f g : CentroidHom α src✝ : α →+ α := ↑f - ↑g a b : α ⊢ (⇑f - ⇑g) (a * b) = a * (⇑f - ⇑g) b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals simp [← map_mul_left, ← map_mul_right]⟩ left_inv := fun z ↦ Subtype.ext <| by simp [centerToCentroid_apply] right_inv := fun T ↦ CentroidHom.ext <| by simp [centerToCentroid_apply, ← map_mul_right] } end NonAssocSemiring section NonUnitalNonAssocRing variable [NonUnitalNonAssocRing α] /-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α) := ⟨fun f ↦ { (-f : α →+ α) with map_mul_left' := fun a b ↦ by change -f (a * b) = a * (-f b) simp [map_mul_left] map_mul_right' := fun a b ↦ by change -f (a * b) = (-f a) * b simp [map_mul_right] }⟩ instance : Sub (CentroidHom α) := ⟨fun f g ↦ { (f - g : α →+ α) with map_mul_left' := fun a b ↦ by change (⇑f - ⇑g) (a * b) = a * (⇑f - ⇑g) b
simp [map_mul_left, mul_sub]
instance : Sub (CentroidHom α) := ⟨fun f g ↦ { (f - g : α →+ α) with map_mul_left' := fun a b ↦ by change (⇑f - ⇑g) (a * b) = a * (⇑f - ⇑g) b
Mathlib.Algebra.Ring.CentroidHom.514_0.FQQ3LT1tg3cKlkH
instance : Sub (CentroidHom α)
Mathlib_Algebra_Ring_CentroidHom
F : Type u_1 M : Type u_2 N : Type u_3 R : Type u_4 α : Type u_5 inst✝ : NonUnitalNonAssocRing α f g : CentroidHom α src✝ : α →+ α := ↑f - ↑g a b : α ⊢ ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) (a * b) = ZeroHom.toFun (↑{ toZeroHom := ↑src✝, map_add' := (_ : ∀ (x y : α), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }) a * b
/- Copyright (c) 2022 Yaël Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Yaël Dillies, Christopher Hoskin -/ import Mathlib.Algebra.Module.Hom import Mathlib.RingTheory.NonUnitalSubsemiring.Basic import Mathlib.RingTheory.Subsemiring.Basic #align_import algebra.hom.centroid from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff" /-! # Centroid homomorphisms Let `A` be a (non unital, non associative) algebra. The centroid of `A` is the set of linear maps `T` on `A` such that `T` commutes with left and right multiplication, that is to say, for all `a` and `b` in `A`, $$ T(ab) = (Ta)b, T(ab) = a(Tb). $$ In mathlib we call elements of the centroid "centroid homomorphisms" (`CentroidHom`) in keeping with `AddMonoidHom` etc. We use the `FunLike` design, so each type of morphisms has a companion typeclass which is meant to be satisfied by itself and all stricter types. ## Types of morphisms * `CentroidHom`: Maps which preserve left and right multiplication. ## Typeclasses * `CentroidHomClass` ## References * [Jacobson, Structure of Rings][Jacobson1956] * [McCrimmon, A taste of Jordan algebras][mccrimmon2004] ## Tags centroid -/ open Function variable {F M N R α : Type*} /-- The type of centroid homomorphisms from `α` to `α`. -/ structure CentroidHom (α : Type*) [NonUnitalNonAssocSemiring α] extends α →+ α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left' (a b : α) : toFun (a * b) = a * toFun b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right' (a b : α) : toFun (a * b) = toFun a * b #align centroid_hom CentroidHom attribute [nolint docBlame] CentroidHom.toAddMonoidHom /-- `CentroidHomClass F α` states that `F` is a type of centroid homomorphisms. You should extend this class when you extend `CentroidHom`. -/ class CentroidHomClass (F : Type*) (α : outParam <| Type*) [NonUnitalNonAssocSemiring α] extends AddMonoidHomClass F α α where /-- Commutativity of centroid homomorphims with left multiplication. -/ map_mul_left (f : F) (a b : α) : f (a * b) = a * f b /-- Commutativity of centroid homomorphims with right multiplication. -/ map_mul_right (f : F) (a b : α) : f (a * b) = f a * b #align centroid_hom_class CentroidHomClass export CentroidHomClass (map_mul_left map_mul_right) instance [NonUnitalNonAssocSemiring α] [CentroidHomClass F α] : CoeTC F (CentroidHom α) := ⟨fun f ↦ { (f : α →+ α) with toFun := f map_mul_left' := map_mul_left f map_mul_right' := map_mul_right f }⟩ /-! ### Centroid homomorphisms -/ namespace CentroidHom section NonUnitalNonAssocSemiring variable [NonUnitalNonAssocSemiring α] instance : CentroidHomClass (CentroidHom α) α where coe f := f.toFun coe_injective' f g h := by cases f cases g congr with x exact congrFun h x map_zero f := f.map_zero' map_add f := f.map_add' map_mul_left f := f.map_mul_left' map_mul_right f := f.map_mul_right' /-- Helper instance for when there's too many metavariables to apply `FunLike.CoeFun` directly. -/ /- Porting note: Lean gave me `unknown constant 'FunLike.CoeFun'` and says `CoeFun` is a type mismatch, so I used `library_search`. -/ instance : CoeFun (CentroidHom α) fun _ ↦ α → α := inferInstanceAs (CoeFun (CentroidHom α) fun _ ↦ α → α) -- Porting note: removed @[simp]; not in normal form. (`toAddMonoidHom_eq_coe` below ensures that -- the LHS simplifies to the RHS anyway.) theorem toFun_eq_coe {f : CentroidHom α} : f.toFun = f := rfl #align centroid_hom.to_fun_eq_coe CentroidHom.toFun_eq_coe @[ext] theorem ext {f g : CentroidHom α} (h : ∀ a, f a = g a) : f = g := FunLike.ext f g h #align centroid_hom.ext CentroidHom.ext @[simp, norm_cast] theorem coe_toAddMonoidHom (f : CentroidHom α) : ⇑(f : α →+ α) = f := rfl #align centroid_hom.coe_to_add_monoid_hom CentroidHom.coe_toAddMonoidHom @[simp] theorem toAddMonoidHom_eq_coe (f : CentroidHom α) : f.toAddMonoidHom = f := rfl #align centroid_hom.to_add_monoid_hom_eq_coe CentroidHom.toAddMonoidHom_eq_coe theorem coe_toAddMonoidHom_injective : Injective ((↑) : CentroidHom α → α →+ α) := fun _f _g h => ext fun a ↦ haveI := FunLike.congr_fun h a this #align centroid_hom.coe_to_add_monoid_hom_injective CentroidHom.coe_toAddMonoidHom_injective /-- Turn a centroid homomorphism into an additive monoid endomorphism. -/ def toEnd (f : CentroidHom α) : AddMonoid.End α := (f : α →+ α) #align centroid_hom.to_End CentroidHom.toEnd theorem toEnd_injective : Injective (CentroidHom.toEnd : CentroidHom α → AddMonoid.End α) := coe_toAddMonoidHom_injective #align centroid_hom.to_End_injective CentroidHom.toEnd_injective /-- Copy of a `CentroidHom` with a new `toFun` equal to the old one. Useful to fix definitional equalities. -/ protected def copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : CentroidHom α := { f.toAddMonoidHom.copy f' <| h with toFun := f' map_mul_left' := fun a b ↦ by simp_rw [h, map_mul_left] map_mul_right' := fun a b ↦ by simp_rw [h, map_mul_right] } #align centroid_hom.copy CentroidHom.copy @[simp] theorem coe_copy (f : CentroidHom α) (f' : α → α) (h : f' = f) : ⇑(f.copy f' h) = f' := rfl #align centroid_hom.coe_copy CentroidHom.coe_copy theorem copy_eq (f : CentroidHom α) (f' : α → α) (h : f' = f) : f.copy f' h = f := FunLike.ext' h #align centroid_hom.copy_eq CentroidHom.copy_eq variable (α) /-- `id` as a `CentroidHom`. -/ protected def id : CentroidHom α := { AddMonoidHom.id α with map_mul_left' := fun _ _ ↦ rfl map_mul_right' := fun _ _ ↦ rfl } #align centroid_hom.id CentroidHom.id instance : Inhabited (CentroidHom α) := ⟨CentroidHom.id α⟩ @[simp, norm_cast] theorem coe_id : ⇑(CentroidHom.id α) = id := rfl #align centroid_hom.coe_id CentroidHom.coe_id @[simp, norm_cast] theorem toAddMonoidHom_id : (CentroidHom.id α : α →+ α) = AddMonoidHom.id α := rfl #align centroid_hom.coe_to_add_monoid_hom_id CentroidHom.toAddMonoidHom_id variable {α} @[simp] theorem id_apply (a : α) : CentroidHom.id α a = a := rfl #align centroid_hom.id_apply CentroidHom.id_apply /-- Composition of `CentroidHom`s as a `CentroidHom`. -/ def comp (g f : CentroidHom α) : CentroidHom α := { g.toAddMonoidHom.comp f.toAddMonoidHom with map_mul_left' := fun _a _b ↦ (congr_arg g <| f.map_mul_left' _ _).trans <| g.map_mul_left' _ _ map_mul_right' := fun _a _b ↦ (congr_arg g <| f.map_mul_right' _ _).trans <| g.map_mul_right' _ _ } #align centroid_hom.comp CentroidHom.comp @[simp, norm_cast] theorem coe_comp (g f : CentroidHom α) : ⇑(g.comp f) = g ∘ f := rfl #align centroid_hom.coe_comp CentroidHom.coe_comp @[simp] theorem comp_apply (g f : CentroidHom α) (a : α) : g.comp f a = g (f a) := rfl #align centroid_hom.comp_apply CentroidHom.comp_apply @[simp, norm_cast] theorem coe_comp_addMonoidHom (g f : CentroidHom α) : (g.comp f : α →+ α) = (g : α →+ α).comp f := rfl #align centroid_hom.coe_comp_add_monoid_hom CentroidHom.coe_comp_addMonoidHom @[simp] theorem comp_assoc (h g f : CentroidHom α) : (h.comp g).comp f = h.comp (g.comp f) := rfl #align centroid_hom.comp_assoc CentroidHom.comp_assoc @[simp] theorem comp_id (f : CentroidHom α) : f.comp (CentroidHom.id α) = f := rfl #align centroid_hom.comp_id CentroidHom.comp_id @[simp] theorem id_comp (f : CentroidHom α) : (CentroidHom.id α).comp f = f := rfl #align centroid_hom.id_comp CentroidHom.id_comp @[simp] theorem cancel_right {g₁ g₂ f : CentroidHom α} (hf : Surjective f) : g₁.comp f = g₂.comp f ↔ g₁ = g₂ := ⟨fun h ↦ ext <| hf.forall.2 <| FunLike.ext_iff.1 h, fun a ↦ congrFun (congrArg comp a) f⟩ #align centroid_hom.cancel_right CentroidHom.cancel_right @[simp] theorem cancel_left {g f₁ f₂ : CentroidHom α} (hg : Injective g) : g.comp f₁ = g.comp f₂ ↔ f₁ = f₂ := ⟨fun h ↦ ext fun a ↦ hg <| by rw [← comp_apply, h, comp_apply], congr_arg _⟩ #align centroid_hom.cancel_left CentroidHom.cancel_left instance : Zero (CentroidHom α) := ⟨{ (0 : α →+ α) with map_mul_left' := fun _a _b ↦ (mul_zero _).symm map_mul_right' := fun _a _b ↦ (zero_mul _).symm }⟩ instance : One (CentroidHom α) := ⟨CentroidHom.id α⟩ instance : Add (CentroidHom α) := ⟨fun f g ↦ { (f + g : α →+ α) with map_mul_left' := fun a b ↦ by show f (a * b) + g (a * b) = a * (f b + g b) simp [map_mul_left, mul_add] map_mul_right' := fun a b ↦ by show f (a * b) + g (a * b) = (f a + g a) * b simp [map_mul_right, add_mul] }⟩ instance : Mul (CentroidHom α) := ⟨comp⟩ variable [Monoid M] [Monoid N] [Semiring R] variable [DistribMulAction M α] [SMulCommClass M α α] [IsScalarTower M α α] variable [DistribMulAction N α] [SMulCommClass N α α] [IsScalarTower N α α] variable [Module R α] [SMulCommClass R α α] [IsScalarTower R α α] instance instSMul : SMul M (CentroidHom α) where smul n f := { (n • f : α →+ α) with map_mul_left' := fun a b ↦ by change n • f (a * b) = a * n • f b rw [map_mul_left f, ← mul_smul_comm] map_mul_right' := fun a b ↦ by change n • f (a * b) = n • f a * b rw [map_mul_right f, ← smul_mul_assoc] } #noalign centroid_hom.has_nsmul instance [SMul M N] [IsScalarTower M N α] : IsScalarTower M N (CentroidHom α) where smul_assoc _ _ _ := ext <| fun _ => smul_assoc _ _ _ instance [SMulCommClass M N α] : SMulCommClass M N (CentroidHom α) where smul_comm _ _ _ := ext <| fun _ => smul_comm _ _ _ instance [DistribMulAction Mᵐᵒᵖ α] [IsCentralScalar M α] : IsCentralScalar M (CentroidHom α) where op_smul_eq_smul _ _ := ext <| fun _ => op_smul_eq_smul _ _ instance isScalarTowerRight : IsScalarTower M (CentroidHom α) (CentroidHom α) where smul_assoc _ _ _ := rfl instance hasNPowNat : Pow (CentroidHom α) ℕ := ⟨fun f n ↦ { (f.toEnd ^ n : AddMonoid.End α) with map_mul_left' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_left' _ _) map_mul_right' := fun a b ↦ by induction' n with n ih · exact rfl · simp rw [pow_succ] exact (congr_arg f.toEnd ih).trans (f.map_mul_right' _ _) }⟩ #align centroid_hom.has_npow_nat CentroidHom.hasNPowNat @[simp, norm_cast] theorem coe_zero : ⇑(0 : CentroidHom α) = 0 := rfl #align centroid_hom.coe_zero CentroidHom.coe_zero @[simp, norm_cast] theorem coe_one : ⇑(1 : CentroidHom α) = id := rfl #align centroid_hom.coe_one CentroidHom.coe_one @[simp, norm_cast] theorem coe_add (f g : CentroidHom α) : ⇑(f + g) = f + g := rfl #align centroid_hom.coe_add CentroidHom.coe_add @[simp, norm_cast] theorem coe_mul (f g : CentroidHom α) : ⇑(f * g) = f ∘ g := rfl #align centroid_hom.coe_mul CentroidHom.coe_mul @[simp, norm_cast] theorem coe_smul (n : M) (f : CentroidHom α) : ⇑(n • f) = n • ⇑f := rfl #align centroid_hom.coe_nsmul CentroidHom.coe_smul @[simp] theorem zero_apply (a : α) : (0 : CentroidHom α) a = 0 := rfl #align centroid_hom.zero_apply CentroidHom.zero_apply @[simp] theorem one_apply (a : α) : (1 : CentroidHom α) a = a := rfl #align centroid_hom.one_apply CentroidHom.one_apply @[simp] theorem add_apply (f g : CentroidHom α) (a : α) : (f + g) a = f a + g a := rfl #align centroid_hom.add_apply CentroidHom.add_apply @[simp] theorem mul_apply (f g : CentroidHom α) (a : α) : (f * g) a = f (g a) := rfl #align centroid_hom.mul_apply CentroidHom.mul_apply @[simp] theorem smul_apply (n : M) (f : CentroidHom α) (a : α) : (n • f) a = n • f a := rfl #align centroid_hom.nsmul_apply CentroidHom.smul_apply example : SMul ℕ (CentroidHom α) := instSMul @[simp] theorem toEnd_zero : (0 : CentroidHom α).toEnd = 0 := rfl #align centroid_hom.to_End_zero CentroidHom.toEnd_zero @[simp] theorem toEnd_add (x y : CentroidHom α) : (x + y).toEnd = x.toEnd + y.toEnd := rfl #align centroid_hom.to_End_add CentroidHom.toEnd_add theorem toEnd_smul (m : M) (x : CentroidHom α) : (m • x).toEnd = m • x.toEnd := rfl #align centroid_hom.to_End_nsmul CentroidHom.toEnd_smul instance : AddCommMonoid (CentroidHom α) := coe_toAddMonoidHom_injective.addCommMonoid _ toEnd_zero toEnd_add (swap toEnd_smul) instance : NatCast (CentroidHom α) where natCast n := n • (1 : CentroidHom α) -- Porting note: `nolint simpNF` added because simplify fails on left-hand side @[simp, norm_cast, nolint simpNF] theorem coe_nat_cast (n : ℕ) : ⇑(n : CentroidHom α) = n • (CentroidHom.id α) := rfl #align centroid_hom.coe_nat_cast CentroidHom.coe_nat_cast theorem nat_cast_apply (n : ℕ) (m : α) : (n : CentroidHom α) m = n • m := rfl #align centroid_hom.nat_cast_apply CentroidHom.nat_cast_apply @[simp] theorem toEnd_one : (1 : CentroidHom α).toEnd = 1 := rfl #align centroid_hom.to_End_one CentroidHom.toEnd_one @[simp] theorem toEnd_mul (x y : CentroidHom α) : (x * y).toEnd = x.toEnd * y.toEnd := rfl #align centroid_hom.to_End_mul CentroidHom.toEnd_mul @[simp] theorem toEnd_pow (x : CentroidHom α) (n : ℕ) : (x ^ n).toEnd = x.toEnd ^ n := rfl #align centroid_hom.to_End_pow CentroidHom.toEnd_pow @[simp, norm_cast] theorem toEnd_nat_cast (n : ℕ) : (n : CentroidHom α).toEnd = ↑n := rfl #align centroid_hom.to_End_nat_cast CentroidHom.toEnd_nat_cast -- cf `add_monoid.End.semiring` instance : Semiring (CentroidHom α) := toEnd_injective.semiring _ toEnd_zero toEnd_one toEnd_add toEnd_mul (swap toEnd_smul) toEnd_pow toEnd_nat_cast variable (α) in /-- `CentroidHom.toEnd` as a `RingHom`. -/ @[simps] def toEndRingHom : CentroidHom α →+* AddMonoid.End α where toFun := toEnd map_zero' := toEnd_zero map_one' := toEnd_one map_add' := toEnd_add map_mul' := toEnd_mul theorem comp_mul_comm (T S : CentroidHom α) (a b : α) : (T ∘ S) (a * b) = (S ∘ T) (a * b) := by simp only [Function.comp_apply] rw [map_mul_right, map_mul_left, ← map_mul_right, ← map_mul_left] #align centroid_hom.comp_mul_comm CentroidHom.comp_mul_comm instance : DistribMulAction M (CentroidHom α) := toEnd_injective.distribMulAction (toEndRingHom α).toAddMonoidHom toEnd_smul instance : Module R (CentroidHom α) := toEnd_injective.module R (toEndRingHom α).toAddMonoidHom toEnd_smul local notation "L" => AddMonoid.End.mulLeft local notation "R" => AddMonoid.End.mulRight lemma centroid_eq_centralizer_mulLeftRight : RingHom.rangeS (toEndRingHom α) = Subsemiring.centralizer (Set.range L ∪ Set.range R) := by ext T refine ⟨?_, fun h ↦ ?_⟩ · rintro ⟨f, rfl⟩ S (⟨a, rfl⟩ | ⟨b, rfl⟩) · exact AddMonoidHom.ext fun b ↦ (map_mul_left f a b).symm · exact AddMonoidHom.ext fun a ↦ (map_mul_right f a b).symm · rw [Subsemiring.mem_centralizer_iff] at h refine ⟨⟨T, fun a b ↦ ?_, fun a b ↦ ?_⟩, rfl⟩ · exact congr($(h (L a) (.inl ⟨a, rfl⟩)) b).symm · exact congr($(h (R b) (.inr ⟨b, rfl⟩)) a).symm /-- The canonical homomorphism from the center into the centroid -/ def centerToCentroid : NonUnitalSubsemiring.center α →ₙ+* CentroidHom α where toFun z := { L (z : α) with map_mul_left' := ((Set.mem_center_iff _).mp z.prop).left_comm map_mul_right' := ((Set.mem_center_iff _).mp z.prop).left_assoc } map_zero' := by simp only [ZeroMemClass.coe_zero, map_zero] exact rfl map_add' := fun _ _ => by simp only [AddSubmonoid.coe_add, NonUnitalSubsemiring.coe_toAddSubmonoid, map_add] exact rfl map_mul' := fun z₁ z₂ => by ext a exact (((Set.mem_center_iff _).mp z₁.prop).left_assoc z₂ a).symm lemma centerToCentroid_apply (z : { x // x ∈ NonUnitalSubsemiring.center α }) (a : α) : (centerToCentroid z) a = z * a := rfl lemma center_iff_op_centroid (a : α) : a ∈ NonUnitalSubsemiring.center α ↔ L a = R a ∧ (L a) ∈ Set.range CentroidHom.toEnd := by constructor · exact fun ha ↦ ⟨AddMonoidHom.ext <| IsMulCentral.comm ha, ⟨centerToCentroid ⟨a, ha⟩, rfl⟩⟩ · rintro ⟨hc, ⟨T, hT⟩⟩ have e1 (d : α) : T d = a * d := congr($hT d) have e2 (d : α) : T d = d * a := congr($(hT.trans hc) d) constructor case comm => exact (congr($hc ·)) case left_assoc => simpa [e1] using (map_mul_right T · ·) case mid_assoc => exact fun b c ↦ by simpa [e1 c, e2 b] using (map_mul_right T b c).symm.trans <| map_mul_left T b c case right_assoc => simpa [e2] using (map_mul_left T · ·) end NonUnitalNonAssocSemiring section NonAssocSemiring variable [NonAssocSemiring α] /-- The canonical isomorphism from the center of a (non-associative) semiring onto its centroid. -/ def centerIsoCentroid : NonUnitalSubsemiring.center α ≃+* CentroidHom α := { centerToCentroid with invFun := fun T ↦ ⟨T 1, by refine ⟨?_, ?_, ?_, ?_⟩; all_goals simp [← map_mul_left, ← map_mul_right]⟩ left_inv := fun z ↦ Subtype.ext <| by simp [centerToCentroid_apply] right_inv := fun T ↦ CentroidHom.ext <| by simp [centerToCentroid_apply, ← map_mul_right] } end NonAssocSemiring section NonUnitalNonAssocRing variable [NonUnitalNonAssocRing α] /-- Negation of `CentroidHom`s as a `CentroidHom`. -/ instance : Neg (CentroidHom α) := ⟨fun f ↦ { (-f : α →+ α) with map_mul_left' := fun a b ↦ by change -f (a * b) = a * (-f b) simp [map_mul_left] map_mul_right' := fun a b ↦ by change -f (a * b) = (-f a) * b simp [map_mul_right] }⟩ instance : Sub (CentroidHom α) := ⟨fun f g ↦ { (f - g : α →+ α) with map_mul_left' := fun a b ↦ by change (⇑f - ⇑g) (a * b) = a * (⇑f - ⇑g) b simp [map_mul_left, mul_sub] map_mul_right' := fun a b ↦ by
change (⇑f - ⇑g) (a * b) = ((⇑f - ⇑g) a) * b
instance : Sub (CentroidHom α) := ⟨fun f g ↦ { (f - g : α →+ α) with map_mul_left' := fun a b ↦ by change (⇑f - ⇑g) (a * b) = a * (⇑f - ⇑g) b simp [map_mul_left, mul_sub] map_mul_right' := fun a b ↦ by
Mathlib.Algebra.Ring.CentroidHom.514_0.FQQ3LT1tg3cKlkH
instance : Sub (CentroidHom α)
Mathlib_Algebra_Ring_CentroidHom