Kan extension

Kan extensions are universal constructs in category theory, a branch of mathematics. They are closely related to adjoints, but are also related to limits and ends. They are named after Daniel M. Kan, who constructed certain (Kan) extensions using limits in 1960.

An early use of (what is now known as) a Kan extension from 1956 was in homological algebra to compute derived functors.

In Categories for the Working Mathematician Saunders Mac Lane titled a section "All Concepts Are Kan Extensions", and went on to write that


 * The notion of Kan extensions subsumes all the other fundamental concepts of category theory.

Kan extensions generalize the notion of extending a function defined on a subset to a function defined on the whole set. The definition, not surprisingly, is at a high level of abstraction. When specialised to posets, it becomes a relatively familiar type of question on constrained optimization.

Definition
A Kan extension proceeds from the data of three categories


 * $$\mathbf{A}, \mathbf{B}, \mathbf{C}$$

and two functors


 * $$X : \mathbf{A} \to \mathbf{C}, F : \mathbf{A} \to \mathbf{B}$$,

and comes in two varieties: the "left" Kan extension and the "right" Kan extension of $$X$$ along $$F$$.

The right Kan extension amounts to finding the dashed arrow and the natural transformation $$\epsilon$$ in the following diagram:


 * RightKanExtension.svg

Formally, the right Kan extension of $$X$$ along $$F$$ consists of a functor $$R: \mathbf{B} \to \mathbf{C}$$ and a natural transformation $$\epsilon: RF \to X$$ that is couniversal with respect to the specification, in the sense that for any functor $$M: \mathbf{B} \to \mathbf{C}$$ and natural transformation $$\mu: MF \to X$$, a unique natural transformation $$\delta: M \to R$$ is defined and fits into a commutative diagram:


 * [[Image:RightKanExtension universal property.svg]]

where $$\delta_F$$ is the natural transformation with $$\delta_F(a) = \delta(Fa): MF(a) \to RF(a)$$ for any object $$a$$ of $$\mathbf{A}.$$

The functor R is often written $$\operatorname{Ran}_FX$$.

As with the other universal constructs in category theory, the "left" version of the Kan extension is dual to the "right" one and is obtained by replacing all categories by their opposites.

The effect of this on the description above is merely to reverse the direction of the natural transformations.


 * (Recall that a natural transformation $$\tau$$ between the functors $$F,G: \mathbf{C} \to \mathbf{D}$$ consists of having an arrow $$\tau(a): F(a) \to G(a)$$ for every object $$a$$ of $$\mathbf{C}$$, satisfying a "naturality" property. When we pass to the opposite categories, the source and target of $$\tau(a)$$ are swapped, causing $$\tau$$ to act in the opposite direction).

This gives rise to the alternate description: the left Kan extension of $$X$$ along $$F$$ consists of a functor $$L: \mathbf{B} \to \mathbf{C}$$ and a natural transformation $$\eta: X \to L F$$ that are universal with respect to this specification, in the sense that for any other functor $$M: \mathbf{B} \to \mathbf{C}$$ and natural transformation $$\alpha: X \to M F$$, a unique natural transformation $$\sigma: L \to M$$ exists and fits into a commutative diagram:


 * LeftKanExtension.svg [[Image:LeftKanExtension universal property.svg]]

where $$\sigma_F$$ is the natural transformation with $$\sigma_F(a) = \sigma(Fa): LF(a) \to MF(a)$$ for any object $$a$$ of $$\mathbf{A}$$.

The functor L is often written $$\operatorname{Lan}_FX$$.

The use of the word "the" (as in "the left Kan extension") is justified by the fact that, as with all universal constructions, if the object defined exists, then it is unique up to unique isomorphism. In this case, that means that (for left Kan extensions) if $$L, M$$ are two left Kan extensions of $$X$$ along $$F$$, and $$\eta, \alpha$$ are the corresponding transformations, then there exists a unique isomorphism of functors $$\sigma: L \to M$$ such that the second diagram above commutes. Likewise for right Kan extensions.

Kan extensions as (co)limits
Suppose $$X:\mathbf{A}\to\mathbf{C}$$ and $$F:\mathbf{A}\to\mathbf{B}$$ are two functors. If A is small and C is cocomplete, then there exists a left Kan extension $$\operatorname{Lan}_FX$$ of $$X$$ along $$F$$, defined at each object b of B by


 * $$(\operatorname{Lan}_F X)(b) = \varinjlim_{f:Fa \to b} X(a)$$

where the colimit is taken over the comma category $$(F \downarrow \operatorname{const}_b)$$, where $$\operatorname{const}_b\colon \ast\to \mathbf{B}, \ast\mapsto b$$ is the constant functor. Dually, if A is small and C is complete, then right Kan extensions along $$F$$ exist, and can be computed as the limit


 * $$(\operatorname{Ran}_F X)(b) = \varprojlim_{Fa \leftarrow b} X(a)$$

over the comma category $$(\operatorname{const}_b \downarrow F)$$.

Kan extensions as (co)ends
Suppose $$X:\mathbf{A}\to\mathbf{C}$$ and $$F:\mathbf{A}\to\mathbf{B}$$ are two functors such that for all objects a and a of A and all objects b of B, the copowers $$\mathbf{B}(Fa',b)\cdot Xa$$ exist in C. Then the functor X has a left Kan extension $$\operatorname{Lan}_FX$$ along F, which is such that, for every object b of B,


 * $$(\operatorname{Lan}_FX)b=\int^a \mathbf{B}(Fa,b)\cdot Xa$$

when the above coend exists for every object b of B.

Dually, right Kan extensions can be computed by the end formula


 * $$(\operatorname{Ran}_FX)b=\int_a Xa^{\mathbf{B}(b,Fa)}.$$

Limits as Kan extensions
The limit of a functor $$F: \mathbf{C} \to \mathbf{D}$$ can be expressed as a Kan extension by


 * $$\lim F = \operatorname{Ran}_E F$$

where $$E$$ is the unique functor from $$\mathbf{C}$$ to $$\mathbf{1}$$ (the category with one object and one arrow, a terminal object in $$\mathbf{Cat}$$). The colimit of $$F$$ can be expressed similarly by


 * $$\operatorname{colim} F = \operatorname{Lan}_E F.$$

Adjoints as Kan extensions
A functor $$F : \mathbf{C} \to \mathbf{D}$$ possesses a left adjoint if and only if the right Kan extension of $$\operatorname{Id} : \mathbf{C} \to \mathbf{C}$$ along $$F$$ exists and is preserved by $$F$$. In this case, a left adjoint is given by $$\operatorname{Ran}_F \operatorname{Id}$$ and this Kan extension is even preserved by any functor $$\mathbf{C} \to \mathbf{E}$$ whatsoever, i.e. is an absolute Kan extension.

Dually, a right adjoint exists if and only if the left Kan extension of the identity along $$F$$ exists and is preserved by $$F$$.

Applications
The codensity monad of a functor $$G: \mathbf{D} \to \mathbf{C}$$ is a right Kan extension of G along itself.