## Spans and Cospans

I was busy all yesterday with my talk at George Washington, so today I’ll make up for it by explaining one of the main tools that went into the talk. Coincidentally, it’s one of my favorite examples of a weak 2-category.

We start by considering a category with pullbacks. A span in is a diagram of the form . We think of it as going from to . It turns out that we can consider these to be the morphisms in a weak 2-category , whose objects are just the objects of .

Now since this is supposed to be a 2-category we need 2-morphisms to go between spans. Given spans and a 2-morphism from the first to the second will be an arrow from to making the triangles on the sides of the following diagram commute:

We compose 2-morphisms in the obvious way, stacking these diamond diagrams on top of each other and composing the arrows down the middle.

The composition for 1-morphisms is where it gets interesting. If we have spans and we compose them by overlapping them at and pulling back the square in the middle, as in the following diagram:

where the middle square is a pullback. Then the outer arrows form a span .

Notice that this composition is not in general associative. If we have three spans , , and , we could pull back on the left first, then on the right, or the other way around:

But the object at the top of each diagram is a limit for the along the bottom of the diagram. And thus the two of them must be isomorphic, and the isomorphism must commute with all the arrows from to an object along the bottom. In particular, it commutes with the arrows from to and to , and thus gives a canonical “associator” 2-morphism. I’ll leave the straightforward-but-tedious verification of the pentagon identity as an exercise.

What is the identity span? It’s just , where the arrows are the identity arrows on . When we pull back anything along the identity arrow on , we get the same arrow again. Thus the 2-morphisms we need for the left and right unit are just the identities, and so the triangle identity is trivially true. Thus we have constructed a 2-category from any category with pullbacks.

The concept of a cospan is similar, but the arrows (predictably) run the other way. A cospan in a category with *pushouts* (instead of pullbacks) is a diagram of the form . Everything else goes the same way — 2-morphisms are arrows in the middle making the side triangles commute, and composition of cospans goes by pushing out the obvious square.

Unusual as it is for this weblog, I’d like to make one historical note. Spans and cospans were introduced by Bénabou in the early 1960s. This was first pointed out to me by Eugenia Cheng (of The Catsters) and John Baez (of The n-Category Café) at a conference at Union College two years ago. Until that point I’d been calling cospans “-diagrams” because I’d invented them out of whole cloth to solve a problem that I’ll eventually get around to explaining. The name seemed appropriate because I tend to draw them (as I have in the above diagrams) as wedges with the arrows on the sides pointing up into the center, sort of like a capital lambda. They’ve shown up in a number of contexts, but as far as I can tell I’m the first (and so far only) to use them in knot theory like I do. However, Jeff Morton has noted that cobordisms are a sort of cospan, and my use of tangles is analogous to that.

[...] there is a (bi)category , where spans are composed using pullbacks. John Armstrong recently posted about spans, describing , which has the same objects as , and morphisms which are spans in [...]

Pingback by Spans and Vector Spaces - pt 1 « Theoretical Atlas | October 9, 2007 |

[...] and Cospans II There’s something we need to note about spans that will come in extremely handy as we start trying to add structure to our categories of [...]

Pingback by Spans and Cospans II « The Unapologetic Mathematician | October 9, 2007 |

[...] Structures on Span 2-Categories Now we want to take our 2-categories of spans and add some 2-categorical analogue of a monoidal structure on [...]

Pingback by Monoidal Structures on Span 2-Categories « The Unapologetic Mathematician | October 10, 2007 |

[...] Useless After All! Today on the arXiv, we find a posting of an old paper, which uses spans of “reflexive graphs” to give an algebraic framework for describing partita doppia [...]

Pingback by Category Theory Isn’t Useless After All! « The Unapologetic Mathematician | March 18, 2008 |

Hey John, you’ve got a dangling latex above the second image.

Comment by Jon McKenzie | March 18, 2008 |

Thanks. fixing it.

Comment by John Armstrong | March 18, 2008 |