Zulip Chat Archive

Stream: Is there code for X?

Topic: A variant of Nat that has instance Zero to return 1?


Siddharth Bhat (Nov 09 2023 at 23:47):

I want to use Finsupp α ℕ, where the default value of the Finsupp where the support does not exist is considered to be 1 (and the additive monoid to be considered as multiplication, of course). How exactly should I achieve this? I can't imagine I'm the first one to want this!

Eric Wieser (Nov 10 2023 at 00:19):

Finsupp α (Additive ℕ) will work

Eric Wieser (Nov 10 2023 at 00:21):

Multiplicative (Finsupp α (Additive ℕ)) might be nicer, since 1 is the constant function of all 1s

Yaël Dillies (Nov 10 2023 at 08:04):

@Sky Wilshaw was thinking about this

Sky Wilshaw (Nov 10 2023 at 09:25):

I was working on a PR to add another parameter to finsupp but that was back in the mathlib3 days, I unfortunately never got round to it


Last updated: Dec 20 2023 at 11:08 UTC