Zulip Chat Archive

Stream: Is there code for X?

Topic: min and max of finsupps


Stuart Presnell (Jan 11 2022 at 14:05):

Do we have min and max operations on finsupps α →₀ M (where M satisfies some suitable conditions)?

Yaël Dillies (Jan 11 2022 at 14:06):

M linear order is what you need.

Stuart Presnell (Jan 11 2022 at 14:21):

That's what I guessed, but it seems that these operations don't exist (yet)

Yaël Dillies (Jan 11 2022 at 14:21):

We're also missing the (very similar) multiset.min/multiset.max. cc @Mantas Baksys

Eric Wieser (Jan 11 2022 at 14:34):

Don't we have docs#finsupp.linear_order?

Eric Wieser (Jan 11 2022 at 14:34):

Oh, the operation you're looking for is , if that exists

Eric Wieser (Jan 11 2022 at 14:34):

docs#finsupp.has_sup

Eric Wieser (Jan 11 2022 at 14:36):

Ignore my above messages. Can you explain what you want max to mean on finsupps? Are you asking for the elementwise max? Or for f.support.max id?

Stuart Presnell (Jan 11 2022 at 14:53):

I was thinking about elementwise operations, i.e. where (min f g)(a) = min (f a) (g a).

Stuart Presnell (Jan 11 2022 at 14:55):

So (for finsupps into nat, at least) I think the support of the min/max is the intersection/union of the supports respectively.

Stuart Presnell (Jan 11 2022 at 14:56):

I haven't thought properly about what this should be when 0 isn't the minimal element of M.

Stuart Presnell (Jan 11 2022 at 15:03):

(For avoidance of #xy, what I'm primarily interested in is the situation where the two finsupps are a.factorization and b.factorization, and I want to produce the finsupp whose value at each prime is the minimum of their respective values, which should then be the factorization of gcd a b.)

Yaël Dillies (Jan 11 2022 at 15:03):

Yeah, you want inf

Yaël Dillies (Jan 11 2022 at 15:05):

inf on finsupp is the pointwise inf, which in your case is the pointwise min. But min on finsupp doesn't make sense (it's not a linear order), so you're stuck with inf.

Stuart Presnell (Jan 11 2022 at 15:05):

Excellent, thanks

Eric Wieser (Jan 11 2022 at 15:42):

Stuart Presnell said:

I was thinking about elementwise operations, i.e. where (min f g)(a) = min (f a) (g a).

docs#finsupp.inf_apply is basically this statement


Last updated: Dec 20 2023 at 11:08 UTC