Skip to content

Commit

Permalink
feat(Algebra/Module/Basic): add RingHom.smulOneHom (#9064)
Browse files Browse the repository at this point in the history
This also renames the existing `smulOneHom` to `MonoidHom.smulOneHom`.

Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>
  • Loading branch information
eric-wieser and alreadydone committed Dec 16, 2023
1 parent 1be2f3f commit 5e43fdc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Mathlib/Algebra/Algebra/Basic.lean
Expand Up @@ -377,6 +377,10 @@ instance _root_.IsScalarTower.right : IsScalarTower R A A :=
fun x y z => by rw [smul_eq_mul, smul_eq_mul, smul_def, smul_def, mul_assoc]⟩
#align is_scalar_tower.right IsScalarTower.right

@[simp]
theorem _root_.RingHom.smulOneHom_eq_algebraMap : RingHom.smulOneHom = algebraMap R A :=
RingHom.ext fun r => (algebraMap_eq_smul_one r).symm

-- TODO: set up `IsScalarTower.smulCommClass` earlier so that we can actually prove this using
-- `mul_smul_comm s x y`.

Expand Down
12 changes: 12 additions & 0 deletions Mathlib/Algebra/Module/Basic.lean
Expand Up @@ -333,6 +333,18 @@ def RingHom.toModule [Semiring R] [Semiring S] (f : R →+* S) : Module R S :=
Module.compHom S f
#align ring_hom.to_module RingHom.toModule

/-- If the module action of `R` on `S` is compatible with multiplication on `S`, then
`fun x => x • 1` is a ring homomorphism from `R` to `S`.
This is the `RingHom` version of `MonoidHom.smulOneHom`.
When `R` is commutative, usually `algebraMap` should be preferred. -/
@[simps!] def RingHom.smulOneHom
[Semiring R] [NonAssocSemiring S] [Module R S] [IsScalarTower R S S] : R →+* S where
__ := MonoidHom.smulOneHom
map_zero' := zero_smul R 1
map_add' := (add_smul · · 1)

section AddCommMonoid

variable [Semiring R] [AddCommMonoid M] [Module R M]
Expand Down
10 changes: 5 additions & 5 deletions Mathlib/GroupTheory/GroupAction/Defs.lean
Expand Up @@ -705,15 +705,15 @@ theorem SMulCommClass.of_mul_smul_one {M N} [Monoid N] [SMul M N]
@[to_additive (attr := simps)
"If the additive action of `M` on `N` is compatible with addition on `N`, then
`fun x => x +ᵥ 0` is an additive monoid homomorphism from `M` to `N`."]
def smulOneHom {M N} [Monoid M] [Monoid N] [MulAction M N] [IsScalarTower M N N] :
def MonoidHom.smulOneHom {M N} [Monoid M] [MulOneClass N] [MulAction M N] [IsScalarTower M N N] :
M →* N where
toFun x := x • (1 : N)
map_one' := one_smul _ _
map_mul' x y := by rw [smul_one_mul, smul_smul]
#align smul_one_hom smulOneHom
#align vadd_zero_hom vaddZeroHom
#align smul_one_hom_apply smulOneHom_apply
#align vadd_zero_hom_apply vaddZeroHom_apply
#align smul_one_hom MonoidHom.smulOneHom
#align vadd_zero_hom AddMonoidHom.vaddZeroHom
#align smul_one_hom_apply MonoidHom.smulOneHom_apply
#align vadd_zero_hom_apply AddMonoidHom.vaddZeroHom_apply

end CompatibleScalar

Expand Down

0 comments on commit 5e43fdc

Please sign in to comment.