You are on page 1of 74

Lecture Notes in Category Theory [Draft]

8th November 2005

These notes are prepared by Mario Caccamo from a graduate course on


Category Theory given by Glynn Winskel in the fall of 1999 at BRICS, Aarhus.
Heavy use has been made of latexed notes and exercises by Thomas Mailund
and Mikkel Nygaard Hansen, under the editorial hand of Mario Caccamo and
Glynn Winskel. The course was derived from and inspired by Martin Hylands
Cambridge part III Mathematics course given in 1995, when notes were taken
by Cocky Hillhorst.

Contents
1 Categories, Functors and Natural Transformations 2
1.1 Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Functors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 Natural Transformations . . . . . . . . . . . . . . . . . . . . . . . 7
1.4 Functor Categories . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2 Constructions on Categories 9
2.1 Opposite Category and Contravariance . . . . . . . . . . . . . . . 9
2.2 Product of Categories . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Natural Transformations between Bifunctors . . . . . . . . . . . 12
2.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3 Yoneda Lemma and Universal Properties 16


3.1 Yoneda Lemma . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.2 Representability . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

4 Limits and Colimits 21


4.1 Definition of Limit . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.2 Examples of Limits . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.3 Limits in Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.4 Limits as Products and Equalisers . . . . . . . . . . . . . . . . . 27
4.5 Definition of Colimit . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.6 Examples of Colimits . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.7 Colimits in Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.8 Limits with Parameters . . . . . . . . . . . . . . . . . . . . . . . 32

1
5 Ends 33
5.1 Dinaturality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.2 Special Cases of Dinatural Transformations . . . . . . . . . . . . 36
5.3 Definition of End . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.4 Ends in Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.5 Ends with Parameters . . . . . . . . . . . . . . . . . . . . . . . . 41

6 Limits and Ends 41


6.1 Some Useful Isomorphisms . . . . . . . . . . . . . . . . . . . . . . 41
6.2 Limits in Functor Categories . . . . . . . . . . . . . . . . . . . . 42
6.3 Fubini Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

7 Coends 44
7.1 Definition of Coend . . . . . . . . . . . . . . . . . . . . . . . . . . 44
7.2 Density Formula . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
7.3 Recasting the Density Formula . . . . . . . . . . . . . . . . . . . 46

8 Limit Preservation from Naturality 47


8.1 Preservation of Limits . . . . . . . . . . . . . . . . . . . . . . . . 47
8.2 Connected Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . 50
8.3 Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
8.4 General Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
8.4.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
8.5 Preservation of colimits . . . . . . . . . . . . . . . . . . . . . . . 61

9 Adjunctions 62
9.1 Definition of Adjunctions . . . . . . . . . . . . . . . . . . . . . . 62
9.2 The Naturality Laws for Adjunctions . . . . . . . . . . . . . . . . 63
9.3 The Triangle Identities . . . . . . . . . . . . . . . . . . . . . . . . 64
9.4 Limits and Adjunctions . . . . . . . . . . . . . . . . . . . . . . . 66
9.5 Representation Functors . . . . . . . . . . . . . . . . . . . . . . . 66
9.6 Cartesian-closed Categories . . . . . . . . . . . . . . . . . . . . . 67
9.7 Presheaf Categories . . . . . . . . . . . . . . . . . . . . . . . . . . 68

10 Presheaf Categories 70

11 Monads and their Algebras 71


11.1 Definition of Monad . . . . . . . . . . . . . . . . . . . . . . . . . 71
11.2 Algebra for a Monad . . . . . . . . . . . . . . . . . . . . . . . . . 72

1 Categories, Functors and Natural Transfor-


mations
1.1 Categories
Definition 1.1 (Category) A category C consists of

2
a collection of objects ob(C),
for each pair of objects X, Y a collection C(X, Y ) of arrows/maps/morphisms,
for each triple of objects X, Y, Z a composition mapping XY Z : C(Y, Z)
C(X, Y ) C(X, Z) and
for each object X an identity idX in C(X, X);
satisfying the axioms

h XZW (g XY Z f ) = (h Y ZW g) XY W f f XXY idX = f = idY XY Y f

for any f in C(X, Y ), g in C(Y, Z) and h in C(Z, W ) where X, Y, Z, W are in


ob(C).

Notation 1.2 Given a category C, we write X C to mean that X is an


object in ob(C). In general we use capital letters from the begining or end of
the alphabet for objects: A, B, . . . , X, Y, Z. Given an arrow f in C(X, Y ) we
say that X is the domain of f and Y is the codomain of f . This is emphasised
in the diagrammatic notation for categories where f in C(X, Y ) is pictured as
f
X / Y ; in the same spirit we sometimes write f : X Y . In general we use
small letters for arrows: f, g, h, . . . , u, v, . . .. For f in C(X, Y ) and g in C(Y, Z)
we write g f for the composition omitting the subscripts; in some cases when
the composition is clear we just write g f instead of g f :

f g
X /Y /3 Z .
gf

Since composition is associative we sometimes omit parenthesis, for example


we write h g f to mean either h (g f ) or (h g) f . We use arr(C) for
U
X,Y C C(X, Y ), the collection of all arrows in C.

Definition 1.3 (Locally Small Category) A category C is locally small iff


for each pair X, Y C the collection C(X, Y ) is a set.
The category Set of (small) sets as objects and total functions between sets
as arrows is a locally small category where composition is defined as composition
of functions and identities correspond to the the identity functions.

Definition 1.4 (Small Category) A locally small category is small iff the
collection of objects is a set.
Simple examples of small categories are 0 and 1, the empty category and
the singleton category respectively. Another example of small category is given
by any partial order where the objects are the elements and the arrows are given
by pairs of the partial-order relation; the identities correspond to reflexivity and
composition to transitivity.

3
Exercise 1.5 Show that any set can be interpreted as a small category. In
general categories of this kind are called discrete categories, but not all discrete
categories are small.

Notation 1.6 Henceforth, we use A, B, C . . . to denote locally small categories


and I, J, C . . . to small categories. Given a locally small category C we call the
collection C(X, Y ) the hom-set for X, Y C.

Definition 1.7 (Isomorphism) An isomorphism (or just iso) is a pair of ar-


rows
f
/
Xo Y
g

such that g f = idX and f g = idY .

Proposition 1.8 Given one arrow of an iso pair, the other arrow is uniquely
determined.
Proof: Assume (f, g) and (f, g ) are iso pairs, where f : X Y , then (g
f ) g = idX g = g and g (f g) = g idY = g . From associativity of the
composition (g f ) g = g (f g) and then g = g .


Notation 1.9 This proposition allows us to denote an iso pair by just one of
the arrows. If f : X Y is an arrow of an iso pair, we say that f is an
f
Y or f : X
isomorphism (or f is an iso), and we write X = =Y.

Definition 1.10 (Mono) The arrow f : X Y in the category C is mono (or


monic) iff for any pair of arrows g, h
g
/ f
Z /X /Y
h

we have that f g = f h implies g = h.

Exercise 1.11 Show that the composition of monos gives a mono. Show that
if the composition g f is mono then f is mono. What are the monos in Set?

Definition 1.12 (Epi) The arrow f : X Y in the category C is epi iff for
any pair of arrows g, h Z and for all g, h C(Y, Z)
g
f /
X /Y /Z
h

we have that g f = h f implies g = h.

Exercise 1.13 Show that the composition of epis gives an epi. Show that if
the composition g f is epi then g is epi. What are the epis in Set?

4
1.2 Functors
Definition 1.14 (Functor) Let A and B be categories. A functor F : A B
consists of
a mapping F0 : ob(A) ob(B) and

for each pair X, Y A a mapping FXY : A(X, Y ) B F0 (X), F0 (Y ) ;
satisfying the axioms

FXZ (g f ) = FY Z (g) FXY (f ) FXX (idX ) = idF0 (X)

for any f C(X, Y ) and g C(Y, Z).

Notation 1.15 For a functor F : A B we usually write just F for F0 and


FXY . Sometimes we write F X instead of F (X) for X A and similarly with
arrows in A. In general we use capital letters from the middle of the alphabet
for functors, e.g., F, G, H, K.

Definition 1.16 (Full Functor) A functor F : A B is full iff for each pair
X, Y A the mapping F : A(X, Y ) B(F X, F Y ) is surjective.

Definition 1.17 (Faithful Functor) A functor F : A B is faithful iff for


each pair X, Y A the mapping F : A(X, Y ) B(F X, F Y ) is injective.
For a functor F which is both full and faithful (fully faithful) the mappings
F : A(X, Y ) B(F X, F Y ) are all bijections.

Proposition 1.18 Functors preserve iso: if (f, g) is an iso pair in the category
A, and F : A B is a functor, then (F f, F g) is an iso pair in B.
f Ff
/ /
Proof: Let X o Y be iso in A. We are to show that F X o F Y is iso
g Fg
in B. This follows from

(F f ) (F g) = F (f g)
= F idY as (f, g) is an iso pair,
= idF Y .

Analogously, we can conclude (F g) (F f ) = idF X .




Proposition 1.19 If F : A B is a full and faithful functor, then F reflects


isomorphisms: if F X
= F Y then X
=Y.

5
Proof: Assume F X
= F Y . Then there exists a pair of arrows f, g

f
/
FX o FY
g

in B such that f g = idF Y and gf = idF X . By fullness there exists f : X Y


and g : Y X in A such that F f = f and F g = g. We show that f and g
are mutual inverses and so an iso pair:

F (f g ) = F f F g
=f g
= idF Y
= F (idY ).

By faithfulness we have f g = idY . Similarly, we can conclude g f = idX .

Definition 1.20 (Composition of Functors) Given the functors F : A B


and G : B C their composition G F : A C is defined as
(G F )0 = G0 F0 and

(G F )XY = GF0 (X)F0 (Y ) FXY for X, Y A.

Exercise 1.21 Check that this definition gives rise to a functor.


It is easy to see that the composition of functors is associative. Moreover, for
any category A we can define the identity functor idA : A A to be the functor
which is the identity on both object and arrow parts. These observations allow
us to define categories of categories where arrows are functors. In particular, we
define the category Cat of small categories and CAT of locally small categories.
From the observation that functors are arrows in a category of categories
we can specialised the general definitions of iso, epi and mono to functors. For
example, if a functor F is defined as both a bijection on objects and arrows we
can define a functor G to be the inverse of F , and thus F is an isomorphism.

Exercise 1.22 Why is a full and faithful functor not necessarily an isomor-
phism?

Definition 1.23 (Subcategory) A subcategory A of a category B, written as


A B, is a collection of objects and arrows in B such that:
for each arrow f in A, we have that the domain and codomain of f are in
A,
for each object A in A, we have the arrow idA in A, and

6
for each pair of composable arrows f : A B and g : B C in A, we
have the composition g f : A C in A.
Clearly, the definition above ensures that a subcategory is itself category. The
mapping which sends objects and arrows in A to themselves in B defines the
inclusion functor. This functor is faithful and if it is full we say that A is a full
subcategory of B.

1.3 Natural Transformations


Definition 1.24 (Natural Transformation) Given the functors F, G : A
B, a natural transformation : F G consists of a collection of arrows hC :
F C G CiCA in B, such that for any arrow h : X Y in arr(A) the
diagram
X
FX / GX

Fh Gh
 
FY Y
/ GY

commutes, i.e., Y F h = G h X . The diagram above is the naturality square


associated with h.

Notation 1.25 A natural transformation : F G for functors F, G : A B


is a family of arrows in B indexed by objects in A. Each arrow of such a family
is a component of the natural transformation, and we use subscripts to denote
them, e.g., C : F C G C. We use angle brackets to denote the family of
arrows as in the definition hC : F C G CiCA . Naturality squares are often
depicted with the arrow which they are associated with on one side, recall that
the arrow and the naturality square may be from different categories.

Definition 1.26 (Composition of Natural Transformations) The compo-


sition of natural transformations is defined componentwise: given two natural
transformations : F G and : G H


G 
A /B
C


H

their composition at component A A is ( )A = A A .

Exercise 1.27 Check that the componentwise composition of two natural trans-
formations is a natural transformation.

7
This composition is often called vertical composition to distinguish it from
the horizontal composition of natural transformations see exercise 1.29 below.
Given the functors F : A B and K : C D and a natural transformation
:GH
G
F K
A /B
>C
/D

H

we define the composition F : G F H F componentwise as ( F )A =


F (A) for A A. Similarly the composition K : K G K H at component
B B is defined by (K )B = K(B ).

Exercise 1.28 Check that the composition of natural transformations with


functors defined above are natural transformations.

Exercise 1.29 Given the natural transformations and

F H
$ %
A :B 9C,

 
G K

we can define the horizontal composition : HF KG how? Hint: The


composition of natural transformations with functors is a degenerate case of the
composition where the functor stands for the identity natural transformation,
i.e., a natural transformation which has identities at each component.

1.4 Functor Categories


Natural transformations between functors can be (vertically) composed and it is
easy to check that this composition is associative. Moreover, given a functor F :
A B we can define the identity idF : F F to be the natural transformation
with identity at all components: (idF )C = idF (C) . That actually defines a
category of functors and natural transformations.

Definition 1.30 (Functor Category) Given the categories A and B, the func-
tor category [A, B] is the category where the objects are the functors from A to
B and the arrows are the natural transformations between them.
As natural transformations are arrows in a functor category we can spe-
cialised the notions of iso, mono and epi to them. For example, a natural
transformation : F G is an iso, called natural isomorphism, if there is a
natural transformation : G F such that = idF and = idG .

Proposition 1.31 A natural transformation is an isomorphism of functors iff


it is an iso at each component.

8
Exercise 1.32 Prove the proposition above.

Notation 1.33 The category of functors with domain A and codomain B is


noted by [A, B]; some authors use B A . In general we use Greek letters to denote
natural transformations. We depict natural transformations as double arrows
only when we want to stress we are dealing with natural transformations.

Exercise 1.34 The category [A, B] need not be locally small even though A
and B are locally small. However, when A is small [A, B] is locally small why?

Exercise 1.35 Let C be a category, a functor F : A B induces a functor


F : [B, C] [A, C] where the action over objects is defined by precomposition
with F . What is the action on arrows of F ?

2 Constructions on Categories
2.1 Opposite Category and Contravariance
Definition 2.1 (Opposite Category) Let C be a category, we define the op-
posite category C op as:
ob(C op ) = ob(C), and

C op (C, D) = C(D, C) for each pair C, D C op .


In words, C op is the category with the same collection of objects as C where
the arrows are reversed. Clearly, the identities in C op correspond to the iden-
tities in C. Some authors prefer to write f op for the arrow f in the opposite
category, however, in general there is no reason to make such a distinction. The
composition of arrows in C op can be expressed in terms of the arrows in C by
reading the composition in the reverse order

