Category Theory A Gentle Introduction Peter Smith University of Cambridge Version of February 8, 2016 (cid:13)cPeter Smith, 2016 This PDF is an early incomplete version of work still very much in progress. For the latest and most complete version of this Gentle IntroductionandforrelatedmaterialsseetheCategoryTheorypage at the Logic Matters website. Corrections, please, to ps218 at cam dot ac dot uk. Contents Preface ix 0 A very short introduction 1 0.1 Why categories? 1 0.2 What do you need to bring to the party? 2 0.3 Theorems as exercises 3 0.4 Notation and terminology 3 1 Categories defined 4 1.1 The very idea of a category 4 1.2 The category of sets 6 1.3 More examples 8 1.4 Diagrams 13 2 Categories beget categories 15 2.1 Duality 15 2.2 Subcategories, product and quotient categories 16 2.3 Arrow categories and slice categories 18 3 Kinds of arrows 22 3.1 Monomorphisms, epimorphisms 22 3.2 Inverses 24 3.3 Isomorphisms 27 3.4 Isomorphic objects 29 4 Initial and terminal objects 31 4.1 Initial and terminal objects, definitions and examples 32 4.2 Uniqueness up to unique isomorphism 33 4.3 Elements and generalized elements 34 5 Products introduced 36 5.1 Real pairs, virtual pairs 36 5.2 Pairing schemes 37 5.3 Binary products, categorially 41 iii Contents 5.4 Products as terminal objects 44 5.5 Uniqueness up to unique isomorphism 45 5.6 ‘Universal mapping properties’ 47 5.7 Coproducts 47 6 Products explored 51 6.1 More properties of binary products 51 6.2 And two more results 52 6.3 More on mediating arrows 54 6.4 Maps between two products 56 6.5 Finite products more generally 58 6.6 Infinite products 60 7 Equalizers 61 7.1 Equalizers 61 7.2 Uniqueness again 64 7.3 Co-equalizers 65 8 Limits and colimits defined 68 8.1 Cones over diagrams 68 8.2 Defining limit cones 70 8.3 Limit cones as terminal objects 72 8.4 Results about limits 73 8.5 Colimits defined 75 8.6 Pullbacks 75 8.7 Pushouts 79 9 The existence of limits 81 9.1 Pullbacks, products and equalizers related 81 9.2 Categories with all finite limits 85 9.3 Infinite limits 87 9.4 Dualizing again 88 10 Subobjects 89 10.1 Subsets revisited 89 10.2 Subobjects as monic arrows 90 10.3 Subobjects as isomorphism classes 91 10.4 Subobjects, equalizers, and pullbacks 92 10.5 Elements and subobjects 94 11 Exponentials 95 11.1 Two-place functions 95 11.2 Exponentials defined 96 11.3 Examples of exponentials 98 11.4 Exponentials are unique 101 iv Contents 11.5 Further results about exponentials 102 11.6 Cartesian closed categories 104 12 Group objects, natural number objects 108 12.1 Groups in Set 108 12.2 Groups in other categories 110 12.3 A very little more on groups 112 12.4 Natural numbers 113 12.5 The Peano postulates revisited 114 12.6 More on recursion 116 13 Functors introduced 120 13.1 Functors defined 120 13.2 Some elementary examples of functors 121 13.3 What do functors preserve and reflect? 123 13.4 Faithful, full, and essentially surjective functors 125 13.5 A functor from Set to Mon 127 13.6 Products, exponentials, and functors 128 13.7 An example from algebraic topology 130 13.8 Covariant vs contravariant functors 132 14 Categories of categories 134 14.1 Functors compose 134 14.2 Categories of categories 135 14.3 A universal category? 136 14.4 ‘Small’ and ‘locally small’ categories 137 14.5 Isomorphisms between categories 139 14.6 An aside: other definitions of categories 141 15 Functors and limits 144 15.1 Diagrams redefined as functors 144 15.2 Preserving limits 145 15.3 Reflecting limits 149 15.4 Creating limits 151 16 Hom-functors 152 16.1 Hom-sets 152 16.2 Hom-functors 154 16.3 Hom-functors preserve limits 155 17 Functors and comma categories 159 17.1 Functors and slice categories 159 17.2 Comma categories 160 17.3 Two (already familiar) types of comma category 161 17.4 Another (new) type of comma category 162 v Contents 17.5 An application: free monoids again 163 17.6 A theorem on comma categories and limits 165 18 Natural isomorphisms 167 18.1 Natural isomorphisms between functors defined 167 18.2 Why ‘natural’? 168 18.3 More examples of natural isomorphormisms 171 18.4 Natural/unnatural isomorphisms between objects 176 18.5 An ‘Eilenberg/Mac Lane Thesis’? 177 19 Natural transformations and functor categories 179 19.1 Natural transformations 179 19.2 Composition of natural transformations 182 19.3 Functor categories 185 19.4 Functor categories and natural isomorphisms 186 19.5 Hom-functors from functor categories 187 19.6 Evaluation and diagonal functors 188 19.7 Limit functors 189 20 Equivalent categories 192 20.1 The categories Pfn and Set are ‘equivalent’ 192 (cid:63) 20.2 Pfn and Set are not isomorphic 194 (cid:63) 20.3 Equivalent categories 195 20.4 Skeletons and evil 198 21 The Yoneda embedding 201 21.1 Natural transformations between hom-functors 201 21.2 The Restricted Yoneda Lemma 204 21.3 The Yoneda embedding 205 21.4 Yoneda meets Cayley 207 22 The Yoneda Lemma 211 22.1 Towards the full Yoneda Lemma 211 22.2 The generalizing move 212 22.3 Making it all natural 213 22.4 Putting everything together 215 22.5 A brief afterword on ‘presheaves’ 216 23 Representables and universal elements 217 23.1 Isomorphic functors preserve the same limits 217 23.2 Representable functors 218 23.3 A first example 219 23.4 More examples of representables 221 23.5 Universal elements 222 23.6 Categories of elements 224 vi Contents 23.7 Limits and exponentials as universal elements 226 24 Galois connections 227 24.1 (Probably unnecessary) reminders about posets 227 24.2 An introductory example 228 24.3 Galois connections defined 230 24.4 Galois connections re-defined 232 24.5 Some basic results about Galois connections 234 24.6 Fixed points, isomorphisms, and closures 235 24.7 One way a Galois connection can arise 237 24.8 Syntax and semantics briefly revisited 237 25 Adjoints introduced 239 25.1 Adjoint functors: a first definition 239 25.2 Examples 241 25.3 Naturality 245 25.4 An alternative definition 246 25.5 Adjoints and equivalent categories 251 26 Adjoints further explored 254 26.1 Adjunctions reviewed 254 26.2 Two more definitions! 255 26.3 Adjunctions compose 255 26.4 The uniqueness of adjoints 257 26.5 How left adjoints can be defined in terms of right adjoints 258 26.6 Another way of getting new adjunctions from old 262 27 Adjoint functors and limits 264 27.1 Limit functors as adjoints 264 27.2 Right adjoints preserve limits 266 27.3 Some examples 268 27.4 The Adjoint Functor Theorems 269 Bibliography 272 vii Preface This Gentle Introduction is work in progress, developing my earlier ‘Notes on Basic Category Theory’ (2014–15). The gadgets of basic category theory fit together rather beautifully in mul- tiple ways. Their intricate interconnections mean, however, that there isn’t a single best route into the theory. Different lecture courses, different books, can quite appropriately take topics in very different orders, all illuminating in their different ways. In the earlier Notes, I roughly followed the order of somewhat over half of the Cambridge Part III course in category theory, as given in 2014 by Rory Lucyshyn-Wright (broadly following a pattern set by Peter Johnstone; see also Julia Goedecke’s notes from 2013). We now proceed rather differently. TheCambridge orderingcertainlyhasits rationale; butthealternativeordering I now follow has in some respects a greater logical appeal. Which is one reason for the rewrite. Our topics, again in different arrangements, are also covered in (for example) Awodey’s good but uneven Category Theory and in Tom Leinster’s terrific – and appropriately titled – Basic Category Theory. But then, if there are some rightlyadmiredtextsoutthere,nottomentionvarioussetsofnotesoncategory theoryavailableonline(seehere),whyproduceanotherintroductiontocategory theory? Ididn’tintendto!Mygoalallalonghasbeentogettounderstandwhatlight categorytheorythrowsonlogic,settheory,andthefoundationsofmathematics. But I realized that I needed to get a lot more securely on top of basic category theoryifIwaseventuallytopursuethesemorephilosophicalissues.Somyearlier Notes began life as detailed jottings for myself, to help really fix ideas: and then –ascanhappen–thewritinghassimplytakenonitsownmomentum.Iamstill concentratingmostlyongettingthetechnicalitiesrightandpresentingthemina pleasing order: I hope later versions will contain more motivational/conceptual material. What remains distinctive about this Gentle Introduction, for good or ill, is that it is written by someone who doesn’t pretend to be an expert who usually operatesattheveryfrontiersofresearchincategorytheory.Idohope,however, that this makes me rather more attuned to the likely needs of (at least some) beginners. I go rather slowly over ideas that once gave me pause, spend more ix Preface time than is always usual in motivating key ideas and constructions, and I have generally aimed to be as clear as possible (also, I assume rather less background mathematicsthanLeinsterorevenAwodey).Wedon’tgetterriblyfar:however, I hope that what is here may prove useful to others starting to get to grips withcategorytheory.Myownexperiencecertainlysuggeststhatinitiallytaking thingsatarathergentlepaceasyouworkintoafamiliaritywithcategorialways of thinking makes later adventures exploring beyond the basics so very much more manageable. x