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.
Weak 2-Categories
I’d like to step aside from homology because I’m on the road and I can throw off a post about weak 2-categories in my sleep by now.
When we were talking about enriched categories we mentioned the case of 2-categories, where between each pair of objects we have a hom-category and so on. We also mentioned that if a 2-category has only one object it’s the same thing as a strict monoidal category. But monoidal categories aren’t generally strict! That is, the monoidal product isn’t associative “on the nose”, but only up to a natural isomorphism. And so we should look for the same sort of thing to happen in the case of more general 2-categories.
So, a (weak) 2-category will have a collection of objects. Between each pair of objects
there will be a category
whose objects we call 1-morphisms from
to
. Between two such 1-morphisms
we have a set of “2-morphisms”
.
We can “vertically” compose 2-morphisms using the composition from a given hom-category. That is, given and
we have
. Of course, there is an “identity” 2-morphism
on any 1-morphism
, and the composition is associative. At this top level, everything is just like any other category.
Down at the level of 1-morphisms, things get hairier. For each triple of objects we have a functor
. This functor is not required to be associative in the usual sense, nor to have identities. Instead, for every triple of 1-morphisms
,
, and
, there is a 2-isomorphism
which replaces the associative law. Similarly, for each object we have a 1-morphism
and for each 1-morphism
we have 2-morphisms
and
to replace the left and right unit laws.
Now because is a functor, it also acts on 2-morphisms. That is, if we have 1-morphisms
and
, and 2-morphisms
and
, then we have a “horizontal” composition
.
Functoriality says that this horizontal composition has to preserve the vertical composition inside each hom-category. So let’s take 1-morphisms and
. Then take 2-morphisms
,
,
, and
. We can vertically compose to get
and
. These can then be horizontally composed to get
. On the other hand we could have composed horizontally before vertically and obtained
. Functoriality tells us that these two 2-morphisms must be the same. We call this equation the “exchange identity”.
As an exercise, write all this out in the case where we just have one object. Then there’s only one hom-category to worry about. Verify that this restates the definition of a (weak) monoidal category, and show what the exchange identity means in this case.
Homology
Today we can define homology before I head up to the Baltimore/DC area for the weekend. Anyone near DC who wants to hear about anafunctors can show up at George Washington University’s topology seminar on Friday.
As a preliminary, we need to know what quotients in an abelian category are. In we think of an abelian group
and a subgroup
and consider two elements of
to be equivalent if they differ by an element of
. This causes problems for us because we don’t have any elements to work with.
Instead, remember that comes with an “inclusion” arrow
, and that the quotient has a projection arrow
. The inclusion arrow is monic, the projection is epic, and an element of the quotient is zero if and only if it comes from an element of
that is actually in
. That is, we have a short exact sequence
. But we know in any abelian category that this short exact sequence means that the projection is the cokernel of the inclusion. So in general if we have a monic
we define
.
Now we define a chain complex in an abelian category to be a sequence
with arrows
so that
. In particular, an exact sequence is a chain, since the composition of two arrows in the sequence is the zero homomorphism. But a chain complex is not in general exact. Homology will be the tool to measure exactly how the chain complex fails to be exact.
So let’s consider the following diagram

where . We can factor
as
for an epic
and a monic
. We can also construct the kernel
of
. Now
, so
because
is epic. This means that
factors through
, and the arrow
must be monic.
Now, if the sequence were exact then would be the same as
, and the arrow we just constructed would be an isomorphism. But in general it’s just a monic, and so we can construct the quotient
. When the sequence is exact this quotient is just the trivial object
, so the failure of exactness is measured by this quotient.
In the case of a chain complex we consider the above situation with and
, so they connect through
. We define
and
, which are both subobjects of
. Then the “homology object”
is the quotient
. We can string these together to form a new chain complex
where all the arrows are zero. This makes sense because if we think of the case of abelian groups,
consists of equivalence classes of elements of
, and when we hit any element of
by
we get
. Thus the residual arrows when we pass from the original chain complex to its homology are all zero morphisms.
The Snake Lemma
And now for what has to be the most popular theorem in all of homological algebra: the snake lemma.
This shows up in every first course in algebraic topology, and always with the same diagram-chasing proof (though not with the same semantic sugar as we’re using). And some grad student always raises the same objection halfway through (I did it in my class). And the follow-up is always the same. Weibel’s An Introduction to Homological Algebra points out that the proof is best seen visually, but I don’t have a video camera like The Catsters. Weibel also points out that a good visual presentation appears in the 1980 movie It’s My Turn. I looked around everywhere but couldn’t find a clip online. So, if you have access to the movie it’s old enough that I’m sure the producers wouldn’t mind a teensy clip posted for The Good of Mathematics. Call it “fair use”.
[UPDATE]: Down in the comments, Graham points out that someone at Harvard has posted the clip here. Tough to see, though.
Now, down to business. We consider the following diagram:

