Zulip Chat Archive

Stream: Is there code for X?

Topic: Monoid hom from Nat given by AddMonoid element


Scott Carnahan (Jul 09 2024 at 02:44):

I couldn't find the following:

import Mathlib.Algebra.Group.Nat

def nsmul.MonoidHom {Γ : Type*} [AddMonoid Γ] (g : Γ) :  →+ Γ where
  toFun n := n  g
  map_zero' := zero_nsmul g
  map_add' := add_nsmul g

Does this have a place in mathlib, or should I use something like an anonymous constructor?

Yury G. Kudryashov (Jul 09 2024 at 03:04):

See docs#multiplesHom

Yury G. Kudryashov (Jul 09 2024 at 03:04):

Found by @loogle Nat →+ _

loogle (Jul 09 2024 at 03:04):

:search: multiplesHom, Nat.castAddMonoidHom, and 15 more

Yury G. Kudryashov (Jul 09 2024 at 03:05):

It's an Equiv, not a constructor, so it doesn't appear in @loogle |- Nat →+ _

loogle (Jul 09 2024 at 03:05):

:search: Nat.castAddMonoidHom, Multiset.replicateAddMonoidHom

Scott Carnahan (Jul 09 2024 at 03:14):

Thank you!


Last updated: May 02 2025 at 03:31 UTC