# Left adjoints, lenses, and localisation

In this post I am going to recount three stories that I’ve been thinking about recently: Cauchy completion, internal lenses, and GZ/zigzag-localisation. The first two of these stories are probably more likely to be familiar to the (applied) category theory audience of this blog than the third. For me, coming from the “opposite” background, the first two seem to have the same flavour as the third, and that is the purpose of me writing this: I’m hoping that somebody out there will be able to tell me what the underlying formalism is. I’ll end this post with a specific “conjecture” (really, just a question), that I would imagine is some sort of folklore result (in that, I can’t find it written down anywhere, but it seems very much alluded to in lots of places).

# 1 Introduction

In this post I am going to recount three stories that I’ve been thinking about recently: Cauchy completion, internal lenses, and GZ/zigzag-localisation. The first two of these stories are probably more likely to be familiar to the (applied) category theory audience of this blog than the third. For me, coming from the “opposite” background, the first two seem to have the same flavour as the third, and that is the purpose of me writing this: I’m hoping that somebody out there will be able to tell me what the underlying formalism is. I’ll end this post with a specific “conjecture” (really, just a question), that I would imagine is some sort of folklore result (in that, I can’t find it written down anywhere, but it seems very much alluded to in lots of places).

To be specific, the shared flavour that these three stories all have to me is this structure of *“nice left leg, specific right leg”*.

For reasons of length (and also of lack of experience on my behalf), I’m not going to give as much motivation for some of these definitions as I would like — I’m really just giving an overview of three constructions and saying “oh my, don’t these look similar?” — but I’ll include some references for the curious reader.

# 2 Representable profunctors

*Main reference: Borceux & Dejean, “Cauchy completion in category theory” (1986).*

Given (commutative) rings R and S, we might define an abelian group M to be an **(R,S)-bimodule** if it is simultaneously a left R-module and a right S-module, in a compatible way: such that (rm)s=r(ms). Slightly slicker would be the equivalent definition of asking for M to be a right (R^{\mathrm{op}}\otimes_{\mathbb{Z}}S)-module (or, dually, a left (R\otimes_{\mathbb{Z}}S^{\mathrm{op}})-module), where we regard R as an \mathsf{Ab}-enriched category with one object.

But, of course, category theory gives us another way of approaching this definition. We start by noting that a (left) R-module is exactly an \mathsf{Ab}-enriched functor R^{\mathrm{op}}\to\mathsf{Ab}. This leads us to the categorical generalisation of our algebraic definition above: given \mathcal{V}-enriched categories \mathcal{C} and \mathcal{D} (for some suitably nice \mathcal{V}), a **\mathcal{V}-bimodule** is a \mathcal{V}-enriched functor \mathcal{D}^{\mathrm{op}}\otimes\mathcal{C}\to\mathcal{V}.

In the specific case where \mathcal{V}=\mathsf{Set}, we often refer to bimodules as **profunctors**, and write \mathcal{C}\nrightarrow\mathcal{D} to mean the functor \mathcal{D}^{\mathrm{op}}\times\mathcal{C}\to\mathsf{Set}. We can compose profunctors using coends, but we’re not really going to care too much about that today; what is important for us is really understanding how functors “sit inside” profunctors.

Given a functor F\colon\mathcal{C}\to\mathcal{D}, we obtain a profunctor F^*\colon\mathcal{C}\nrightarrow\mathcal{D} by defining F^*(d,c)=\mathcal{D}(d,Fc). This has a right adjoint, given by the dual definition: F_*\colon\mathcal{D}\nrightarrow\mathcal{C}, where F_*(c,d)=\mathcal{D}(Fc,d). If we take \mathcal{C} to be small, then we have the equivalences of categories \begin{aligned} \mathcal{C} &\simeq \operatorname{Fun}(1,\mathcal{C}) \\\hat{\mathcal{C}} &\simeq \operatorname{Profun}(1,\mathcal{C}) \end{aligned} where we write \hat{\mathcal{C}} to mean the presheaf category \operatorname{Fun}(\mathcal{C}^{\mathrm{op}},\mathsf{Set}). Under these identifications, the Yoneda embedding is exactly given by \begin{aligned} よ\colon\operatorname{Fun}(1,\mathcal{C}) &\to \operatorname{Profun}(1,\mathcal{C}) \\F &\mapsto F^*. \end{aligned}

