In mathematics, especially in category theory, the codensity monad is a fundamental construction associating a monad to a wide class of functors.
The codensity monad of a functor is defined to be the right Kan extension of along itself, provided that this Kan extension exists. Thus, by definition it is in particular a functor
The codensity monad exists whenever is a small category (has only a set, as opposed to a proper class, of morphisms) and possesses all (small, i.e., set-indexed) limits. It also exists whenever has a left adjoint.
By the general formula computing right Kan extensions in terms of ends, the codensity monad is given by the following formula:
If the functor admits a left adjoint the codensity monad is given by the composite together with the standard unit and multiplication maps.
In several interesting cases, the functor is an inclusion of a full subcategory not admitting a left adjoint. For example, the codensity monad of the inclusion of FinSet into Set is the ultrafilter monad associating to any set the set of ultrafilters on This was proven by Kennison and Gildenhuys,[2] though without using the term "codensity". In this formulation, the statement is reviewed by Leinster.[3]
A related example is discussed by Leinster:[4] the codensity monad of the inclusion of finite-dimensional vector spaces (over a fixed field ) into all vector spaces is the double dualization monad given by sending a vector space to its double dual
Thus, in this example, the end formula mentioned above simplifies to considering (in the notation above) only one object namely a one-dimensional vector space, as opposed to considering all objects in Adámek and Sousa[5] show that, in a number of situations, the codensity monad of the inclusion
Sipoş showed that the algebras over the codensity monad of the inclusion of finite sets (regarded as discrete topological spaces) into topological spaces are equivalent to Stone spaces.[6] Avery shows that the Giry monad arises as the codensity monad of natural forgetful functors between certain categories of convex vector spaces to measurable spaces.[1]
Di Liberti[7] shows that the codensity monad is closely related to Isbell duality: for a given small category Isbell duality refers to the adjunction