It’s funny how similar ideas pop up in different branches of mathematics. Calculus, for instance, is built around metric spaces (or, more generally, Banach spaces) and measures. A limit of a sequence is defined by points getting closer and closer together. An integral is an area under a curve. In category theory, though, we don’t talk about distances or areas (except for Lawvere’s take on metric spaces), and yet we have the abstract notion of a limit, and we use integral notation for ends. The similarities are uncanny.

This blog post was inspired by my trying to understand the idea behind the Freyd’s adjoint functor theorem. It can be expressed as a colimit over a comma category, which is a special case of a Grothendieck fibration. To understand it, though, I had to get a better handle on weighted colimits which, as I learned, were even more general than Kan extensions.

# Category of elements as coend

Grothendieck fibration is like splitting a category in two orthogonal directions, the base and the fiber. Fiber may vary from object to object (as in dependent types, which are indeed modeled as fibrations).

The simplest example of a Grothendieck fibration is the *category of elements*, in which fibers are simply sets. Of course, a set is also a category—a discrete category with no morphisms between elements, except for compulsory identity morphisms. A category of elements is built on top of a category using a functor

Such a functor is traditionally called a copresheaf (this construction works also on presheaves, ). Objects in the category of elements are pairs where is an object in , and is an element of a set.

A morphism from to is a morphism in , such that .

There is an obvious projection functor that forgets the second component of the pair

(In fact, a general Grothendieck fibration starts with a projection functor.)

You will often see the category of elements written using integral notation. An integral, after all, is a gigantic sum of tiny slices. Similarly, objects of the category of elements form a gigantic sum (disjoint union) of sets . This is why you’ll see it written as an integral

However, this notation conflicts with the one for conical colimits so, following Fosco Loregian, I’ll write the category of elements as

An interesting specialization of a category of elements is a *comma category*. It’s the category of arrows originating in the image of the functor and terminating at a fixed object in . The objects of are pairs where is an object in and is a morphism in . These morphisms are elements of the hom-set , so the comma category is just a category of elements for the functor

You’ll mostly see integral notation in the context of ends and coends. A coend of a profunctor is like a trace of a matrix: it’s a sum (a coproduct) of diagonal elements. But (co-)end notation may also be used for (co-)limits. Using the trace analogy, if you fill rows of a matrix with copies of the same vector, the trace will be the sum of the components of the vector. Similarly, you can construct a profunctor from a functor by repeating the same functor for every value of the first argument :

The coend over this profunctor is the colimit of the functor, a colimit being a generalization of the sum. By slight abuse of notation we write it as

This kind of colimit is called *conical*, as opposed to what we are going to discuss next.

# Weighted colimit as coend

A colimit is a universal cocone under a diagram. A diagram is a bunch of objects and morphisms in selected by a functor from some indexing category . The legs of a cocone are morphisms that connect the vertices of the diagram to the apex of the cocone.

For any given indexing object , we select an element of the hom-set , as a *wire* of the cocone. This is a selection of an element of a set (the hom-set) and, as such, can be described by a function from the singleton set . In other words, a wire is a member of . In fact, we can describe the whole cocone as a natural transformation between two functors, one of them being the constant functor . The set of cocones is then the set of natural transformations:

Here, is the category of presheaves, that is functors from to , with natural transformations as morphisms. As a bonus, we get the cocone triangle commuting conditions from naturality.

Using singleton sets to pick morphisms doesn’t generalize very well to enriched categories. For conical limits, we are building cocones from zero-thickness wires. What we need instead is what Max Kelly calls *cylinders* obtained by replacing the constant functor with a more general functor . The result is a *weighted* colimit (or an indexed colimit, as Kelly calls it), . The set of weighted cocones is defined by natural transformations

and the weighted colimit is the universal one of these. This definition generalizes nicely to the enriched setting (which I won’t be discussing here).

Universality can be expressed as a natural isomorphism

We interpret this formula as a one-to-one correspondence: for every weighted cocone with the apex there is a unique morphism from the colimit to . Naturality conditions guarantee that the appropriate triangles commute.

A weighted colimit can be expressed as a coend (see Appendix 1)

The dot here stands for the tensor product of a set by an object. It’s defined by the formula

If you think of as the sum of copies of the object , then the above asserts that the set of functions from a sum (coproduct) is equivalent to a product of functions, one per element of the set ,

# Right adjoint as a colimit

A fibration is like a two-dimensional category. Or, if you’re familiar with bundles, it’s like a fiber bundle, which is locally isomorphic to a cartesian product of two spaces, the base and the fiber. In particular, the category of elements is, roughly speaking, like a bundle whose base is the category , and the fiber is a (-dependent) set .

We also have a projection functor on the category of elements that ignores the component

The coend of this functor is the (conical) colimit

But this functor is constant along the fiber, so we can “integrate over it.” Since fibers depends on , different objects end up weighted differently. The result is a coend over the base category, with objects weighted by sets

Using a more traditional notation, this is the formula that relates a (conical) colimit over the category of elements and a weighted colimit of the identity functor

There is a category of elements that will be of special interest to us when discussing adjunctions: the comma category for the functor , in which the weight functor is the hom-functor

If we plug it into the last formula, we get

If the functor has a right adjoint

we can rewrite this as

and useing the ninja Yoneda lemma (see Appendix 2) we get a formula for the right adjoint in terms of a colimit of a comma category

Incidentally, this is the left Kan extension of the identity functor along . (In fact, it can be used to define the right adjoint as long as it preserves the functor .)

We’ll come back to this formula when discussing the Freyd’s adjoint functor theorem.

# Appendix 1

I’m going to prove the following identity using some of the standard tricks of coend calculus

To show that two objects are isomorphic, it’s enough to show that their hom-sets to any object are isomorphic (this follows from the Yoneda lemma)

I first used the universal property of the colimit, then rewrote the set of natural transformations as an end, used the definition of the tensor product of a set and an object, and replaced an end of a hom-set by a hom-set of a coend (continuity of the hom-set functor).

# Appendix 2

The proof of

follows the same pattern

I used the fact that a hom-set from a coend is isomorphic to an end of a hom-set (continuity of hom-sets). Then I applied the definition of a tensor. Finally, I used the Yoneda lemma for contravariant functors, in which the set of natural transformations is written as an end.

August 22, 2020 at 3:53 am

[…] Перевод статьи Бартоша Милевски «Weighted Colimits» (исходный текст расположен по адресу — Текст оригинальной статьи). […]