[This is the fifth in a series of posts about combinatorial species. Previous posts: And now, back to your regularly scheduled combinatorial species; Decomposing data structures; Combinatorial species definition, Species definition clarification and exercises.]
Recall that a species is a functor from , the category of finite sets and bijections, to ,1 the category of finite sets and total functions. (Equivalently, species are endofunctors on , but in this post I’m going to want to think about them as the former.) That is, a species is a mapping sending every set of labels to a set of structures , which also lifts relabelings to functions in a way that respects the compositional structure of bijections.
However, as I hinted in a previous post, it’s inconvenient to work directly with this definition in practice. Instead, we use an algebraic theory that lets us compositionally build up certain species from a collection of primitive species and species operations. (It’s important to note that it does not allow us to build all species, but it does allow us to build many of the ones we care about.)
In this post we’ll begin by examining a few natural species to take as primitive.
-
The zero or empty species, denoted , is the unique species with no structures whatsoever; that is,
and
.
Of course, will turn out to be the identity element for species sum (which I’ll define in my next post, though it’s not hard to figure out what it should mean).
-
The unit species, denoted , is defined by
That is, there is a unique -structure indexed by the empty set of labels, and no -structures with any positive number of labels. lifts bijections in the obvious way, sending every bijection to the appropriate identity function.
Some people initially find this definition surprising, expecting something like for all instead. That is indeed a valid species, and we will meet it below; but as I hope you will come to see, it doesn’t deserve the name .
Of course we should also verify that this definition satisfies the requisite functoriality properties, which is not difficult.
More abstractly, for those who know some category theory, it’s worth mentioning that can be defined as , that is, the covariant hom-functor sending each finite set to the (finite) set of bijections . (This is why I wanted to think of species as functors . I learned this fact from Yeh (1986).) There is, of course, a unique bijection and no bijections for nonempty , thus giving rise to the definition above.
As you might expect, will be the identity element for species product. Like itself, species product isn’t defined quite as most people would initially guess. If you haven’t seen it before, you might like to try working out how product can be defined in order to make an identity element.
-
The singleton species, denoted , is defined by
with lifting of bijections defined in the evident manner. That is, there is a single -structure on a label set of size (which we identify with the label itself, though we could have also defined when ), and no -structures indexed by any other number of labels.
As with , we may equivalently define as a hom-functor, namely .
It’s worth noting again that although and do “case analysis” on the label set , they actually only depend on the size of ; indeed, as we noted previously, by functoriality this is all they can do.
-
The species of bags2, denoted , is defined by
,
that is, there is a single -structure on any set of labels , which we usually identify with the set of labels itself (although we could equivalently define ). The idea is that an -structure consists solely of a collection of labels, with no imposed ordering whatsoever.
If you want to abuse types slightly, one can define as a hom-functor too, namely . (Yeh (1986) actually has , but that’s wrong.)
As a summary, here’s a graphic showing -, -, -, and -structures arranged by size (i.e., the size of the underlying set of labels ): a dot indicates a single structure, and the size of the label set increases as you move to the right.
Just as a teaser, it turns out that and are identity elements for certain binary operations on species as well, though you’ll have to wait to find out which ones!
Next up, addition!
References
Yeh, Yeong-Nan. 1986. “The calculus of virtual species and K-species.” In Combinatoire énumérative, ed. Gilbert Labelle and Pierre Leroux, 1234:351–369. Springer Berlin Heidelberg. http://dx.doi.org/10.1007/BFb0072525.
Can you explain what you mean in footnote [2]? I don’t see bags anywhere: there is a unique E-structure on a SET of labels U which can be identified with the SET U itself.
[I would expect something called the species of bags to have bags as structures, not sets. Say, generalizing species to allow infinitely many structures on a single set of labels, i.e. generalizing to functors B->Sets, I’d expect the species of bags to be Sets(.,N) where N is the natural numbers (a bag on U can be regarded as a function U->N giving the multiplicities of each element).]
Great question! I probably should have done a better job explaining that footnote. Remember that we are talking about labeled shapes, not data structures. An E-structure is just the shape of a bag. To make an actual bag data structure we would pair an E-structure (i.e. a set of labels ) with any total function of type . The fact that the function need not be injective reflects the fact that values of type can show up multiple times. (If you wanted set data structures instead, you could restrict the function to be injective.) Labels, on the other hand, should be unique, so the fact that an E-structure is a set just reflects the lack of ordering.
Oh, I see. Combinatorialists study E-structures, they don’t use them as containers for data, so it makes sense that they call this particular E the species of sets.
Do you do this renaming consistently? For example, do you call the species of graphs “the species of graphs with possibly repeated vertices” or something like that?
No, because the term “graph” does not have a connotation of “the data stored at vertices is unique”, so there is no opportunity for confusion.
I’ve been interested in the connections between species theory and data types for a while now. (I’m an enumerative combinatorialist by trade, but I have some amateur interest in the formal side of theoretical CS.) I’ll definitely be following this series with keen interest!
Pingback: Avoiding the axiom of choice, part I | blog :: Brent -> [String]
Pingback: Signed sets and ballots, part 1 | blog :: Brent -> [String]