Category Theory
Total Page:16
File Type:pdf, Size:1020Kb
Category Theory Course by Dr. Arthur Hughes, 2010 Typset by Cathal Ormond 1 Contents 1 Types, Composition and Identities 3 1.1 Programs . 3 1.2 Functional Laws . 4 2 Categories 5 2.1 Definitions . 5 2.2 Examples . 6 3 Functors 10 3.1 Definitions . 10 3.2 More Definitions . 10 3.3 Examples of Functors . 11 4 Universal Properties 13 4.1 Terminal Object . 13 4.2 Duality . 14 4.3 Initial Object . 14 4.4 Binary Product . 15 4.5 Examples of Binary Products . 16 4.6 Binary Sum . 18 4.7 Examples of Binary Sums . 19 5 More on Functors 21 5.1 Covariant Hom Functor . 21 5.2 Covariant Hom Functor . 21 5.3 Subcategory . 21 5.4 Universal Morphism . 22 5.5 Natural Transformations . 23 5.6 Equivalence . 23 5.7 The Functor Category . 23 6 Yoneda Embeddings 25 6.1 The Yoneda Lemma . 25 A Supplementary Definitions 28 A.1 Function and Classes . 28 A.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 develop some notation before we continue: • f ◦ g · x = f · (g · x) • < f; g > ·x =< f · x; g · x > f · x if t = l • [f; g]· < t; x >= g · 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 using set notation: • If f : A ! B, then x 2 A 7! f · x 2 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 denoted such functions by what are called commuting diagrams. For example, we denote the fact that 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: idA f A / A A A / B A A @ @ @ @ ; O s9 O @ @ f @ @ h◦g f xx outl ss @@ f f @@ @@ g @@ xx ss @ @ @ @ x outl ss outl f @@ @@ g◦f @@ @@ xx ss xx<f;g> s idA×B B B / B C / D T / A × B A × B / A × B idB h FF KK FF KK FF outr KK outr g FF outr KK F# KK B % 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 usually consider simply f and its properties. To do this, we use categories and functions, instead of 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 2 Mor(C), we call dom(f) the deomain of f and cod(f) the codomain of f. 4. id : Obj(C) ! Mor(C). For all A 2 Obj(C), id (A) = idA is called the identity morphism for A. 5. ◦ : Mor(C) × Mor(C) * Mor(C) a partial function called composition. For f; g 2 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 2 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 2 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 2 Obj(C), C[A; B] is a (hom) set. • A category C is called Locally Small if for all A; B 2 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 mappings between sets. • Pfn a category of sets, whose objects are sets and whose morphisms are partial mappings between sets. • Rel a category of sets and relations, whose objects are sets and whose morphisms are binary relations on the sets. • Setf a category of sets, whose objects are finite sets and whose morphisms are mappings. • Set∗ the category of pointed sets, whose objects are pairs of the form (A; ∗A) where A is a set and ∗A 2 A and whose morphisms are mappings f : A ! B such that f(∗A) = ∗B, called base point preserving. • Set? a category of sets, whose objects are sets which don't contain ? and whose morphisms are mappings f : A [ f?g ! B [ f?g such that f(?) =?, called ?- preserving . 2.2.2 Algrbraic Structures • Graph the category of directed graphs, whose objects are directed graphs and whose morphisms are graph morphisms. • Mon the category of monoids, whose objects are monoids and whose morphisms are monoid morphisms. • Grp the category of groups, whose objects are groups and whose morphisms are group homomorphisms. • Ab the category of Abelian Groups, whose objects are Abelian Groups and whose morphisms are group homomorphisms. • Rng the category of rings, whose objects are rings and whose morphisms are ring homomorphisms. • CRng the category of commutative rings, whose objects are commutative rings and whose morphisms are ring homomorphisms. • VectF the category of vector spaces, whose objects are vector spaces over the field F and whose morphisms are linear transformations. • Pre the category of preorders, whose objects are preorders and whose morphisms are monotone (order preserving) mappings. • Pos the category of posets, whose objects are posets and whose morphisms are monotone mappings. • M-Set the category of M actions, whose objects are actions on a fixed monoid M and whose morphisms are M-action morphisms. 7 2.2.3 Topological Spaces • Top a category of topological spaces, whose objects are topological spaces and whose morphisms are continuous mappings. • Toph a category of topological spaces, whose objects are topological spaces and whose morphisms are homotopy classes of continuous mappings. • Top∗ a category of topological spaces, whose objects are topological spaces with base points and whose morphisms are base point preserving continuous mappings. Isomorphism A morphism f 2 C[A; B] is called an Isomorphism if there exists some g 2 C[A; B] such −1 that g ◦ f = idA and f ◦ g = idB. We call g the inverse for f sometimes denoted f , and also say that A and B are isomorphic, denoted A =∼ B. 2.2.4 Proposition If g1; g2 2 C[A; B] are inverses for f 2 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 are given by f : x ! y exists iff x y. 8 • Given a set S, the objects are elements of S and the morphisms are simply the identity morphisms.