A profunctor P\colon1\nrightarrow\mathcal{C} is of the form P=よ(F)=F^* if and only if *P admits a right adjoint*.

(I’ll just point out that this theorem has another equivalent condition in it, which justifies the title of the Borceaux–Dejean paper: “if and only if P is in the Cauchy completion of \mathcal{C}, i.e. if and only if P is absolutely presentable, i.e. if and only if P preserves all small colimits”.)

# 3 Internal functors and lenses

*Main reference: Clarke, “Internal lenses as functors and cofunctors” (2020).*

Let \mathcal{E} be a category with pullbacks (such as \mathcal{E}=\mathsf{Set}), and consider the bicategory \operatorname{Span}(\mathcal{E}): its objects are objects A of \mathcal{E}, its 1-morphisms A\to B are spans A\leftarrow S\rightarrow B, and its 2-morphisms (A\to B)\Rightarrow(A'\to B') are maps of spans S\to S' such that everything commutes.

Then we can think about monads in \operatorname{Span}(\mathcal{E}). Such a thing consists of

- an object A_0 of \mathcal{E};
- a span A_0\xleftarrow{s_0}A_1\xrightarrow{t_0}A_0; and
- span morphisms \begin{CD} A_0 @<{\mathrm{id}}<< A_0 @>>{\mathrm{id}}> A_0 \\@| @VViV @| \\A_0 @<<s_0< A_1 @>>t_0> A_0 \end{CD} \qquad \begin{CD} A_1 @<s_1<< A_2 @>t_1>> A_1 \\@Vs_0VV @VVcV @VVt_0V \\A_0 @<s_0<< A_1 @>t_0>> A_0 \end{CD}

(where A_2 is a pullback, and some other nice conditions are satisfied).

We then have the beautiful fact that *monads in \operatorname{Span}(\mathcal{E}) are exactly internal categories in \mathcal{E}*.

The slightly irksome sequel to this fact, however, is that *morphisms of monads in \operatorname{Span}(\mathcal{E}) are not exactly internal functors*. If we wish to describe internal functors in this language of monads of spans, then we need to consider

**colax monad morphisms**: such a thing from one monad (A,S) to another (B,T) consists of

- a 1-morphism f\colon A\to B; and
- a 2-morphism \varphi\colon S\circ f\Rightarrow f\circ T

(such that certain diagrams commute). We obtain the dual notion of **lax monad morphisms** by asking for \varphi to go in the opposite direction.

Internal functors (resp. internal cofunctors) correspond exactly to colax (resp. lax) monad morphisms *whose 1-morphism admits a right adjoint*.

Note that a 1-morphism in \operatorname{Span}(\mathcal{E}) admits a right adjoint if and only if *its left leg is an identity morphism*, i.e. it is of the form A\xleftarrow{{\mathrm{id}}}A\to B.

Now we can start talking about (internal) lenses. First, we need the following nice “trivial” fact: *every internal cofunctor can be written as a span of internal functors, with the left leg an identity-on-objects internal functor and the right left a discrete opfibration*. More explicitly, writing \underline{A}=(A_0,A_1,s_0,\ldots), we can write any internal cofunctor from \underline{B} to \underline{A} as
\underline{A} \xleftarrow{K} \underline{\Lambda} \xrightarrow{\overline{F}} \underline{B}
where K acts as the identity on objects, and where \overline{F} gives the pullback square
\begin{CD}
B_1^{\mathrm{op}}@>\overline{F}_1^{\mathrm{op}}>> \Lambda_1^{\mathrm{op}}
\\@Vd_0VV @VVd_0V
\\B_0^{\mathrm{op}}@>>\overline{F}_0^{\mathrm{op}}> \Lambda_0^{\mathrm{op}}
\end{CD}
(again, I am omitting details, but this is because I would much rather that people go and read this stuff in Bryce Clarke’s paper instead of listening to me).

All this formalism lets us now define an **internal lens** to be an internal cofunctor from \underline{B} to \underline{A} (as above) along with an internal functor F from \underline{A} to \underline{B} such that the two commute, i.e. FK=\overline{F}.

