## November 15, 2019

### Doubles for Monoidal Categories

#### Posted by John Baez

guest post by Fosco Loregian and Bryce Clarke

This post belongs to the series of the Applied Category Theory Adjoint School 2019 posts. It is the result of the work of the group “Profunctor optics” led by Bartosz Milewski, and constitutes a theoretical preliminary to the real meat, i.e. the discussion of Riley’s paper Categories of Optics by Mario Roman and Emily Pillmore (hi guys! We did our best to open you the way!)

In the following post, we first introduce you to the language of co/ends. Then we deconstruct this paper by Pastro and Street:

Our goal is to make its main result (almost) straightforward: Tambara modules can be characterized as particular profunctors, precisely those that interact well with a monoidal action on their domain. For a fixed category $X$, these endoprofunctors form the Kleisli category of a monad on $Prof(X,X)$.

# Coend calculus

Coend calculus rules the behaviour of certain universal objects associated to functors of two variables $T : C^{op}\times C \to D$; intuitively, $end(T)$ stands to $T$ as the limit $\lim\, F$ of $F : A \to B$ stands to $F$; the major difference is that $end(T)$ takes into account the fact that $T$ eats at the same time two “terms” of the same “type” $C$, once covariantly in the second component, and once contravariantly in the first: on arrows $f : c\to c'$ the functor $T$ acts in fact as follows:

Now, a distinguising feature of the objects that depend contra-covariantly on the same variable is that they can be integrated: given a sufficiently regular function $f(x)$, its dependence from $x$ can be thought as “covariant” (and defined, say, on a topological vector space $V\cong \mathbf{R}^n$), whereas the “$d x$” in the symbol $\int f(x)d x$ is contravariant (it belongs to a certain dual space of covectors on $V$); altogether, the integral can be thought as exhibiting a contra-covariant dependence from $x$.

