# bivariate Yoneda lemma

$$\newcommand{\Hom}{\operatorname{Hom}}$$Any category is equipped with a covariant hom-functor $$\Hom(A,-)$$, by letting the second argument vary. The covariant Yoneda lemma says $$\operatorname{Nat}(\Hom(A,-),F)\cong F(A)$$ for any covariant functor $$F$$.

Alternatively any category is equipped with a contravariant hom-functor, by instead letting the first argument vary. Then for contravariant functors $$F\colon C^\mathrm{op}\to \operatorname{Set},$$ we have the contravariant Yoneda lemma $$\operatorname{Nat}(\Hom(-,X),F)\cong F(X).$$

Instead of choosing one or the other argument to vary, we may let both vary. Giving the hom functor as a bivariate functor $$\operatorname{Hom}(-,-)\colon C^\mathrm{op}\times C\to \operatorname{Set}$$. Is there a Yoneda lemma for this functor as well?

Show that $\mathsf{Nat}(\mathsf{Hom}(-_1,X)\times\mathsf{Hom}(A,-_2),P)\cong P(A,X)$ where $P:\mathcal C^{op}\times\mathcal C\to\mathbf{Set}$. You can prove this by currying and applying each variation of the Yoneda lemma. Or, you can realize that the two variants of the Yoneda lemma are the same statement, and the above is also just a special case of the Yoneda lemma.

