*This is a typed up copy of my lecture notes from the combinatorics seminar at KTH, 2010-09-01. This is not a perfect copy of what was said at the seminar, rather a starting point from which the talk grew.*

*In some points, I’ve tried to fill in the most sketchy and un-articulated points with some simile of what I ended up actually saying.
*

Combinatorial species started out as a theory to deal with enumerative combinatorics, by providing a toolset & calculus for formal power series. (see Bergeron-Labelle-Leroux and Joyal)

As it turns out, not only is species useful for manipulating generating functions, btu it provides this with a categorical approach that may be transplanted into other areas.

For the benefit of the entire audience, I shall introduce some definitions.

**Definition**: A *category* C is a collection of *objects* and *arrows* with each arrow assigned a *source* and *target* object, such that

- Each object has its own
*identity arrow*1. - Chains of arrows are associatively
*composable*, with 1 the identity of this composition.

**Examples**: Sets, Finite sets, k-Vector spaces, left and right R-Modules, Graphs, Groups, Abelian groups.

: finite sets with only bijections as morphisms.

**Examples**:

- Category of a monoid.
- Category generated by a graph
- Category of a group (groupoid version of the category of a monoid)
- Category of a poset
- Category of Haskell types and functions.

**Definition**: A *functor* F is a map of categories, in other words, a pair of maps Fo on objects and Fa on arrows, such that the identity arrow maps to identity arrows and compositions of maps map to compositions of their images.

**Examples**:

Constant functor: sends every object to A, every map to 1.

Identity functor: sends objects and arrows to themselves.

Underlying set functor, free monoid/vector space/module/… functors.

We are now equipped to define Species:

**Definition**: A *species of structures* is a functor .

The idea is a set gets mapped to the set of all structures labelled by the elements in the original set. A bijection on labels maps to the *transport of structures* along the relabeling.

**Examples**:

: rooted trees, labels on vertices

: simple graphs, labels on vertices

: connected simple graphs, labels on vertices.

: trees, labels on vertices.

: directed graphs, labels on vertices

: subsets, .

: endofunctions

: involutions

: permutations

: cycles

: linear orders

: sets:

: elements:

: singletons: if and otherwise

: empty set: , otherwise

: empty species: .

In enumerative combinatorics, the power of species resides in the association to each species a number of generating functions:

The generating series of a species F is the exponential formal power series

where we use the convention , and .

Thus:

There are a number other in use for combinatorics, but for my purposes, this is the one I’ll focus on.

## Operations on species

The real power, though, emerges when we start combining species, and carry over the combinations to actions on the corresponding power series.

### Addition

The number of ways to form either, say, a graph or a linear order on a set of labels is the sum of the numbers of ways to form either in isolation.

This corresponds cleanly to the coproduct in Set, and we may write F+G for the species

(where the second + is the coproduct — i.e. disjoint union — of sets)

In the power series, we get .

Examples: We may define the species of all non-empty sets by

This kind of functional equations is where the theory of species starts to really *shine*.

### Multiplication

A tricoloring of a set is a subdivision of the set into three disjoint subsets covering the original set. The number of tricolorings of size n is

A permutation fixes some set of points. The permutation restricted to the non-fixed points is a *derangement*. Total number of permutations on n elements is

In both of these cases, the total generating series is a product of the component series, and we end up defining

So .

Thus, tricolorings are and permutations are , where the set is that of fixed points, and the derangement captures the actual action of the permutation.

### Composition

Endofunctions of sets decompose in their actions on the points as cycles or directed trees leading in to these cycles.

Since a collection of disjoint cycles corresponds to a permutation, we can consider such endofunctions to be permutations decorated with rooted trees attached to points of the permutations; or even permutations of rooted trees.

To form such a structure on a set U, we’d first partition U into subsets, put the structure of a rooted tree on each subset, and then the structure of a permutation on the set of these subsets.

Thus, the number of such structures on n elements is

This corresponds to the power series , and we write, in general, for the species of F-structures of G-structures on subsets.

**Examples**:

A = X·E(A)

L = 1 + X·L

B = 1 + X·B·B

### Pointing

Picking out a single point in a structure on n points can be done in precisely n ways.

Thus the corresponding generating function will be

for f-structures with a single label distinguished.

Since we’re working with exponential power series, we may notice that

and thus that derivatives are shifts.

Furthermore,

so that the generating function for F-structures with a single distinguished are

In species, this process is called pointing.

In functional programming, Conor McBride related this construction to Huet’s Zipper datatypes.

As it turns out, many of the constructions for species make eminent sense outside the category . In fact, species in Hask are known to programming language researchers as *container datatypes* and the whole calculus translates relatively cleanly.

Functional equations translate to the standard new data type definitions in Haskell.

**Examples**:

L = 1 + X·L

data List a = Nil | Cons a (List a)

B = 1 + X·B·B

data BinaryTree a = Leaf | Node (BinaryTree a) a (BinaryTree a)

A = X·E(A)

data RootedTree a = Node a (Set (RootedTree a))

usually, we simulate the Set here by a List. If we need for our rooted trees to be planar, we can in fact impose a Linear Order structure instead, and get something like

Ap = X·L(Ap)

The species interpretation of corresponding to leaving a hole in the structure carries over cleanly, so that is the type of T-with-a-hole.

## Two derivatives of lists

We can deal with in two different ways:

1.

DL = D(1+X·L) = D1 + D(X·L) = 0 + DX·L+X·DL

and thus

DL-X·DL = 1·L

so (1-X)·DL = L

and thus

DL = L·1/(1-X)

Now, from L=1+X·L follows by a similar cavalier use of subtraction and division — which, by the way, in species theory is captured by the idea of a *virtual species*, and dealt with relatively cleanly — that

L = 1+X·L

so

L-X·L = 1

and thus

(1-X)·L = 1

so

L = 1/(1-X)

Thus, we can conclude that

DL = L·1/(1-X) = L·L

and thus, a list with a hole is a pair of lists: the stuff before the hole and the stuff after the hole.

2.

We could, instead of using implicit differentiation, as in 1, attack the derivation we had of

L = 1/(1-X) = 1+X+X·X+X·X·X+…

Indeed,

DL = D(1/(1-X)) = D(1+X+X·X+…) = 0+1+2X+3X·X+…

which we can observe factors as

= (1+X+X·X+X·X·X+…)·(1+X+X·X+X·X·X+…) = L·L

Or we can just use the division rule

DL = D(1/(1-X)) = D(1/u)·D(1-X) = -1/(u·u)·(-1) = 1/[(1-X)·(1-X)] = L·L

## Gröbner bases for operads

All of this becomes relevant to the implementation of Buchberger’s algorithm on shuffle operads (see Dotsenko—Khoroshkin and Dotsenko—Vejdemo-Johansson) in the step where the S-polynomials (and thereby also the reductions) are defined. With a common multiple defined, we need some way to extend the modifications that take the initial term to the common multiple to the rest of that term.

For this, it turns out, that the derivative of the tree datatype used provides theoretical guarantees that only partially filled in trees of the right size, with holes the right size, can be introduced; and also provides an easy and relatively efficient algorithm for contructing the hole-y trees and later filling in the holes.

“The idea is a set gets mapped to the set of all structures labelled by the elements in the original set.”

What do you mean by “structures”? Subsets?