One final thing that I’d like to point out is that initial functors and discrete opfibrations form an **orthogonal factorisation system** on the category of small categories: every functor factors uniquely (up to unique isomorphism) as an initial functor followed by a discrete opfibration, and the class of initial functors (resp. of discrete opfibrations) contains all isomorphisms and is closed under composition.

# 4 GZ localisation and the derived category

Finally then, let’s look at the story which I heard first, back when I was an undergraduate studying algebraic geometry.

If this is your first time seeing these definitions, then they will almost certainly appear mysterious and unmotivated. I am not going to waste your time by trying to explain this here, and will instead recommend that, if you want some motivation for this, you can read “Derived categories for the working mathematician”, for example.

Let \mathcal{C} be a category, and \mathcal{W} a wide subcategory (i.e. a class of arrows in \mathcal{C}). Then the **localisation of \mathcal{C} along \mathcal{W}** is, *if it exists*, a category \mathcal{W}^{-1}\mathcal{C} along with a functor from \mathcal{C} “in which all morphisms in \mathcal{W} become isomorphisms”, such that it is the universal such one. More precisely, for any category \mathcal{D} along with a functor \mathcal{C}\to\mathcal{D} such that the image of \mathcal{W} is contained inside the wide subcategory of all isomorphisms in \mathcal{D}, there should exist a unique functor \mathcal{W}^{-1}\mathcal{C}\to\mathcal{D} through which it factors.