• Should I infer from your answer that there's no Yoneda lemma for $\sf{Hom}(-,-),$ but instead only for $\sf{Hom}(-,X)\times \sf{Hom}(A,-)$? Feb 25, 2018 at 21:45
• There is a result in the theory of (co)ends or weighted (co)limits that states that $\mathsf{Nat}(\mathsf{Hom},P)\cong\int_{C:\mathcal C}P(C^-,C^+)$, or, using Kelly's notation for the weighted limit, $\{\mathsf{Hom},P\}\cong\int_{C:\mathcal C}P(C^-,C^+)$. Using this notation, the Yoneda lemma is $\{\mathsf{Hom}(-,X),F\}\cong F(X)$ because for $\mathbf{Set}$-valued functors $F$ and $G$, $\mathsf{Nat}(F,G)\cong\{F,G\}$. (This also generalizes to the enriched context.) Feb 25, 2018 at 22:09
• Was that link meant to go to page 58 of the document? The anchor did not work, but anyway I do not see any statement of Yoneda lemma, bivariant or otherwise, on page 58 of the linked document. Are you now saying that $\{\mathsf{Hom},P\}=\int P(C^-,C^+)$ is a statement of the Yoneda lemma for the bivariant hom-functor? What do $C^-$ and $C^+$ denote? Feb 25, 2018 at 23:09
• Yes, it was meant to go to page 58. $C^-$ and $C^+$ indicate the contravariant and covariant occurrences of $C$ in the end. I'm saying what $\mathsf{Nat}(\mathsf{Hom},P)$ gives you is that end which (in $\mathbf{Set}$) is a particular limit (assuming $\mathcal C$ is small). This is not usually referred to as a variation on the Yoneda lemma. As stated in my answer, there is no need for a special Yoneda lemma for profunctors. A functor $\mathcal C^{op}\times\mathcal C\to\mathbf{Set}$ is a functor $\mathcal D\to\mathbf{Set}$ just with $\mathcal D=\mathcal C^{op}\times\mathcal C$. Feb 26, 2018 at 0:27
• Either you want to know what $\mathsf{Nat}(\mathsf{Hom},P)$ is and perhaps specifically if it is naturally isomorphic to $P$ which is addressed in my comment (and it's not naturally isomorphic to $P$), or if there's a Yoneda-like statement for $P(A,X)$ which is addressed in the answer, or if there is some other result called "the Yoneda lemma" that's particular to the $\mathsf{Hom}$ profunctor which there isn't to my knowledge, or it's unclear what you are asking. Feb 26, 2018 at 0:27

Indeed, applying e.g. the covariant Yoneda lemma $$\left[\,{\rm Nat}(\hom_{\mathcal C}(C,-),\,F)\,\simeq\,F(C)\right.$$ for $$\left. F:\mathcal C\to\mathcal Set\,\right]$$ with $$\mathcal C=\mathcal A^{op}\times\mathcal B$$ and an arbitrary profunctor $$F:\mathcal A^{op}\times\mathcal B\to\mathcal Set$$ will produce $${\rm Nat}(\hom_{\mathcal A^{op}\times\mathcal B}((A,B),\,-),\,F)\,\simeq\,F(A,B)$$ where $$\hom_{\mathcal A^{op}\times\mathcal B}((A,B),\, (X,Y))=\hom_{\mathcal A}(X,A)\times\hom_{\mathcal B}(B,Y)$$.

Let $$H_{A,B}$$ denote this profunctor $$H_{A,B}(X,Y)=\hom_{\mathcal A}(X,A)\times\hom_{\mathcal B}(B,Y)$$.
Observe that this is basically the same as considering the disjoint union $$\mathcal A+\mathcal B$$ and freely joining an arrow $$h_{A,B}:A\to B$$:
the set of arrows $$X\to Y$$ arising this way, for $$X\in Ob\,\mathcal A,\ Y\in Ob\,\mathcal B$$, consists exactly of formal compositions $$\beta\circ h_{A,B}\circ\alpha$$ for arbitrary $$\alpha:X\to A$$ and $$\beta:B\to Y$$.
(In the above setting, we have $$h_{A,B}=(1_A,1_B)\in H_{A,B}(A,B)$$.)

We can also view any profunctor $$F:\mathcal A^{op}\times\mathcal B\to\mathcal Set$$ as a category containing $$\mathcal A+\mathcal B$$ by considering $$F(A,B)$$ as the set of (hetero-)morphisms 'from $$A$$ to $$B$$'. Compositions are given by the action of $$F$$ on morphisms.
Also, natural transformations $$F\to G$$ simply correspond to functors that are identical on $$\mathcal A+\mathcal B$$.

From this perspective, it's clear that $${\rm Nat}(H_{A,B},\,F)\cong F(A,B)$$, since any morphism of profunctors $$\Phi:H_{A,B}\to F$$ is indeed uniquely determined by its image on the freely joined arrow $$h_{A,B}$$ which can be any arrow $$A\to B$$ in $$F$$, i.e. any element of $$F(A,B)$$.

It's easy to see that both the covariant and the contravariant Yoneda lemmas are consequences of this instance, by letting either $$\mathcal A$$ or $$\mathcal B$$ be the trivial, one element category.

To answer your original question, the bivariate hom functor has less to do with Yoneda, nevertheless we can have a similar statement:

For any 'endoprofunctor' $$F:\mathcal A^{op}\times\mathcal A\to\mathcal Set$$, we have $${\rm Nat}(\hom_{\mathcal A}(-,-),\,F)\,\simeq\,{\rm Nat}(I_1,I_2)\,\simeq\,\int_{\mathcal A}F$$ where $$I_1,I_2:\mathcal A\to\mathcal F$$ are the two embeddings of $$\mathcal A$$ into the category $$\mathcal F$$ constructed as above from $$F$$, and the integral denotes the end of $$F$$.
For the correspondence, observe that any natural transformation $$\Phi:\hom_{\mathcal A}(-,-)\to F$$ is determined by the images $$t_A:=\Phi_{A,A}(1_A)\in F(A,A)$$ of $$1_A\in\hom_{\mathcal A}(A,A)$$, and these elements $$t_A$$ need to satisfy a commutativity condition for each arrow $$\alpha:A\to A'$$.

• Apparently the profunctor version was called the "diagonal Yoneda lemma" as early as MacLane, S. (1965). Categorical algebra. Bulletin of the American Mathematical Society, 71(1), 40-106. Jan 22, 2021 at 22:02
• Good note, I was not aware of it. Thank you. Jan 22, 2021 at 22:04
• @Colin: Very nice! For others also interested in following it up: the cited Mac Lane paper is here, and the “diagonal Yoneda lemma” is Lemma 7.5. Mar 9, 2023 at 17:01
• It's not clear (to me) what is meant by "the two embeddings of A into the category $F$ constructed as above from F". In the above, is the category F equal to Set, or to A + B? If the latter, is this comment referring to the two "coproduct injections" A -> A + A, where A + A =: F? Apr 19 at 18:21
• @hasManyStupidQuestions: The category F constructed by F is not equal to the disjoint union A+B, but contains it, and also contains additional ('hetero'-)morphisms, regarding F(a,b) as the hom-set in F, compositions are given by functoriality of F. About the other question, I think it's rather called the 'co-Yoneda lemma'. May 8 at 14:18