f g f g
C op : X /Y /4 Z C : X ko Yo Z .
gf f g

A contravariant functor F : C D is essentially a functor which reverses the


arrows
A F (A)
O
f
 / F (f )

B F (B) .
In contrast, the functors as defined in section 1.2 are called covariant. It is
more convenient to identify a contravariant functor F : C D with a covariant
functor F : C op D.
functions.

9
Exercise 2.2 Show the opposite construction gives rise to a functor ()op :
CAT CAT acting on objects and arrows

C C op
F F op
 
D Dop .

2.2 Product of Categories


Definition 2.3 (Product of Categories) Given the categories C and D, we
define the product category C D as:
ob(C D) = ob(C) ob(D),
 
CD (C, D), (C , D ) = C(C, C )D(D, D ) for each (C, D), (C , D )
C D, and
composition and identities are defined componentwise.
A functor whose domain is a product of categories is called a bifunctor..
In general a mapping M on objetcs and arrows in C D to objects and
arrows in E determines mappings M (C, ) from D to E for each C C defined
as follows
D M (C, D)
g M(C,g)=M(idC ,g)
 
D M (C, D ) .
Similarly M defines mappings M (, D) for every D D. Notice that M is not
necessarily a bifunctor, and from the following proposition we cannot in general
conclude that M is a bifunctor even when M (C, ) and M (, D) are.

Proposition 2.4 Suppose F is a mapping on objects and arrows in C D such


that
F (C, D) E for any C C and D D, and

F (f, g) E F (C, D), F (C , D ) if f C(C, C ) and g D(D, D ).
F is a bifunctor from C D to E iff
1. F (C, ) is a functor from D to E for all C C,
2. F (, D) is a functor from C to E for all D D, and

10
3. F (f, g) = F (C , g) F (f, D) = F (f, D ) F (C, g), i.e., the diagram

F (f,D)
F (C, D) / F (C , D)
MMM
MMFM(f,g)
F (C,g) MMM F (C ,g)
 M& 
F (C, D )
/ F (C , D )
F (f,D )

commmutes for all f : C C in C and g : D D in D.

Proof:
Only-if : if F is a functor then F (C, ) and F (, D) are functors, and F must
satisfy 3 since (f, g) = (f, idD ) (idC , g) = (idC , g) (f, idD ).
If : we need to prove F satisfies the functor laws. It is easy to show F (id(C,D) ) =
idF (C,D) by using the fact that F (C, ) is a functor (or equivalently that F (, D)
f f
is a functor). It remains to prove F preserves composition; assume C / C / C

g g
and D / D / D , then

F (f , g ) (f, g) = F (f f, g g) by comp. in C D,

= F (C , g g) F (f f, D) by 3,
   
= F (C , g ) F (C , g) F (f , D) F (f, D) by 1 and 2,
 
= F (C , g ) F (C , g) F (f , D) F (f, D) by associativity,
 
= F (C , g ) F (f , D ) F (C , g) F (f, D) by 3,
= F (f , g ) F (f, g) by associativity and twice 3.


The next example considers a mapping satisfying conditions 1 and 2 but not
3.

Example 2.5 Let A and B be one-object categories

f g

 
A : Z B : Z .

id id

Let F be a mapping from A A to B which sends (, ) to the only object

11
in B and acts on arrows as follows

F (f, f ) = g
F (id, f ) = id = F (, f )
F (id, id) = id = F (, id) = F (id, )
F (f, id) = id = F (f, ).

One can check F (, ) and F (, ) are functors from A to B, but F does not
satisfy condition 3 of Proposition 2.4

F (f, f ) = g
F (id, f ) F (f, id) = id id = id .

Hence, 
F (id, f ) (f, id) = F (f, f ) = g 6= F (id, f ) F (f, id) .
Therefore, F is not a functor.

2.3 Natural Transformations between Bifunctors


Given the bifunctors F, G : C D E, consider the natural transformation
F
#
CD


;E .
G

From the definition of natural transformation is a family of arrows in E indexed


by objects in C D such that given an arrow (f, g) in C D the square
C,D
(C, D) F (C, D) / G(C, D)

(f,g) F (f,g) G(f,g)


  
(C , D ) F (C , D ) / G(C , D )
C ,D

commutes. This definition induces two natural transformations by fixing one of


the arguments:
C, : F (C, ) G(C, ) where (C, )D = C,D , and
,D : F (, D) G(, D) where (,D )C = C,D .

Proposition 2.6 Given the bifunctors F, G : C D E, a family of maps


hC,D : F (C, D) G(C, D)i(C,D)CD in E is a natural transformation iff
1. C, = hC,D iDD is a natural transformation from F (C, ) to G(C, )
for any C C, and

12
2. ,D = hC,D iCC is a natural transformation from F (, D) to G(, D)
for any D D.
Proof:
Only-if : left as exercise.
If : It follows from exhibing the arrow

(f,g)
(C, D) / (C , D )

as the composition

(C, D)
(f,idD )
/ (C , D) (idC ,g)/ (C , D ) .

Consider the associated squares:

(,D )C =C,D
(C, D) F (C, D) / G(C, D)

(f,idD ) F (f,idD )=F (f,D) G(f,idD )=G(f,D)


  (,D )C =C ,D =(C , )D 
(C , D) F (C , D) / G(C , D)

(idC ,g) F (idC ,g)=F (C ,g) G(idC ,g)=G(C ,g)


  (C , )D =C ,D 
(C , D ) F (C , D ) / G(C , D )

From 2 we have the commutativity of the upper square and from 1 of the lower
square. Hence the outermost square commutes

C ,D F (f, g) = (C , )D F (idC , g) (f, idD )
= (C , )D F (idC , g) F (f, idD ) as F is functor,
= G(idC , g) G(f, idD ) (,D )C by commutativity of the squares,

= G (idC , g) (f, idD ) (,D )C as G is functor,
= G(f, g) C,D .

Therefore we can conclude is a natural transformation from F to G.



Thus, naturality may be checked in each argument separately when dealing
with bifunctors.

Exercise 2.7 Prove the Only-if part in the proof of Proposition 2.6.

Remark 2.8 (Functoriality and Naturality) Suppose E(X) is an expres-


sion, with an argument X, such that given an object A A, the expression
E(A) stands for an object in the category C; and given an arrow f arr(A),
the expression E(f ) stands for an arrow in C. We say that E(X) is functorial

13
in X, as X ranges over A, if this assignment yields a functor from A to C. For
example, for a category C, the hom-set expression C(X, Y ) is functorial in X
ranging over C op and Y over C.
Traditionally, arguments in expressions are denoted by place-holders like for
example C(, +). This notation might lead to some confusion specially in dis-
tinguishing the scope where each argument is defined. To save this potential
source of confution we sometimes use -notation to indicate arguments in ex-
pressions. Thus, assuming E(X) is functorial in X of type A then the expression
X. E(X) denotes a functor from A to C.
We say that the expressions E1 (X) and E2 (X) both functorial in X are
naturally isomorphic in X or equivantly that there is an isomorphism natural in
X, iff there is a natural isomorphism between X. E1 (X) and X. E2 (X).

Exercise 2.9 Prove that a bifunctor F : A B C defines a unique curried


functor X. Y. F (X, Y ) : A [B, C]. Similarly, show how a natural transfor-
mation : F G for functors F, G : A B C uniquely defines a natural
transformation from X. Y. F (X, Y ) to X. Y. G(X, Y ).

2.4 Examples
Evaluation Functor: Define the evaluation functor eval : [C, D] C D for
categories C and D as follows

(F, C) / F (C)
(,g)
 / F (g)C =C F (g)
 
(F , C )  / F (C )

where : F F and g : C C . The arrow g induces the natural square


which justifies the action of eval on the arrow (, g)
C
C FC / F C
g Fg F g
  C 
C F C / F C .

We use Proposition 2.6 to show eval is a bifunctor:


1. eval (F, ) : C D which sends g : C C to F g : F C F C is a
functor since F is a functor;
2. eval (, C) : [C, D] D which sends : F F to C : F C F C
is a functor since the identity natural transformation has identities in
each component and the composition of natural transformations is defined
componentwise; and

14
3. finally we want

eval (, g) = eval (F , g) eval (, C) = eval (, C ) eval (F, g)

from the definition of eval this is

eval (, g) = F g C = C F g

and this follows from the naturality square above.

Hom-functor: Recall that the hom-set C(C, D) is defined to be the set of


arrows with domain C and codomain D in the locally small category C. Here
we show how hom-sets extend to bifunctors.
The hom-functor for a category C is a functor C(, ) : C op C Set which
sends a pair of objects (C, D) to the hom-set C(C, D) and acts on arrows by
sending (f, g) : (C, D) (C , D ) to

C(f,g)=gf
C(C, D) / C(C , D )

h / f h g
where C(f, g) is a function mapping any arrow C D to the arrow C /C /D / D .

Informally, to obtain an arrow from C to D out of an arrow from C to D, we
need both a way to go from D to D and a way to go from C to C.

Exercise 2.10 Check that the definition of the hom-functor above is actually
a bifunctor.
From Proposition 2.4 we have a functor C(, D) : C op Set which acts on
objects and arrows
C C(C, D)
O
f C(,D)=f

C C(C , D) .
Notice that the arrow f drawn above is in the category C not C op ; that explains
why the direction of the arrow is reversed after applying C(, D). In the same
manner we can define a functor C(C, ) : C Set.

Yoneda Functor: Given the category of functors and natural transformations


[C op , Set], we define the Yoneda functor Y : C [C op , Set] which takes an object
C C to the functor C(, C) and acts on arrows as follows

C Y C = C(, C)
g Y g=hgiEC
 
D Y D = C(, D).

15
Exercise 2.11 Check that Y defines a functor from C to [C op , Set].
Dually, we define the contravariant version of the Yoneda functor Y o : C op
[C, Set] which acts on objects and arrows

C Y o C = C(C, )
O
g Y o g=hgiEC

D Y o D = C(D, ) .

Constant Functor: Given Y D, we write Y : C D for the constantly


Y functor which acts over objects and arrows as follows:

C Y (C) = Y
f Y (f )=idY
 
C Y (C ) = Y

This may be extended to the functor : D [C, D] which sends g : D D


to g : D D where g is just the arrow g at all components.

Exercise 2.12 Check that is a functor from D to [C, D].

3 Yoneda Lemma and Universal Properties


3.1 Yoneda Lemma
Proposition 3.1 Let F : C op Set be a functor, we have that each element
x F (C) for some C C induces a natural transformation x
e : Y C = C(, C)
F whose component at an arbitrary D C is

x
eD = F ()(x) . (1)

Proof: We need to prove that for an arbitrary arrow g : E D in C the


diagram
eD
x
C(D, C) / F (D)

g F (g)
 eE
x

C(E, C) / F (E)

commutes. For any f C(D, C) we have

F (f g)(x) = F (g)(F (f )(x))

since F is a functor. This gives the commutativity required. Recall F is a


contravariant functor and so reverses the order of composition in C.

16


Proposition 3.2 Let F : C op Set be a functor; given a natural transforma-


tion : C(, C) F we have = ^
C (idC ).

Proof: Given an arbitrary f C(D, C), we need to check that D (f ) =


F (f )(C (idC )). This equality is obtained by chasing the identity idC around
the naturality square determined by f .


Theorem 3.3 (Yoneda Lemma) The mapping C,F which takes in [C op , Set](Y C, F )
to C (idC ) F (C) is an isomorphism
C,F
[C op , Set](Y C, F )
= F (C)

natural in C C and F [C op , Set].

Remark 3.4 Notice that the naturality condition in the statement of the Yoneda
lemma uses expressions which are functorial in their arguments. The right
hand side corresponds to the application of the evaluation functor eval : C op
[C op , Set] Set. The right hand side is a more complex expression that involves
composition of functors:

Y op id [C op ,Set](,+)
C op [C op , Set] / [C op , Set]op [C op , Set] / Set.

Proof: We show that (e) defined by (1) is the inverse of C,F . From Proposi-
^
tion 3.2 we already have that C,F () = ^
C (idC ) = . Let x be an element in
F (C)

C,F (e
x) = x
eC (idC ) by definition of C,F ,
= F (idC )(x) by definition of (e),
= idF (C) (x) as F is a functor,
=x.

Thus we complete the prove that C,F is an isomorphism of sets.


It remains to prove naturality in C C and F [C op , Set]. By Proposi-
tion 2.6, this is equivalent to proving naturality in C and F separately.

Naturality in C: Given an arrow f : C D in C, we need to prove


C,F
[C op , Set](Y C, F ) / F (C)
O O
(Y f ) F (f )
D,F
[C op , Set](Y D, F ) / F (D)

17
commutes. Given [C op , Set](Y D, F ), we have
C,F ( (Y f )) = ( (Yf ))C (idC ) by definition of C,F ,
= (C (Yf )C )(idC ) as composition is componentwise,
= (C (f ))(idC ) by definition of Y,
= C (f )
= F (f )(D (idD ))
which gives the commutativity of the diagram above.

Naturality in F : Given [C op , Set](Y C, F ) and : F G. Since the


composition of natural transformations is defined componentwise we have
( )C (idC ) = C (C (idC )) ,
which proves the commutativity of the diagram
C,F
F [C op , Set](Y C, F ) / F (C)

C
  C,G 
G [C op , Set](Y C, G) / G(C) .


The Yoneda lemma is stated for an arbitrary set-valued functor F . A special
case arises when F is itself a hom-functor, say C(, D). In this setting the
Yoneda lemma tells us that there is an isomorphism between the morphisms in
C(C, D) and the natural transformations in [C op , Set](YC, YD). As one might
expect this isomorphism coincides with the Yoneda functor on arrows.

Corollary 3.5 The Yoneda functor Y : C [C op , Set] is full and faithful,


i.e., given C, D C the Yoneda functor defines a bijection between (Y D) C =
C(C, D) and [C op , Set](YC, YD).

Proof: Given f C(C, D) we show fe = Y f . Given an object E in C, from the


definition of (e) in (1) we have

feE = C(, D) (f ) = f = (Yf )E .


Proposition 3.6 Given C, D C, we have that C


= D iff Y C
= Y D in
[C op , Set].
Proof: As Y is full and faithfulsee Proposition 1.19.


Exercise 3.7 State the Yoneda Lemma for the Yoneda contravariant functor
case.

18
3.2 Representability
Definition 3.8 (Representation) A representation for a functor F : C op
Set consists of an object C C and a natural isomorphism

Y C = C(, C)
=F .
We then say that F is representable.

Proposition 3.9 Representations are unique up to isomorphisms: if (A, ) and


(B, ) are both representations of a functor F : C op Set then A
= B in C.
Proof: A direct consequence of Proposition 3.6.