If \mathcal{W} is nice enough, then we can give a reasonably explicit construction of the localisation, via **Gabriel–Zisman** (or **zigzag**) localisation: the objects of \mathcal{W}^{-1}\mathcal{C} are exactly the objects of \mathcal{C}, but the morphisms are given by particularly nice spans:^{1}
\operatorname{Hom}_{\mathcal{W}^{-1}\mathcal{C}}(x,y)
= \Big\{ x \xleftarrow{\sim} a \to y \Big\}/\sim
where we write \xrightarrow{\sim} to mean a morphism that lies in \mathcal{W}, and where two spans are defined to be equivalent if there exists a span which dominates them both (i.e. some a\xleftarrow{\sim}b\to a' such that the big diagram of all three spans commutes).

The main motivation for algebraic geometers to study this localisation is for construction of the derived category of chain complexes, which goes as follows. Let \mathcal{A} be an abelian category (which we will just assume to be the category of modules over a commutative ring, for simplicity). We define the **dg-category of chain complexes** \mathsf{C}^\mathrm{dg}(\mathcal{A}) to have objects being chain complexes in \mathcal{A}, and to have morphisms being degree-wise morphisms in \mathcal{A}, i.e.
\begin{aligned}
\operatorname{ob}(\mathsf{C}^\mathrm{dg}(\mathcal{A}))
&= \Big\{ \ldots\to A_{m+1}\xrightarrow{d_m}A_m\xrightarrow{d_{m-1}}A_{m-1}\to\ldots \mid A_i\in\mathcal{A}, d_{i-1}\circ d_{i}=0\,\,\forall i\in\mathbb{Z} \Big\}
\\\operatorname{Hom}(A_\bullet,B_\bullet)
&= \Big\{ \big(k,(f_m)_{m\in\mathbb{Z}}\big) \mid k\in\mathbb{Z}, f_m\in\operatorname{Hom}_{\mathcal{A}}(A_m,B_{m+k}) \Big\}.
\end{aligned}
This has the structure of a dg-category: the hom sets are actually themselves chain complexes, with grading given by the degree k of the morphism, and with differential given by f\mapsto d_B\circ f\pm f\circ d_A (with the sign depending on the degree of f).

Given a chain complex A_\bullet\in\mathsf{C}^\mathrm{dg}(\mathcal{A}), we define the **m-cycles** to be the group
\operatorname{K}_m(A_\bullet) = \{c\in A_m \mid d_{m-1}(c)=0\}
(where, remember, we are assuming that \mathcal{A} is some category of modules, so it makes sense to talk about elements of its objects). We also define the **m-boundaries** to be the group
\operatorname{B}_m(A_\bullet) = \{b\in A_m \mid b=d_m(b')\text{ for some }b'\in A_{m+1}\}.
This lets us define the **m-th homology** of A_\bullet as the quotient
\operatorname{H}_m(A_\bullet) = \operatorname{K}_m(A_\bullet)/\operatorname{B}_m(A_\bullet).

Now we can define the “usual” category of chain complexes to be \mathsf{C}(\mathcal{A})=\operatorname{K}^0(\mathsf{C}^\mathrm{dg}(\mathcal{A})), where \operatorname{K}_0 denotes the 0-chains:
\operatorname{Hom}_{\mathsf{C}(\mathcal{A})}(A_\bullet,B_\bullet)
= \Big\{ (k,f)\in\operatorname{Hom}_{\mathsf{C}^\mathrm{dg}(\mathcal{A})}(A_\bullet,B_\bullet) \mid k=0, df=0 \Big\}
(with these morphisms often being called **chain maps**, since they commute with the differentials of both of the chain complexes involved).

You might be wondering why we only consider the 0-chains of \mathsf{C}^\mathrm{dg}(\mathcal{A}), and not the 0-th homology, but we actually do care about both! The category \operatorname{H}^0(\mathsf{C}^\mathrm{dg}(\mathcal{A})), given by taking the quotient of \mathsf{C}(\mathcal{A}) by **chain homotopy equivalence**, is called (annoyingly) the **homotopy category** of \mathcal{A}, and often denoted (again, annoyingly) by \mathscr{K}(\mathcal{A}).

Finally, we can define the **derived category of \mathcal{A}** to be a certain localisation:
\mathscr{D}(\mathcal{A}) = \mathcal{W}^{-1}\mathsf{C}(\mathcal{A})
where \mathcal{W} is the wide subcategory of **quasi-isomorphisms**, i.e. chain maps which induce isomorphisms in homology.^{2} We may also talk of the **bounded** derived category \mathscr{D}^\mathrm{b}(\mathcal{A}), which is constructed in the same way, but under the requirement that all our chain complexes be bounded, i.e. non-zero in only finitely many degrees. Now we can apply this wonderful construction of zigzag localisation, thanks to some beautiful results relating the homotopy theory of chain complexes to the homology theory of chain complexes.

We haven’t yet defined what it means for a complex to be K-injective, so let’s do so now: it means that \operatorname{Hom}_{\mathscr{K}(\mathcal{A})}(S_\bullet,A_\bullet) is acyclic (i.e. has zero homology) whenever S_\bullet is acyclic. These things tend to turn up when talking about *unbounded* chain complexes.

(In case you’re wondering, you can find the above theorem as Proposition 1.4 or 1.5 in Spaltenstein, “Resolutions of unbounded complexes” (1988). The fact that I’m working with roofs instead of valleys (or “coroofs”) shouldn’t matter, since quasi-isomorphisms give both a left *and* right calculus of fractions on the “homotopy” category \mathscr{K}(\mathcal{A}).)

# 5 Some obvious similarities

Now, there are some surface-level (at least) similarities between these three stories that I’ve told: namely spans with “nice” left legs and “specific” right legs. Two things which I imagine would appear in an explanation for what relates everything would be model categories (or something similar but weaker) and proarrow equipments, but I don’t know the specific formal statement that I’m looking for. Here’s my attempt at giving a concrete question:

Of course, there’s always the possibility that the answer to my question is “it’s trivial”, but that would at least give me an answer!

Something that still appears completely mysterious to me is this “right adjoint” property turning up in the first two stories. Is this explained by some proarrow equipment machinery? Does it secretly also turn up somewhere in this story about the construction of the derived category (maybe the fact that the proper/extraordinary inverse image f^! only exists at the level of the derived category)?

I don’t know!

## Footnotes

People working with this construction often refer to spans as “roofs”, but I’ll try to refrain from doing this.↩︎

There is a nice result which tells us that the natural functor \mathscr{K}(\mathcal{A})\to\mathscr{D}(\mathcal{A}) is well defined, i.e. that every chain homotopy equivalence is also a quasi-isomorphism. This lets us equivalently construct the derived category as a localisation of the “homotopy” category \mathscr{K}(\mathcal{A}) as well. ↩︎