2024-06-08
In December I got the book Set Operads in Combinatorics and Computer Science (Méndez 2015) from the library. I didn't read the whole thing, but I'll share some notes I took on the parts that I read.
These will probably be pretty messy, and risk not being super useful, unless you happen to be unfamiliar with exactly the topics I felt warranted more explanation, and familiar with exactly the topics I felt could be taken for granted.
I didn't find their example of labeled parenthesized words as a set operad particularly
compelling. For one thing, it was difficult to understand that they were considering
I also wonder whether, coming from a CS/PL background, I would find this structure to be a poor motivator for operads for the same reason that the list monad isn't a good prototypical example for why we care about monads in Haskell. But I have no idea what e.g. an "IO operad" would look like; the book isn't focused on this.
This chapter introduces combinatorial species.
Their intuition: "a combinatorial species is a class of finite labeled structures that is closed by relabeling."
More precisely, a combinatorial species is a map
Using the language of category theory, a species is a functor
where
But actually --- the image of an isomorphism under a functor is always another isomorphism
(
Last intuition: a species is an arbitrary algebraic data type, like
type Foo a = (a, DayOfWeek, a -> Bool)
which has the property that Foo a is finite whenever a is finite.
We don't require that Foo be a covariant or contravariant functor,
but it does need to be an "invariant functor" ---
in the Haskell sense
that given a pair of inverse maps (a -> b, b -> a) we can
convert between Foo a and Foo b.
In other words, it needs to respect isomorphism, as all types should.
An example species:
We also evaluate species at natural numbers,
so e.g.
For any species
The generating function for a species
Note the use of parentheses instead of square brackets.
Keep in mind that the generating function doesn't give us a complete picture of a species. We can exhibit two species which are distinct but have the same generating function.
When I was in grade school I was told that a permutation was a choice of how to arrange the elements of a set.
When I went to university I was told that a permutation is a bijection from a set to itself.
These are basically the same idea, right? After all, there are
In fact, finite orderings and finite endobijections become equivalent
as soon as you fix an ordering as your "origin."
Then given any other ordering you can make a bijection that sends the least
element of the fixed ordering to the least element of the given one, etc.
Another way to say this is that an endobijection is like the difference between two orders.
But since it was arbitrary which fixed ordering we chose to start with,
the isomorphism we obtain this way is also arbitrary.
(This is why it's harder to see the distinction between these notions for sets like
This is reminiscent of the difference between a point (in an affine space) and a vector (in a vector space) --- we get a vector by subtracting two points, and given any point you can create a coordinate system fixing that point at the origin, but our choice of origin is arbitrary.
(Some google suggests what I'm describing is the idea of a principal homogeneous space.)
Anyway, working with species gives us a chance to clearly distinguish these two notions of permutation in our minds - since they yield different ideas of what it means to relabel them.
There is a species
And there is a species
These species have the same generating function:
These species are not equivalent even though they have the same cardinalities. The intuition behind this is that, to relabel a permutation, we need to undo the relabeling on the way in and then do it on the way out, whereas to relabel a list we only do it on the way out.
In general in mathematics, automorphisms (isomorphisms from an object to itself) capture the idea of a symmetry of a structure. For example:
- The map that reverses a list defines an automorphism of
$\mathbb{L}$ (the species of lists); - The map that sends a graph to its complement defines an automorphism of
$\mathcal{G}$ (the species of graphs).
We also define two elements of a species (
This relation, when restricted to two structures on the same input set
This lets us easily see that there is no isomorphism
In general, operations on species are going to be inspired by operations on generating functions.
For example,
(We use
The species
You might ask why we don't define
Finally, the exponential species
(The same reasoning as before applies for why we don't define
The book also invites us to consider two different interpretations for
We define a species
For a connected species
Since generating functions given by power series are summed termwise, the sum of two species is just their pointwise disjoint union:
Infinite sums are permitted as long as the sum does not become infinite at any individual point.
For example, if
where
We say a species
The product of species is the first major place where operations on species start to diverge from the categorical notions.
The product of two species
- A choice of partition of
$V$ into two disjoint parts$V_1, V_2$ ; - an element of
$R[V_1]$ ; - an element of
$S[V_2]$ .
This is consistent with a desire to make the generating function of the species look like the product of the power series:
- Species and Functors and Types, Oh My! --- a paper about realizing these ideas in the context of Haskell.
- Species: making analytic functors practical for functional programming --- I haven't read this one, but it's on my list.
