Signed multiset (source code)

= Signed multiset
{title2=$m:T\to\mathbb Z$}

= Complete multiset
{synonym}

A finitely supported function $m:T\to\mathbb Z$, allowing negative as well as positive multiplicities. Missing keys denote zero. Addition, exact subtraction, pointwise maximum/minimum and pointwise order can be implemented over the union of operand supports. A nonnegative <multiset> is a refinement, but exact subtraction can leave that refinement while still producing a signed multiset. Fixed-width count implementations must also specify overflow behavior.