Remark 3.10 We have a dual definition; a functor G : C Set is repre-


sentable iff there exist an object D C and a natural isomorphism Y o D =

C(D, )
=G

Definition 3.11 (Universal Element) Given a functor F : C op Set, a


pair (C, e) where C C and e F (C) is a universal element of F iff for any
C C and e F (C ) there exists a unique f : C C in C such that
e = F (f )(e).

Theorem 3.12 There exists a universal element for a functor F : C op Set


iff F is representable.
Proof:
Only-if : Let (C, e) be a universal element for F . From Proposition 3.1 we
have that e induces a natural transformation ee : Y C F whose component
at C C is eeC = F ()(e). As e is a universal element we have that eeC is a
bijection. By Proposition 1.31 we conclude that ee is a natural isomorphism.

if : Suppose Y C = F , then from for any e F (C ) for some C C there
exists a unique arrow f C(C , C) such that C (f ) = e . From Proposition 3.2
we have that e = ^ C (idC )C (f ) = F (f )(C (idC )) and then (C (idC ), C) is a
universal element.


Theorem 3.13 (Parametrised Representability) Let F : A B op Set


be a bifunctor such that for every A A there exists a representation (B(A), A )
for the functor F (A, ) : B op Set. Then there is a unique extension of the
mapping A 7 B(A) to a functor B() : A B such that
A
B(, B(A))
= F (A, )
is natural in A A.

19
Proof: By currying F we have the functor X. Y. F (X, Y ) : A [B op , Set]
see Exercise 2.9. Then, given f : A A we can construct the commuting
square

= A
Y(B(A)) / F (A, )

( A )1 F (f,) A F (f,)=hF (f,B)iBB
 

= A
Y(B(A )) / F (A , ) .

Since Y is full and faithful, there must exist a unique arrow, say B(f ), from

B(A) to B(A ) in B such that Y(B(f )) = (A )1 F (f, ) A . We need to
check that this extension to B() indeed satisfies the definition of functor:
f f
Given the arrows A / A / A in A, we have

Y B(f f ) = (A )1 F (f f, ) A

= (A )1 F (f , ) F (f, ) A as X. Y. F (X, Y ) is a functor,
A 1 A A 1 A
= ( ) F (f , ) ( ) F (f, )
= Y(B(f )) Y(B(f ))

= Y B(f ) B(f ) as Y is a functor;

therefore Y(B(f f )) = Y(B(f ) B(f )), and as Y is faithful we have


B(f f ) = B(f ) B(f ) as required.
Given the identity idA in for A A we have

Y(B(idA )) = (A )1 F (idA , ) A
= (A )1 idF (A,) A as X. Y. F (X, Y ) is a functor,
= idY(B(A))
= Y(idB(A) ) as Y is a functor;

therefore Y(B(idA )) = Y(idB(A) ), and as Y is faithful we have B(idA ) =


idB(A) as required.

The composition of the functor B() and Y gives rise to a functor which is
isomorphic to the curried version of F where the natural isomorphism is given
by = hA iAA
X. Y. F (X,Y )
A; KS / [B op , Set]
;; 9 =
=
;; zzz
;; zz
B() ;; YB() zzz
;; z Y
 zz
op z
B .

20
Exercise 3.14 State the dual version of parametrised representability theorem,
i.e., where representables are of the form Y o (B(A)).

Exercise 3.15 Let n and let P rod : Set Set be the functor which
sends the set X to X n and acts on arrows accordingly, i.e., it sends f : X Y
to f n : X n Y n . In this setting, f n (x1 , . . . , xn ) = (f x1 , . . . , f xn ). Suppose
: P rod P rod is a natural isomorphism. Show that there is a permutation
on the sequence 1, . . . , n such that

X (x1 , . . . , xn ) = (x(1) , . . . , x(n) ) .

Hint: Use the contravariant Yoneda embedding Y o : Setop [Set, Set] noting
that X n
= Set(~n, X), where ~n = {1, . . . , n}.

4 Limits and Colimits


4.1 Definition of Limit
We take limits over functors whose domains are small categories (I, J, K . . . )
and codomains are locally small categories (C, D . . . ). In this setting these
functors are sometimes called (small) diagrams, e.g., for F : I C we say F is
an I-indexed diagram in C.

Definition 4.1 (Limit Abstractly) A limit for a diagram F : I C is a


representation for the functor [I, C](, F ) : C op Set:

C(, L)
= [I, C](, F ) .

Notice that the functor [I, C](, F ) : C op Set in the definition above is
obtained as the composition

[I,C](,F )
C op / [I, C]op / Set.

X
Take X C in the definition above, then we have C(X, limI F )
= [I, C](X, F ),

i.e., an arrow f : X limI F is mapped to a natural transformation X (f ) =

: X F . Given an arrow u : I J in I we have the associated naturality
square in C
I
I X(I) = X / F (I)

u X(u)=idX F (u) (2)


  J

J X(J) = X / F (J) .

21
This diagram can be drawn as

I I hhhh4 F (I)
hhhhh
hh
u X VVVVV J F (u)
 VVVV 
V*
J F (J);

from the commutativity of (2) we have that this triangle commutes, i.e., J =
F (u) I . A natural transformation of this kind is called a cone.

Definition 4.2 (Cone) Let F : I C be a diagram. A cone from X C


to F (or a cone for the I-indexed diagram F in C with vertex X) is a collection
of arrows hI : X F (I)iII in C such that for any arrow u : I J in I the
diagram
I hhhh4 F (I)
hhhh
hhh
X VVVV J
V F (u)
VVVV 
V*
F (J)
commutes.
Therefore, the functor [I, C](, F ) takes an object X C op1 to the set of
cones from X to F . Given an arrow f : X X in C and a cone = hI : X
F (I)iII , we can extend to a cone = hf I : X F (I)iII = f .
This explains how [I, C](, F ) acts on arrows.
From the definition above a limit for a diagram F : I C is given by a

representation C(, L) = [I, C](, F ). From the proof of Theorem 3.12, we
have that (L (idL ), L) is a universal element of [I, C](, F ). Then given a cone
[I, C](X, F ) there exists a unique f : X L such that
 
= [I, C]( f, F ) L (idL )

= L (idL ) f
= h(L (idL ))I f iII

Then each component I : X F (I) is the composition of arrows

f (L (idL ))I
X /L / F (I) .

This straightforwardly gives a more concrete definition of limit in terms of cones


where L (idL ) is a limiting cone.

Proposition 4.3 (Limit Concretely) Given a diagram F : I C, a limit for


F determines and is determined by a cone = hI : L F (I)iII from some
1 Recall ob(C op ) = ob(C).

22
L C to F such that for any other cone = hI : X F (I)iII there exists a
unique arrow f : X L such that for every I I the diagram
I
X / F (I)
z=
f
 I zzz
 zzz
 z
L

commutes. The cone is called a limiting cone.



Proof: Given a representation C(, L) = [I, C](, F ) from Theorem 3.12 we
have that (L (idL ), L) is a universal element. To prove the converse we just need
to show (, L) is a universal element of [I, C](, F ), and then by Theorem 3.12
e

we have the representation C(, L)
= [I, C](, F ).

Like all universal elements, limiting cones are only determined to within
isomorphism:

Proposition 4.4 Let D : I C be a diagram. Suppose : c D and


: c D are both limiting cones. Then c
= c . Conversely, given a limiting
f
cone : c D and an isomorphism c = c, then f : c D is a limiting
cone.

Definition 4.5 (Complete Category) A category C is complete iff the limits


for all diagrams exist in C.

Proposition 4.6 Two results on limiting cones:


f
(i) Suppose is a limiting cone from X to F , and Y
= X. Then f is a
limiting cone from Y to F .
(ii) Suppose X is a limiting cone from X to F and that Y is a limiting
f
cone from Y to F . Then there is an isomorphism Y
= X such that
Y = X f .
Proof: Left as an exercise.

Exercise 4.7 Prove the proposition above (use the concrete understanding of
limiting cone).

23
4.2 Examples of Limits
Definition 4.8 (Terminal Object) An object 1C in a category C is called a
terminal object (final, one) iff there is exactly one arrow from every A C to
1C .
A limit for a diagram F : I C where I is the empty category is a terminal
object in C. Notice that this limit might not exist. Any A C is the vertex for
an empty cone to F , then there must be a unique arrow from A to limI F = 1C .

Exercise 4.9 What is the terminal object in Set?

Definition 4.10 (Product) A product of two objects A and B in the category


C is an object A B in C together with two projections 1 : A B A and
2 : A B B, such that for any pair of arrows f : C A and g : C B
there is a unique (mediating) arrow hf, gi : C A B making the diagram

C
f  g
hf,gi 

 1 2 
Ao AB /B

commute, i.e., f = 1 hf, gi and g = 2 hf, gi.


Let I = {1, 2} be the discrete category with two objects. A limit for a
diagram F : I C is the product F (1) F (2) in C where the limiting cone gives
the projections 1 and 2 .
One can extend the definition of binary product to general products:

Definition 4.11 Assume I is a discrete


Q category. Given a diagram F : I C a
product
Q of F consists of an object II F (I) in C, and a collection of projections
I : II F (I) F (I) for each I I, such that given any X C together with
a collection
Q of arrows hfI : X F (I)iII there is a unique arrow hfI iII :
X II F (I) such that for each I I the diagram

fI
X / F (I)
tt9
 t
hfI iII tt
 ttt I
Q  t
II F (I)

commutes, i.e., fI = I hfI iII .

Definition 4.12 (Pullback) A pullback of a pair of arrows f : A C and


g : B C in a category C is an object P C, sometimes written A C B,
together with a pair of arrows g : P A and f : P B such that

24
1. f g = g f , i.e., the diagram

f
P /B

g g
 f 
A /C

commutes, and
2. for any X C together with arrows h : X A and i : X B for which
f h = g i, i.e., the diagram

X
i

"
h
B
g
 f 
A /C

commutes, then there exists a unique arrow k : X P such that h = g k


and i = f k, i.e., the two triangles in

X@
@ i
@
k @ "
h
P
/B
f
g g
  f 
A /C

commute.

Exercise 4.13 Let I be the category represented by the following graph


$

$ 
/z .

Show that a limit for a diagram F : I C is a pullback in C.

f
/
Definition 4.14 (Equaliser) An equaliser of a pair of parallel arrows A /B
g
in a category C is an arrow m : E A such that f m = g m and with the

25
universal property that for any arrow h : X A such that f h = g h there is
a unique arrow k : X E making m k = h, i.e., the triangle in the diagram
f
m / /
EO >A /B
~~ g
k
 ~~
 ~~~ h
X
commutes.

Exercise 4.15 Let I be the category represented by the following graph


" / |
/ .
Show that a limit for a diagram F : I C is an equaliser in C. Hint: The
equaliser corresponds to one of the arrows in the limiting cone.

Exercise 4.16 Show an equaliser is mono.

4.3 Limits in Set


Consider a diagram F : I Set; from the definition of limit for any u : I J
the induced triangle
I hhhhh4
F (I)
hh
hhhh
limI F VV F (u)
VVVVJ
VVVV 
*
F (J)
commutes, where = hI iII is a limiting cone. Then for any x limI F we

have that F (u) I (x) = J (x).
We define our choice of limits in Set to be

lim F = hxI iII | xI F (I) & u : I J xJ = (F (u)) xI

I

and the limiting cone = hI iII by letting I be the projection on the Ith
component. Clearly, any other cone = hI : X F (I)iII factors uniquely
through our choice of limit in Set by the mapping z X 7 hI (z)iII .

Products in Set: Consider the diagram F whose domain is a discrete cate-


gory with two objects {1, 2} and codomain is Set. As we have seen before the
limit of F is the product F (1) F (2) in Set. Using the definition of limits in
Set above we obtain
lim F = {hx1 , x2 i | x1 F (1) x2 F (2)}

{1,2}

which is the usual definition of product of sets.

26
Pullbacks in Set: Let us assume F is a diagram in Set whose limit gives a
pullback for the arrows
A
f
g 
B /C

(the identities arrows are not drawn). From the definition of limits in Set, the
pullback P is

P = {ha, c, bi | a A b B c C f (a) = c g(b) = c}


= {ha, bi | a A b B f (a) = g(b)}.

Exercise 4.17 What are equalisers in Set?

Exercise 4.18 The set [I, C]( X, F ) is itself (isomorphic to) a limit, of which
diagram?

4.4 Limits as Products and Equalisers


Q F : I C, then
Assume a category C with all products. Given a small diagram
a cone uniquely defines a mediating arrow hI iII : X I F (I) such that
for every I I the diagram

F (I)
o oo7 O
I ooo
I
ooooo
ooo Q
X =h i / II F (I)
I II

commutes. This is just a consequence of the


Q definition of product.
We can also define in C the product u:IJarr(I) F (J): the product of
F (J) indexed by arrows u : I J arr(I). The projections of this product
are indexed by the arrows in I. Q Q
We have two mediating arrows from II F (I) to u:IJarr(I) F (J):

1. hJ iu:IJarr(I) such that for an arbitrary u : I J the diagram

F (u)
F (I) h/4 F (J)
h h hhhhh O
J hhhhh
hhhh u
hhh h
Q hhh hJ iu:IJarr(I) Q
F (I) / u:IJarr(I) F (J)
II

commutes; and

27
2. hF (u) I iu:IJarr(I) such that for an arbitrary u : I J the diagram

F (u)
F (I) / F (J)
t: O
I ttt
tt u
tt
Q t hF (u)I iu:IJarr(I) Q
II F (I)
/ u:IJarr(I) F (J)

commutes.

Theorem 4.19 A category C has all small limits iff C has all products and
equalisers.
Proof:
Only-if : Obvious since products and equalisers are limits.
If : Given a diagram F : I C, a cone from X to F equalises the mediating
arrows hJ iu:IJarr(I) and hF (u) I iu:IJarr(I) . On the other hand, any
arrow equalising these arrows determines a cone on F . So a limit of F is an
equaliser for hJ iu:IJarr(I) and hF (u) I iu:IJarr(I) .


4.5 Definition of Colimit


Definition 4.20 (Colimit Abstractly) A colimit for a diagram F : I D is
a representation for [I, D](F, ) : D Set:

D(C, )
= [I, D](F, ) .

The object C is often written as limI F or colimI F .



The component at X of the natural isomorphism in the definition above
takes arrows in D(C, X) to cones from F to X (or a cocone for the I-indexed
diagram F in D with vertex X). A cone from F to X is a collection of arrows
hI : F (I) XiII such that for any u : I J in I the diagram

F (I) VVV I
VVVV
VVVV
*
F (u)
J hhh4 X
 hhhhhhh
F (J)

commutes.