We start with two short exact sequences and a morphism from one to the other. We construct the kernel and cokernel of each arrow, and then use their universal properties to construct arrows between the kernels and cokernels. It is straightforward to show that the given rows are exact — in particular,
is monic and
is epic.
However, the upper and lower rows are not necessarily short exact sequences. That is, may fail to be epic and
may fail to be monic. Amazingly, though, these two fail to happen in exactly the same way at exactly the same time! It turns out that there is a morphism
so that the sequence
is exact.
Now, if you really want to see the chase you can get someone to walk you through it, try to construct it yourself, or beg Netflix to stock more early 1980s romances between Jill Clayburgh and Michael Douglas. Here I’ll do a much more insightful proof that gets to the heart of what the connecting morphism really is. The proof depends on this diagram:

We start with the same middle rows as before and construct and
. Now we use one of our lemmas (and its dual) to construct the pullback
, the pushout
, and the two dashed arrows. Notice that here we’re using the (unshown) facts that
is monic and
is epic. We have an arrow
, which satisfies
and
. And then since
is the kernel of
and
is the cokernel of
, we see that
factors as
for some unique
.
What does this arrow do to a member ? Well first it gets sent to
. Then because
is epic there must be a
with
. We calculate that
. But then by exactness there must be
with
. This is the usual diagram chase given to construct the connecting morphism. Now I claim that
.
This happens because is a pullback, so there is a member
with
and
. Then
Since is monic we have
, as desired. This also shows that the equivalence class of
is independent of the choices made in the construction of the last paragraph, which is the standard objection I mentioned earlier, now handled in a very slick (but not diagram-chasing) way.
So now we need to verify the exactness of the long sequence. We’ll show the exactness at , and that at
will follow by duality.
First of all we need to see that . For this, we show that
for any
. Now when we use the diagram chase our first step is to choose a
with
, where
is the kernel map. This shows we can choose
. But then
, and so we choose
and find
.
Now take with
, meaning that we construct
. By the definition of the cokernel there will be
with
, so
. The “subtraction” rule gives us a
with
and
. But now by the definition of
we have
with
. Then
, and so
because
is monic. And thus the sequence is exact at
.
Incidentally, what the setup of the snake lemma tells us is that the category , while always enriched over
, is not generally abelian itself. If it were an abelian category the upper and lower rows of the first diagram would have to be short exact sequences themselves. That doesn’t quite happen, but we can exactly capture the obstruction to existence of kernels and cokernels in a single connecting morphism. If this morphism
is the zero morphism, then we can insert
into the long exact sequence and then break it into the two short exact sequences, and thus we have a kernel and a cokernel for the triple
.
Notice here that , so the obstruction lives in this abelian group, which is determined by
and
. Thus in a sense a morphism of short exact sequences has or fails to have a kernel and a cokernel on
alone. I’ll leave this to you to ponder: if we’ve given
and
, must there exist a
so that
has a kernel and a cokernel — so that
? And if so, how can we find it?
The Five Lemma
Today I’ll prove the “five lemma”, using the diagram chasing rules I outlined last time. This is an extension of the short five lemma from last week.
We consider the following commutative diagram with exact rows:

The five lemma states that if is epic, and
and
are monic, then
is monic. By our chasing rules this means that for all
,
implies that
. So let’s start with a member
of
and assume that
.
First off we can tell that , and since
is monic this means
. Now the upper row is exact at
, so there must exist a member
with
. We find
, so by the exactness of the lower row at
there must be a member
with
. Because
is epic, there is a member
with
. Then
, and so
. Then
, but exactness tells us that
, which leads us to conclude that
. Therefore
is monic.
Dually, if and
are epic while
is monic we conclude that
is epic. And then if
is epic,
and
are isomorphisms, and
is monic, then
is an isomorphism.
It’s instructive to run through the above chase in both languages. First read as denoting an element of an abelian group, while
denotes equality of elements. Then go back and reconstruct the proof in terms of morphisms between objects of general abelian categories. Thinking of members as behaving like actual elements allows us to create a proof that works for any abelian category we happen to be considering.
