category theory - maths.tcd.ieormondca/notes/category theory.pdf · 4 outl : a b!a outr : a b!b inl...
TRANSCRIPT
Category TheoryCourse by Dr. Arthur Hughes, 2010
Typset by Cathal Ormond
1
Contents
1 Types, Composition and Identities 31.1 Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 Functional Laws . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Categories 52.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Functors 103.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.2 More Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.3 Examples of Functors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4 Universal Properties 134.1 Terminal Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.2 Duality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144.3 Initial Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144.4 Binary Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154.5 Examples of Binary Products . . . . . . . . . . . . . . . . . . . . . . . . . . 164.6 Binary Sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184.7 Examples of Binary Sums . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5 More on Functors 215.1 Covariant Hom Functor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.2 Covariant Hom Functor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.3 Subcategory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.4 Universal Morphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225.5 Natural Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235.6 Equivalence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235.7 The Functor Category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6 Yoneda Embeddings 256.1 The Yoneda Lemma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
A Supplementary Definitions 28A.1 Function and Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28A.2 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2
Chapter 1
Types, Composition and Identities
1.1 Programs
A program (function) f applied to an argument x is denoted f ·x or f(x). We will developsome notation before we continue:
• f ◦ g · x = f · (g · x)
• < f, g > ·x =< f · x, g · x >
• [f, g]· < t, x >={f · x if t = lg · x if t = r
We also define the following primitive functions:
• id · x = x
• outl · (x, y) = x
• outr · (x, y) = y
• inl · x =< l, x >
• inr · x =< r, x >
• zero · x = 0
• succ · x = x+ 1
The above notation is quite abstract, so we can think of them in familiar terms by usingset notation:
• If f : A→ B, then x ∈ A 7→ f · x ∈ B.
• If f : A→ B, g : B → C, then g ◦ f : A→ C.
• If f : T → A, g : T → B, then < f, g >: T → A×B.
• If f : A→ T, g : B → T , then [f, g] : A+B → T .
We can also consider the above defined functions in terms of set theory:
• id : A→ A
3
4
• outl : A×B → A
• outr : A×B → B
• inl : A→ A+B
• inr : B → A+B
• zero : 1→ N
• succ : N→ N
where 1 is the set containing one element, sometimes denoted {∗}. It is common to denotedsuch functions by what are called commuting diagrams. For example, we denote the factthat if f : A→ B, g : B → C then g ◦ f : A→ C by the following commuting diagram:
1.2 Functional Laws
We have a set of laws that apply to all programs/functions:
• Identity Law: If f : A→ B, then f ◦ idA = f : A→ B
• Identity Law: If f : A→ B, then idB ◦ f = f : A→ B
• Associativity Law: If f : A → B, g : B → C, h : C → D, then h ◦ (g ◦ f) =(h ◦ g) ◦ f : A→ D
• If A : T → A, g : T → B then outl ◦ < f, g >= f : T → A
• If A : T → A, g : T → B then outr ◦ < f, g >= g : T → B
• < outlA,B, outrA,B >= idA×B : A×B → A×B
We can represent the above by commuting diagrams:
A
f ��@@@@@@@idA // A
f
��B
A
f
��
f
@@@@@@@
BidB
// B
A
g◦f ��@@@@@@@f // B
g
��
h◦g
@@@@@@@
Ch// D
A
T<f,g>//
f;;xxxxxxxxx
g##FFFFFFFFF A×B
outl
OO
outr��B
A
A×BidA×B //
outl
99ssssssssss
outr%%KKKKKKKKKK A×B
outl
OO
outr��B
where we have combined the 4th and 5th conditions in the second last diagram.
We shall denote by (A ⇒ B) the set of all functions from A to B. We wish to sepa-rate the following two concepts:
• functional programs and their laws
• the meaning of functions as defined by their application.
For example, given f(x) = x2 we wish to differentiate between f and x2. We will usuallyconsider simply f and its properties. To do this, we use categories and functions, insteadof sets and mappings.
Chapter 2
Categories
2.1 Definitions
We define a Category C to contain the following data:
1. Obj(C), a class of objects.
2. Mor(C), a class called the morphisms of C.
3. dom, cod : Mor(C)→ Obj(C). For all f ∈ Mor(C), we call dom(f) the deomain of fand cod(f) the codomain of f .
4. id : Obj(C) → Mor(C). For all A ∈ Obj(C), id (A) = idA is called the identitymorphism for A.
5. ◦ : Mor(C) × Mor(C) ⇀ Mor(C) a partial function called composition. For f, g ∈Mor(C) we denote by f ◦ g the composite of g after f
subject to the following conditions:
• dom(idA) = A = cod(idA)
• g ◦ f ∈ Mor(C)⇔ cod(f) = dom(g)
• if g ◦ f is defined, then dom(g ◦ f) = dom(f) and cod(g ◦ f) = cod(g)
• if dom(f) = A and cod(f) = B, then idB ◦ f = f = f ◦ idA
• The associativity law holds on Mor(C)
We denote by C[A,B] or C(A,B) the class of morphisms from A to B. If for all A,B ∈Obj(C), C[A,B] is a set, then these sets are called homomorphism (or simply hom) sets.We have the followind definitions:
• A category C is called Small if Obj(C) is a set and for all A,B ∈ Obj(C), C[A,B] isa (hom) set.
• A category C is called Locally Small if for all A,B ∈ Obj(C), C[A,B] is a (hom)set.
• A category C is called Large if Obj(C) is not a set.
5
6
2.2 Examples
The following are large categories.
2.2.1 From Sets
• Set a category of sets, whose objects are sets and whose morphisms are mappingsbetween sets.
• Pfn a category of sets, whose objects are sets and whose morphisms are partialmappings between sets.
• Rel a category of sets and relations, whose objects are sets and whose morphismsare binary relations on the sets.
• Setf a category of sets, whose objects are finite sets and whose morphisms aremappings.
• Set∗ the category of pointed sets, whose objects are pairs of the form (A, ∗A) whereA is a set and ∗A ∈ A and whose morphisms are mappings f : A → B such thatf(∗A) = ∗B, called base point preserving.
• Set⊥ a category of sets, whose objects are sets which don’t contain ⊥ and whosemorphisms are mappings f : A ∪ {⊥} → B ∪ {⊥} such that f(⊥) =⊥, called ⊥-preserving .
2.2.2 Algrbraic Structures
• Graph the category of directed graphs, whose objects are directed graphs and whosemorphisms are graph morphisms.
• Mon the category of monoids, whose objects are monoids and whose morphisms aremonoid morphisms.
• Grp the category of groups, whose objects are groups and whose morphisms aregroup homomorphisms.
• Ab the category of Abelian Groups, whose objects are Abelian Groups and whosemorphisms are group homomorphisms.
• Rng the category of rings, whose objects are rings and whose morphisms are ringhomomorphisms.
• CRng the category of commutative rings, whose objects are commutative rings andwhose morphisms are ring homomorphisms.
• VectF the category of vector spaces, whose objects are vector spaces over the fieldF and whose morphisms are linear transformations.
• Pre the category of preorders, whose objects are preorders and whose morphismsare monotone (order preserving) mappings.
• Pos the category of posets, whose objects are posets and whose morphisms aremonotone mappings.
• M-Set the category of M actions, whose objects are actions on a fixed monoid Mand whose morphisms are M -action morphisms.
7
2.2.3 Topological Spaces
• Top a category of topological spaces, whose objects are topological spaces and whosemorphisms are continuous mappings.
• Toph a category of topological spaces, whose objects are topological spaces andwhose morphisms are homotopy classes of continuous mappings.
• Top∗ a category of topological spaces, whose objects are topological spaces withbase points and whose morphisms are base point preserving continuous mappings.
Isomorphism
A morphism f ∈ C[A,B] is called an Isomorphism if there exists some g ∈ C[A,B] suchthat g ◦ f = idA and f ◦ g = idB. We call g the inverse for f sometimes denoted f−1, andalso say that A and B are isomorphic, denoted A ∼= B.
2.2.4 Proposition
If g1, g2 ∈ C[A,B] are inverses for f ∈ C[A,B], then g1 = g2
Proof
g1 = g1 ◦ idB = g1 ◦ (f ◦ g2) = (g1 ◦ f) ◦ g2 = idA ◦ g2 = g2
2.2.5 Proposition
Identity morphisms are isomorphisms
Proof
This follows directly from the definitions of isomorphism and identity.
2.2.6 Proposition
The composition of two isomorphisms is an isomorphism.
Proof
Let f and g be isomorphisms with inverses f−1 and g−1 respectively. We’ll show that(g ◦ f)−1 = f−1 ◦ g−1.
(g ◦ f)−1 = f−1 ◦ g−1 ⇔ (g ◦ f) ◦ f−1 ◦ g−1 = id⇔ g ◦ (f ◦ f−1) ◦ g−1 = id⇔ g ◦ id ◦ g−1 = id⇔ g ◦ g−1 = id
the last statement of which is clearly true. The other direction, i.e. showing that(f ◦ g)−1 = g−1 ◦ f−1 follows similarly.
The following are small categories.
• Given a preorder P = (P,�), the objects are elements of P and the morphisms aregiven by f : x→ y exists iff x � y.
8
• Given a set S, the objects are elements of S and the morphisms are simply theidentity morphisms.
• Given a monoid M =< M, ∗, u >, the objects are the single object F and themorphisms are the mappings x :F→F for all x ∈M
• Given a graph G =< N,E, s, t >, the objects are the nodes in N and the morphismsare paths between nodes.
• 0 the empty category, graph with no objects and no morphisms, generated from theempty graph.
• 1 the trivial category containing one object and the identity mapping, generatedfrom a graph with one node and no edges.
• 2 the category containing two points and three mappings (two identity mappings)generated from the graph with two nodes and one edge.
• � the category with one object and one mapping, generated from a graph with onenode and one edge.
A function Rwhich assigns to each pair A,B in a category C a binary relation RA,B onthe hom class C[A,B] is called a congruence or relation on C if:
• for all A,B ∈ Obj(C), RA,B is a reflexive, symmetric and transitive relation onC[A,B].
• for all A,B,A′, B′ ∈ Obj(C) and for all f, f ′ ∈ C[A,B], g ∈ C[A,A′], h ∈ C[B,B′] wehave fRA,Bf ′ ⇒ (h ◦ f ◦ g)RA′,B′(h ◦ f ′ ◦ g)
2.2.7 Proposition
Given any function R which assigns to each pair A,B in a category C a binary relationRA,B on the hom class C[A,B], then there exists a least congruence R′ on C with R ⊆ R′.
Quotient category
Given a category C and a function R which assings to each pair A,B in a category C abinary relation RA,B on the hom class C[A,B], then there exits a Quotient categoryC/R whose objects are objects of the category C and whose objects are the hom classes(C/R)[A,B] := C[A,B]/R′A,B, where R′A,B is the least congruence of C containing R.
Dual Category
Given a category C, we define the Dual category, denoted Cop, by
• Obj(Cop) = Obj(C)
• for all A,B ∈ Obj(C), Cop[A,B] := C[B,A]
• domop(f) = cod(f) and codop(f) = dom(f)
• idopA = idA
• f ◦op g := g ◦ f
9
Product Category
Given categories C,D, we define the Product category, denoted C × D, by
• Obj(C × D) = Obj(C)×Obj(D)
• for all A,A′ ∈ Obj(C) and B,B′ ∈ Obj(D) we define C ×D[< A,B >,< A′, B′ >] :=C[A,A′]× C[B,B′]
• domC×D(< f, g >) :=< domC(f), domD(g) >, codC×D(< f, g >) :=< codC(f), codC(g) >
• id<A,B> :=< idA, idB >
• < g, g′ > ◦ < f, f ′ >:=< g ◦ f, g′ ◦ f ′ >
Slice Category
Given a category C and an element X ∈ Obj(C), then we define the Slice category overX, denoted C/X, by
• Objects: pairs < A, f > where A ∈ Obj(C) and f ∈ C[A,X]
• Morphisms: mappings h :< A, f >→< A′, f ′ > where h : A → A′ is a morphism inC and f = f ′ ◦ h
Chapter 3
Functors
3.1 Definitions
A (covariant) Functor F : C → D between categories C and D consists of an objectmapping FObj : Obj(C) → Obj(D) and a morphism mapping F : Mor(C) → Mor(D) suchthat
• for all f ∈ Mor(C), we have dom(F (f)) = FObj(dom(f)) and cod(F (f)) = FObj(cod(f)),
• for all A ∈ Obj(C), we have F (idA) = idFObj(A)
• for all A,B,C ∈ Obj(C) and for all f ∈ C[A,B], g ∈ C[B,C], we have F (g ◦ f) =F (g) ◦ F (f).
Usually, the subsript Obj is dropped when the meaning is clear. Equivalently, we have a(covariant) functor F : C → D consists of a function F : Obj(C) → Obj(D) and a familyof functions F [A,B] : C[A,B] → D[F (A), F (B)] induced by pairs < A,B > of objects ofC such that
• for all A ∈ Obj(C), we have F [A,A](idA) = idF (a)
• for all A,B,C ∈ Obj(C) and for all f ∈ C[A,B], g ∈ C[B,C] we have F [A,C](g◦A,B,Cf) = F [B,C](g) ◦F (A),F (B),F (C) F [A,B](f)
3.2 More Definitions
• Given functors F : C → D and G : D → E , we define the Composite functorG ◦ F : C → E by the following:
A
f
��
G(F (A))
G(F (f))
��
� //
B G(F (B))
10
11
• Given a category C, the Identity functor on C denoted idC : C → C is given by
A
f
��
A
f
��
� //
B B
• We denote by Cat the category of small categories and functors between smallcategories.
• We denote by CAT the “category” of categories and functors between categories.
• A functor F : Cop → D is called a Contravariant functor.
3.3 Examples of Functors
• We have the inclusion functor which, for example, maps Set to Pfn or Pfn to Rel.
• ∗ : Pfn→Set∗ with f 7→ f∗, where f∗(x) =
f(x) if x ∈ A, x ∈ dom(f)∗B if x ∈ A, x /∈ dom(f)∗B x = ∗A
for
mappings of the form f : A→ B.
• D :Set∗ →Pfn with f 7→ Df , where dom(Df) := {x ∈ A | x 6= ∗A, f(x) 6= ∗B} and(Df)(x) = f(x) for all x ∈ dom(Df), where f :< A, ∗A >→< B, ∗B >
• U :Mon→Set which is a forgetful functor (it “forgets” the monoid structure andjust gives a set).
• V :Cat→Graph, a forgetful functor given by:
< Obj(C),Mor(C),domC , codC , idC , ◦ >
F
��
< Obj(C),Mor(C),domC , codC >
V (F )
��
� //
< Obj(D),Mor(D),domD, codD, idD, ◦ > < Obj(D),Mor(D), domD, codD >
• ∗ :Graph→Cat, a free functor given by
< N,E, s, t >
h
��
< N,P (E), s, t, id, ◦ >
f
��
� //
< N ′, E′, s′, t′ > < N ′, P (E′), s′, t′, id′, ◦ >
where we define
– P (E) := {e1, . . . , en | t(ei) = s(ei+1), 1 ≤ i ≤ n} ∪ {idA | A ⊆ N}, where theidentity element is interpreted as the empty word.
12
– composition to be the concatenation for the paths which join head to tail.
– h∗ : G∗ → H∗ is a functor between categories defined by:
a ∈ N
e1e2···en
��
hn(a) ∈ N ′
h∗(e1e2···en):=he(e1)···he(en)
��
� //
b ∈ N hn(b) ∈ N ′
• I :AbMon→Mon an inclusion functor, which is the identity mapping on the objectsof AbMon, and where AbMon[A,A′] ⊆Mon[A,A′]
• U :M-Set→Set, a forgetful functor.
Given a monoid M =< M, �, u >, we can also consider two functors in the reverse orderto the last example:
• ∗Set→M-Set, a free functor given by the following commutative diagram
A
f
��
< M ×A, δ∗ : M × (M ×A)→M ×A >
f∗:=idM×f
��
� //
B < M ×B, δ∗ : M × (M ×B)→M ×B >
where for all m,m′ ∈ M,a ∈ A, b ∈ B we define δ∗(m, (m′, a)) := (m �m′, a) andδ∗(m, (m′, b)) := (m �m′, b)
• ∗Set→M-Set, a free functor given by the following commutative diagram
A
f
��
< M ⇒ A, δ∗ : M × (M ⇒ A)→M ⇒ A >
f∗:=idM×f
��
� //
B < M ⇒ B, δ∗ : M × (M ⇒ B)→M ⇒ B >
where for all m,m′ ∈ M,f ∈ M ⇒ A, g ∈ M ⇒ B we define [δ∗(m, f)](m′) :=f(m �m′) and [δ∗(m, g)](m′) := g(m �m′)
Chapter 4
Universal Properties
4.1 Terminal Object
A terminal object in a category C is an object 1 such that for all A ∈ Obj(C) thereexists a unique morphism from A to 1, i.e. C[A, 1] contains one object. We’ll denote thisunique isomorphism by <>A.
4.1.1 Proposition
If 1 and 1′ are terminal objects of a category C, then there exists a unique isomorphismfrom 1 to 1′.
Proof
As 1 is terminal, there exists a unique <>1: 1 → 1′. Similarly, as 1′ is terminal, thereexists a unique <>1′ : 1′ → 1. Note that the only element in C[1, 1] is id1 and the onlyelement in C[1′, 1′] is id1′ . However, <>1′ ◦ <>1: 1→ 1 and <>1 ◦ <>1′ : 1′ → 1′, so <>1
and <>1′ must be isomorphisms.
4.1.2 Proposition: Reflection Law
<>1= id1
Proof
<>1= id1 iff id1 : 1→ 1, which is true.
4.1.3 Proposition: Fusion Law
If f ∈ C[A,B], then <>B ◦f =<>A
Proof
<>B ◦f =<>A iff <>B ◦f : 1→ 1, which is true.
13
14
4.2 Duality
Let S(C) be a statement about the objects and morphisms of a catagory C. Then wecan form, by reversing the direction of all the morphisms in S(C), another statementSop(C) = S(Cop) about C.
4.2.1 Proposition
For all C ∈Obj(CAT), S(C) is equivalent to for all ∈Obj(CAT), Sop(C).
Proof
For all C, we have S(C) ⇒ S(Cop) ⇔ Sop(C). Similarly, for all C, we have Sop(C) ⇒Sop(Cop)⇔ S((Cop)op)⇔ S(C).
The question arises: what is the dual statement to the terminal object?
4.3 Initial Object
An Initial Object in a category C is an object 0 such that for all A ∈ Obj(C) thereexists a unique morphism from 0 to A, i.e. C[0, A] contains one object. We’ll denote thisunique isomorphism by [ ]A.
The first following three propositions now follow by duality.
4.3.1 Proposition
If 0 and 0′ are terminal objects of a category C, then there exists a unique isomorphismfrom 0 to 0′.
4.3.2 Proposition: Reflection Law
[ ]0 = id0
4.3.3 Proposition: Fusion Law
If f ∈ C[A,B], then f ◦ [ ]A = [ ]B
4.3.4 Proposition
The empty category 0 is an initial object in Cat.
4.3.5 Proposition
The trivial category 1 is a terminal object in Cat.
4.3.6 Proposition
The empty set ∅ is an initial object in Set.
15
4.3.7 Proposition
The singleton set {∗} is a terminal object in Set.
4.4 Binary Product
A Binary Product of two objects A,B in a category C is specified by
• an object A×B of Obj(C)
• two projection morphisms outl: A×B → A and outr: A×B → B
such that the following diagram commutes
T
f
����������������
∃!<f,g>
��
g
��66666666666666
A A×Boutloo
outr// B
We say that a category has binary products if a binary product exists for all pairs ofobjects.
4.4.1 Proposition
If < P, outl, outr > and < P ′, outl′, outr′ > are binary product for the objects A,B of acategory C, then there exists a unique isomorphism h : P → P ′ such that outl = outl′ ◦ hand outr = outr ◦ h.
Proof
As < P ′, outl′, outr′ > is a binary product, we know that there exists some unique <outl′, outr′ >: P ′ → P such that
outl′ = outl ◦ < outl′, outr′ >
andoutr′ = outr ◦ < outl′, outr′ >
Similarly, as < P, outl, outr > is a binary product, we know that there exists some unique< outl, outr >: P → P ′ such that
outl = outl′ ◦ < outl, outr >
andoutr = outr′ ◦ < outl, outr >
16
We will show that the following diagram commutes:
P
outl
��~~~~~~~~~~~~~~~~
outr
��@@@@@@@@@@@@@@@@
<outl,outr>
��A P ′
outl′oo outr′ //
<outl,outr>
��
B
P
outl
__@@@@@@@@@@@@@@@@
outr
??~~~~~~~~~~~~~~~~
As per above, from outl′ = outl ◦ < outl′, outr′ > and outl = outl′ ◦ < outl, outr >, weconclude that
outl ◦ < outl′, outr′ > ◦ < outl, outr >= outl
and so< outl′, outr′ > ◦ < outl, outr >= idP
Using similar logic, but in the other direction, we can show that < outl, outr > ◦ <outl′, outr′ >= idP ′ also. Thus, < outl, outr > and < outl′, outr′ > must be isomorphisms.
4.4.2 Proposition: Reflection Law
< outl, outr >= idA×B
4.4.3 Proposition: Fusion Law
< f, g > ◦h =< f ◦ h, g ◦ h >
4.5 Examples of Binary Products
4.5.1 Set
Let A and B be sets.
• A×B := {< a, b > | a ∈ A, b ∈ B}
• outl < a, b >= a
• outr < a, b >= b
4.5.2 Mon
Let < M, ∗, u > and < M ′, ∗′, u′ > be monoids.
• M×M ′ :=< M×M ′, �, < u, u′ >>, where < m,m′ > � < n, n′ >=< m∗n,m′∗′n′ >.
• outl < m,n >= m
• outr < m,n >= n
17
4.5.3 Cat
Let C and D be monoids.
• C × D is the product category.
• outl(< f, g >:< A,B >→< C,D >) = (f : A→ C)
• outl(< f, g >:< A,B >→< C,D >) = (g : B → D)
4.5.4 Pos
If C, P,�> is a category defined by a poset, then a binary product exists iff the poset hasa greatest lower bound for all pairs of elements p, q ∈ P
• p× q := u{p, q} := p u q
• outl : p u q → p if p u q = p
• outl : p u q → q if p u q = q
4.5.5 Proposition
If C is a category with a specified binary product, then × C × C → C given by
(A,B)
(f,g)
��
A×B
f×g=<f◦outl ,g◦outr >
��
� //
(A′, B′) A′ ×B′
is a bifunctor.
Proof
We need to show the following
• for all f, g ∈ Mor(C), dom(f×g) =dom(f)×dom(g) and cod(f×g) =cod(f)×cod(g)
• for all A,B ∈ Obj(C), idA × idB = idA×B
• for all A,A′, A′′, B,B′, B′′ ∈ C and f ∈ C[A,A′], f ′ ∈ C[A′, A′′], g ∈ C[B,B′], g′ ∈C[B′B′′], we have (f ′ ◦ f)× (g′ ◦ g) = (f ′ × g′) ◦ (f ◦ g)
The first part follows directly from the definitions. The second part is true by noting that
idA × idB =< idA ◦ outl , idB ◦ outr >=< outl , outr >= idA×B
the last part of which follows by the reflection law. To show the final part, we note thefollowing proposition
4.5.6 Proposition: The Absorbtion Law
(f × g)◦ < p, q >=< f ◦ p, g ◦ q >
18
Proof
(f×g)◦ < p, q >=< f◦outl , g◦outr > ◦ < p, q >=< f◦outl ◦p, g◦outr ◦q >=< f◦p, g◦q >
Thus, our previous proposition follows thus:
(f ′×g′)◦(f◦g) = (f ′×g′)◦ < f◦outl , g◦outr >= (f ′◦f◦outl , g′◦g◦outr) = (f ′◦f)×(g′◦g)
4.5.7 Proposition
If C is a category with binary products and with a terminal object, then the followingnatural isomorphisms exist for all A,B,C ∈ C:
unitA : A× 1→ AswapA,B : A×B → B ×AassocA,B,C : (A×B)× C → A× (B × C)
4.5.8 Proposition
A binary product of objects A,B in a category C is a terminal object in the span[A,B](C)of spans over A and B:
• Objects: pairs of morphisms from C with a common source, i.e. (f, g) where
A Tfoo g // B .
• m : (f, g)→ (f ′, g′) where m : T → T ′ is a morphism on C such that f ′ ◦m = f andg′ ◦m = g.
4.6 Binary Sum
A Binary Sum of objects A,B in a category C is specified by
• an object A+B of C with
• two injective morphisms inl : A→ A+B and inr : B → A+B
such that the following diagram commutes:
Ainl //
f
��66666666666666 A+B
[f,g]
��
Binroo
g
����������������
T
Note that this is the dualized idea of binary products. This gives us the following propo-sitions.
4.6.1 Proposition: Reflection Law
[inl, inr] = idA+B
19
4.6.2 Proposition: Fusion Law
h ◦ [f, g] = [h ◦ f, h ◦ g]
4.7 Examples of Binary Sums
4.7.1 Set
Let A and B be sets.
• A+B := A ]B := ({l} ×A) ∪ ({r} ×B)
• inl(a) = (l, a)
• inr(b) = (r, b)
4.7.2 Mon
Let M =< M, ∗, u > and M ′ =< M ′, ∗′, u′ > be monoids, and define (A+ B)∗ to be theset of finite sequences of elements from the set A+B
• M + M ′ :=< (M + M ′)∗/ ∼, ·, [ε] >, where · is the concatenation operation i.e.[(x, . . . , y)] · [(x′, . . . , y′)] = [(x, . . . , y, x′, . . . , y′)], [ε] is the empty word and ∼ is theleast equivalence relation such that
– u ∼ ε and ε ∼ u′
– (. . . , a, a′, . . . ) ∼ (. . . , a ∗ a′, . . . ) for all a, a′ ∈M ,
– (. . . , b, b′, . . . ) ∼ (. . . , b ∗′ b′, . . . ) for all b, b′ ∈ B
• inl(a) = [(a)]
• inr(b) = [(b)]
in the above, what we means by the least equivalence relation is the equivalence relation∼ given by:
∼Al //r//� _
��
< A∗,_ , ε >[ ]∼A //
inl
��
< A∗/∼A , ◦, [ε] >∼= //
inl
��
< A, ∗, u >
∼ l//r// < (A+B)∗,_ , ε >
[ ]∼ // < (A+B)∗/∼A , ◦, [ε] >
∼Bl //r//?�
OO
< B∗,_ , ε >[ ]∼B //
inr
OO
< B∗/∼B , ◦, [ε] >∼= //
inr
OO
< B, ∗, u >
20
Example: Graph
IfG is a directed graph, G∗ is the underlying graph of the path category overG, H ∈Obj(Cat)and H is the underlying graph of the category H, then we have the following:
G ηG
//
f BBBBBBBB G∗
∃!f̃��H
G∗
∃!f̃��H
If we are given f : (A, ∗, u)→ (M, ∗′′, u′′) and g : (B, ∗′, u′)→ (M, ∗′′, u′′), then we want toconstruct a unique h : ((A+B)∗/∼, ·, [ε])→ (M, ∗′′, u′′) such that h = h◦inl and g = h◦inr.
Step 1
In Set, we have
Ainl //
f
��66666666666666 A+B
∃![f,g]
��
Binloo
g
����������������
M
Step 2
In Set and then in Mon, we have
(A+B)ηA+B //
[f,g]&&MMMMMMMMMMM
(A+B)∗
∃! ˜[f,g]��M
((A+B)∗,_ , ε)
∃! ˜[f,g]��
(M, ∗′′, u′′)
4.7.3 Step 3
x ∈ ul//r// ((A+B)∗,_ , ε)
˜[f,g] ))SSSSSSSSSSSSSS
[]∼ // ((A+B)∗/∼, ·, [ε])
∃!h��
(M, ∗′′, u′′)
Chapter 5
More on Functors
5.1 Definition: Covariant Hom Functor
Given a fixed object A of a catagory C the Covariant Hom Functor is a mappingC[A,+] = HA
+ : C →Set such that
B
g
��
h ∈ C[A,B]
C[A,g]=HAg
��
� //
B′ C[A,B′]
where C[A, g] = HAg is given by HA
g (h) = g ◦ h.
5.2 Definition: Covariant Hom Functor
Given a fixed object B of a catagory C the Contravariant Hom Functor is a mappingC[−, B] = H−B : Cop →Set such that
A
Fop
��
h ∈ C[A,B]
C[Fop,B]=HFop
B
��
� //
A′ C[A′, B]
where C[Fop, B] = HFop
B is given by HB(h) = h ◦ Fop.
5.3 Definition: Subcategory
C is called a Subcategory of D if there exists an inclusion functor I : C → D such thatI(f : A→ B) = (f : A→ B).
5.3.1 Definition: Faithful
A functor F : C → D is called Faithful if the morphism mapping of the functor isinjective.
21
22
5.3.2 Definition: Full
A functor F : C → D is called Full if the morphism mapping of the functor is surjective.
5.3.3 Definition: Isomorphic
Two categories C and D are said to be isomorphic, denoted C ∼= D if there exist mappingsF : C → D and G : D → C such that F ◦G = idC and G ◦ F = idD.
5.4 Universal Morphism
If G : X → A is a functor and A ∈ A is an object, then a universal morphism is a pair< A∗, η : A→ G(A∗) > consisting of an object A∗ ∈ X and a morphism η : A→ G(A∗) ofA such that to every pair < X, f : A→ G(X) > with X ∈ X an object and f a morphismof A, there exist a unique mapping [f ] : A∗ → X with G([f ]) ◦ η = f , i.e.
X G // A
A∗
∃![f ]
��
Aη //
f
""EEEEEEEEEEEEEEEEEEE G(A∗)
∃!G([f ])
��X G(X)
5.4.1 Example: U :Mon → Set
Let A be a set, define η(a) =< a > and f(a) = 1 for all a ∈ A, we have
Aη //
f ))RRRRRRRRRRRRRRRRR U(< A∗,_ , u >)
∃!U(L)��
U(< N,+, 0 >)
< G∗,_ , ε >
L��
< N,+, 0 >
where L is the length mapping.
5.4.2 Example: U :Graph → Cat
Let G be a graph and H be a small category. Then, we have
GηG //
f ''OOOOOOOOOOOOO U(G∗)
∃!U([h])
��U(H)
G∗
L��H
23
5.4.3 Example: U :Mon → Set
Let A be a set, define η(a) =< a > and f(a) = 1 for all a ∈ A, we have
Aη //
f ))RRRRRRRRRRRRRRRRR U(< A∗,_ , u >)
∃!U(L)
��U(< N,+, 0 >)
< G∗,_ , ε >
L��
< N,+, 0 >
where L is the length mapping.
5.4.4 Example: Diagonal Functor
Let 4 : C × C → C be the functor given by 4(A,A) = A, called the diagonal functor.Then we have:
(A,B)(inl,inr) //
(f,g) ((RRRRRRRRRRRRRRR 4(A+B)
∃!4([f,g])
��4(T )
A+B
[f,g]
��T
5.5 Natural Transformations
Given categories C andD and two functors F,G : C → D, we define a Natural Transformationdenoted
ψ : F →• G : C → D
as a collection φ = {φA : F (A) → G(A) | A ∈ obj(C)} of morphisms of D indexed byobjects of C such that for all f(: A→ B) ∈ Mor(C), we have
F (A)φA //
F (f)
��
G(A)
G(f)
��F (B)
φB
// G(B)
C F //
• φ
��
D
CG
// D
The morphism φA is called the component of φ. A natural transformation φ : F →• G :C → D is called an Isomorphism if φA is an isomorphism for all A ∈ Obj(C).
5.6 Equivalence
We say that two categories C and D are Equivalent if there exists two functors F,G :C → D together with two natural isomorphisms ε : FG→•∼= idD and η : idC →•∼= GF .
5.7 The Functor Category
Let C and D be two categories. The Functor Category usually denoted [C, ] or DC isgiven by:
24
• The objects are functors from C to D
• The morphisms are natural transformations between functors
• We define
dom(α : F →• G : C → D) = F : C → Dcod(α : F →• G : C → D) = G : C → D
• We define the identity transformation on a functor F as
idF = {idF (A) : F (A)→ F (A) | A ∈ Obj(C)}
• We define the composition of two natural transformations α : F →• G and β : G→•H as the mapping β ◦ α : F →• H, where
β ◦ α = {(β ◦ α)A = βA ◦ αA : F (A)→ H(A) | A ∈ Obj(C)}
Chapter 6
Yoneda Embeddings
Let C be a locally small category, and define H− : Cop → [C, Set ] as follows:
A
fop
��
C[A,+] = HA+
Hfop
��
� //
A′ C[A′,+] = HA′+
where Hfop: HA
+ →• HA′+ : C → Set is defined for all (g : B → B′) ∈ Mor(C) as
HAB
Hfop
B //
HAg
��
HA′B
HA′g
��HAB′
Hfop
B′
// HA′B′
6.1 The Yoneda Lemma
Let C be a locally small category, F : C → Set a functor and A ∈ Obj(C). The collectionnat[HA
+ , F ] of natural transformations α : HA+ →• F is a set, so we may define a functor
Nat[H−,+] : C × [C, Set ]→ Set given by
< A,F >
<f,µ>
��
Nat[HA+ , F ]
Nat[Hf ,µ]
��
� //
< A′, F ′ > Nat[HA′+ , F ′]
25
26
where we define Nat[Hf , µ] = (Nat[H−,+]) < f, µ >. We can also define the eval functor,namely ev : C × [C, Set ]→ Set as
< A,F >
<f,µ>
��
F (A)
ev<f,µ>
��
� //
< A′, F ′ > F (A′)
where for all x ∈ F (A), we have
(ev < f, µ >)(x) = [F ′(f) ◦ µA](x) = [µA′ ◦ F (f)](x)
There exists natural ismorphisms Φ : Nat[H−,+]↔• ev : Ψ such that for all A ∈ Obj(C)and F : C → Set, we have
Φ<A,F> : Nat[HA, F ]↔•∼= F (A) : Ψ<A,F>
6.1.1 Proof
Part A
We’ll show that for all A ∈ Obj(C), F : C → Set, we have Nat[HA+ , F ] ∈ Set by showing
that there exists a bijection from Nat[HA+ , F ]→ F (A). For all α : HA
+ →• F , we have
Φ<A,F> = αA(idA)
Also, for all a ∈ F (A), B ∈ Obj(C), f ∈ HAB , we have
Ψ<A,F>(a) = [F (f)](a)
We need to show that Ψ<A,F>(a) ∈ Nat[HA+ , F ], namely for all (g : B → B′) ∈ Mor(C) we
have
HAB
Ψ<A,F>(a)B //
HAg
��
F (B)
F (g)
��HAB′ Ψ<A,F>(a)B′
// F (B′)
We note the following:
(F (g) ◦Ψ<A,F>(a)B)(f) = F (g)(Ψ<A,F>(a)B(f))= F (g)(F (f(a))= [F (g) ◦ F (f)](a)= [F (g ◦ f)](a)= [F (HA
g (f))](a)= Ψ<A,F>(a)B′(HA
g (f))= (Ψ<A,F>(a)B′ ◦HA
g )(f)∈ Nat[HA
+ , F ]
27
We now wish to show that
Ψ<A,F> ◦ Φ<A,F> = idNat[HA+ ,F ] Φ<A,F> ◦Ψ<A,F> = idF (A)
For all α ∈ Nat[HA+ , F ], B ∈ C, f ∈ HA
B , we have the following:
(Ψ<A,F> ◦ Φ<A,F>)(α) = Ψ<A,F>(Φ<A,F>(α))= Ψ<A,F>(αA(idA))= F (f)(αA(idA))= (F (f) ◦ αA)(idA)= (αB ◦HA
f )(idA)= αB(HA
f (idA))= αB(f ◦ idA))= αB(f)= α
Also, note that for all a ∈ F (A), we have
(Φ<A,F > ◦Ψ<A,F>)(a) = Φ<A,F > (Ψ<A,F>(a))= Ψ<A,F > (a)A(idA)= F (idA)(a)= idF (A)(a)= a
And so, we have that there exists an isomorphism between F (A) and Nat[HA+ ] for all
A ∈ Obj(C).
6.1.2 Part B
We now wish to show that above-defined morphism actually defined a natural morphism,i.e. we want the following diagram to commute:
< A,F >
<f,µ>
��
Nat[HA+ , F ]
Nat[Hfop,µ]
��
Φ<A,f> // ev < A,F >= F (A)
ev<f,µ>
��
� //
< A′, F ′ > Nat[HA′+ , F ′]
Φ<A,f> // ev < A,F >= F (A)
28
For all α ∈ Nat[HA+ , F ], we have the following:
(Ψ<A′,F ′> ◦Nat[Hfop
+ , µ])(α) = Ψ<A′,F ′>(Nat[Hfop
+ , µ](α))= Ψ<A′,F ′>(µ ◦ α ◦Hfop
+ )= (µ ◦ α ◦Hfop
+ )A′(idA′)= (µA′ ◦ αA′ ◦Hfop
A′ )(idA′)= (µA′ ◦ αA′)(Hfop
A′ (idA′))= (µA′ ◦ αA′)(idA′ ◦ f)= (µA′ ◦ αA′)(f)= (µA′ ◦ αA′)(f ◦ idA)= (µA′ ◦ αA′)(HA
f (idA))= (µA′ ◦ αA′ ◦HA
f )(idA)= (µA′ ◦ F (f) ◦ α′A)(idA)= (F ′(f) ◦ µA ◦ α′A)(idA)= (F ′(f) ◦ µA)(α′A(idA))= ev < f, µ > (α′A(idA))= ev < f, µ > (Φ<A,F>(α))= (ev < f, µ > ◦Φ<A,F>)(α)
Thus, we have shown that there exists a natural transformation from Nat[H−,+] to evwhose components are isomorphisms. Hence, result. �
We note that the Yoneda embedding y : Cop → [C, Set ] is both full and faithful, bynoting that for all A,A′ ∈ Obj(C), we have
[C,Set][y(A), y(A′)] = Nat[HA+ , H
A′+ ]
∼= ev < A,HA′+ >
= HA′+ (A)
= HA′A
= C[A,A′]∼= Cop[A,A′]
as required.
Appendix A
Supplementary Definitions
A.1 Function and Classes
A.1.1 Single Valued
Given a function f : A → B we let R be the set of all pairs (a, b) such that f(a) = b fora ∈ A, b ∈ B. We say that f is Single Valued, if (a, b), (a′, b′) ∈ R and a = a′, thenb = b′.
A.1.2 Totally Defined
Given a function f : A → B we let R be the set of all pairs (a, b) such that f(a) = b fora ∈ A, b ∈ B. W say that f is Totally Defined, if {a ∈ A | ∃ b ∈ Bs.t.(a, b) ∈ R} = A.
A.1.3 Mapping
A Mapping is a single-valued, totally defined function.
A.1.4 Partial Mapping
A Partial Mapping is a single-valued function.
A.1.5 Relation
A Relation is a function between sets.
A.2 Structures
A.2.1 Directed Graph
A Graph G is a quadruple < N,E, s, t > where E is a set of edges of the graph, N is aset of nodes of the graph and s, t : E → N are the source and target mappings.
A Graph Morphism h : G → G′ is a quadruple < G, hn, he, G′ > where hn : N → N ′
and he : E → E′ are mappings such that hn ◦ s = s′ ◦ he and hn ◦ t = t′ ◦ he. In other
29
30
words, the following diagrams commute:
Ehe //
s
��
E
s′
��N
hn
// N
Ehe //
s
��
E
s′
��N
hn
// N
A.2.2 Monoid
A Monoid is a triple < M, ∗, u > where M is a set, ∗ : M ×M → M is an associativebinary operation and u is a unit (identity) for the operation.
Examples of monoids are:
• < N,+, 0 >
• < N0,×, 1 > where N0 = N \ {0}
• < P(A),∪,∅ >
• < P(A),∩, A >
• < Set[A,A], ◦, idA >
Note that a morphism between monoids h : M →M ′ is an operation preserving mappingwhich maps the unit to the unit. In other words, the following diagrams commute:
M ×M ∗ //
h×h��
M
h��
M ×M∗′
//M
1 e //
e′ ��@@@@@@@@ M
h��M
A.2.3 Preorder
A Preorder is a pair (P,�) where P is a set and � is a reflexive and transitive binaryrelation.
A.2.4 Poset
A Poset (partially ordered set) is a preorder whose binary relation is also anti-symmetric.
A.2.5 Bounds
Let < P,�> be a poset and S ⊆ P . Then an element z ∈ P is called a
• Lower Bound of S if for all s ∈ S, z � s.
• Greatest Lower Bound of S if for all lower bounds y of S, y � z. This issometimes denoted uS
• Upper Bound of S if for all s ∈ S, s � z.
• Least Upper Bound of S if for all lower bounds y of S, z � y. This is sometimesdenoted tS
31
A.2.6 M-Action
An M-action on a fixed monoid M =< M, ∗, u > is a pair < S, δ > where S is a set ofstates and δ : M × S → S is a mapping such that for all x, y ∈ M and s ∈ S, we haveδ(x∗y, s) = δ(x, δ(y, s)) and δ(u, s) = s. In other words, the following diagrams commute:
(M ×M)× S ∼=//
∗×idS
��
M × (M × S)idM×δ //M × S
δ
��M × S S // S
S∼= //
idS))TTTTTTTTTTTTTTTTTTTT 1× S
u×idS//M × Sδ��S