145

Many statements of mathematics are phrased most naturally in terms of multisets. For example:

Every positive integer can be uniquely expressed as the product of a multiset of primes.

But this theorem is usually phrased more clumsily, without multisets:

Any integer greater than 1 can be written as a unique product (up to ordering of the factors) of prime numbers.¹

Apart from rearrangement of factors, $n$ can be expressed as a product of primes in one way only.²

Every integer greater than 1 can be expressed as a product of prime numbers in a way that is unique up to order.³

Many similar factorization theorems are most naturally stated in terms of multisets; try a search for the phrase "up to rearrangement" or "disregarding order". Other examples: a monic polynomial is uniquely determined by its multiset of roots, not by its set of roots. The eigenvalues of a matrix are a multiset, not a set.

Two types that are ubiquitous in mathematics are the set and the sequence. The sequence has both order and multiplicity. The set disregards both. The multiset has multiplicity without order, but is rare in mathematical literature.

When we do handle a multiset, it's usually by interpreting it as a function into $\Bbb N$. This leads to somewhat strange results. For example, suppose $M$ is the multiset of the prime factors of some integer $n$. We would like to write:

$$n = \prod_{p\in M} p$$

or perhaps even just:

$$n = \prod M$$

But if we take the usual path and embed multisets in the conventional types as a function $M:\mathrm{Primes}\to\Bbb N$, then we have to write the statement with an infinite product and significantly more notation:

$$n = \prod_{p\in\mathrm{ Primes}}p^{M(p)} $$

(For comparison, imagine how annoying it would be if sets were always understood as characteristic functions with codomain $\{0, 1\}$, and if we had to write $\sum_{x\in S}{F(x)}$ all the time instead of just $|F|$.)

Interpreting multisets as functions is infelicitous in other ways too. Except in basic set theory, we usually take for granted that the difference between a finite and an infinite set is obvious. But for multisets-as-functions, we have to say something like:

A multiset $M$ is finite if $M(x)=0$ for all but finitely many values of $x$.

The other way that multisets are sometimes handled in mathematical proofs is as (nonstrict) monotonic sequences. One often sees proofs that begin "Let $a_1\le a_2\le\ldots\le a_n$; then…". The intent here is that the $a_i$ are a multiset, and if $b_i$ are a similar sequence of the same length, then the multisets are equal if and only if $a_i = b_i$ for each $i$. Without the monotonicity, we don't get this equality property. With first-class multisets, we would just say $A=B$ and avoid a lot of verbiage.

Sets and sequences both have a full complement of standard notation and jargon. Multisets don't. There is no standard notation for the union or intersection of multisets. Part of the problem here is that there are two reasonable definitions of multiset union:

$$(M\uplus N)(x) = M(x) + N(x)$$ or $$(M\Cup N)(x) = \max(M(x), N(x))$$

For example, if $M$ and $N$ are the prime factorizations of $m$ and $n$, then $M\uplus N$ is the prime factorization of $mn$, and $M\Cup N$ is the prime factorization of $\mathrm{lcm}(m,n)$.

Similarly there is no standard notation for multiset containment, for the empty multiset, for the natural injection from sets to multisets, or for the forgetful mapping from multisets to sets. If there was standard notation for multisets, we could state potentially useful theorems like this one:

$$ m|n \quad\mbox{if and only if}\quad \mathrm{factors}(m) \prec \mathrm{factors}(n)$$

Here $\mathrm{factors}(m)$ means the multiset of prime factors of $m$, and $\prec$ means multiset containment. The analogous statement with sets, that $m|n$ if and only if factors$(m)\subset$ factors$(n)$, is completely false.

It seems to me that multisets are a strangely missing piece of math jargon. Clearly, we get along all right without them, but it seems that a lot of circumlocution would be avoided if we used multisets more freely when appropriate. Is it just a historical accident that multisets are second-class citizens of the mathematical universe?

