Kan extensions diagrammatically
30 January 2024- Introducing string diagrams
- Adjunctions
- Kan extensions
- Everything is a Kan extension?
- Adjoints preserve Kan extensions
- Wrapping up
Today I want to present an alternative way for reasoning about (strict) 2-categories that allows us to express seemingly difficult concepts in a very simple way visually. To see how powerful this approach is, we will study (weak) Kan extensions as a concept in the 2-category of (adequately size bounded) categories.
Introducing string diagrams #
The key insight here is that in this context we mainly care about natural transformations. Functors serve as endpoints for the natural transformations and categories are just ambient and not important for our arguments. Unfortunately, the usual commutative diagram notation realize natural transformations as 2-dimensional objects (faces). To shift the focus onto natural transformations instead, we dualize commutative diagrams.
This dual notation is a string diagram. There are different conventions for how to write and read them. The notation I will use here reflects contravariant composition in formulas exactly. This allows us to translate the diagram into a formula by reading it top to bottom and left to right. Furthermore:
- Functor composition is realized by drawing two parallel strings.
- Identity functors are omitted.
- The identity natural transformations are omitted.
Using our conventions we can introduce the notation for composing natural transformations.
The true power of the string diagram calculus in proofs comes from the fact that certain equations turn into topological properties of the diagrams that we can easily use to manipulate the equations visually. The interchange law for horizontal and vertical composition of natural transformations tells us that we can freely slide the “marbles” on the strings up and down as long as they retain their relative order.
Notice how easy it is to express whiskering in this notation. It is practically automatic!
Adjunctions #
Given functors and , an adjunction is realized by two natural transformations
that satisfy the zig-zag law (or equivalently the triangle identities). We shall write them out directly in string diagram notation. The corresponding formulas are easily read off from the images.
Since we omit the string of the identity functors, the unit and counit are realized as a cup and cap respectively. The zig-zag identities are topologically intuitive from the diagrams. They will play an important role in understanding how adjunctions interact with different constructions.
Kan extensions #
A left Kan extension of a functor with respect to a functor is given by a functor and a natural transformation with the following universal property.
Visually, each splits into and some unique . Sliding into creates a unique .
Dualizing this construction, the definition of a right Kan extension is obtained by flipping source and target of the involved natural transformations. In string diagram notation this corresponds to mirroring the picture vertically!
Everything is a Kan extension? #
As it turns out, almost everything can be written as a Kan extension.
Adjunctions are Kan extensions #
Suppose we have an adjunction with unit and counit . We will see the following.
- is a left Kan extension of with respect to .
- is a right Kan extension of with respect to .
Using duality, it suffices to show only the first claim. (Notice how the right-adjoint is the left Kan extension and vice versa.)
Let be given. If any factors , then it must satisfy the following equations.
But this determines uniquely as . According to the zig-zag identity, this clearly works and thus the proof is complete!
Limits and colimits are Kan extensions #
To see that limits and colimits can be identified with certain Kan extensions, we simply notice that a cone to a functor is exactly a natural transformation from the constant functor that picks the apex of the cone to the functor .
Since every constant functor factors uniquely through the terminal category, we have a decomposition that fits the framework of Kan extensions. It is now obvious that the terminal cone corresponds exactly to the right Kan extension of with respect to .
Dually, the initial cocone corresponds exactly to the left Kan extension of with respect to .
Adjoints preserve Kan extensions #
Suppose we have a an adjunction .
- If is a left Kan extension and composes, then is a left Kan extension of with respect to .
- If is a right Kan extension and composes, then is a right Kan extension of with respect to .
By duality it suffices to prove only the first claim. Using the string diagram calculus, the proof basically writes itself.
Suppose we are given and it factors through via . Adding some zig-zag identities we come to the following conclusion.
Where is the unique natural transformation that factors through . It is again clear that this factors , so this concludes the proof.
Corollary: Left adjoints preserve colimits and right adjoints preserve limits.
Wrapping up #
Many more interesting things can be said about Kan extensions and we can prove the properties using string diagrams. For example, if we try to take a Kan extension of a functor with respect to itself, we obtain certain (co)density monads. Furthermore, we can use Kan extensions to understand / define derived functors in convenient generality.
It should be noted that the string diagram calculus works extremely well in the context of monoidal categories (effectively 2-categories with a single object.) Perhaps an idea for another post…
Scroll to Top