Dan wrote:

> I have a question regarding notation. In the equation below, is it fair to say that the sign "\$$+\$$" has two meanings?

> $(2 [\textrm{egg}] + [\textrm{yolk}]) + (3 [\textrm{egg}] + 3 [\textrm{pie crust}]) = 5[\textrm{egg}] + [\textrm{yolk}] + 3 [\textrm{pie crust}]$

You can say yes, or you can say no: I believe both viewpoints can be developed in a consistent way. If you treat them as different you may need to distinguish between

$([\textrm{egg}]) + ([\textrm{yolk}])$

and

$([\textrm{egg}] + [\textrm{yolk}]) .$

Here's how I actually think: \$$\mathbb{N}[S]\$$ is the **free commutative monoid** on the set \$$S\$$. There are many ways to construct this thing, but they're all canonically isomorphic so it doesn't matter which one we use.

(Sorry, that's how category theorists actually think: we are very flexible while being very precise about the ways in which we're being flexible: the words _canonically isomorphic_ summarize a lot of detail that I'm reluctant to explain right now.)

Here's one way to construct \$$\mathbb{N}[S]\$$. We take elements of \$$S\$$, create all possible finite sums of these elements, which are purely formal expressions of this sort:

$s_1 + \cdots + s_n$

where \$$s_1, \dots, s_n \in S\$$, and then we mod out by an equivalence relation which imposes the commutative monoid rules. For example, we decree that

$s_1 + s_2 + s_3 = s_2 + s_1 + s_3 .$

This gives a commutative monoid \$$\mathbb{N}[S]\$$. Then, we allow ourselves to abbreviate an \$$n\$$-fold sum of copies of \$$s \in S\$$ as \$$n s\$$, e.g.

$[\textrm{egg}] + [\textrm{egg}] + [\textrm{egg}] = 3[\textrm{egg}] .$

If you don't like this, here's another equivalent to way to think about it if \$$S\$$ has some finite number of elements, say \$$n\$$. In this case, after we choose an ordering for \$$S\$$, we can think of \$$\mathbb{N}[S]\$$ as the set of \$$n\$$-tuples of natural numbers. So, for example, if

$S = \\{ [\textrm{egg}], [\textrm{yolk}] \\}$

we write elements of \$$\mathbb{N}[S]\$$ as pairs of natural numbers. The element \$$(2,3) \$$ in here corresponds to the element

$2 [\textrm{egg}] + [\textrm{yolk}]$

in my previous, isomorphic, description of \$$\mathbb{N}[S]\$$. Similarly, the equation

$(2,3) + (1,1) = (3,4)$

corresponds to the equation

$(2 [\textrm{egg}] + 3[\textrm{yolk}] ) + ([\textrm{egg}] + [\textrm{yolk}]) = 3 [\textrm{egg}] + 4[\textrm{yolk}] .$