MJD
  • 65,394
  • 39
  • 298
  • 580
  • 28
    Historical inertia. What are you gonna do? – Qiaochu Yuan May 31 '12 at 21:40
  • You know this article? It discusses a logical foundation for multisets and defines union and containment, p. e. – martini May 31 '12 at 21:43
  • 4
    Dear Mark, A nice question, with great examples. I think that the answer, as @Qiachu write, is historical inertia/accident. Cheers, – Matt E May 31 '12 at 22:06
  • @martini: I had not seen that paper. I am looking forward to reading it. Thanks for the reference. – MJD May 31 '12 at 22:11
  • 5
    Interestingly, many software container libraries ignore the concept as well; one exception that I am aware of the the C++ standard library which includes a container, quite appropriately named, called multiset; I know that .Net does not; Java might..I'm not sure where the prejudice against the concept of a multiset derives, but in practical applications, I have rolled my own on many occasions... – ItsNotObvious May 31 '12 at 22:22
  • 2
    Very clearly explained! In that last example, don't you mean factors(m) ≺ factors(n)? –  May 31 '12 at 23:00
  • @HurriCane: I have converted your answer to a comment. Please note that answers should be reserved for posts that answer the question. But because you do not have 50 reputation points yet, you can only comment on your own questions and answers. So, you didn't do anything wrong; the "add comment" button will only appear for you once you gain 50 points. Here is an explanation of reputation points. – Zev Chonoles May 31 '12 at 23:02
  • @HurriCane Thanks for the correction. – MJD Jun 01 '12 at 00:22
  • +1: a very solid, thought-through, and well-written question. – Neal Jun 01 '12 at 01:46
  • I agree that they are oddly neglected! I had an interesting interaction with a neuro-science colleague a few months ago: he needed to know how many different symmetric arrangements of 8 molecules can be made where the molecules are chosen from (infinite supplies) of 4 different species. (I hope the phrasing is clear: put 8 molecules together with repeats allowed and the order irrelevant.) I'd never come across this very natural counting question before, and had to take it home for the night before being able to answer. – user12477 May 31 '12 at 21:37
  • I'd never heard of multisets - and clearly nor had he, or wikipedia would have answered his question. Just to mention another application, a colleague spotted immediately that the problem is equivalent to counting the number of different monomials of degree 8 in 4 variables. (Apologies for not providing anything that remotely resembles an answer...this was too long for a comment!) – user12477 May 31 '12 at 21:37
  • 1
    @user12477: I've seen people post comments-that-are-too-long-for-a-comment as a series of comments instead, which I feel is preferable to posting an answer-that-is-not-really-an-answer. –  May 31 '12 at 23:00
  • I don't see any mention of limits of sequences. An infinite sequence can be rearranged without changing its limit points. So the sequence ought to be a multiset. Specifically, a point $l$ is the limit of a sequence $(a_n:n\in\mathbb N)$ iff, for any neighbourhood of $l$, there exists a neighbourhood of $\infty$ such that, for all $n$ in the latter neighbourhood, $a_n$ is in the former neighbourhood. But what is a neighbourhood of $\infty$? It is just the complement of a finite subset of $\mathbb N$; order or other structure is irrelevant. – mr_e_man Oct 30 '23 at 21:54
  • So, in terms of multisets, $l$ is the limit of $A$ iff, for any neighbourhood of $l$, there exists a finite submultiset $B\subset A$ such that $A-B$ is contained in that neighbourhood. – mr_e_man Oct 30 '23 at 21:55
  • More generally, a point $l$ is a limit point (rather, accumulation point; not necessarily unique) of a sequence $(a_n:n\in\mathbb N)$ iff, for any neighbourhoods of $l$ and $\infty$, there exists $n$ in the latter neighbourhood such that $a_n$ is in the former neighbourhood. In terms of multisets, $l$ is a limit point of $A$ iff, for any neighbourhood of $l$ and any finite submultiset $B\subset A$, there's a non-empty intersection of $A-B$ with that neighbourhood. – mr_e_man Oct 30 '23 at 21:56
  • In the sum of an infinite sequence of positive numbers (or any unconditionally convergent series), the terms can be rearranged. So here also the sequence should be a multiset. A number $s$ is the sum of $A$ iff, for any neighbourhood of $s$, there exists a finite submultiset $B\subset A$ such that, for any finite submultiset $C\subset A-B$, the finite sum $\sum B+\sum C$ is in that neighbourhood. – mr_e_man Oct 30 '23 at 21:59