Proposition 4.21 (Colimit Concretely) Given a diagram F : I D, a


colimit for F determines and is determined by a cone = hI : F (I) CiII

28
from F to some C D such that given any other cone = hI : F (I) CiII
there exists a unique arrow g : C X such that for every I I the diagram

I
F (I) /X
z=
I z
z g
 z
C
commutes.
Proof: Left as exercise.


Exercise 4.22 Prove the proposition above by using the dual of Theorem 3.12.
All the remarks we made for limits are applied to colimits in the dual version.

Definition 4.23 (Cocomplete Category) A category D is cocomplete iff the


colimits for all diagrams exist in D.

4.6 Examples of Colimits


Definition 4.24 (Initial Object) An object 0D in a category D is called an
initial object (zero) iff there is exactly one arrow from 0D to every A D.
A colimit for a diagram F : I D where I is the empty category is an
initial object in D. Notice that this colimit might not exist. Any A D is the
vertex for an empty cone from F , then there must be a unique arrow from
limI F = 0D to A.

Definition 4.25 (Coproduct) A coproduct of two objects A and B in the


category D is an object A + B in D together with two injections 1 : A A + B
and 2 : B A + B, such that for any pair of arrows f : A C and g : B C
there is exactly one arrow [f, g] : A + B C such that the diagram
1 2
A / A+B o B


[f,g] 
f  g
%  y
C

commutes, i.e., f = [f, g] 1 and g = [f, g] 2 .


Let I = {1, 2} be the discrete category with two objects. A colimit for a
diagram F : I D is a coproduct F (1) + F (2) in D where the limiting cone
defines the injections 1 and 2 .
We can extend this to general coproducts:

29
Definition 4.26 Assume I is a discrete category. Given aP diagram F : I D a
colimit for F isP
called a coproduct and consists of an object II F (I) and a cone
hI : F (I) II F (I)iII such that for any other cone hfI : F (I) XiII
there exists a unique arrow [fI ]II such that for each I I the diagram
I P
F (I) II F (I)
/
KKK 
KKfKI
KKK  [fI ]II
KK% 
X
commutes.

Definition 4.27 (Pushout) A pushout of a pair of arrows f : C A and


g : C B is an object P together with a pair of arrows f : B P and
g : A P such that
1. f g = g f , i.e., the diagram

PO o BO
f
g g
f
Ao C
commutes, and
2. for any object X together with arrows h : A X and i : B X for
which h f = i g, i.e., the diagram

XS k
i

h
BO
g
f
Ao C

commutes, then there exists a unique arrow k : P X such that h = kg


and i = k f , i.e., the two triangles in