Ends and coends are associated to functors $T : C^{op}\times C \to D$ in a similar fashion that resembles integration: they are certain objects $\int_c T(c,c)$ (the end) and $\int^c T(c,c)$ (the coend), canonically associated to $T$, treating $c$ as a mute variable (meaning that $\int_c T(c,c)$ and $\int_{c'} T(c',c')$ are the same object), and satisfying a “commutative rule of integrals” analogous to $\int f(x,y) d x d y = \int \Big(\int f(x,y)d x\Big) d y = \int \Big(\int f(x,y)d y\Big) d x$ The end of $T$ is endowed with projections on the “symmetrized components” $\int_c T(c,c) \to T(c',c')$, one for each object $c'$; dually, the coend $\int^c T(c,c)$ is endowed with injections $T(c',c') \to \int^c T(c,c)$.

All in all, this happens also for colimits, so the two constructions are -at least intuitively- tightly related: this intuition can of course be made more precise. Every universal object built in category theory can be thought either as a subobject of a product (a limit), or as a quotient of a coproduct (a colimit), and co/ends make no exception:

• An end arises as an “object of invariants” $\int_c T$ for the action of $T$ given by the functions on arrows $T_{x y} : \hom_{C^{op}\times C}(x,y) \to \hom_D(T x, T y)$, and it is defined as the subobject of $\prod_{c\in C} T(c,c)$ of those elements invariant under this action.
• Dually, a coend arises as a “quotient space” of $\coprod_{c\in C}T(c,c)$ by a suitable equivalence relation generated by the same functions $T_{x y} : \hom_{C^{op}\times C}(x,y) \to \hom_D(T x, T y)$, i.e. as a space of orbits for the action.

More on this will be explained later on in the discussion.

What is more important now, and quite astounding, is that such contra-covariant actions arise at every corner of category theory: using co/ends it is possible to re-state the Yoneda lemma and the theory of Kan extensions, and to find plenty of applications to algebra, topology, geometry… and functional programming. :-)

## Dinaturality

As already said, a functor $T : C^{op}\times C \to D$ acts on morphisms as

given two such functors, say $P,Q : C^{op}\times C \to D$, we can consider the two diagrams

and

Given two functors $F,G : A \to B$ a natural transformation can be seen as a family of maps that “fill the gap” between $F(f)$ and $G(f)$ in a commutative square; in a similar fashion, a dinatural transformation between the above $P,Q$ can be seen as a way to close a certain diagram that testifies a transformation from the arrow action of $P$ to the arrow action of $Q$:

Just as co/limits are defined via suitable transformation to/from a constant, so are co/ends:

• If $Q : C^{op}\times C \to D$, a wedge for $Q$ with base $x$ consists of a dinatural transformation from the constant functor on $x\in D$, i.e. of a family of morphisms $\alpha_c : x\to Q(c,c)$ such that for each $f :c\to c'$ the above hexagon reduces to a commutative square:

• If $P : C^{op}\times C \to D$, a cowedge for $P$ with tip $y$ consists of a dinatural transformation to the constant functor on $y\in D$, i.e. of a family of morphisms $\alpha_c : P(c,c) \to y$ such that for each $f :c\to c'$ the above hexagon reduces to a commutative square:

There exists a category $Wd(Q)$ of wedges, defined with an obvious choice of morphisms between bases; similarly, there is a category of cowedges $Cwd(P)$.

The end $\int_c Q(c,c)$ of $Q$ is now defined as a terminal object in the category of its wedges; dually, the coend $\int^c P(c,c)$ of $P$ is the initial object of the category of its cowedges. Of course, we say “the” end because such an initial object is unique up to unique isomorphism when it exists.

So far, so good. In fact, we didn’t stray much far from plain old category theory, as it is possible to show the following:

Lemma (co/ends are colimits): Given $Q : C^{op}\times C \to D$ there exist a category $\text{tw}\, C$ and a functor $Q^\tau : \text{tw}\, C \to D$ such that $\int_c Q(c,c) \cong \lim \,Q^\tau$ For those who know: the end of $Q$ is the weighted colimit of $Q : C^{op}\times C \to D$ with the $\hom_C$ functor $C^{op}\times C \to Set$, and thus the category $\text{tw}\, C$ is nothing more, nothing less than the category of elements of $\hom_C$; this allows for a very explicit presentation of $\text{tw}\, C$:

• objects: the arrows of $C$, $f : c \to c'$;
• morphisms: the commutative squares

Corollary (hom commutes with all ends): As a consequence of the fact that $\int_c Q$ is a limit, there is an isomorphism $\hom_C\Big(y, \int_c P(c,c)\Big) \cong \int_c \hom_C(y, P(c,c))$ natural in $y$. Dually, $\hom_C\Big( \int^c P(c,c), y \Big )\cong \int_c \hom_C(P(c,c), y).$ natural in $y$.

(of course, a coend is just an end in the opposite category!)

But why are co/ends denoted as integrals? The notation dates back to Yoneda,

Yoneda, Nobuo. “On Ext and exact sequences.” J. Fac. Sci. Univ. Tokyo Sect. I 8.507-576 (1960): 1960.

(in particular, see Â§4 but beware that the notation is reversed; a coend is called an integration and denoted $\int_a$ and an end $\int_a^\ast$ is called a cointegration!); all the discussion and terminology is essentially motivated by the fact that an end behaves like an integral:

Theorem (Fubini rule): Let $P : C^{op}\times C \times D^{op}\times D \to E$ be a functor; then $\int^c\left(\int^d P(c,c,d,d)\right) \cong \int^{(c,d)}P(c,d,c,d) \cong \int^d\left(\int^c P(c,c,d,d)\right) \qquad\qquad{(Fub)}$ in the sense that if one of the three objects exists, so do the other two, and they are all canonically isomorphic (the category $C^{op}\times C \times D^\text{op}\times D$ is of course equal to $(C\times D)^\text{op}\times( C \times D)$). Similarly, there is such a rule for ends.

Thus, in category theory integration is “as commutative as it can be”; it can happen in whatever order we desire: given a permutation $\sigma$ of the set $\{1,\dots,n\}$, whenever $P$ is a functor of $2n$ variables of the form $c_1, c_1'; c_2, c_2',\dots c_n, c_n'$, and the integral $\int^{c_{\sigma 1}}\int^{c_{\sigma 2}}\cdots \int^{c_{\sigma n}} P(c_{\sigma 1}, c_{\sigma 1}, c_{\sigma 2}, c_{\sigma 2}, \dots, c_{\sigma n}, c_{\sigma n})$ exists, then so does $\int^{(c_1,\dots, c_n)} P(c_1, c_1, c_2, c_2, \dots, c_n, c_n)$ Proof. Sending a functor $P : C^{op}\times C \to D$ to its coend is a functor $\int^C : [C^{op}\times C, D] \to D$, and it is easy to see that it is a left adjoint (for those who know, $\int^C$ is a particular kind of weighted colimit, and every such weighted colimit admits a right adjoint expressed in terms of the weight): now it’s easy to prove that these right adjoints $R_C, R_D, R_{C,D}$ commute, i.e. $R_C\circ R_D \cong R_D \circ R_C \cong R_{C,D}$ thus yielding the Fubini rule by uniqueness of adjoints.

## The building blocks of co/end calculus

Here we explore how co/ends allow to rediscover category theory from scratch.

### Natural transformations

Theorem (Natural transformations as an end) Let $F,G : C \to D$ be two functors; then, there is an isomorphism $Nat(F,G) \cong \int_c \hom_D(F c,G c) \qquad\qquad{(nat)}$ Proof. There is a natural choice for a wedge $\omega : Nat(F,G) \to \hom(F c,G c)$, that sends a natural transformation to its $c$-component; it remains to show that this is indeed a terminal wedge. Given another wedge $\alpha : A \to \hom(F c, G c)$, the wedge condition translates into the equation

valid for every $a\in A$; but this is only a convoluted way to say that for every $a\in A$ the family $\{\alpha_{a,c} : F c \to G c\}$ is a natural transformation.

Two important remarks:

1. In an additive setting, the wedge condition for $\alpha$ can be easily translated into the fact that natural transformations appear form the kernel of a certain map; the intuition that naturality is a cocycle condition is more or less what led Yoneda to study ends and coends in homological algebra.

2. Even in a non-additive setting, one can easily see that a natural transformation $\alpha : F \Rightarrow G$ is a map that equalizes the action of $F,G$ on arrows; this means that the following diagram $Nat(F,G) \to \prod_{c\in C} \hom(F c, G c) \underset{G f_\ast}{\overset{F f^\ast}\rightrightarrows} \prod_{c\to c'} \hom(F c, G c')$ is an equalizer; there is nothing special here, as for every functor $T : C^{op}\times C \to D$ there is a similar equalizer diagram $\int_c T(c,c) \to \prod_{c\in C} T(c,c) \underset{T f_\ast}{\overset{T f^\ast}\rightrightarrows} \prod_{c\to c'} T(c, c')$

Here’s a discussion on what is the coend of the hom functor; I claim that the following object represents the coend of $\hom(F-,G-)$, perhaps you know where the same object appears under a different name, and where it is used for some purpose? I find this particularly intriguing in the case of a monoid $M$ regarded as single-object category:

• the end of $\hom_M$ is the center of the monoid, i.e. the subset $\{m\in M\mid mx=xm \forall x\in M\}$;
• the coend of $\hom_M$ corresponds to something like the $\pi_0$ of the monoid.

I didn’t expect these construction to be dual, and yet they are!

Claim (but also: exercise for the reader). Let $C$ be a small category. The coend $\int^c \hom_C(c,c)$ is the set of connected components of the “endo-comma” category whose objects are endomorphisms of $C$, and whose morphisms $(u : x \to x) \to (v : y \to y)$ are the $f : x \to y$ such that $f u = v f$. More generally, if $F,G: C \to D$ are functors there is an isomorphism $\int^c \hom(F c, G c) \cong \pi_0((F/G)_{end})$ where the endomorphism comma is defined similarly.

Compare this example with the following: let $A$ be an associative algebra, and let us consider it as a category with a single object; then the co/end of its hom functor correspond to the 0-th Hochschild co/homology of $A$! People in algebraic geometry, especially the Russian school of DG-categories love this kind of results!

It would be awesome to recover higher homotopy and co/homology of geometric objects as coends: any ideas?

### The Yoneda lemma and Kan extensions

On the first day He created the Yoneda lemma, and He saw that it was good:

Theorem (The ninja Yoneda lemma) Let $F : C^{op} \to Set$; then for every object $a\in C$, $F a\cong \int^c F c \times \hom_C(a,c) \cong \int_c Set(\hom_C(c,a), F c)$ Proof. The set $\int_c Set(\hom_C(c,a), F c)$ is the set of natural transformations from $\hom(-,c)$ to $F$, and thus the non-ninja Yoneda lemma yields an isomorphism between this set and $F a$. Dually, call $F\otimes y$ the functor $a\mapsto \int^x F x\times \hom_C(a,x)$ Then, we have $\begin{array}{rl} Nat(F\otimes y, G) &\cong\displaystyle \int_a Set(F x\times \hom_C(a,x), G a)\\ &\displaystyle\cong\int_a\int_x Set(F x\times \hom_C(a,x), G a)\\ &\displaystyle\cong\int_a\int_x Set(F x, [\hom_C(a,x), G a])\\ &\displaystyle\cong\int_x Set(F x, \int_a[\hom_C(a,x), G a])\\ &\displaystyle\cong\int_x Set(F x, Nat(y(x), G))\\ &\displaystyle\cong Nat(F, G) \end{array}$ Each of these steps can be easily justified in light of what we already proved:

• the fact that the hom functor preserves ends;
• the Fubini rule for ends;
• the fact that the set of natural transformations between two functors is an end.

This natural deduction-style kind of proof is half-jokingly called “coend-fu” in my note, soon-ish a book, on coends.

Incidentally, the isomorphism $F a\cong \int^c F c \times \hom_C(a,c)$ is precisely the sense in which “every presheaf is a colimit of representable functors”; the colimiting diagram has domain the category of elements of $F$, and the natural functor $\Sigma : El(F) \to C \to [C^{op},Set]$ has colimit $F$.

On the second day, He created Kan extensions, and category theory was complete.

Theorem (Kan extensions are co/ends) Let $A \xleftarrow{G} B\xrightarrow{F} C$ be a span of functors; if the coend $\int^b \hom_A(G b, a) \times F b$ exists, then it is the value at $a$ of the left Kan extension of $F$ along $G$; dually, is the end $\int_b F b ^ {\hom_A(a, G b)}$ exists, then it is the value at $a$ of the right Kan extension of $F$ along $G$.

Proof. The proof is another lengthy, but completely straightforward, kata using the coend-fu we already know: $\begin{array}{rl} Nat(\text{Lan}_G F, H) &\textstyle \cong\displaystyle \int_a \hom(\text{Lan}_G F( a ), H a ) \\ & \textstyle \cong\displaystyle \int_a \hom\Big( \int^c \hom(G c, a )\times F c, H a \Big) \\ Fub & \textstyle \cong\displaystyle \int_{ a c} \hom\Big( \hom(G c, a )\times F c, H a \Big) \\ & \textstyle \cong\displaystyle \int_{ a c} \hom\Big( F c,[\hom(G c, a ), H a ] \Big) \\ ccnt & \textstyle \cong\displaystyle \int_c \hom\Big( F c,\int_a [\hom(G c, a ), H a ] \Big) \\ nat & \textstyle \cong\displaystyle \int_c \hom\Big( F c,Nat(\hom(G c,-), H) \Big) \\ nat & \textstyle \cong\displaystyle \int_c \hom\Big( F C,H G C \Big) = Nat(F, H G) \\ \end{array}$

# Bimodules

The paper that we want to discuss today makes heavy use of the theory of bimodules. Let’s dig deeper into their structure. First of all, let us define a bicategory as follows:

• objects are (unitary) rings $R,S,\dots$
• 1-cells $M : R \to S$ are modules ${}_S M_R$, left over $R$ and right over $S$.
• 2-cells $\varphi : {}_R M_S \to {}_R N_S$ are $R$-$S$-linear homomorphisms of modules.

The composition of 1-cells is the tensor product of modules:

• ${}_R M \otimes_S N_T$ is a $R$-$T$-bimodule for every $R$-$S$bimodule $M$ and every $S$-$T$-bimodule $N$ (so in particular this is not a strict 2-category);
• 2-cells are composed horizontally and vertically, using the obvious function composition, and bifunctoriality of the $\otimes$ operation.

So far so good! There is a 2-categorical characterization of modules.

What is it good for? Well: rings are monoids in the category of abelian groups. We could have done the very same thing taking (plain) monoids, i.e. monoids in the category of sets, and defining a category of “bimodules” as sets with a left action of some monoid, and a right action of some other monoid.

But we can also generalize the same construction, with no additional cognitive loading, and take $X,Y,Z\dots$ to be multi-object monoids (i.e. categories): we define a bicategory $Mod$ as follows:

• objects are categories $C,D, E,\dots$
• 1-cells $P : C \mathrel{⇸} D$ are functors $P : D^{op}\times C \to Set$
• 2-cells are natural transformations between functors.

A functor $P : D^{op}\times C \to Set$ is a multiobject module on which the multiobject monoids $C,D$ act.

So categories really are monoids, and are also eager to act on sets.

A bimodule is also called a profunctor, a distributor, a correspondence, a span,… and possibly with many other names; each name comes from a certain intuition behind their nature that leads to the definition of the same bicategory:

• they are called profunctors because they generalize functors: some profunctors are called representable, and they are the ones of the form $\hom(b, F a)$ for some functor $F : A \to B$ between categories. A pro-functor thus works “on behalf of a functor”, as well as a relation generalizes a function.
• …which is why some people prefer to call them relators: just as a func-tion is a special kind of rela-tion, a func-tor is a special kind of rela-tor.
• they are called distributors: as the nLab says,

Jean Bénabou, who invented the term and originally used “profunctor”, now prefers “distributor”, which is supposed to carry the intuition that a distributor generalizes a functor in a similar way to how a distribution generalizes a function.

There’s in fact a beautiful story about this: Lawvere defined a notion of distribution between toposes, such that the points of a topos $p : Set \to \mathcal{E}$ behave like Dirac delta functions, and such that distributions between presheaf toposes are exactly profunctors.

• they are called correspondences or spans because of the Grothendieck construction: every presheaf $P : D^{op}\times C \to Set$ has a category of elements $El(P)$ that in this case is a discrete fibration over $D^{op}\times C$, and composing with the projections, this is a span $D^{op} \leftarrow El(P) \to C$.

Well… until now we cheated a bit. In order to get a bicategory we need to define a composition law for 1-cells and show that it is bifunctorial, and I didn’t tell you how to do it: but it turns out it is really easy, if you know coend-fu! Indeed, the intuition of a bimodule as a “matrix indexed by its domain” and the rule to compose two relations guide us to find an expression to meaningfully compose $Q : A \mathrel{⇸} B, P : B \mathrel{⇸} C$. We can define $(P \diamond Q) (a,c) = \int^b P(a,b)\times Q(b,c)$ This boils down, on discrete domains $A,B\in Set$ to a “matrix product of sets” like $(P \diamond Q)_{a c} = \sum_{b\in B} P_{a b}\times Q_{b c}$ There is also a connection between the ways in which profunctors compose, and the way in which relations do. Indeed, look how the two concepts closely resemble each other: $\begin{array}{cccccc} (x,z)\in S\circ R & \iff & \exists y\in Y & \big((x,y)\in R\big) & \wedge & \big((y,z)\in S\big) \\ (P\diamond Q)(x,z) & = & \int^y & Q(x,y) & \times & P(y,z) \\ \end{array}$ A final list of remarks, to address the many questions you might have at this point:

• Yes! The dictionary between relations and profunctors can be extended very far: try to check when a relation is a function; how does this condition translates into the one telling when a profunctor is a functor?
• Yes, you can make the dictionary a precise theorem by saying that sets are discrete categories, or even more precisely categories enriched over truth values, and that relations are precisely the $\{0,1\}$-enriched version of profunctors, as they are functions $A\times B \to \{0,1\}$!

# Doubles for monoidal categories

One of the key results of the paper Doubles for Monoidal Categories is the canonical equivalence of categories:

$\mathbf{Tamb}(\mathcal{C}) \simeq [\mathbf{Doub}(\mathcal{C}), \mathbf{Set}]$

This theorem has since been labelled by some as the “fundamental theorem of optics”, as it provides the link between the category of Tambara modules $\mathbf{Tamb}(\mathcal{C})$ and the double $\mathbf{Doub}(\mathcal{C})$ of the monoidal category $\mathcal{C}$, now also known as the category of optics. To unpack this theorem, we first begin with the definition of a Tambara module.

### Tambara modules

The category of (bi)modules $\mathbf{Mod}$ forms a bicategory, however when we choose a particular category $\mathcal{C}$ we may instead consider the monoidal category $\mathbf{Mod}(\mathcal{C})$ whose:

• objects are endomodules $P \colon \mathcal{C}^{op} \times \mathcal{C} \rightarrow \mathbf{Set}$;
• morphisms are natural transformations;
• monoidal product is module composition: $(P \diamond Q) (X,Y) = \int^Z P(X,Y)\times Q(Y,Z)$ One may ask the question: what if $\mathcal{C}$ has the structure of a monoidal category?

Definition: Let $\mathcal{C}$ be a monoidal category. A (left) Tambara module on $\mathcal{C}$ is a pair $(P, \tau)$ consisting of:

• a profunctor $P \colon \mathcal{C}^{op} \times \mathcal{C} \rightarrow \mathbf{Set}$;
• a family of functions $\tau_{A}(X,Y) \colon P(X, Y) \rightarrow P(A \otimes X, A \otimes Y)$ called the Tambara structure maps, which are natural in $X, Y$ and dinatural in $A$, satisfying the equations:

The idea is that the structure maps tell you how the profunctor changes under the monoidal action. For example, if we consider the hom-profunctor on the monoidal category $(\mathbf{Set}, 1, \times)$, then the Tambara structure would tell you to take a function $f \colon X \rightarrow Y$ in $\mathbf{Set}(X, Y)$ to $1_{A} \times f \colon A \times X \rightarrow A \times Y$ in $\mathbf{Set}(A \times X, A \times Y)$ for any set $A$.

Tambara modules form the objects of a category $\mathbf{Tamb}(\mathcal{C})$, whose morphisms $\gamma \colon (P, \tau) \rightarrow (Q, \sigma)$ are natural transformations $\gamma \colon P \Rightarrow Q$ such that $\gamma \circ \tau = \sigma \circ \gamma$. There is functor to the category of endomodules on $\mathcal{C}$, $\iota \colon \mathbf{Tamb}(\mathcal{C}) \longrightarrow \mathbf{Mod}(\mathcal{C})$ which forgets the Tambara structure (this functor is actually strong monoidal, but that won’t be important for what follows).

### An adjoint triple for Tambara modules

The forgetful functor $\iota : \mathbf{Tamb}(\mathcal{C}) \longrightarrow \mathbf{Mod}(\mathcal{C})$ forms part of an adjoint triple:

This adjoint triple captures almost everything you need to know about Tambara modules in order to derive the category $\mathbf{Doub}(\mathcal{C})$. For the following, let $\mathcal{C}$ be a monoidal category and $P \colon \mathcal{C}^{op} \times \mathcal{C} \rightarrow \mathbf{Set}$ be an endomodule.

The right adjoint $\theta \colon \mathbf{Mod}(\mathcal{C}) \rightarrow \mathbf{Tamb}(\mathcal{C})$ outputs the cofree Tambara module consisting of:

• a profunctor $\theta_{P} \colon \mathcal{C}^{op} \times \mathcal{C} \rightarrow \mathbf{Set}$ whose action on objects is given by the end: $\theta_{P} (X, Y) = \int_{C} P(C \otimes X, C \otimes Y)$
• Tambara structure maps $\theta_{P}(X, Y) \rightarrow \theta_{P}(A \otimes X, A \otimes Y)$ which are induced by the projection functions, $\pr_{C \otimes A} \colon \int_{C} P(C \otimes X, C \otimes Y) \rightarrow P(C \otimes A \otimes X, C \otimes A \otimes Y)$ $\pr_{C} \colon \int_{C} P(C \otimes A \otimes X, C \otimes A \otimes Y) \rightarrow P(C \otimes A \otimes X, C \otimes A \otimes Y)$ using the universal property of the end.

The left adjoint $\phi \colon \mathbf{Mod}(\mathcal{C}) \rightarrow \mathbf{Tamb}(\mathcal{C})$ outputs the free Tambara module consisting of:

• $\phi_{P} \colon \C^{\op} \times \C \rightarrow Set$ has action on objects given by the coend: $\phi_{P}(X, Y) = \int^{C, U, V} \C(X, C \otimes U) \times \C(C \otimes V, Y) \times P(U, V)$
• Tambara structure maps $\phi_{P}(X, Y) \rightarrow \phi_{P}(A \otimes X, A \otimes Y)$ which are induced, using the universal property of the coend, by the function (via functorality of the hom-functor),

composed with the coprojection $\copr_{A \otimes C, U, V}$ into $\phi_{P}(A \otimes X, A \otimes Y)$.

The adjunction $\iota \dashv \theta$ yields a comonad denoted $\Theta \colon \mathbf{\Mod}(\mathcal{C}) \rightarrow \mathbf{\Mod}(\mathcal{C})$ and the adjunction $\phi \dashv \iota$ yields a monad denoted $\Phi \colon \mathbf{\Mod}(\mathcal{C}) \rightarrow \mathbf{\Mod}(\mathcal{C})$.

Proposition: The category of Tambara modules $\mathbf{Tamb}(\mathcal{C})$ is isomorphic to the category of coalgebras for $\Theta$ and the category of algebras for the monad $\Phi$.

The proof is a nice exercise in the universal property for (co)ends. For example, a coalgebra for the comonad $\Theta$ consists of:

• An object of $\mathbf{Mod}(\mathcal{C})$ given by $P \colon \mathcal{C}^{op} \times \mathcal{C} \rightarrow \mathbf{Set}$.
• A struture map given by a morphism $\tau \colon P \Rightarrow \theta_{P}$ in $\mathbf{Mod}(\mathcal{C})$ whose components $\tau(X, Y) \colon P(X, Y) \rightarrow \theta_{P}(X, Y)$ are given by: $\tau(X, Y) \colon P(X, Y) \longrightarrow \int_{A} P(A \otimes X, A \otimes Y)$ However using the universal property of the end, the structure map is determined exactly by a family of morphisms dinatural in $A$: $\tau_{A}(X, Y) \colon P(X, Y) \longrightarrow P(A \otimes X, A \otimes Y)$ Therefore the data for a $\Theta$-coalgebra corresponds to a Tambara module $(P, \tau)$.

### The double of a monoidal category

The adjoint triple $\phi \dashv \iota \dashv \theta$ induces an adjunction,

between the resulting monad $\Phi$ and comonad $\Theta$. A basic result in category theory states that any left adjoint functor between categories of presheaves is equivalent to a profunctor. Therefore recalling that $\mathbf{Mod}(\mathcal{C}) = [\mathcal{C}^{op} \times \mathcal{C}, \mathbf{Set}]$ by definition, the left adjoint $\Phi$ above is equivalent to an endomodule $\check{\Phi} \colon (\mathcal{C} \times \mathcal{C}^{op})^{op} \times (\mathcal{C}^{op} \times \mathcal{C}) \rightarrow \mathbf{Set}$ whose action on objects is given by the coend: $\check{\Phi}(X, Y, U, V) = \int^{C} \mathcal{C}(X, C \otimes U) \times \mathcal{C}(C \otimes V, Y)$ This endomodule actually underlies a monad in the bicategory $\mathbf{Mod}$ of modules (also known as a promonad). Furthermore it is known that the bicategory $\mathbf{Mod}$ admits the Kleisli construction for promonads.

Definition: The double $\mathbf{Doub}(\mathcal{C})$ of a monoidal category $\mathcal{C}$ is the Kleisli category for the promonad $\check{\Phi}$ on $\mathcal{C}^{op} \times \mathcal{C}$.

The category $\mathbf{Doub}(\mathcal{C})$ has the same objects as $\mathcal{C}^{op} \times \mathcal{C}$ and hom-sets given by the previous coend: $\mathbf{Doub}(\mathcal{C})((X, Y), (U, V)) = \int^{C} \C(X, C \otimes U) \times \C(C \otimes V, Y)$ While this may seem like a fairly abstract definition, it has concrete applications in describing a variety of optics used in functional programming. Taking the example $\mathcal{C} = (\mathbf{Set}, 1, \times)$ again, we see that a morphism in $\mathbf{Doub}(\mathcal{C})$ from $(S, T)$ to $(A, B)$ is an element of the set: $\int^{C} \mathbf{Set}(S, C \times A) \times \mathbf{Set}(C \times B, T) = \int^{C} \mathbf{Set}(S, C) \times \mathbf{Set}(S, A) \times \mathbf{Set}(C \times B, T) = \mathbf{Set}(S, A) \times \mathbf{Set}(S \times B, T)$ That is, a morphism $(S, T) \nrightarrow (A, B)$ is a pair of functions $S \rightarrow A$ and $S \times B \rightarrow T$, which is exactly the data for the optic known as a lens.

We are now ready to state the central theorem of the paper.

Theorem: There is an equivalence of categories: $\mathbf{Tamb}(\mathcal{C}) \simeq [\mathbf{Doub}(\mathcal{C}), \mathbf{Set}]$ While the proof is outside the scope of this post, we note it essentially follows from universal property of the Kleisli category for a promonad.

Posted at November 15, 2019 4:59 PM UTC

TrackBack URL for this Entry:   https://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/3154

### Re: Doubles for Monoidal Categories

Thanks for the post. I’m just trying to match up your explicit description of the hom-sets $\mathbf{Doub}(\mathcal{C})((X,Y),(U,V))$ with the one in Pastro-Street (top of Sec 6). It’s different. Is something back-to-front? and is it supposed to be what they call $\mathcal{D}_l$?

Posted by: Sam Staton on November 15, 2019 9:20 PM | Permalink | Reply to this

### Re: Doubles for Monoidal Categories

As far as I understand, it seems to be $\mathbf{Doub}(\mathcal{C}) = \mathcal{D}_l^{op}$. The left-right difference should not be very important because the plan is to generalize from monoidal products to arbitrary monoidal actions anyway. I think the choice of $\mathcal{D}_l^{op}$ over $\mathcal{D}_l$ is due to the fact that the definitions in the post are swapping the $(U,V)$ with the $(X,Y)$ of the original definitions.

Posted by: Mario Román on November 19, 2019 8:13 AM | Permalink | Reply to this

### Re: Doubles for Monoidal Categories

(First line of the ninja Yoneda proof: a $\int^x$ is missing. Last line of Kan proof: $C$ should be $c$.)

Posted by: Nasos Evangelou-Oost on November 15, 2020 4:04 AM | Permalink | Reply to this

Post a New Comment