There is a class of all cardinalities , and it
has elements ,
and operations
,
, and so forth defined on it. Furthermore, there is a map
which takes
sets to cardinalities such that (and so on).
Ordinary generating functions can be thought of entirely analogously
with set maps replacing sets:
There is a class with elements
,
, and operations
,
. Furthermore,
there is a (partial) map such that
(and so on). Here,
is defined by
. Other operations on set maps (like disjoint union) are similarly defined pointwise.
(This is probably obvious and trivial to anyone who actually works
with generating functions, but it only occurred to me recently, so I
thought I’d write a blog post about it.)
The class is in fact a set, and is just the set of formal power series
. The partial map
takes
to
just in case
is “canonically isomorphic” (a notion I’ll leave slippery and undefined but that can be made precise) to the map
, where
indicates disjoint union.
That provides a semantics for ordinary generating functions. Furthermore, this semantics has a number of features beyond those of cardinality. For example, in addition to respecting and
,
represents composition.
A similar semantics can be provided for exponential generating functions, but it takes a little more work. In particular, we have to single out as a distinguished set. Let
be the smallest set containing all measurable subsets of
for any finite
and which is closed under finite products, countable disjoint unions, and products with sets
for finite
.
We can define the measure of all sets in
by extending Lebesgue measure in the obvious way (taking the product of a set with
will multiply the measure by
). Furthermore, notice that, by construction, every element of every set
in
is a tuple which (after flattening) has all of its elements either natural numbers or elements of
and has at least one element of
. Therefore, we can define a pre-ordering on
by comparing the corresponding first elements that are in
.
The point of all that is that, for , we can form the set
which will again be in
and its measure will be
. The corresponding statement with cardinality is not true since you have to worry about the case when elements in the tuple are equal (
) but the set of tuples that have duplicates has measure 0, so by working with measure, we can get the equality we want.
Finally, let be the set of formal power series
. The partial map
takes
to
just in case
is “canonically isomorphic” to the map
for all
in
. Just as before, this map respects
,
, composition, etc.
Note that the exponential generating functions are usually explained via labeled objects and some sort of relabeling operation. This approach weasels out of that by observing that the event that there was a label collision has probability 0, so you can just ignore it.