# The Unapologetic Mathematician

## 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 $\mathcal{C}$ with pullbacks. A span in $\mathcal{C}$ is a diagram of the form $A_1\leftarrow B\rightarrow A_2$. We think of it as going from $A_1$ to $A_2$. It turns out that we can consider these to be the morphisms in a weak 2-category $\mathbf{Span}(\mathcal{C})$, whose objects are just the objects of $\mathcal{C}$.

Now since this is supposed to be a 2-category we need 2-morphisms to go between spans. Given spans $A_1\leftarrow B\rightarrow A_2$ and $A_1\leftarrow B'\rightarrow A_2$ a 2-morphism from the first to the second will be an arrow from $B$ to $B'$ 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 $A_1\leftarrow B_1\rightarrow A_2$ and $A_2\leftarrow B_2\rightarrow A_3$ we compose them by overlapping them at $A_2$ 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 $A_1\leftarrow C\rightarrow A_3$.

Notice that this composition is not in general associative. If we have three spans $A_1\leftarrow B_1\rightarrow A_2$, $A_2\leftarrow B_2\rightarrow A_3$, and $A_3\leftarrow B_3\rightarrow A_4$, we could pull back on the left first, then on the right, or the other way around:

But the object $D$ at the top of each diagram is a limit for the $A_1\leftarrow B_1\rightarrow A_2\leftarrow B_2\rightarrow A_3\leftarrow B_3\rightarrow A_4$ 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 $D$ to an object along the bottom. In particular, it commutes with the arrows from $D$ to $A_1$ and to $A_4$, 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 $A\leftarrow A\rightarrow A$, where the arrows are the identity arrows on $A$. When we pull back anything along the identity arrow on $A$, 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 $\mathbf{Span}(\mathcal{C})$ 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 $\mathcal{C}$ with pushouts (instead of pullbacks) is a diagram of the form $A_1\rightarrow B\leftarrow A_2$. 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 “$\Lambda$-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.

### Like this:

Posted by John Armstrong | Category theory

## 6 Comments	»

1. [...] 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 | October 9, 2007 | Reply

2. [...] 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 | October 9, 2007 | Reply

3. [...] 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 | October 10, 2007 | Reply

4. [...] 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 | March 18, 2008 | Reply

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

Comment by Jon McKenzie | March 18, 2008 | Reply

6. Thanks. fixing it.

Comment by | March 18, 2008 | Reply

« Previous | Next »

## About this weblog

This is mainly an expository blath, with occasional high-level excursions, humorous observations, rants, and musings. The main-line exposition should be accessible to the “Generally Interested Lay Audience”, as long as you trace the links back towards the basics. Check the sidebar for specific topics (under “Categories”).

I’m in the process of tweaking some aspects of the site to make it easier to refer back to older topics, so try to make the best of it for now.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 31, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9421244859695435, "perplexity_flag": "middle"}