Let $X$ be an infinite set and $M$ a commutative monoid. Find a function $f \colon \mathcal{P}(X) \to M$ such that
- $f(\emptyset) = 0$
- for each element $x$ of $X$, $f(\{x\}) = 0$,
- for any two disjoint subsets $A$ and $B$ of $X$, $f(A \cup B) = f(A) + f(B)$.
This has an obvious solution, the constant function $\mathcal{P}(X) \to \{0\}$. Is that the only solution? In particular, is that the only solution when $M$ is $\mathbf{N}$, $\mathbf{Z}$, $\mathbf{Q}$, or $\mathbf{R}$?
[Edited in light of Matthew Daly's answer]
If your monoid has only one element $0$, then obviously that's the only solution. Otherwise "nonprincipal ultrafilters" give you a solution when the monoid has at least two elements $0$ and $a$.
A filter on a set $X$ is a collection $\mathcal{F} \subseteq \mathcal{P}(X)$ such that:
A filter is an ultrafilter if for every $A \subseteq X$ either $A \in \mathcal{F}$ or $X \setminus A \in \mathcal{F}$. It is non-principal if it contains no singletons.
Non-principal ultrafilters exist on any infinite set $X$. So if $\mathcal{F}$ is such a filter on $X$, then mapping $f(A) = 0$ if $A \notin \mathcal{F}$, $f(A) = a$ if $A \in \mathcal{F}$, gives you a non zero solution.