6 Answers6

66

This question reminded me of several notes by the influential computer scientist Edsger W. Dijkstra, who spent a lot of time thinking about how our notation can affect how we think and reason formally. (He preferred the term "bag" to "multiset", as in "a bag of positive integers.")

For example:

  • In writing about how computing science influenced mathematical style:

    I similarly prefer products to be defined on bags of factors rather than on sequences of factors. In the last case, one of the first things one has to do is to point out that as far as the value of the product is concerned, the order in which the factors occur in the sequence is irrelevant. Why then order them in the first place?

  • In discussing the notational conventions he uses, and why he uses them:

    Not making superfluous distinctions should always be encouraged; it is bad enough that we don’t have a canonical representation for the unordered pair.

Indeed--- forget multisets in general: why don't we even have the unordered pair? In this note, Dijkstra observes how a lack of a standard notation for this object often prevents us from recognizing that two statements are the same. (We are often fooled by superficial differences into saying things like "it suffices" to prove one of A, B, when from a logical point of view there is no difference between A and B.)

For my part, I think that we unconsciously "avoid" the formalism of multisets because we are generally uncomfortable with unordered things as unordered things. It is far more congenial to the human mind to think in terms of ordered things whose order then might, or might not, matter.

For some reason, the unordered set concept really "caught on" and we have all of this standard terminology associated with it. I would regard this as exceptional. I would definitely not regard it as evidence that sets are truly "first-class citizens" in written mathematics:

  • Have you noticed how often it is possible to simplify the language and notation of a published argument by using "arbitrary" index sets, instead of initial segments of $\mathbb{N}$? (People introduce integer subscripts that play no role in organizing the ideas of an argument all the time.)

  • Have you noticed how often people explicitly rule out the empty set in situations when it only complicates a statement or proof?

We could also avoid "a lot of circumlocution" if we only made better use of firmly established things! But do we?

I think that many mathematicians simply "think in lists." I think this preference has its roots in how humans communicate. Outside of mathematics, it is almost impossible to communicate the elements of an unordered collection without choosing some arbitrary order. (e.g. "Who is going to your party next weekend?" "What do we need from the grocery store?" "What are the nations of Europe?") We naturally communicate the elements of finite sets as lists, and then understand that they are sets. "De-listing" is so natural to us that we barely notice the "circumlocutions" it requires.

Another reason I think that multisets have not caught on is terminological.

  • The word "multiset" sounds too technical for what it is.

  • Dijkstra's "bag," on the other hand, doesn't sound technical enough. (To me, it only sounds OK for collections of "elementary" things, like integers).

  • Neither "multiset" nor "bag" gives rise to a decent-sounding subobject name.

