# Yoneda lemma and (locally) small categories

A category is locally small if for all objects $A, B$, $\textrm{Hom}(A,B)$ is a set. A category is small if its objects and morphisms are all elements of a single set.

Wikipedia defines a functor category $\mathcal D^{\mathcal C}$ only for $\mathcal C$ a small category (https://en.wikipedia.org/wiki/Functor_category). Why is this? If $\mathcal C$ is instead locally small, does it somehow not make sense to talk about the category of functors from $\mathcal C$ to $\mathcal D$?

Also, what does this mean for the Yoneda lemma? Do you need for $\mathcal C$ to be a small category in order for the statement "$\mathcal C$ is antiequivalent to the full subcategory of $\mathcal D^{\mathcal C}$ consisting of representable functors" to make sense?

It's provable that the category of functors from a small category is locally small while it is not necessarily the case for a locally small category. For example, let $F$ be the functor $\mathbf{Set}\to\mathbf{Set}$ that maps all sets to $1$ except that $\emptyset$ gets mapped to $\emptyset$. Then $\mathbf{Set}^\mathbf{Set}(F,Id)$ is essentially the class of all sets. Whether the category $\mathcal{D}^\mathcal{C}$ exists for non-small $\mathcal{C}$ will depend on what category you are working in (category of small/locally small/large categories) and foundational assumptions. I'll assume local smallness for the remainder.

As for the Yoneda lemma, it means that if $\mathcal{C}$ isn't small then the category $\mathbf{Set}^\mathcal{C^{op}}$ need not exist, therefore, the Yoneda embedding can't be presented as an arrow of that category or equivalently as an element of the hom-"set" of that category in this context. It may be a "large functor" or some other notion, but it's not an arrow in the category of locally small categories. We can still state and prove the Yoneda lemma, $\mathsf{Nat}(\mathsf{hom}(-,C), F) \cong FC$, it's just that $\mathsf{Nat}$ is not a hom-set between objects in a (locally small) category. We don't need to describe a natural transformation as an arrow in a functor category or a natural isomorphism as mutually inverse such arrows. We can directly formulate these notions (and then later prove that they do lead to categories sometimes). In general, $\mathsf{Nat}(F,G)$ will be a "proper class" and so part of proving the Yoneda lemma would be proving that $\mathsf{Nat}(\mathsf{hom}(-,C), F)$ is, in fact, a set.

Nevertheless, it is often convenient to have this additional structure such as cartesian closure. I suspect someone has made a "conservativity" theorem that warrants proving facts about locally small categories by operating on them as large categories, and there are set-theoretic foundations that give large categories some of the properties we'd like.

You may find A Higher-Order Calculus for Categories interesting.

• What do you mean by "$\textrm{Set}^{\mathcal C^{\textrm{op}}}$ need not exist?" – D_S Jan 11 '17 at 13:41
• If the category of functors from $\mathcal{C}^{op}\to\mathbf{Set}$ is not locally small, then it doesn't exist as an object of the category of locally small categories. It's possible that it doesn't exist at all for a given definition of "category" and a given set-theoretic foundation. – Derek Elkins left SE Jan 11 '17 at 14:33
• Why Set^{Set}(F,Id) is essentially the class of all sets? For me it has just one element, maybe I am doing something wrong. – Pouya Layeghi Aug 16 '20 at 13:12

The reason $$\mathcal D^{\mathcal C}$$ is usually only defined for small categories $$\mathcal C$$ is that it is only for small categories that the category tends to exist more or less independently of the notion of classes chosen (e.g. all functor categories always exist if you use a Grothendieck universe, but if you use "syntactic" classes it is only functor categories from small categories that are guaranteed to exist; for more on the various notions of classes see Mike Shulman's expository article Set Theory for Category Theory).

Regarding the Yoneda lemma, what you wrote seems confused: $$\mathcal C$$ is not anti-equivalent to a subcategory of an arbitrary $$\mathcal D^{\mathcal C}$$ (e.g. it's certainly not if $$\mathcal D=\mathbf 1\neq\mathcal C$$ where $$\mathbf 1$$ is the category with one object). Furthermore, the statement that (for small $$\mathcal C$$) $$\mathcal C$$ is anti-equivalent to the subcategory of representable functors in $$\mathcal Set^{\mathcal C}$$ is a special case of the Yoneda embedding, not the Yoneda lemma.

The Yoneda lemma states that if you have a class-valued copresheaf $$\mathcal F$$ on a category $$\mathcal C$$, then the natural transformations from the representable class-valued copresheaf $$\mathrm{Hom}_{\mathcal C}(X,-)$$ to $$F$$ are in natural bijection with the class $$\mathcal F(X)$$. One consequence is that the category of representable class-valued copresheaves is isomorphic to the opposite category of $$\mathcal C$$.

A category is locally small if each representable class-valued copresheaf $$\mathrm{Hom}_{\mathcal C}(X,-)$$ is representable functor to $$\mathcal Set$$. Since sets are small classes, the Yoneda lemma implies that the natural transformations from the representable set-valued functor $$\mathrm{Hom}_{\mathcal C}(X,-)$$ to a set-valued functor $$F$$ are in natural bijection with the set $$F(X)$$.

The cocompletion of a category $$\mathcal C$$ is a functor $$\mathcal C\to\hat{\mathcal C}$$ initial among functors $$\mathcal C\to\mathcal D$$ for $$\mathcal D$$ a category complete under small colimits. The Yoneda embedding is the cocompletion $$\mathcal C\to\hat{\mathcal C}$$ of a locally small category, which always exists (and $$\hat{\mathcal C}$$ is actually locally small). Explicitly, the cocompletion $$\hat{\mathcal C}$$ is constructed by identifying $$\mathcal C$$ with the category of representable (contravariant) set-valued functors $$\mathrm{Hom}_{\mathcal C}(-,X)$$, identifying the objects of $$\hat{\mathcal C}$$ with small diagrams of representable functors, then using the facts that presheaves send colimits to limits and that colimits of functors are computed pointwise, to identify $$\mathrm{Hom}_{\hat{\mathcal C}}(J,K)=\mathrm{Nat}(\mathrm{colim}_j\mathrm{Hom}(-,X_j),\mathrm{colim}_k\mathrm{Hom}(-,X_k))=\mathrm{lim}_j\mathrm{colim}_k\mathrm{Hom}_{\mathcal C}(X_k,X_j)$$.

In particular, the cocompletion $$\hat{\mathcal C}$$ of a locally small category is always a full locally small "subcategory" of $$\mathcal Set^{\mathcal C}$$, even if the latter is large or does not exist. In fact, a category $$\mathcal C$$ is equivalent to a small category if and only if $$\mathcal C$$ and $$\mathcal Set^{\mathcal C}$$ are both locally small, in which case the cocompletion $$\hat{\mathcal C}$$ is all of $$\mathcal Set^{\mathcal C}$$; for a proof see On the Size of Categories by Freyd and Street.