XS `@k
@ i
@k
@
PO o BO
h f
g
g
f
Ao C
commute.

30
Exercise 4.28 Let I be a category defined by the graph
$
O

$ z
o .
Show that colimit for a diagram F : I D is a pushout in D.

f
/
Definition 4.29 (Coequaliser) A coequaliser of a pair of parallel arrows A /B
g
in a category D is an arrow m : B E such that m f = m g with the uni-
versal property that for any arrow h : B X such that h f = h g there is a
unique arrow k : E X making k m = h, i.e., the triangle in the diagram
f
/ m
A / B CC /E

g CC
CC  k
h CC 
! 
X .
commutes.

Exercise 4.30 Let I be the category defined by the graph


$ / z
/ .
Show that a colimit for a diagram F : I D is a coequaliser in D.

4.7 Colimits in Set


Consider a diagram F : I Set, from the definition of colimits we have that
for any u : I J the triangle
F (I) VVV
VVVVI
VVVV
*
F (u) lim F
h 4 I
hh
 hhhhhhJh
F (J)

commutes, where hI iII is a colimiting cone. Then for any x F (I) we have
I (x) = (j F (u))(x). U
We define our choice of colimits in Set to be limI F = II F (I)/ , where

the relation represents the constraints imposed by Uthe arrows Uin I. We define
the relation as the least equivalence relation on II F (I) II F (I) such
that
(I, x) (J, y) u : I J arr(I) (F (u))x = y . (3)
U
For (I, x) II F (I) we let [(I, x)] denote the equivalence class of con-
taining (I, x). The colimiting cone is given by the collection of injection arrows
I : x 7 [(I, x)] .

31
Exercise 4.31 Show this choice indeed gives a colimit in Set.

Exercise 4.32 What are coproducts, pushouts and coequalisers in Set?

4.8 Limits with Parameters


A special case of parametrised representability arises when considering limits of
diagrams as representations:

Proposition 4.33 (Parametrised Limits) Let F : I A C be a functor


such that for every A A the functor (small diagram in C) F (, A) : I C has
A
as limit the representation C(, limI F (, A)
= [I, C](, F (, A)). Then the

mapping A 7 limI F (, A) extends uniquely to a functor W. limI F (, W ) :

A C such that

 (A )X 
C X, lim F (, A) = [I, C] X, F (, A) (4)

I

natural in A A and X C.
Proof: This proposition is just a corollary of Theorem ?? (Parametrised Repre-
sentability) applied to the functor A, X. [I, C](X, F (, A)) : A C op Set.

Given the functor F : I A C in the proposition, an arrow g : A B in
A has associated the naturality square

 A
=X 
A C X, limI F (, A) / [I, C] X, F (, A)

g lim F (,g) F (,g)

I
   B
=X
 
B C X, limI F (, B) / [I, C] X, F (, B)

for an arbitrary X C. Taking X = limI F (, A) and chasing the identity



idlim F (,A) around the diagram we have
I
B
 A
lim F (,A) lim F (, g) = F (, g) lim F (,A) (idlim F (,A) ),
I I I
I

i.e., limI F (, g) is the mediating arrow associated with the cone F (, g)



A
lim F (,A) (idlimI F (,A) ).
I
A
Exercise 4.34 Verify that F (, g) lim F (,A) (idlimI F (,A) ) is a cone from
I
limI F (, A) to F (, B).

32
An important special case of Proposition 4.33 arises by taking A = [I, C] and
F to be the evaluation functor eval : I [I, C] C where C has all limits for
I-indexed diagrams. Hence, from the definition of the evaluation functor, for
every G [I, C] there is a representation
 
C , lim eval (, G) = [I, C] , eval (, G) .

I

Notice that eval (, G) = G. Then from parametrised limits we have a functor


W. limI eval (, W ) = limI : [I, C] C, the limit functor, such that

C(X, lim F )
= [I, C]( X, F )

I

natural in X C and F [I, C]. From the observation above, given a natural
transformation : F G the arrow limI is just the mediating arrow associ-

ated with the cone resulting from the composition of the limiting cone for limI F

with .

Remark 4.35 The definition of the limit functor is given w.r.t. a particular
choice of representation for each diagram F [I, C]; or equivalently w.r.t. a par-
ticular choice of limiting cone for each diagram. The limit functors asscociated
with different choices of representation are, however, all isomorphic.

Remark 4.36 In general there are categories where limits for some diagrams
are missing. We can still define the limit functor, however, by restricting to
the subcategory of diagrams for which all limits exists. Given a category A for
which not necessarily all limits of type I exist, we define the full subcategory
Diag[I, A] [I, A] of diagrams with limits in A and restrict the limit functor
to range over such diagrams. Notice that if A is not the empty category then
Diag[I, A] contains at least the constant diagrams since their limits always exist
in A.

Exercise 4.37 State the dual of the Proposition 4.33 for colimits and conclude
that if C has all limits for I-indexed diagrams there is a colimit functor limI :

[I, C] C.

Exercise 4.38 Check that the definition of limI satisfies the axioms in the

definition of functor. In principle that is not necessary since parametrised rep-
resentability ensures that the extension of the mapping F 7 limI F is a functor!

5 Ends
5.1 Dinaturality
We have considered bifunctors and natural transformations between them in
2.2. We now study special kinds of bifunctors of mixed-variance, e.g. with

33
domain C op C, and dinatural transformations between them. A main moti-
vation for dinatural transformations is to present ends and dually coends as
representations for suitable functors.

Definition 5.1 (Dinatural Transformation) Let F, G : C op C D be


functors. A dinatural transformation : F G consists of a family hU :
F (U, U ) G(U, U )iUC of arrows in D such that for every arrow f : V U in
C the diagram
U
F (U, U ) / G(U, U )
s9 KKK
F (idU ,f )sss
ss KKK U )
KKG(f,id
s KK
sss %
F (U, V ) G(V, U )
KKK s9
KKK
KK s ssss
F (f,idV ) KK s
% sss G(idV ,f )
F (V, V ) V
/ G(V, V )

commutes.
Recall that F (idU , f ) = F (U, f ) where F (U, ) : C Set is the functor
obtained by fixing the object U in the first argument of F (see 2.2). Henceforth
we use the more compact F (U, f ) instead of F (idU , f ). Similarly, we use F (f, V )
instead of F (f, idV ).
Every ordinary natural transformation gives rise to a dinatural transforma-
tion: Let
F
'
C op C 7E

G

be a natural transformation then the family of arrows hU,U : F (U, U )


G(U, U )iUC is a dinatural transformation. Given the arrow f : V U we
construct the diagram
U,U
F (U, U ) / G(U, U )
s9 s9 KKK
F (U,f ) sss G(U,f ) sss KKG(f,U)
s (1) s KKK
ss ss KK
sss U,V sss %
F (U, V ) / G(U, V ) (3) G(V, U )
KKK KKK 9
KKK KKK sssss
KK (2) KK ss
F (f,V ) KK G(f,V ) KK
% % sss G(V,f )
F (V, V ) V,V
/ G(V, V )

where
(1) is the naturality square associated with (idU , f ) : (U, V ) (U, U ),

34
(2) is the naturality square associated with (f, idV ) : (U, V ) (V, V ), and
(3) commutes since G is a bifunctor and then G(f, f ) = G(V, f ) G(f, V ) =
G(f, U ) G(U, f ) (see 2.2).
Therefore,
G(f, U ) U,U F (U, f ) = G(f, U ) G(U, f ) U,V (1) commutes,
= G(V, f ) G(f, V ) U,V (3) commutes,
= G(V, f ) V,V F (f, V ) (2) commutes.
Thus hU,U iUC is a dinatural transformation.
In general dinatural transformations do not compose. But dinatural trans-
formations obtained from natural transformations compose with arbitrary di-
natural transformations.

Exercise 5.2 Given : F F , : F G


and : G G (assume functors
of the right type), show that
1. hU,U iU ;
2. hU,U iU ; and
3. hU,U iU hU,U iU
are dinatural transformations, where the composition is defined componentwise.
Hint: For 1 consider the diagram
U,U U
F (U, U ) / F (U, U ) / G(U, U )
rr8 9s KKK LLL
F (U,f )rr F (U,f ) sss KKFK(f,U) LLG(f,U)
rrr s ss KKK LLL
rrr sss K% LL&
U,V
F (U, V ) / F (U, V ) F (V, U ) G(V, U )
LLL KKK 9 r8
LLL KKK sssss rrr
LL
F (f,V ) LL&
KK
F (f,V ) KK ss rrr
% sss F (V,f ) rrr G(V,f )
F (V, V ) V,V
/ F (V, V ) / G(V, V ) .
V

The composition of dinatural transformations with natural transformations


is functorial, i.e., we have a functor

Dinat , + : [C op C, D]op [C op C, D] Set
where and+ are place-holders used to stress the mixed-variance of the functor.
Dinat , + acts on functors and natural transformations as follows:

FKS G Dinat F, G

Dinat , =
  
H K Dinat H, K .

35
5.2 Special Cases of Dinatural Transformations
In the next examples we consider functors F, G : C op C D and dinatural
transformations from F to G.

One-side Constant: Assume F = X is a constant functor for some X D


and consider a dinatural transformation : X G.
Then given f : V U in
C the diagram
U
/ G(U, U )
?X LLL
idX LLG(f,U)
LLL
LL%
X> G(V, U )
>> 9
>> rrrr
> rrr
idX >>
 rrr G(V,f )
X / G(V, V ).
V

commutes. This diagram can be drawn as

G(U, U )
U
jjjjjj5 LLL
LLG(f,U)
jjj LLL
jjjjj LL
jj %
jjj
X TTTT G(V, U )
TTTT 9
TTTT rrrrr
V
TTTT rr
TT) rrr G(V,f )
G(V, V ).

Such an is called an extra natural transformation, a super natural transfor-


mation, or a wedge from X to G.
Likewise, if G is a constant functor we can consider the dinatural transfor-
mation : F
X for some X D. Then we have for any f : V U that the
diagram
F (U, U ) T
F (U,f ) sss
s9 TTTT
TTTU
s ss TTTT
sss TTT
TTT
)
F (U, V ) jj5 X
KKK jj
KKK jjj
KKK jj jjj
F (f,V ) K% j
jj V
jjj
F (V, V )
commutes. This is a wedge from F to X.
As an example of the first case consider the set-valued functors: {} and
C(, +). The collection whose component at U is the function 7 idU is a

36
dinatural transformation from {} to C(, +). For any f : V U in C we
construct the diagram

C(U, U )
nn6 KKK
U
nnn KKf
nn KKK
nnnn KK%
nnn
{} PP C(V, U )
PPP
PPP ssss9
PP
V PPP sss
P( sss f
C(V, V ) .

By chasing in the diagram it is easy to check that the diagram commutes.


An example of the second case is given by the family of arrows hev B :
Set(B, A) B AiBSet for A Set where the component ev B is defined by
(g, b) 7 g(b). Given an arrow f : D C in Set we construct the diagram

Set(C, A) C
ll6 RRR
lll
Set(C,A)f RRRev C
l ll RRR
ll RRR
lll RRR
R)
Set(C, A) D ll5 A
RRR ll
RRR lll
RRR
R lllll
f D RRR l D
( lll ev
Set(D, A) D .

By chasing (k, x) Set(C, A) D in the diagram above


ev C Set(C,A)f
(k, x)  / k(f (x)) , and

ev D (f D)
(k, x)  / (k f )(x) = k(f (x)) .

Therefore hev B iBSet is a dinatural transformation from Set(, A) + to
A.

Dummy in One Argument: A functor F : C op C D is dummy in


its first argument if there exists a functor F0 : C D such that F is the
composition
2
C op C / C F0 / D
where 2 : C op C C is the projection to the second argument. Analogously,
a functor G : C op C D is dummy in its second argument if there exists a
functor G0 : C op D such that G is the composition
1 G0
C op C / C op /D

where 1 : C op C C op is the projection to the first argument.

37
Suppose F, G : C op C D are both dummy in the first argument and
: F G
is a dinatural transformation. Then for any f : V U in C the
diagram
U
F (U, U ) = F0 (U ) / G(U, U ) = G0 (U )
kk5 SSS
kkk SS
F (U,f )=F0 (f ) G(f,U)=GS
0S(U)
kk SSS
kkk )
F (U, V ) = F0 (V ) G(V, U ) = G0 (U )
SSS kk5
SS kkk
F (f,V )=FS(V )
0S G(V,f )=G0 (f )
SSS kk
) kkk
F (V, V ) = F0 (V ) V
/ G(V, V ) = G0 (V )

commutes. Hence the diagram


U
F0 (U ) / G0 (U )
O O
F0 (f ) G0 (f )

V
F0 (V ) / G0 (V )

commutes and defines a natural transformation from F0 to G0 .


If F is dummy in its second argument and G is dummy in its first argument,
a dinatural transformation : F G
is a family hU : F0 (U ) G0 (U )iUC of
arrows in D where F0 : C op D and G0 : C D are functors such that given
f : V U in C the diagram
U
F0 (U ) / G0 (U )
O
F0 (f ) G0 (f )

F0 (V ) V
/ G0 (V )

commutes. The case where F is dummy in its first argument and G is dummy
in its second argument is similar.

5.3 Definition of End


We take ends over functors whose domains are products of the form Iop I,
where I is a small category.

Definition 5.3 (End Abstractly)


 An end for a functor F : Iop I D is a
op
representation for Dinat , F : D Set


D(, end F )
= Dinat , F .

38

The set Dinat X, F for X D is the set of wedges from X to F . We can
recover a more concrete characterisation
 of ends as we have done with limits.
Given a wedge Dinat X, F by Theorem 3.12 there exists a unique
arrow h : X end F such that
 
= Dinat h, F end F (idend F )

= end F (idend F ) h

= h end F (idend F ) I hiII .

In other words, the universal or ending wedge end F (idend F ) is uniquely ex-
tended by the arrow h resulting in the wedge . Given f : V U the situation
is illustrated in the following commutative diagram where = end F (idend F )

2 F (U, U )
U 9 LLL
t tt LLFL(f,U)
t
tttU LLL
ttt L%
h
D _ _ _ _ _ _/ end FJ F (V, U )
JJ
JJV r rr9
JJ
JJ rrr
V J% rrrrF (V,f )
,
F (V, V ).

Proposition 5.4 (End Concretely) An end for a functor determines and is


determined by a universal wedge.
Proof: By using Theorem 3.12 following the same reasoning done with limits.

R
Notation 5.5 In general we write I F (I, I) for the object end F D, where
F : Iop I D; the properties of ends shall justify this notation.

Limits are Ends: Let F0 : I D be a functor with limit the representation



[I, D](I , F0 ). The functor F0 induces a functor F : Iop I
D(, limI F0 ) =

D dummy in its first argument. The natural transformations from I X to F0
are the dinatural transformations from Iop I X to F see 5.2. Thus we have

X 
D(X, lim F0 )
= [I, D](I X, F0 ) = Dinat Iop I X, F

I

natural in X, i.e., (limI F0 , ) is a representation for Dinat Iop I , F and
R
consequently limI F0 = I F (I, I).

R
Notation 5.6 This justifies writing I F0 (I) for limI F0 .

39
Ends are Limits: Let F : Iop I D be a functor with end the representation
R 
D(, I F (I, I))
= Dinat , F . We construct a category I and a functor
R
d : I Iop I such that I F (I, I) = limI (F d ). The category I is built

from the objects and arrows in the category I as follows:
ob(I ) = ob(I) arr(I); and
arr(I ) is the collection of identities and for every f : V U in I the
arrows
U UUUUU
UUUU
UU*
iiiii4 f
iii
iii
V.

The only possible composition in I is with identities.


Now, we define the functor d : I Iop I acting on objects and arrows

U SSSS (U, U ) WWW (f,U)


SSSS WWWWW
SSS) WWW+
 d
5f / 3 (V, U )
kkkkkkk ggggggg
g
kkkk gg (V,f )
V (V, V ) .

Observe (left as an exercise) thatthe cones in [I , D](I X, F d ) are exactly


the wedges in Dinat Iop I X, F :

R 
D(, I F (I, I)) = Dinat Iop I , F = [I , D](I , F d ) .
R
Therefore I F (I, I) is a limit for F d .

Exercise 5.7 Show that [I , D](I , F d ) = Dinat Iop I , F .
As a consequence of these two results we can deduce that if D has all limits
then D has all ends; we also have a choice for ends in Set given by the choice
for limits and a parametricity result.

5.4 Ends in Set


Let F : Iop I Set be a functor. A choice for the end of F is given by
R
limI (F d )
I F (I, I) =
 
= hxA iAI | xA (F d )(A) & f : V U arr(I) F (f, U )(xU ) = xf & F (V, f )(xV ) = xf

= hxU iUI | xU F (U, U ) & f : V U arr(I) : F (f, U )(xU ) = F (V, f )(xV )
(5)

where the projections form the ending wedge.

40
5.5 Ends with Parameters
R Let F : I I B D be a functor
op
Proposition 5.8 (Parametrise Ends)
such that for every B B the end I F (I, I, B)R of the functor F (, +, B) :
Iop I D exists in D. Then the function B 7 I F (I, I, B) extends uniquely
to a functor from B to D such that
R  
D D, I F (I, I, B) = Dinat D, F (, +, B)

natural in D D and B B.

Proof: The proof follows from parametrised representability


 (Theorem ??)
applied to the functor B, D. Dinat D, F (, +, B) .


Exercise 5.9 Define the end functor end : [Iop I, C] C where C has all
ends of type I.

6 Limits and Ends


6.1 Some Useful Isomorphisms
Curry and Uncurry: Letting F : A B C, the isomorphism curry : [A
B, C]
= [A, [B, C]] with inverse uncurry (see exercise 2.9) gives an isomorphism
curry
[A B, C](F, G)
= [A, [B, C]](A. B. F (A, B), A. B. G(A, B)) (6)

which sends a natural transformation : F G to hhA,B iBB iAA . Its


inverse, uncurry, acts by sending to h(A )B iA,BAB . The isomorphism is
natural in F and G.

Exercise 6.1 Swap?

Limits and Ends as Representations: Assume D has all limits, as a con-


sequence of parametrised representability for limits there is an isomorphism

R X,F
D(X, I
F (I))
= [I, D]( X, F )

natural in X D and F [I, D] see 4.8. Moreover, from Theorem 3.12 the
isomorphism is defined by

R  X,F
f D X, I
F (I)  / f [I, D]( X, F ) (7)

where = R F (I), F (idR F (I) ) is the limiting cone of F .


I I

41
The case for ends goes similarly. As D has all limits then it has all ends,
then from parametrised representability for ends there is an isomorphism
R X,G 
D(X, I G(I, I))
= Dinat X, G
natural in X D and G [Iop I, D], where X,G is defined by
R  X,G 
f D X, I
G(I, I)  / f Dinat X, G (8)

where = R G(I, I), G (idR G(I, I) ) is the universal wedge of G.


I I

Dinaturality Formula: Letting F, G : Iop I D, then


 R 
Dinat F, G = I D F (I, I), G(I, I) (9)
provided we make the specific choice for ends of set-valued functors as given
by (5). The right hand side of this  formula is the end taken over the functor
I , I + . D F (I + , I ), G(I , I + ) . The two sides of (9) are the same (left as an
exercise) functorially in F and G (by virtue of the identity isomorphism).

Exercise 6.2 Prove the dinaturality formula by using our explicit choice for
ends in Set.

Naturality Formula: We can specialise the dinaturality formula to an end


characterisation of natural transformations. Letting F, G : I D, then
 R 
Nat F, G = [I, D](F, G) = I D F (I), G(I) (10)
where the end of the right hand side is taken over the functor I , I + . F (I , I + ).
Again with respect to the specific choice for ends in Set the two sides are the
same functorially in F and G.

6.2 Limits in Functor Categories


Let F : I J D be a functor; if for each J J the functor F (, J) : I D
has Ra limit in D then by parametrised limits (Theorem 4.33) there is a functor
J.
R I
F (I, J) : J D. This limit functor is in fact isomorphic to the limit
I J. F (I, J). In other words, limits in functor categories are obtained pointwise
provided the pointwise limits exist.

Proposition 6.3 Assume a functor F : I J D is


such that for each object
J J there is a limiting cone J for F (, J). Then hJI iJJ II is a limiting
R
cone for I. J. F (I, J) Rwith vertex J. I F (I, J). Assuming every functor F
in [I J,D ] has a limit I F (I, J) for all object J J, the isomorphism
R R

I J. F (I, J) = J. I F (I, J) ,

determined by universality, is natural in F .

42
R  
Proof: We show [J, D] Y, J. I F (I, J) = [I, [J, D]] I Y, I. J. F (I, J) nat-
ural in Y [I, D]. This natural isomorphism is obtained as the composition of
the following natural isomorphisms:
R  R R 
[J, D] Y, J. I F (I, J) = J D Y (J), I F (I, J) by naturality formula (10),
R 

= J [I, D] I. Y (J), I. F (I, J) by representation of limits,

= [J, [I, D]] J. I. (Y (J)), J. I. F (I, J) by naturality formula (10),


= [I J, D] I, J. Y (J), I, J. F (I, J) by uncurrying and swapping,


= [I, [J, D]] I. J. (Y J), I. J. F (I, J) by currying.
As each isomorphism is natural in Y [J, D] we obtain R the required
 repre-
sentation.

J A natural transformation [J, D] Y, J. I F (I, J) is sent to


hI J iJJ II as shown below:


= hJ iJJ  / hJ J iJJ  / hJ J iI,JIJ  / hJI J iJJ .
I II

R
J
In particular the identity idJ. F (I, J) is sent to hI iJJ II which by The-
I
orem 3.12 is a limiting cone for I. J. F (I, J). As each isomorphism is natural
in F as well, by parametrised representability, we have
R R

I J. F (I, J) = J. I F (I, J)

natural in F .


6.3 Fubini Theorem


R
Proposition 6.4 Let F : I J D be a functor and assume I F (I, J) exists
for any object J in J, then
R R R

J I F (I, J) = (I,J) F (I, J)

meaning if one limit exists so does the other. If D is complete the isomorphism
is natural in F .
R
Proof: By parametrised representability
R and since I F (I, J) exists for any
J J we have the functor J. I F (I, J). By representation of limits
R R  R 
D , J I F (I, J) = [J, D] , J. I F (I, J) and
R  
D , F (I, J) = [I J, D] , I, J. F (I, J) .
(I,J)

We prove that the right hand sides are isomorphic:


R  R R 
[J, D] V, J. I F (I, J)
= J D V, I F (I, J) by naturality formula (10),
R 

= [I, D] I. V, I. F (I, J) by representation for limits,
J


= [J, [I, D]] J. I. V, J. I. F (I, J) by naturality formula (10),


= [I J, D] I, J. V, I, J. F (I, J) by uncurring and swapping.

43
Notice that each isomorphism is natural in V D and F [I J, D] (provided
we assume D is complete).


Corollary 6.5 (Fubini for Limits) Let F : I J D be a functor such that


R
I F (I, J) exists for all object J in J; and
R
J F (I, J) exists for all object I in I,
then R R R R
J I F (I, J)
= I J F (I, J) ,
meaning if one side exists so does the other. Assuming D is complete the
isomorphism is natural in F .
Proof: Apply the Proposition 6.4 twice.

As ends are limits we also have a Fubini theorem for ends:

Corollary 6.6 (Fubini for Ends) Given F : Iop I Jop J D such that
R
I F (I, I, J , J + ) exists for all J ,J + J; and
R
J F (I , I + , J, J) exists for all I ,I + I,
then R R R R
I J F (I, I, J, J)
= J I F (I, I, J, J) ,
meaning if one side exists so does the other. Moreover this isomorphism is
natural in F if D is complete.

7 Coends
7.1 Definition of Coend
Definition 7.1 (Coend Abstractly)
 A coend for F : Iop I D is a repre-
sentation for Dinat F, : D Set

RI  
D F (I, I), = Dinat F, .

An element of the set Dinat F, X is a wedge from F to X. By using the dual
form of Theorem 3.12 we can recover a concrete definition for coends
 in terms
of couniversal wedges. Thus given a wedge Dinat F, X there  exists  a
RI
unique arrow h : R R
F (I, I) X such that = h I F (I,I) id I F (I,I)

44
 
where R I F (I,I) idR I F (I,I) is the couniversal wedge. Therefore, given an arrow
f : V U in I we have that in the diagram

F (U, U )
t9 LLL U
F (U,f ) ttt LLLU
tt LLLL
tt (1)
tt %
RI h (
F (U, V ) F (I, I) _ _ _ _ _ _/6 X
JJ r 9
JJ (2)
JJ
JJ rr rrr
F (f,V ) JJ rr V
% rr V
F (V, V )
 
(1) and (2) commutes, where = R I F (I,I) idR I F (I,I) .
By means of the dinaturality 9 formula we can define coends in terms of
ends, given a functor F : Iop I D
RI   R
D F (I, I), V = Dinat F, V = I D(F (I, I), V ) (11)
natural in V (and also natural in F if D is a complete category).
The relation between colimits and coends allows to extend our choice for
colimits of set-valued functors to coends in Set. Thus, given a functor F :
Iop I Set RI U
F (I, I) = II F (I, I)/ (12)
U U
where the relation is the least equivalence relation on II F (I, I) II F (I, I)
such that
(U, x) (V, y) if f : V U arr(I) z F (U, V ) . (x = F (U, f )z) & (y = F (f, V )z) .
The universal wedge is given by the collection of injection arrows x 7 [(U, x)] .
The results for ends have a dual version for coends: parametricity coends,
Fubini Theorem and pointwise coends in functor categories.

7.2 Density Formula


Given an object X in the functor category [Cop , Set], by Yoneda Lemma (The-
orem 3.3) and naturality formula 10
 R 
X(U )
= [Cop , Set] Y U, X = V Set (Y U )V, X(V ) . (13)

Notation 7.2 Henceforth we shall denote hom-sets in Set with square R brack-
ets, for instance [A, B] instead of Set(A, B). Rewriting (13) to X(U )
= V [C(V, U ), X(V )].
We now present a coend formula for X. The density formula expresses X(U )
in terms of the coend
RW
X(U )
= C(U, W ) X(W )
natural in U and X [Cop , Set]. Notice that the right hand side is a coend
for the functor W , W + . C(U, W + ) X(W ) : Cop C Set where U C.

45
Notation 7.3 In a category C with all small
P coproducts, for S Set and
A C, the copower S A is the coproduct sS A.
Let us rewrite the density formula using copowers:
RW
X
= U. X(W ) C(U, W )
RW

= U. X(W ) C(U, W ) as coends are computed pointwise,
RW

= X(W ) (U. C(U, W )) (14)
RW
= X(W ) YW

where (14) is justified by


X X
(U. C(U, W )) = U. C(U, V ) = U. X(W ) C(U, W ) .
sX(W ) sX(W )

Proof of the density formula: Let Y [Cop , Set]


RW  R RW
[Cop , Set] X(W ) Y W, Y = U [( X(W ) Y W )U, Y (U )] by naturality formula (10),
R RW

= U[ X(W ) C(U, W ), Y (U )] as coends are computed pointwise,
R R

= U W [X(W ) C(U, W ), Y (U )] by (11),
R R

= U W [X(W ), [C(U, W ), Y (U )]] by currying,
R R

= W U [X(W ), [C(U, W ), Y (U )]] by Fubini,
R R

= W [X(W ), U [C(U, W ), Y (U )]] by dinaturality formula,
R

= [X(W ), Y (W )] by Yoneda Lemma,
W
= [Cop , Set](X, Y ) by dinaturality formula,
RW
natural in Y . By Proposition 3.6 we have X
= X(W ) Y W .

7.3 Recasting the Density Formula


The density formula can be rewritten in two ways. Both make use of a con-
struction called the category of elements of a set-valued functor.

Definition 7.4 LetR G : A Set be a functor. Define its category of elements


els(G) (sometimes G though this clashes with our use for ends and coends) to
be the category consisting of
U
ob(els(G)) = AA G(A); and
arrows h : (A, z) (A , z ) where h : A A is an arrow in A such that
G h(z) = z .

46
Often we will take the category of elements defined by a contravariant functor
G : Cop Set, in this case h : (C, z) (C , z ) is an arrow of els(G) if
h : C C is an arrow in C and (G h)(z) = z .
Note that a product of sets X(W ) C(U, W ) can be written as a coproduct
in two ways X R xX(W )
C(U, W ) = C(U, W ) (15)
xX(W )
or X R f C(U,W )
X(W ) = X(W ) (16)
f C(U,W )

where we treat the sets X(W ) and C(W, U ) as discrete categories (i.e. all maps
are identities) when using the integral notation (here representing colimits).
From the density formula, we have
RW R W R xX(W )
X(U )
= X(W ) C(U, W ) = C(U, W ) .

By using els(X) we can replace the double integral by a single integral


R W R xX(W ) R (W,x)els(X)
C(U, W )
= C(U, W ) . (17)
R xX(W )
Notice that while the left hand side is a coend for the functor W , W + . C(U, W + )
the right hand side is a colimit for the functor (W, x) 7 C(U, W ) from els(X)
to Set.

Exercise 7.5 Considering our particular choice for coends and colimits in Set
prove that the isomorphism (17) holds and conclude that it is natural in U .
R (W,x)els(X)
Hence, X(U ) = C(U, W ), so
R (W,x)els(X) R (W,x)els(X)
X
= U. C(U, W )
= U. C(U, W ) , (18)

exhibiting X as a colimit of representables. Similarly, by considering (16)


R W R f C(U,W ) R (W,f )els(C(U,))
X(U )
= X(W )
= X(W ).

Exercise 7.6 Show this isomorphism by considering the concrete construction


of coends and colimits in Set.

8 Limit Preservation from Naturality


8.1 Preservation of Limits
Definition 8.1 (Preservation of Limits) Let G : C D be a functor. The
functor G preserves limits for a diagram D : I C if whenever : c D is a
limit then the cone G : G(c) G D, got by composition with G, is also a
limit.

47
Clearly, if composition with G sends one limit for a diagram D : I C
to a limit for G D then it sends any other limit for D to a limit for G D.
Most often we talk of the functor G preserving I-limits, or being I-continuous;
this means that G preserves limits of all diagrams in [I, C]. Sometimes we are
interested in a subcategory of diagrams K [I, C] for which limits exist in C.
Just as above we can define a functor limI : K C. And, as later, talk about a

functor preserving K-limits or being K-continuous.

Proposition 8.2 The hom-functor C(C, ) : C Set preserves all limits.


Proof: Suppose F : I C is a diagram with limiting cone = hI iII ,
as a consequence of our choice of limits in Set (a special case of naturality
formula (10)):
R R
C(C, I F (I))
= [I, C](C, F ) = I C(C, F (I)).

That does not ensure that C(C, ) is limiting. Let us examine the diagram
for I
R C(C,I )=I
C(C, I F (I)) / C(C, F (I))
kkk5
kkkk
=
kkkkkkI
R  kk
I
C(C, F (I)) ,
R
given f C(C, I F (I)), we have from the representation for limits (7)

 I
f / I f .

Thus I = I = C(C, I ), and by Proposition 4.6(i) we conclude


hC(C, I )iII is a limiting cone in Set.

Clearly, if F and G are isomorphic functors then F preserves I-indexed limits
iff G does. Hence from Proposition 8.2, we conclude that representable functors
preserve limits.

Proposition 8.3 Given a diagram F [I, C] and a functor G : C D such


that the limits of F and G F exists, then G preserves the limit of F iff the
mediating arrow defined by universality of limit is an isomorphism.
Proof: Left as exercise.


Exercise 8.4 Prove the result above by using Proposition 4.6

48
Let G : C D be a functor. Given a cone : limI D D for a diagram

D : I C the natural transformation G : G(limI D) G D obtained by

composition is a cone as well. Thus, given a limiting cone : limI GD GD

there is a unique mediating morphism m : G(limI D) d such that the diagram

G(limI D) m / lim
I
GD
PP
PPP
PPP
G PPPP
' 
GD

commutes. Requiring that G preserves limits of D is equivalent to insisting that


the mediating arrow defined by G is an isomorphism; in fact some authors use
this as the definition of preservation of limits.
In order to prove that a functor G : C D preserves limits of a diagram
D : I C it is not enough to exhibit an isomorphism

G(lim D)
= lim G D.

I I

Indeed, the action of G over arrows may result in a family that is not univer-
sal. As an example consider the category count of countably infinite sets and
functions. Clearly the objects of count are all isomorphic. There is a functor
+ 1 : count count that acts over sets by adding a new element: given
X count then X + 1 = X {X} and given a function f : X Y , the function
f + 1 sends a X to f (a) and {X} to {Y }. There is an isomorphism

(X Y ) + 1
= (X + 1) (Y + 1),

but this functor does not preserve products; the arrow X + 1 : (X Y ) + 1


X + 1 is not a projection.
If the categories C and D have enough limits the expressions

G(lim D) and lim(G D)



I I

are both functorial in D. For every D there is a mediating arrow mD defined


by G where is the universal cone associated to limI D. The family hmD iD

is natural, this follows directly from the universality of the mediating arrows.
Thus if G is K-continuous there is a canonical isomorphism

G(lim D)
= lim(G D)

I I

natural in D K.
An isomorphism G(limI D) = lim (G D) natural in D is not always unique.
I
Consider, for instance, the category 1 with one object, say , and the identity
arrow. The functor category [1,1 ] has only one object: the constant functor

49
. The limit for this functor is the object itself where the limiting cone is
the identity. We can extend 1 with an extra morphism

id : / id :d f

where f is also an isomorphism, i.e.f f = id. The inclusion functor clearly


preserves the limit of the diagram . The mediating arrow is given by the
identity on which is an isomorphism and trivially natural. The arrow f ,
however, gives another isomorphism

(lim )
= lim

1 1

naturality here is trivial as well.


Often checking the isomorphism between the limiting objects follows from a
fairly direct calculation, while proving that a functor preserves a limiting cone
can involve a fair amount of bookkeeping. We wish to determine under which
conditions having an isomorphism

G(lim D)
= lim(G D)

I I

is enough to ensure that G preserves limits of D.


We shall first investigate two extreme cases, one when diagrams are con-
nected and the other when they are discrete. We later combine the results for
general limits.

8.2 Connected Diagrams


We first consider a special case: preservation of connected limits, i.e.limits of
connected diagrams. A category E is connected if it is nonempty and for any
pair of objects a, b E there is a chain of arrows

a e1 e2 . . . en b.

Observe that if I is connected then C has limits for all I-indexed constant
diagrams.

Proposition 8.5 Let J be a connected small category and D : J C a diagram.


For every limiting cone : c D the arrow limJ is an isomorphism.

Proof: By definition limJ is the unique arrow making the diagram

lim
limJ c
J / lim D
J

 
c
/D

50
commute, where and are the chosen limiting cones associated to limJ c

f
and limJ D respectively. As J is connected there is an isomorphism limI c = c

such that = f . As and are limiting cones by Proposition 4.4 there is an
isomorphism g : c
= lim D such that = g. Hence,
J
(g f ) = g f = f = = lim .

J

Since is limiting,
lim = g f.

J

Thus as f and g are isomorphisms it follows that limJ is an isomorphism as



well.

The following main theorem of this section, establishes that a natural iso-
morphism is enough to ensure preservation of limits of connected diagrams.

Theorem 8.6 Let J be a small connected category. Let G : C D be a


functor with all J-limits. The functor G preserves J-limits if and only if there
is an isomorphism
G(lim D) = lim(G D)

J J

natural in D [J, C].


Proof: The only-if part from the general fact that limit preservation implies
that the mediating arrows are isomorphisms. To show the if part, let J be a
connected small category and assume there is an isomorphism
D

G(lim D) = lim(G D)

J J

natural in D. Given a diagram D : J C and a limiting cone : c D there


is a unique morphism m : G(c) limJ G D such that the diagram

m /
G(c) limJ (G D)
NNN
NNN
N
G NNNN
& 
GD

commutes, where is the chosen limiting cone for G D. We verify that m is


an isomorphism as required.

51
The limiting cone : c D induces the naturality square
 c
G limJ c
= / lim (G(c))
J
G(lim ) lim G

J
J
 
D
G(limJ D)
= / lim (G D).
J

Since J is connected by Lemma 8.5 the arrow limJ is an isomorphism and



so G(limJ ) is an isomorphism as well. From the naturality square above we

can conclude limJ G is an isomorphism.

By definition limJ G is the unique mediating arrow making the diagram

lim G
limJ (G(c))
J / lim (G D)
J
h
 
G(c) / GD
G

commute where h is the chosen limiting cone associated with limJ (G c).

Since J is connected h is an isomorphism. Hence,

G = ( lim G) (h)1 = ((lim G) h1 ) .



J J

By uniqueness of the mediating arrow,

m = (lim G) h1

J

and m is an isomorphism. Thus G preserves the limits of D.



It is stressed that the statement of Theorem 8.6 above refers to any nat-
ural isomorphism and not necessarily to the canonical natural transformation
defined from the limit. The theorem establishes that if there exists such a nat-
ural isomorphism then the canonical natural transformation is indeed a natural
isomorphism as well.
We can relax the conditions of this theorem to consider the case where not
all J-limits exist. Take instead a full subcategory K [J, C] of diagrams whose
limits exist in C and such that K includes all constant diagrams.

Corollary 8.7 Let J be a connected small category and K be a full subcategory


of [J,C ] including all constant diagrams and such that C is K-complete. Then
G is K-continuous if and only if

52
1. for every D K, G D has a limit in D; and
2. there exists an isomorphism limJ (G D)
= G(lim D) natural in D K.
J
Proof: We use the proof of Theorem 8.6 within the subcategory K. Notice that
the expression limJ D is functorial in D but the domain is K instead of [J,C ].

As the indexing category J is connected the limits for constants diagrams exist
in C.

Connectivity is a significant constraint on diagrams. There are, however,
many applications where connected limits (and colimits) are central and then
the result above (and its dual) can be useful.
Theorem 8.6 does not necessarily hold when the indexing category is not
connected. For example, consider the functor category [2,1 ] were 2 is the
two-objects discrete category. This functor category has a unique object: the
constant diagram . Now consider the functor G : 1 Set selecting a
countable infinite set, say the natural numbers N. As = in 1, where the
projections are given by the identity, we have
G( )
= G() G()
natural in since N
= N N. The pair (idN , idN ), however, is not a product.

8.3 Products
Clearly, Theorem 8.6 cannot be applied to products; then the index category is
discrete, an extreme example of lack of connectivity.
Given a discrete category K a diagram D : K C can be regarded as a
tuple of objects hxk ikK in C where xk = D(k). A cone for this functor is any
family of arrows (called projections) hfk : x xk ikK for some object x. Notice
that as the index category is discrete there is no commutativity to check and
naturality comes for free. We say that a family hfk : x xk ikK is a K-product
(or often just product) when it is a limiting cone. Because with a discrete index
category naturality is automatic, we can strengthen Proposition 4.4; we retain
a product when objects in the diagram vary to within isomorphism.

Proposition 8.8 Let fk : x xk and fk : x xk , for k K, where K is a


discrete category. Suppose there are isomorphisms s : x
= x, and sk : xk
= xk
indexed by k K, such that
s /x
x
=

fk fk
 
xk
=
sk
/ xk

commutes for all k K. Then hfk : x xk ikK is a product in C iff hfk : x


xk ikK is a product in C.

53
We now study the conditions for a functor to preserve products. In the next
section we see how these same conditions are enough to ensure preservation of
limits in the general case. In a category with terminal object we use ! : c
to denote the unique arrow from c to . We will use the following simple fact
about products with a terminal object.

Proposition 8.9 Let C be a category with a terminal object . A pair

hf : x x, ! : x i

is a product iff f is an isomorphism.


AsQspecial limits, K-products extend to functors once a choice of K-product
hkD : kK xk xk ikK is made for each diagram D = hxk ikK . AsQis tradi-
tional we have written the chosen limit object for a diagram hxk ikK as kK xk ,
and write x y for a diagram hx, yi.

Theorem 8.10 Let C, D be categories with finite products. The functor G :


C D preserves binary products if
1. G preserves terminal objects and
2. there is an isomorphism

G(x y)
= G(x) G(y)

natural in x, y C.
Proof: Assume that G preserves terminal objects and that the isomorphism
sx,y
G(x y)
= G(x) G(y)

is natural in x, y. Let be a terminal object of C. There is a morphism


! : y in C. This morphism determines the commuting naturality square in
the diagram
sx,y
G(x y)
= / G(x) G(y)
t MMM Gx,Gy
G(1x,y ) tt MMM1
ttt G(idx !) G(idx )G(!) MMM
t
ytt  sx,  M&
G(x) o G(x )
= / G(x) G() / G(x) .
x, Gx,G
G(1 ) 1

The left triangle commutes since it is obtained by applying G to the commuting


triangle
xy
1x,y xx
x
xx idx !
x xx 
{ox
x x,
x .
1

54
By Proposition 8.9 the morphism 1x, is an isomorphism and so G(1x, ) is an
isomorphism as well. The right triangle commutes as products are special limit
functors.
By assumption G() is a terminal object and so from Proposition 8.9 the
arrow 1Gx,G is an isomorphism. Thus the composition

s1 = 1Gx,G sx, G(1x, )1

forms an isomorphism such that


sx,y
G(x y)
= / G(x) G(y)
G(1x,y ) 1Gx,Gy
 s1

G(x)
= / G(x)

commutes.
We can follow the same argument with y instead of x. Then by Proposi-
tion 8.8 the pair
hG(1x,y ), G(2x,y )i
is a product. (Notice that the mediating arrow defined by hG(1x,y ), G(2x,y )i is
an isomorphism but does not necessarily coincide with sx,y .)

We generalise the last theorem to K-products where the naturality of the
isomorphism is required within a subcategory K [K, C] of product diagrams.

Theorem 8.11 Let K be a discrete category and C, D be categories with ter-


minal object. Let K [K, C] be the full subcategory of diagrams for which
products exist in C. The functor G : C D preserves K-products of tuples in
K if
1. whenever hxk ik K then a product of hG(xk )ik K exists in D,
2. G preserves terminal objects, and
3. there is an isomorphism
Q shxk ik Q
G( kK xk )
= / kK G(xk )

natural in hxk ik K.
Proof: This generalises the proof of Theorem 8.10 above to K-products of tuples
within K. It follows by fixing one component at a time and mapping all other
components to the terminal object .


55
8.4 General Limits
P category I can be decomposed into its connected components. We write
A small
I = kK Ik for this decomposition where Ik s are the connected components of
Ithis assumes that K is a discrete category. A connected component Ik is a
full subcategory of I and there is an inclusion functor k : Ik I. This functor
defines by pre-composition the restriction functor

k : [I, C] [Ik , C].

If the category I is connected then we have

[I, C](c, d)
= C(c, d)

and the diagonal functor is full and faithful.


P
Proposition 8.12 Let I = kK Ik be a small category with Ik , where k K,
its connected components. There is an isomorphism
 Y 
[I, C] H, F
= [Ik , C] H k , F k
kK

natural in H, F [I, C] where k : Ik I is the inclusion functor.


Proof: The isomorphism takes a natural transformation : H F and splits
it in the natural transformations k : H k F k . Conversely a collection of
natural transformations hk : H k F k ikK gives a natural transformation
: H F . This construction is clearly a bijection and it is preserved through
pre- and post-composition and thus is natural in both variables.

A limit can be decomposed into a product of connected limits provided these
exist:
P
Proposition 8.13 Let I = kK Ik be a small category with Ik , where k K,
its connected components. Let D : I C be a functor. Assume Q a limiting cone
k with limit object limI (Dk ) for each k K and a product kK limI (Dk )
k k
with projections k . Then, for k K and i Ik , the arrows

Q k ik
limI (D k ) / lim (D k ) / D(i)
kK k Ik

form the components of a limiting cone for D.


Proof: From Proposition 8.12 there is an isomorphism
 Y 
[I, C] c, D = [Ik , C] c, D k
kK

56
natural in c. Hence,
 Y 
[I, C] c, D = [Ik , C] c, D k
kK
Y 

= C c, lim(D k ) the limit as a representation,

kK Ik
Y 

= C c, lim(D k ) since hom-functor preserves limits,

kK Ik

all isomorphisms being natural in c. This provides the limit of D as a represen-


tation. The limiting cone is obtained as the associated univeral element:
 / hk ikK  / h k k ikK .
id


The task now is to combine the results on products (Theorem 8.11) and on
connected diagrams (Theorem 8.6) to treat preservation of more general limits.
In order to do so we use two embeddings of functor categories. Assuming C has
terminal object , the first embedding is the right adjoint of k :
k
/
[I, C] o [Ik , C] . (19)
+

Given H : Ik C, the functor H + : I C is such that it acts as H over


the component Ik and as the constant functor otherwise. The unit of the
adjunction above is defined for D [I, C] as
(
idD(i) if i Ik
(D )i =
! otherwise (the unique arrow from D(i) to ,)

which is clearly universal.

Proposition 8.14 Let Ik be a connected component of I. Assume categories


C and D with terminal objects and a functor G : C D that preserves terminal
objects.
1. there is an isomorphism limI H +
= lim H, and
Ik
2. there is an isomorphism limI G H +
= lim G H.
Ik
In both cases we mean that if one side of the isomorphism exists then so does
the other. The isomorphisms are natural in H K for a subcategory K [Ik , C]
such that C is K-complete.

57
Proof: For 1 consider the chain of isomorphisms

C(c, lim H + )
= [I, C] c, H + the limit as a representation,

I


= [Ik , C] (c) k , H by the adjunction (19),

= [Ik , C] c, H

= C(c, lim H) the limit as a representation,

Ik

all natural in c and H K. As the Yoneda embedding is full and faithful it


follows that there is an isomorphism

lim H +
= lim H

I Ik

natural in H K.
For 2 observe that since G preserves the terminal objects it is possible to
define an adjunction as (19) with D as codomain where G H + = (G H)+ .
Thus we have

D(d, lim G H + )
= [I, D] d, G H + the limit as a representation,

I


= [I, D] d, (G H)+


= [Ik , D] (d) k , G H by the adjunction (19),

= [Ik , D] d, G H

= D(d, lim G H) the limit as a representation,

Ik

all natural in d and H. It follows that there is an isomorphism

lim G H +
= lim GH

I Ik

natural in H.

There is a less obvious embedding  : [K, C] [I, C] where K is the discrete
category whose objects are identified with the connected components of I. Given
a tuple hxk ikK , the functor hxk ikK : I C acts as the constant xk over
the objects and arrows in Ik .
P
Proposition 8.15 Let G : C D be a functor and I = kK Ik be a small
category with Ik , where k K, its connected components:
Q
1. there is an isomorphism limI hxk ikK
= kK xk , and

Q
2. there is an isomorphism limI G hxk ikK
= kK G(xk ).

58
In both cases it is meant that if one side of the isomorphism exists then so does
the other. The isomorphisms are natural in hxk ikK K for a subcategory of
K-tuples K [K, C] such that C is K-complete.
Proof: For 1,

C(c, lim hxk ikK )
= [I, C] c, hxk ikK the limit as a representation,

I
Y 

= [Ik , C] c k , hxk ikK k by Proposition 8.12,
kK
Y 
= [Ik , C] c, Ik xk by definition of ,
kK

= [K, C] c, hxk ikK

= C(c, limhx i ) the limit as a representation,
k kK
K
Q
all natural in c and hxk ikK . Thus limI hxk ikK is isomorphic to kK xk =

limK hxk ikK with naturality following from Yoneda. In a similar way, using the

identity
G x = G(x) ,
we can prove 2.

Now we can reduce the preservation of general limits to naturality.

Theorem 8.16 Let C, D be complete categories. A functor G : C D is


continuous if and only if for any small category I there is an isomorphism

G(lim D)
= lim(G D) (20)

I I

natural in D [I, C].


Proof: The only-if part follows as usual. For the if part first observe
that G trivially
P preserves terminal objects: take I to be the empty category.
Let I = kK Ik be a non-empty small category with Ik , where k K, its
connected components. By Proposition 8.13, any diagram D : I C has a
limiting cone with components

Q k ik
limI (D k ) / lim (D k ) / D(i)
kK k Ik

with projections k and where k is the limiting cone associated with limI (D
k
k ). So in order to prove that G is limiting, it is enough to verify that the cone
with components
G(ik ) G(k )

59
is limiting. For this it suffices to show that hG(k )ikK is a product and that
for every k the cone G k is limiting.
However,
Y
G( xk )
= G(lim

hxk ik ) by Proposition 8.15,
kK I

= lim(G hxk ik ) by assumption (20),

I
Y

= G(xk ) by Proposition 8.15,
kK

all natural in hxk ik [K, C]. So G preserves K-products by Theorem 8.11 and
hG(k )ikK above is a product.
Similarly,

G(lim H)
= G(lim H +) by Proposition 8.14,

Ik I

= lim (G H + ) by assumption (20),

I

= lim (G H + ) by Proposition 8.14,

I

all natural in H [Ik , C]. Thus G preserves Ik -limits by Theorem 8.6 and G( k )
above is a limit for G(D k ).

The proof of the theorem above can be carried out under more liberal as-
sumptions, to cover the preservation of I-limits, for a particular small category
I.

Theorem 8.17 Let I be a small category. Suppose categories C and D are


categories with terminal objects and all I-limits. A functor G : C D preserves
I-limits if
1. G preserves terminal objects, and
2. there is an isomorphism G(limI D) = lim (G D), natural in D [I, C].
I
P
Proof: Let I = kK Ik with Ik , for k K, being its connected components.
Having I-limits implies having Ik -limits for k K (Proposition 8.14), and K-
products (Proposition 8.15). Whereupon the proof can be conducted as for
Theorem 8.16.


60
8.4.1 Examples
Proposition 8.18 The Yoneda embedding Y : C [C op , Set] preserves limits.
Proof: As a consequence of Propositions 8.2 and 6.3 there is an isomorphism
R R
(Y I F (I))(C) = ( I Y F (I))(C)

natural in C C and F Diag[I, C]. As [C op , Set] is complete the functor Y F


has limit for all F , then from Corollary 8.17 we can conclude that Y preserves
limits.


Proposition 8.19 The bifunctor eval : [J, D] J D induces a functor


eval (, J) : [J, D] D for every J J. Suppose F : I [J, D] is a func-
tor such that I. (F I)J has a limit for all J J; then eval (, J) preserves the
limit of F .
Proof: Again we use Proposition 6.3 to conclude that there is an isomorphism
R  R 
I
F (I) J = I F (I)J
R R R
Rnatural in F and J. By definition eval ( I F (I), J) = ( I F (I))(J) and I eval (F (I), J) =
I
F (I)J . Thus, from Corollary 8.17 we have eval (, J) preserves the limit
of F .


8.5 Preservation of colimits


Of course, we have dual results concerning the preservation of colimits. The
main theorems are:

Theorem 8.20 Suppose the category I is small and connected. Suppose cate-
gories C, D have initial objects and all I-colimits.
A functor G : C D preserves I-colimits iff there is an isomorphism

G(lim D)
= lim(G D) ,

I I

natural in D [I, C].

Theorem 8.21 Suppose the category I is small. Suppose categories C, D have


all I-colimits. Suppose that G sends initial objects to initial objects.
A functor G : C D preserves I-colimits iff there is an isomorphism

G(lim D)
= lim(G D) ,

I I

natural in D [I, C].

61
Theorem 8.22 Suppose categories C, D are cocomplete.
A functor G : C D preserves all colimits iff for all small categories I there
is an isomorphism
G(lim D) = lim (G D) ,

I I

natural in D [I, C].

9 Adjunctions
9.1 Definition of Adjunctions
F /
Definition 9.1 (Adjunction) Let C o D be functors where C and D are
G
categories. An adjunction in which F is the left adjoint and G is the right adjoint
consists of an isomorphism
X,Y
D(F (X), Y )
= C(X, G(Y ))
natural in X C and Y D. When such a natural isomorphism exists we write
F G.
By (the dual form of) parametrised representability (Theorem ??), it is suf-
ficient to specify an adjunction via a representation for the functor C(X, G())
X
D(F [X], )
= C(X, G())
where F [X] D for each X C. Then, the mapping which sends X to F [X]
extends uniquely to a functor F : C D such that
X
Y
D(F (X), Y )
= C(X, G(Y ))
natural in X C and Y D, i.e., so F is the left adjoint of G.
From (the dual form of) Theorem 3.12, the representation for C(X, G())
defines a universal element X = FX[X] (idF [X] ), i.e., for any f C(X, G(Y ))
where Y D there exists a unique f D(F [X], Y ) such that

f = C(X, G())(f ) (X )

= G(f ) (X )
= G(f ) X .
Then the diagram
X
XG / G(F [X]) F [X]
GG  
GGf  f
GG
GG  G(f ) 
# 
G(Y ) Y

62
commutes. The collection of universal elements hX iXC is called the unit of
the adjunction. Thus we obtain the freeness condition sufficient to establish an
adjunction.

Definition 9.2 (Freeness Condition) Let G : D C be a functor. Say a


pair (F [X], X ), where F [X] is an object of D and X : X G(F [X]) is a map
in C, is free over X with respect to G iff for any map f : X G(Y ) in C with
Y D, there is a unique map f : F [X] Y in D such that f = G(f ) x .
Suppose G : D C is a functor, a necessary and sufficient condition for
there to be a functor F : C D such that F G is that for each object
X C there is an object F [X] D and an arrow X : X G(F [X]) in C such
that (F [X], X ) is free over X. The family hX iXC is called the unit of the
adjunction.

Exercise 9.3 Show that the action of the induced functor F over an arrow
f : C C in C is the unique arrow determined by the freeness condition of C
for the arrow C f . Then conclude that the collection hX iXC is a natural
transformation from idC to G F .
Dually, suppose F : C D is a functor, a necessary and sufficient condition
for there to be a functor G : D C such that F G is that for each object
Y D there is an object G[Y ] C and an arrow Y : F (G[Y ]) Y in D such
that (G[Y ], Y ) is co-free over Y with respect to F , i.e. the diagram
Y
G[Y ] Y cGo G F (G[Y ])
O GG O
g GG  F (g)
G
g GG 

X F (X)

commutes. The family of arrows hY iY D is called the co-unit of the adjunction.

9.2 The Naturality Laws for Adjunctions


F /
Given an adjunction F G for functors C o D we denote the natural
G
isomorphism
D(F (X), Y )
= C(X, G(Y ))
by () in both directions. Traditionally this correspondence is represented by
g f
F (X) /Y X / G(Y )
and
g f
X / G(Y ) F (X) /Y .

Given that both the isomorphism and its inverse are written as () we must
have f = f and g = g. Given an arrow h we called the arrow h the transpose of
h. Using this notation, we investigate the consequences of naturality.

63
Naturality in X: For h : X X in C the square

XO D(F (X), Y )
= C(X, G(Y ))
h F h h
 
X D(F (X ), Y )
= D(X , G(Y ))

commutes, i.e., given f D(F (X), Y )


Fh f
F (X ) / F (X) /Y
h f
X /X / G(Y ) .

Reading from top to bottom () f F h = f h, and reading from bottom to


top () g h = g F h.

Naturality in Y : For k : Y Y in D the square

Y D(F (X), Y )
= C(X, G(Y ))
k k G k
  
Y D(F (X), Y )
= D(X, G(Y ))

commutes, i.e., given f D(F (X), Y )


f k
F (X) /Y /Y
f Gk
X / G(Y ) / G(Y ) .

Reading from top to bottom () k f = G k f , and reading from bottom to


top () G k g = k g.

9.3 The Triangle Identities


F /
Assume the functors C o D.
G

Proposition 9.4 Given an adjunction F G with unit and counit the


diagrams of functors and natural transformations
G F
G FF / GF G F FF / F GF
FF FF
FF FF
idG
FF G idF
FF F
F#  F# 
G F

commute. They are called the triangle identities.

64
Proof: Recall from exercise 9.3 (and its dual) that the unit and counit of an
adjunction are natural transformations. We prove only the left hand identity
above, the other follows analogously. Given Y D, we have
G(Y ) G(Y )
G(Y ) / G(F (G(Y ))) / G(Y )
G(Y ) =idG(Y ) Y
F (G(Y )) / F (G(Y )) / Y,

and by definition Y = idG(Y ) . Then G(Y ) G(Y ) = idG(Y ) , i.e., G(Y )


G(Y ) = idG(Y ) .


Theorem 9.5 (Adjunction) A pair of natural transformations ( : idC


G F, : F G idD ) satisfying the triangular identities define an adjunction
as follows:
Given an arrow f : X G(Y ) in C the transpose f is Y F (f ), and
given an arrow g : F (X) Y in D the transpose g is X G(f ).
Proof: We need to check these functions give a natural bijection. Naturality is
inherited from naturality of and , e.g., given an arrow h : X X in C and
g D(F (X), Y )
g h = G(g) X h by def. of (),
= G(g) G(F (h)) X by naturality of ,
= G(g F (h)) X
= g F (h).
Now, we check the functions are mutually inverse. Given f : X G(Y ) in
C
f = G(Y F (f )) X by def. of (),
= G(Y ) G(F (f )) X
= G(Y ) G(Y ) f by naturality of ,
=f by triangle identity.
Similarly given an arrow g : F (X) Y we can prove g = g.


Corollary 9.6 An adjunction F G is completely determined by its unit and


counit.
Proof: Since the unit and counit are natural transformations satisfying the
triangle identities and the definition of the transpose in the theorem above
corresponds to the freeness conditions.


65
9.4 Limits and Adjunctions
F /
Theorem 9.7 Suppose the functors C o D form an adjunction F G.
G
Then G preserves all limits which exist in D, and F preserves all colimits which
exist in C.
Proof: Assume D : I D is a diagram whose limit exists in D. Composing
isomorphisms
R  R 
C U, G( I D(I)) = D F (U ), I D(I) by the adjunction,
R 
D F (U ), D(I)
= by Proposition 8.2,
RI 

= I C U, G(D(I)) by the adjunction,
R 

= C U, G(D(I)) by representation of limits,
I

by Proposition 3.6 we have


R R
G( I D(I))
= I G(D(I))

natural in U C and D Diag[I, D] (see Remark 4.36). It follows that the


limit for G D exists for any D Diag [I, D] and thus from Theorem 8.17 we
can conclude that G preserves limits. Dually F preserves colimits.


Exercise 9.8 Complete the proof by showing that left adjoints preserve colim-
its.

Exercise 9.9 Show m : A B is monic in a category D iff


idA
A /A

idA m
 
A m
/B

is a pullback. Deduce right adjoints preserve monics. Why do left adjoints


preserve epis?

9.5 Representation Functors


Assume a functor F : C D where D has all small colimits (i.e. D is cocom-
plete). We can obtain an adjunction

F
w
[Cop , Set] 9D
F!

66
The functor F! is got by extending F along the Yoneda embedding Y (an example
of a left Kan extension):
Y
C HH / [Cop , Set]
HH 
HH F
HH
F HH  !
$ 
D.
RC
Define F! = X. X(C) F (C) and F = Y. C. D(F (C), Y ). To show
F! F :
RC 
D(F! (X), Y ) = D X(C) F (C), Y by definition,
R
= C D(X(C) F (C), Y ) by representation for coends,
R P
= C D( xX(C) F (C), Y ) by definition of copower,
R Q

= C xX(C) D(F (C), Y ) (21)
R

= C [X(C), D(F (C), Y )]
R

= C [X(C), (F (Y ))(C)] by definition of F ,
op
= [C , Set](X, F (Y )) by naturality formula,

where all the isomorphisms are natural in X [Cop , Set] and Y D.


Note that treating the set X(C) as a discrete category we have
X R xX(C) Q R
F (C) = F (C) and xX(C) F (C) = xX(C) F (C),
xX(C)

so step (21) is a special case of the representation for colimits.


In particular, presheaf categories Db = [Dop , Set] have all colimits (they are
obtained pointwise from colimits in Set). So given F : C D b we obtain

F
|
b
C b
: D.

F!

Note that F might arise from a functor F0 : C D by composition with


Yoneda:
F :C
F0
/ D Y / D.
b

9.6 Cartesian-closed Categories


Definition 9.10 (Cartesian Closed Categories) A cartesian-closed category
(ccc) is a category C with
all finite products specifically given (so there is a terminal object 1C and
binary products A B for all A, B C); and

67
a representation for the functor C( B, C):

C(, [B, C])
= C( B, C)

for all B, C C.

Notation 9.11 The object [B, C] C is called the exponential of B and C and
sometimes is written as C B .
By parameterised representability (Theorem ??) for a ccc C there is a unique
way to extend the mapping (B, C) 7 [B, C] to an exponentiation functor [, +]
from C op C to C such that

C(A, [B, C])


= C(A B, C)

natural in A, B, C. Notice that from this isomorphism we have B [B, ].


In fact, provided C has specified finite products an adjunction with B
[B, ] for all B C, conversely determines a cartesian closed structure on C.

Exercise 9.12 What are the unit and counit of B [B, ]?

9.7 Presheaf Categories


Proposition 9.13 Presheaf categories are cartesian-closed.
b = [Cop , Set] has products, computed pointwise, like all
Proof: The category C
limits:
(X Y )(U ) = X(U ) Y (U )
natural in U C. We can make an educated guess at the form of the exponen-
b It should satisfy:
tiation [Y, Z], for Y, Z C.

[Y, Z](U ) b U, [Y, Z])


= C(Y by the Yoneda Lemma (Theorem 3.3)
b U Y, Z)
= C(Y by the adjunction property.

b U Y, Z) and check that C(X,


So we define [Y, Z] = U. C(Y b [Y, Z]) b
= C(X
Y, Z) is natural in X:

68
R
b
C(X, [Y, Z])
= U [X(U ), [Y, Z](U )] by naturality formula,
R
b U Y, Z)]
= U [X(U ), C(Y by definition of [Y, Z],
R  R 

= U X(U ), V [C(V, U ) Y (V ), Z(V )] by naturality formula,
R R  

= U V X(U ), [C(V, U ) Y (V ), Z(V )] by representation for ends,
R R  

= U V X(U ) C(V, U ), [Y (V ), Z(V )] by currying and uncurrying,
R R  

= V U X(U ) C(V, U ), [Y (V ), Z(V )] by Fubini (Corollary 6.6),
R RU 

= V X(U ) C(V, U ), [Y (V ), Z(V )] by representation of coends,
R  

= V X(V ), [Y (V ), Z(V )] by the density formula,
R
[X(V ) Y (V ), Z(V )]
= by uncurrying,
RV

= V [(X Y )(V ), Z(V )] product is got pointwise (Proposition 6.3,
C(X
= b Y, Z) by naturality formula,

b
all natural in X C.


Theorem 9.14 (Presheaf categories are free colimit completions) The cat-
b = [Cop , Set] with the Yoneda embbeding Y : C C
egory of presheaves C b is the
free colimit completion of C, i.e. for any functor F : C D, where D is a cate-
bD
gory with all colimits there is a unique colimit-preserving functor F! : C
such that the diagram
Y
C> /Cb

>>
>> 
> F!
F >> 
 
D

commutes, i.e., F! Y = F .
RC
Proof: Let us define F! = X. X(C) F (C). As shown in 9.5 there is an
adjunction F! D. D(F (), D). By Theorem 9.7 as a left adjoint F! preserves
colimits.
The adjunction F! D. D(F (), D) is given by an isomorphism

D(F! (X), D) b
= C(X, D(F (), D))

b and D D. Setting X to be a representable Y V :


natural in X C

D(F! (Y V ), D) b V, D(F (), D))


= C(Y

= D(F (V ), D) by the Yoneda Lemma (Theorem 3.3)

natural in D and V . Then F! (Y V )


= F (V ), natural in V C, i.e., F! Y
= F.

69
b D is a
It remains to prove the uniqueness of F! . Suppose that H : C
colimit-preserving functor such that H Y
= F . Then,

R 
C
H(X)
=H X(C) Y C by the density formula,
RC

= X(C) H(Y C) as H preserves colimits, (22)
RC

= X(C) F (C) since H Y = F,
= F! (X) by definition of F! ,

natural in X C.b Hence H = F! , as required to complete the proof. The


following expands step 23
R  R
C C
H X(C) Y C = H(X(C) Y C) as coends are colimits,
RC

= X(C) H(Y C) as copowers are coproducts,

and H preserves colimits.




10 Monads and their Algebras


10.1 Definition of Monad
Definition 10.1 A monad on a category C is a functor T : C C equipped
with two natural transformations : idC T and : T 2 T such that the
diagrams of functors and natural transformations

T T
T3 / T2 T A / T2 o T T
AA }

AA }} (23)
T AA }}}
idT A  ~}} idT
 
T2 /T T

commute. Sometimes we write a monad as a tripe (T, , ).

Example 10.2 (Action of a Monoid?) If [M, , e] is a monoid in Set then


M : Set Set is a monad where the function x 7 (e, x) for x X defines
X , and the function (m1 , (m2 , x)) 7 (m1 m2 , x) for m1 , m2 M and x X
defines X .

Example 10.3 (Monads for Posets) closure operators

Theorem 10.4 Let F : C D and G : D C be functors. An adjunction


F G with unit and counit defines a monad (G F, , G F ) on C.

70
Proof: By naturality of for any B D the square
F GB
F GF GB / F GB

F G B B
 B 
F GB /B

commutes. By pre-composing with F and post-composing with G we obtain


the required square defined in ??. The triangles in ?? follow similarly from the
triangular identities.


10.2 Algebra for a Monad


Definition 10.5 (T -algebra) Suppose (T, , ) is a monad on C. An algebra
for T or T -algebra is an arrow : T A A in C such that the diagrams
A A
T2 A /TA AC
CC
/TA
CC (24)
T C
idA CC
  ! 
TA /A A

commute.

Definition 10.6 (Map of T -algebras) Let : T A A and : T B B be


T -algebras for a monad T on C. A map from to is an arrow f : A B in
C such that the diagram

Tf
TA /TB

(25)
 f 
A /B

commutes.

Proposition 10.7 (Eilenberg-Moore Category) Given a monad (T, , )


on C, there is a category C T where the objects are T -algebras and arrows are
maps of T -algebras
Proof: Left as an exercise.


Exercise 10.8 Verify the definition above gives a category.

71
There is a forgetful functor GT : C T C acting on objects and arrows

:TAA A
f
 / f
 
:TBB B.

The functor GT has a left adjoint F T : C C T defined by


F T (A) = A : T 2 A T A for A C; and
F T (f ) = T (f ) for f arr(C).

Exercise 10.9 Check that A : T 2 A T A is a T -algebra and that given an


arrow f : A B in C the arrow T (f ) is a map of T -algebras.

Proposition 10.10 There is an adjunction F T GT .


Proof: Since GT F T = T we can define the unit of the adjunction to be the
natural transformation defined by the monad. The square in the definition
of T -algebra 25 establishes tha any T -algebra : T A A is itself a map from
F T GT (A) = A : T 2 A T A to A. Moreover, this transformation is gives
rise to a natural transformation : F T GT idC T left as exercise. Now we
check that and satisfy the triangular identities:
the identity A in the definition of T -algebra gives GT GT = idGT ;
and
the identity A T A in the definition of monad gives F T F T = idF T .

Exercise 10.11 Prove that the collection of arrows h:T AA = i:T AAC T
is a natural transformation from F T GT to idC T .

Theorem 10.12 Every monad is defined by its T -algebras: the monad induced
by the adjunction F T GT is T istself.
Proof: From proposition 11.4 the adjunction F T GT with unit and counit
defines a monad (GT F T , , GT F T ). Clearly, GT F T = T and is the unit
of T . Given A C the component (GT F T )A = A .


Definition 10.13 A T -algebra isomorphic to F T (A) = A : T 2 A T A for


some A C is called a free T -algebra.

Proposition 10.14 (Kleisli Category) Given a monad (T, , ) on C the fol-


lowing definition gives a category:

72
ob(CT ) = ob(C),
CT (A, B) = C(A, T B),
for f CT (A, B) and g CT (B, C) the composition g f CT (A, C) is
defined to be C T g f C(A, T C), and
the identity idA CT (A, A) is A C(A, T A).
This is the Kleisli category defined by T and is written as CT .
Proof: That this definition gives indeed a category follows from the indentities
in the definition of monad and naturality; the details are left as exercise.


Exercise 10.15 Prove the proposition above.

Proposition 10.16 The full subcategory induced by the free subalgebras is


equivalent to CT .
Proof: Let Free T C T be the full subctegory where the objects are the free
T -algebras. Define the functor H : CT Free T as follows:
H(C) = C : T 2 C T C for C CT , and
H(f ) = D T (f ) for f CT (C, D).
That H(f ) is a T -algebras follows from naturality of and the identity T =
T in the definition of monad. Similarly we can show that H preserves
identities and composition defining indeed a functor.
By definition of Free T the functor H is esentially surjective . Moreover H is
full and faithful:
H is full: given map of T -algebras g : H(C) H(D) we have the arrow
g C : C T D in C sucht that

H(g C ) = D T g T C
= g C T C g is a T -algebra,
= g idT (C) by triangle in ??,
= g.

H is faithful: given f, g : C T D such that H(f ) = H(g), then

f = D T D f by triangle in (??),
= D T f C by naturality of ,
= D T g C by assumption H(f ) = H(g),
= D T D g by naturality of ,
=g by triangle in (??).

73
Therefore, H is an equivalence.

We have the diagram of categories and functors:

H
CT > / CT
FT }}} }
} }
}}}}
}} }}} GT
~}
C.

The equivalence H : CT Free T C T induces a functor S : Free T CT which


is an equivalence as well. Moreover by Proposition ?? there is an adjunction
S H.

Corollary 10.17 The functor GT H : CT C where H is the equivalence


from CT to the full subcategory of free algebras has a left adjoint. Furthermore
the monad defined by this adjunction is T .
Proof: By composing the adjunction S H with the adjunction obtained by
restricting F T GT to the full subcategory of free algebras we obtaine an
adjunction GT = FT = S F T GT H = GT see ??. By using the axioms in
the definition of Monad it easy to check that GT FT = T , since the unit and
counit of S H are natural isomorphisms we conclude that the monad given
by FT GT is indeed T .


74

You might also like