Zulip Chat Archive

Stream: Is there code for X?

Topic: Sum of terms of a finsupp function


Antoine Chambert-Loir (Jul 18 2024 at 12:49):

When working with multivariate polynomials or multivariate power series, it is often necessary to consider the sum of all terms of a finitely supported function d : I -> Nat, and to know basic things such as the fact as the sum is 0 if and only if d = 0.
Obviously, most definitions and results apply when Nat is replaced by a reasonable AddCommMonoid…
The theory of degree of polynomials contains docs#MvPolynomial.weightedDegree which
should probably be accessible in another file, under another name…

Any idea of where to put it and in what generality?

Yaël Dillies (Jul 18 2024 at 12:54):

Can't you simply write ∑ i, d i?

Antoine Chambert-Loir (Jul 18 2024 at 12:57):

I certainly can, but my experience is that for some proofs, that makes it simpler to have a name for this function of d. (Some mathematicians would write it |d|.)

Ruben Van de Velde (Jul 18 2024 at 12:57):

Do we not have docs#Finsupp.sum ?

Antoine Chambert-Loir (Jul 18 2024 at 12:57):

Using docs#Finsupp.sum, one has to type d.sum (fun _ => id) every time, which is relatively unappealing.

Yaël Dillies (Jul 18 2024 at 13:08):

I think this is a case where you should just have local notation, eg |d|

Antoine Chambert-Loir (Jul 18 2024 at 13:13):

Updating Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous to use such a local notation (that needs to be used elsewhere; probably a scoped notationis possible, but in what scope?) looks frightening to me…

Antoine Chambert-Loir (Jul 18 2024 at 13:19):

Finsupp.total _ _ _ 1 d also works, and there is quite an API for docs#Finsupp.total, but these three underscores are also annoying.


Last updated: May 02 2025 at 03:31 UTC