Given categories and objects , we let denote the category where we freely add an arrow to the disjoint union of and .
This can be achieved e.g. by taking the colimit of the following -shaped diagram:
where is the terminal category and contains two objects, denoted by and , and a single nonidentity arrow , whose image in the colimit will be the freely adjoined arrow .
Alternatively, we can consider the profunctor induced by the span (which is just the profunctor composition ).
It’s straightforward to check that .
Based on the construction, for any profunctor , the profunctor morphisms (functors that are identical on both and ) are uniquely determined by where they take the freely added arrow , and that can be any heteromorphism in .
Theorem. (Yoneda lemma for profunctors.) For any profunctor and objects we have a bijection
natural in both and .
It’s also straightforward to verify that, for profunctors , a functor that acts as the identity on both and , naturally corresponds to a natural transformation where are the hom functors of restricted to heteromorphisms (i.e. ), and vice-versa.
This way, involving our previous observation about , we can reformulate the above theorem as, for any functor we have
naturally in .
That clearly implies both the covariant and the contravariant versions of the original Yoneda lemma when applying it either with or with .
Presheaves as simple extensions
A presheaf on a category is a functor , so using we can even consider it as a profunctor , which can be viewed as a left -module, or… as a simple right extension of by a single object (the object of ).
Similarly, a presheaf on the opposite category can be though of as a right -module, or as a simple left extension.
Definition. A category with object is a simple right extension of category by a new object , if is a full(y embedded) subcategory of , , and is not the domain of any morphism besides its identity .
Examples. For any object we obtain a simple right extension by joining a new object and copying all the arrows as where . This extension category will be denoted by .
Observe that by construction, , so it’s just the hom functor seen as a profunctor where is embedded into as the new object .
We can also define the empty and the unique simple right extensions by prescribing that each contains exactly 0 or 1 elements, respectively.
If and are simple right extensions of , with new objects , respectively, then a functor is said to be a morphism of extensions whenever it takes to and fixes all objects and arrows in .
Theorem. (Yoneda lemma for simple right extensions.)
For every simple right extension of , the morphisms of extensions correspond to the new arrows in , naturally in .
Proof. Such a morphism is uniquely determined by where it takes the copy of in and that can be any new arrow .
Theorem. (co-Yoneda lemma for simple right extensions.)
Every simple right extension of is a colimit of simple extensions .
Proof. Let a simple right extension of with new object be fixed, and consider the following diagram on the slice category : an object of that is a new arrow and the diagram assigns the simple extension to it, whereas to an arrow (with ) it assigns .
Now, we get a cocone over to by defining to be the morphism of extensions that corresponds to , and actually any cocone over , with vertex determines a morphism of extensions by sending any new arrow in to the image of (the copy of) under the corresponding leg map of the cocone.