2 The Yoneda Lemma

Definition 2.1 (Locally small). We say a category C is locally small if, for any two objects A and B, the morphisms A→B in C are parameterised by a set C(A,B).

If A is an object of a locally small category C, we have a functor C(A,∙):C→Set sending B to C(A,B) and a morphism B→gC to the mapping (f↦gf):C(A,B)→C(A,C) (this is functorial since composition in C is associative).

Dually, we have C(∙,B):Cop→Set.

Lemma 2.2 (Yoneda). Assuming that:

Then

Proof.

  • (i) Given α:C(A,∙)→F, we define Φ(α)=αA(1A)∈FA.

    Given x∈FA, we define Ψ(x):C(A,∙)→F by Ψ(x)B(f:A→B)=Ff(x)∈FB. This is natural in B since F is a functor: given g:B→C we have

    (Fg)Ψ(x)B(f)=(Fg)(Ff)(x)=F(gf)(x)=Ψ(x)C(gf).

    For any x, ΦΨ(x)=Ψ(x)A(1A)=F1A(x)=x.

    For any α, ΨΦ(α)B(f)=Ff(αA(1A))=αB(C(A,f)(1A)=αB(f) for all f:A→B. So ΨΦ(α)=α.

  • (ii) Later. Seeing examples of usage of (i) is interesting first. □

Corollary 2.3. Assuming that:

Then A↦C(A,∙) is a full and faithful functor Cop→[C,Set].

Proof. Substitute C(B,∙) for F in Lemma 2.2(i): we have a bijection from C(B,A) to the collection of natural transformations C(A,∙)→C(B,∙).

For a given f, the natural transformation C(f,∙) sends g:B→C to gf, so this is functorial by associativity of composition C.

Similarly, we have a full and faithful functor C→[Cop,Set] sending A to C(∙,A). We call this the Yoneda embedding: it allows us to regard any locally small category C as a full subcategory of a Set-valued functor category. □

Compare with Cayley’s Theorem in group theory (every group is isomorphic to a subgroup of a permutation group) and ‘Dedekind’s Theorem’ (every poset is isomorphic to a sub-poset of a power set).

Definition 2.4 (Representable). We say a functor F:C→Set is representable if it’s isomorphic to a C(A,∙) for some A. By a representation of F, we mean a pair (A,x) where x∈FA is such that Φ(x) is an isomorphism. We call x a universal element of F.

Corollary 2.5. Suppose (A,x) and (B,y) are both representations of F. Then there is a unique isomorphism A→fB such that (Ff)(x)=y.

Proof. (Ff)(x)=g is equivalent to saying that

    𝒞(B,∙)              𝒞(A, ∙)


𝒞ΦΦ(((f,yx∙)))         F
commutes, so f must be the unique isomorphism, whose image under Yoneda is Φ(x)−1Φ(y). □

Proof of Yoneda(ii).

Suppose for the moment that C is small, so that [C,Set] is locally small. Given two functors C×[C,Set]→Set: the first sends an object (A,F) to FA, and a morphism (A→fA′,F→αF′) to the diagonal of
  F A       F A′


FααFfAA′fF′ ′A       F ′A ′
The second is the composite

C×[C,Set]→Y×1[C,Set]op×[C,Set]→[C,Set](∙,∙)Set

where Y is a Yoneda embedding. Then Φ and Ψ define a natural isomorphism between these two.

In elementary terms, this says that if x∈FA, and x′∈F′A′ is its image under the diagonal, then Ψ(x′) is the composite

C(A′,∙)→C(f,∙)C(A,∙)→Ψ(x)F→αF′.

This makes sense without the assumption that C is small, and it’s true since the composite maps

1A′↦f↦(Ff)(x)↦αA′(Ff)(x).□

Example 2.6.

  • (a) The forgetful functor Gp→Set is represented by (ℤ,1), Rng→Set is represented by (ℤ[X],X), Top→Set is represented by ({∗},∗).
  • (b) The functor P∗:Setop→Set is represented by ({0,1},{1}). This is the bijection between subsets of A and functions A→f{0,1}, and it’s natural. But P:Set→Set is not representable, since P({∗}) isn’t a singleton.
  • (c) The functor Ω:Topop→Set sending X to the set of open subsets of X, and X→fY to f−1:Ω(Y)→Ω(X) is representable by the Sierpinski space Σ={0,1} with {1} open but {0} not open. This works since continuous maps X→Ω are the characteristic functions of open subsets of X.
  • (d) The functor (∙)∗:Vectk→Vectk isn’t representable, but its composite with Vectk→Set is represented by k.
  • (e) For a group G considered as a 1-object category, the unique representable functor G→Set is the Cayley representation: G acting on itself by multiplication.
  • (f) Given two objects A,B in a locally small category C, we have a functor Cop→Set sending C to C(C,A)×C(C,B). If this functor is representable, we call the representing object a categorical product A×B and write (π1:A×B→A,π2:A×B→B) for the universal element. Its defining property is that given any pair (f:C→A,g:C→B), there is a unique isomorphism h:C→A×B such that πqh=f and π2h=g.

    Dually, we have the notion of coproduct A+B with coprojections γ1:A→A+B, γ2:B→A+B.

  • (g) Given a parallel pair A⇉gfB in a locally small category C, we have a functor F:Cop→Set sending C to {h:C→A|fh=gh} and defined on morphisms in the same way as C(∙,A).

    A representation of this functor is called an equaliser of (f,g): it consists of E→eA satisfying fe=ge, and such that any h with fh=gh factors uniquely as ek. Note that e is monic; we call a monomorphism regular if it occurs as an equaliser.

    Dually, we have the notions of coequaliser and regular epi.

In Set, products are just cartesian products (also in Gp, Rng, Top, …). coproducts in Set are disjoint unions A∐B=(A×{0})∪(B×{1}). In Gp, coproducts are free products G∗H.

In Set, the equaliser of A⇉gfB is the inclusion of {a∈A|f(a)=g(a)} and the coequaliser of (f,g) is the quotient of B by the smallest equivalence relation containing {(f(a),g(a))|a+A}.

Note that in Set, all monomorphisms and all epimorphisms are regular, but in Top, a monomorphism X→fY is regular if and only if X is topologised as a subspace of Y. An epimorphism X→fY is regular if and only if Y is topologised as a quotient of X.

Note that if f is both regular monic and regular epic, then it’s an isomorphism since the pair (g,h) of which its equaliser must satisfy g=h.

Warning. The following terminology is not standard. These are usually (both!) referred to as “generating”, but to avoid confusion, in this course we will refer to them with separate names.

Definition 2.7 (Separating / detecting family). Let G be a family of objects of a locally small category C.

  • (a)
    We say G is a separating family if the functors C(G,∙), G∈G are jointly faithful, i.e. given a parallel pair A⇉gfB, the equations fh=gh for all h:G→A with G∈G imply f=g.
  • (b)
    We say G is a detecting family if the G(G,∙) jointly reflect isomorphisms, i.e. given A→fB, if every G→gB with G∈G factors uniquely through f, then f is an isomorphism.

If G={G}, we call G a separator or a detector.

Lemma 2.8.

Proof.

  • (i) Suppose G is a detecting family, and suppose A⇉gfB satisfy the hypothesis of Definition 2.7(a). Let E→eA of (f,g): then any G→hA with G∈G factors uniquely through e, so e is an isomorphism, so f=g.
  • (ii) Suppose G is separating, and A→fB satisfies the hypothesis of Definition 2.7(b). If C⇉hgA satisfy fg=fh, then any G→kC with G∈G satisfies gk=hk, since both are factorisations of fgk through f. So g=h; hence f is monic.

    Similarly, if B⇉mlD satisfy lf=mf, then any G→nB satisfies ln=mn, since it factors through f, so l=m and hence f is epic. Since C is balanced, f is an isomorphism. □

Example 2.9.

  • (a) In Set, 1={∗} is a separator and a detector, since Set(1,∙) is isomorphic to the identity functor. Also, 2={0,1} is a coseparator and a codetector, since it represents P∗:Setop→Set.
  • (b) In Gp (respectively Rng), ℤ (respectively ℤ[X]) is a separator and a detector, since it represents the forgetful functor.

    But Gp has no coseparator or codetector set: given any set G of groups, there is a simple group H with card⁡H>card⁡G for all G∈G, so the only homomorphisms H→G with G∈G are trivial.

  • (c) For any small category C, the set {C(A,∙)|A∈ob⁡C} is separating and detecting in [C,Set]. This uses Yoneda and Lemma 1.8 (for the detecting case).
  • (d) In Top, 1 is a separator since it represents U:Top→Set. But Top has no detecting set of objects: given a set G of spaces, choose κ>card⁡X for all X∈G, and let Y and Z be a set of card⁡κ. Give Y the discrete topology and for Z, we set the closed sets be Z plus all the subsets of card⁡κ. The identity Y→Z is continuous, but not a homeomorphism, but its restriction to any subset of card⁡<κ is a homeomorphism, so G can’t detect the fact that f isn’t an isomorphism.
  • (e) Let G be the category whose objects are the ordinals, with identities plus two morphisms α⇉gfβ whenever α<β with composition defined by ff=fg=gf=gg=f.

    Then 0 is a detector for C: it can tell that 0⇉gfα aren’t isomorphisms since neither factors through the other, and if 0<α<β it can tell that α⇉gfβ aren’t isomorphisms since 0→gβ doesn’t factor through either.

    But C has no separating set: if G is any set of ordinals, choose α>β for all β∈G and then G can’t separate α⇉gfα+1.

By definition, the functors C(A,∙):C→Set preserve monomorphisms, but they don’t always preserve epimorphisms.

Definition 2.10 (Projective). We say an object P in a locally small category Cis projective if C(P,∙) preserves epimorphisms, i.e. if given

         P


fg Q      R
there exists h:P→Q with gh=f. Dually, P is injective if it’s projective in Cop.

If P satisfies this condition for all g in some class E of epimorphisms, we call it E-projective.

In [C,Set], we consider the class of pointwise epimorphisms, i.e. those α such that αA is surjective for all A.

Corollary 2.11. If C is small, then functors of the form C(A,∙) are pointwise projective in [C,Set].

Proof. Immediate from Yoneda; given

           𝒞 (A, ∙)


αβ Q        R
with β pointwise epic, Φ(α)∈RA is βA(y) for some y∈QA, so βΨ(y)=α. □

“[C,Set] has enough pointwise projectives”:

Proposition 2.12. Assuming that:

Then there exists a pointwise epimorphism P↠F where P is pointwise projective.

Proof. Set P=∐⁡(A,x)C(A,∙) where the disjoint union is over all pairs (A,x) with A∈ob⁡C and x∈FA. A morphism P→Q is uniquely determined by a family of morphisms C(A,∙)→Q. . Hence P is pointwise projective, since all the C(A,∙) are. But we have α:P→F whose (A,x)-th component is Ψ(x):C(A,∙)→F and this is pointwise epic since any x∈FA appears as Ψ(x)(1A). □