(Note, for example, how the OP unconsciously avoided the awful word "submultiset" through repeated use of the phrase "multiset containment".)

  • 16
    Dijkstra's remarks remind me of something J.H. Conway said complaining that mathematicians were too concerned with the specific implementation of objects in terms of set theory. He said that one should simply be able to postulate, say, two kinds of ordered pairs $\langle a,b\rangle$ and $\lbrack a,b\rbrack$ with $\langle a,b\rangle = \langle c,d\rangle$ if and only if $a=c$ and $b=d$, $\lbrack a,b\rbrack = \lbrack c,d\rbrack$ if and only if $a=c$ and $b=d$, and $\langle a,b\rangle\ne\lbrack c,d\rbrack$ for all $a,b,c,d$, without having to worry about how these would be represented by sets. – MJD Jun 05 '12 at 02:18
  • 5
    Similarly one should be able to causally define an unordered pair $\def\ll{\langle!\langle} \def\rr{\rangle!\rangle}\ll a,b\rr$ with $\ll a,b\rr = \ll c,d\rr$ if and only if $(a=c \mathrm{\ and\ } b=d) \mathrm{\ or\ } (a=d \mathrm{\ and\ } b=c)$ without having to allay anyone's suspicions by demonstrating a particular set-theoretic object with that property. Conway wanted a someone to establish a general principle that all "reasonable" objects were definable in any "reasonable" theory, including ZF. – MJD Jun 05 '12 at 02:20
  • 15
    Maybe "inventory" would be a good name: For the inventory, you care about how many you have of each item, but not about any particular order (it doesn't matter if you have three bottles of water and two bottles of Coke, or two bottles of Coke and three bottles of water). Also, I think "subinventory" doesn't sound bad. – celtschk Jul 07 '15 at 21:23
  • 7
    Is "collection" taken? – Oliphaunt Sep 17 '15 at 20:10
  • 1
    Isn't {a,b} with curly braces a common notation for an unordered pair? – Chris Chudzicki Mar 01 '16 at 16:31
  • @MJD I think I disagree with that example. What if you needed arbitrarily many different types of parentheses? In my opinion, I would rather just use ordered triples — $(a,b,0)$ instead of $\langle a,b\rangle$ and $(a,b,1)$ instead of $\lbrack a,b\rbrack$ — because it generalizes much more easily. And it just so happens that this is how I would represent them as sets. (Perhaps I would write $(a,b)_0$ instead of $(a,b,0)$ for clarity.) – Akiva Weinberger Mar 01 '16 at 20:50
  • @MJD As for the unordered pair, we can just write ${a,b}$, noting that it satisfies the properties you've listed. It's the unordered triple and higher that's the issue. – Akiva Weinberger Mar 01 '16 at 20:53
  • I don't know. I find it easier to think with multisets than regular sets. E.g. when I think of a bag of 3 apples of the same type (say 3 green apples), I want to think of representing this most naturally with a mathematical abstraction of the form ${\ \mathrm{apple},\ \mathrm{apple},\ \mathrm{apple}\ }$, which would collapse as a (uni)set. Of course the standard rejoinder might be that the apples are not all the same -- but to our everyday eye, and our use of them as food, we would probably consider them interchangeable unless something tells us otherwise. – The_Sympathizer Feb 23 '17 at 04:26
  • (e.g. one had a worm in it and so should not be used, in which case even then though I'd want to represent as ${\ \mathrm{apple},\ \mathrm{apple}_{\mathrm{bad}},\ \mathrm{apple}\ }$ or something like that, leaving the other 2 still interchangeable. Again though this collapses to a 2-set in uniset theory.) – The_Sympathizer Feb 23 '17 at 04:28
  • Even with your "list" claim, I can still imagine a list containing repeated elements. Doesn't seem unnatural to me. I also don't get regarding: "For my part, I think that we unconsciously "avoid" the formalism of multisets because we are generally uncomfortable with unordered things as unordered things." how an "unordered multiset" is any worse of an "offender" in this regard than the "unordered sets" used all the time in mathematics. – The_Sympathizer Feb 23 '17 at 04:30
  • 6
    The trouble with ${}$ notation is that ${a,a}={a}$. However, $\langle\langle a, a\rangle\rangle \ne \langle\langle a\rangle\rangle$. – Rosie F Jul 05 '18 at 13:10
  • I think the tendency to think in (ordered) lists had trickled down from the apparently one-dimensional constraint imposed by the passage of time. I'm unsure whether any reasonable way exists in order to circumvent it. – Vandermonde Apr 07 '23 at 03:01
  • In fact, I read something on here lamenting about how the linear nature of most writing might have similarly biased conventional practice towards binary operations when it would be more appropriate to allow for arbitrary finite sets (... or lists) as arguments -- e.g., see how often definitions of topology single out the empty intersection (which admittedly would call for a distinct notion $\cap_X$ of intersection for each space $X$ so as to avoid unrestricted intersections without a ceiling to dominate them -- i.e., intersect things as subsets of $X$) or union. – Vandermonde Apr 07 '23 at 03:06
  • It's just that what I take away is, all that infix notation just to save a pair of delimiters per instance! – Vandermonde Apr 07 '23 at 03:07
  • @celtschk, Oliphaunt -- How about "family"? We already have indexed families (which are really just functions). An unindexed family (i.e. a multiset) on $X$ can be defined as an equivalence class of functions with codomain $X$, where two functions $f:A\to X$ and $g:B\to X$ are equivalent iff there's a bijection $h:A\to B$ between their domains such that $f=g\circ h$. -- I think "subfamily" sounds okay. (And it means there's an injection from one domain to the other domain.) – mr_e_man Nov 07 '23 at 03:56
  • https://math.stackexchange.com/questions/2338870/what-is-difference-between-set-and-family?noredirect=1&lq=1 – mr_e_man Nov 08 '23 at 14:55
19

Here's another reason I think multisets have not entered common usage: they are very complicated! Blizard's multiset paper is just full of… stuff. Here are a couple of examples.

  1. There are at least three analogs of the 'subset' relation. Writing $x\in_n M$ for "$x$ occurs in the multiset $M$ exactly $n$ times", and $x\in M$ for "$x\in_n M$ for some positive $n$", one can define:
  • $A\Subset B$ if $x\in_n A$ implies $x\in_m B$ for some $m\ge n$.

  • $A\sqsubset B$ if $x\in_n A$ implies $x\in_n B$

  • $A\subset{\llap\sqsubset } B$ if $A\Subset B$ and $x\in B$ implies $x\in A$.

    See page 43 of Blizard.

  1. A union of multisets may fail to be a multiset. Let $M_i$ be the multiset that contains the single element $\ast$ with multiplicity $i$. Then $\bigcup M_i$ is not a multiset; this holds for both the $\Cup$ and $\uplus$ operations I mentioned in the original question.
Glorfindel
  • 3,955
MJD
  • 65,394
  • 39
  • 298
  • 580
  • 13
    Point 2 could be resolved by allowing arbitrary cardinal numbers as multiplicity. Then $\bigcup M_i$ would contain the single element $*$ with multiplicity $\aleph_0$. – celtschk Jul 09 '12 at 16:23
  • 2
    I agree that some notions are really difficult to generalize from sets to multisets. However your examples are not the most convincing. $A\Subset B$ should mean $A\Cup B=B$ and this gives the first interpretation. If arbirtary unions are not allowed, too bad, topology is used to such restrictions as well. However there is a real difficulty in defining maps between multisets (or morphisms of multisets for the categorial oriented), not to mention injections, surjections. – Marc van Leeuwen Jul 13 '12 at 07:16
  • 1
    @MarcvanLeeuwen, I think that's kind of missing the point. We can have a set $X$, and we can say, "Let $A$ denote a subset of $X$," and we can also say, "Let $B$ denote a multiset in $X$." And just like we can take images and preimages of subsets under functions, we can take images and preimages of multisets under functions. In neither case are subsets/multisets the objects of a category. – goblin GONE May 07 '13 at 07:10
  • 1
    @user18921: Of course one can, and does, work with multisets without considering them objects of a category. However the real difficulty of finding a natural definition of morphism is quite remarkable (see this discussion that sclv linked to) and certainly explains why we cannot treat multiset like a natural generalisation of sets for all purposes. Also, while I agree with what you say for images, I don't for preimages. If $f(x)=y$, how does the multiplicity of $x$ in $f^{-1}(M)$ depend on the multiplicity of $y$ in the multiset $M$? – Marc van Leeuwen May 07 '13 at 09:35
  • 1
    @MarcvanLeeuwen, write $x * A$ for the multiplicity of $x$ in $A$, which is understood to be a cardinal number. Then for an arbitrary relation $f : X \rightarrow Y$ and any multiset $A \subseteq X$, we can define $y * f(A) = \sum_{x \in X : (x,y) \in f}x * A$. (From this, you can work out the answer to your question - simply view $f^{-1}$ as the converse of $f$.) Indeed, we can generalize. For an arbitrary multirelation $f : X \rightarrow Y$, we define $y * f(A) = \sum_{x \in X}[x * A][(x,y)*f]$. The point is, in both cases, the source and target of $f$ are sets, not multisets. – goblin GONE May 07 '13 at 12:50
  • @user18921: OK, I stand corrected. I had missed that the preimage does not have to be submultiset of anything in particular. Nor does the image in fact. And the multiplicity of $x$ I asked for is just the same as that of $y$ in $M$. – Marc van Leeuwen May 07 '13 at 13:15
  • In my mind 2. and related issues is a real problem. On the one hand, it feels very unnatural and inconvenient to insist on finite multiplicity (except in a strictly "finite" context). It almost feels like insisting on working with finite sets only. On the other hand, if one wants to get around this one would have to engage with some cardinal arithmetic. – quid Jan 04 '16 at 22:38
  • The difficulty with cardinals is that they are unyielding in the face of a variety of fundamental arithmetic operations such as subtraction. Ordinals are only slightly better (and are entirely the wrong variety of number for this). This makes (for instance) multiset subtraction impossible in the general case. The disjoint union also begins to look more than a little weird. – Kevin Aug 12 '16 at 18:38
17

I agree with Qiaochu that historical inertia plays the largest rôle: short of independent invention, you can’t use what you’ve never seen, and if there’s a familiar alternative, you probably won’t use something that’s less familiar to you, especially if you expect it to be somewhat unfamiliar to your audience. I don’t think that I ever saw them singled out as a separate kind of object until I decided to use Scheinerman’s text for our elementary discrete math course not too many years ago.

The fact that they’re a bit awkward to formalize probably also has had some effect. Had they come into common use early enough, this probably wouldn’t have mattered: ordered pairs are also a little awkward to formalize, but in most contexts no one cares. But their widespread utility was recognized late enough that (a) formalization was more of a concern, and (b) a variety of work-arounds was already available and often in use.

Why the general utility of the concept wasn’t recognized earlier is probably an unanswerable question, though I suspect that the variety of guises in which it can appear, or perhaps better, the variety of equivalent formulations in terms of more ‘standard’ objects, has something to do with the matter. One could also point to the fact that many applications in which they play a more than incidental rôle seem to fall in the area between logic and computer science.

Brian M. Scott
  • 616,228
  • 3
    I'm pleased that you made the connection to ordered pairs, which I had not thought of before in this context. I think the comparison is quite apt. Ordered pairs also arrived surprisingly late, and I've observed before that a lot of Principia Mathematica would be superfluous if Whitehead and Russell had had a modern conception of the ordered pair. Whole chapters of PM are devoted to proving theorems about relations which, in a modern presentation, would be special cases of the theorems about sets that were proved in earlier chapters. But in $PM$ relations are a different sort than sets. – MJD Jun 01 '12 at 01:59
12

I'd suggest that part of the problem is the non-obviousness of operations on multisets. Take a look at the nLab page, for instance, where there's discussion about how precisely to think of morphisms, colimits, etc. with regard to multisets.

Also see the discussion on signed-multisets (a natural and immediate generalization) on haskell-cafe, where there was a large range of opinions regarding the meanings of a range of basic operations.

Arguably, if there were more attention to multisets in general, then more of these issues would be agreed on by convention or understood more broadly. On the other hand, the complexity of these issues vs. the definition of a simple set also points to why there hasn't necessarily been such attention. Also, of course, as one moves to fields like combinatorics, my sense is that multiset constructions become more common.

sclv
  • 331
  • 1
  • 6
  • 1
    I could remark that what you call signed multisets on a base set $X$, if the multisets are finite (which I think is implicitly assumed in the discussion linked to), are nothing other than elements of the free Abelian group generated by $X$, a construction that is fairly well known and employed in the areas (mostly of algebra) where it is useful. – Marc van Leeuwen Jul 13 '12 at 07:09
  • Interesting, they wan't to define union as $(a+b)(x)=max(a(x),b(x))$, but then the empty set is no longer the identity. @MarcvanLeeuwen, how would that work with generated abelian groups? – Thomas Ahle Sep 30 '15 at 17:42
  • 1
    @ThomasAhle: The reason for using free Abelian groups is to allow additive combination and removal of elements without having the idempotent-like behaviour of unions and intersections. So the answer to your question would simply be "don't do that". One can of course define such operations using $\max$/$\min$ on multiplicities, but then one gets not-very-algebraic operations, which notably lack a neutral element, just like $\max$ and $\min$ on $\Bbb Z$ do. – Marc van Leeuwen Oct 01 '15 at 08:30
  • @Marc, do you not even have a notion of a subset then? – Thomas Ahle Oct 01 '15 at 20:25
  • 1
    @ThomasAhle: Well I don't think it is often called like that in the context of free Abelian groups. But if one thinks of elements of the free Abelian group on $X$ as "sets" of elements of $X$ but allowing positive or negative multiplicities, then one can consider $A$ a "subset" of $B$ if $B-A$ has no negative multiplicities (lies in the "positive cone", which is the free monoid on $X$ sitting inside the free Abelian group). Such relations are actually used in practice. – Marc van Leeuwen Oct 02 '15 at 04:31
  • @MarcvanLeeuwen I guess some people would be confused by not having $A\subseteq A+B$ in general, but I we have to give up on some things. At least we get $A\subseteq A$. – Thomas Ahle Oct 02 '15 at 12:19
7

Old question I know, but I wanted to point out that (finite) multisets do appear quite frequently in algebraic geometry/topology in the guise of finite formal sums; i.e., a multiset over a set $A$ is an element of the free abelian group on the elements of $A$. For example:

$$ a-2b+4c $$

for $a,b,c\in A$.

If you want to allow only positive numbers of each element, you work over the free commutative monoid instead; i.e., you require that the coefficients be non-negative:

$$ a+2b+4c $$

The fact that we are allowed to reorder is immediately given to us by the commutativity of the $+$ operation.

In the case of the product of primes it is very easy just to change the operation to multiplication and declare that every number is a unique product of primes, in the sense that it corresponds to a unique formal (commutative) product of (formal symbols corresponding to) primes.

Finite formal sums should be enough for the examples you gave, but if you want to allow infinitely many 'elements' then you can do that as well:

$$ M=\sum_{a\in A} m_a a $$

where $m_a\in\mathbb N$ for each $a\in A$. Semantically, this is still represented as a function from $A$ to $\mathbb N$, but the notation is different.

John Gowers
  • 24,959
6

One reason to prefer working with sequences is that they respond well to having their properties proven by induction. The syntactic representation of associative/commutative structures, by contrast, invites tricky reasoning and proofs with hard-to-spot errors in reasoning by case - if one is forced to reason about equivalence classes of sequences, then there will be no advantage and some additional complexity compared to working with sequences directly.

This problem facing the mathematician at work on a proof is faced in the automatic theorem proving community when trying to do pattern matching on associative-commutative structures. A lot of work has been done in the past thirty years applying term rewriting systems to this problem. As an example, here are how multisets of natural numbers are represented in Maude, an implementation of rewriting logic.