Programming with Categories (DRAFT)

Total Page:16

File Type:pdf, Size:1020Kb

Programming with Categories (DRAFT) Programming with Categories (DRAFT) Brendan Fong Bartosz Milewski David I. Spivak (Last updated: October 6, 2020) Contents Preface vii Learning programming................................ ix Installing Haskell................................ x Haskell points.................................. xi Acknowledgments ..................................xiv 1 Categories, Types, and Functions1 1.1 Programming: the art of composition .................... 1 1.2 Two fundamental ideas: sets and functions................. 3 1.2.1 What is a set?.............................. 3 1.2.2 Functions ................................ 4 1.2.3 Some intuitions about functions ................... 6 1.3 Categories.................................... 9 1.3.1 Motivation: the category of sets.................... 9 1.3.2 The definition of a category...................... 12 1.3.3 Examples of categories......................... 14 1.3.4 Thinking in a category: the Yoneda perspective .......... 20 1.4 Categories and Haskell............................. 23 1.4.1 The lambda calculus.......................... 23 1.4.2 Types................................... 26 1.4.3 Haskell functions............................ 28 1.4.4 Composing functions.......................... 30 1.4.5 Thinking categorically about Haskell ................ 33 2 Universal constructions and the algebra of types 35 2.1 Constructing datatypes............................. 35 2.2 Universal constructions............................. 37 2.2.1 Terminal objects............................. 37 2.2.2 Initial objects .............................. 39 2.2.3 Products................................. 40 ii CONTENTS iii 2.2.4 Coproducts ............................... 43 2.3 Type constructors................................ 44 2.3.1 Type constructors............................ 45 2.3.2 Unit and void.............................. 46 2.3.3 Tuple types ............................... 48 2.3.4 Sum types................................ 53 2.4 Exponentials and function types ....................... 56 2.4.1 Interlude: Distributivity........................ 56 2.4.2 Exponential objects........................... 57 2.4.3 Function types, and currying in Haskell............... 60 3 Functors, natural transformations, and type polymorphism 65 3.1 Relationships, relationships, relationships.................. 65 3.2 Functors ..................................... 66 3.2.1 Definition ................................ 66 3.2.2 Examples of functors.......................... 67 3.2.3 Functors and shapes.......................... 71 3.2.4 The category of categories....................... 74 3.3 Type classes ................................... 74 3.3.1 Polymorphism in Haskell....................... 74 3.3.2 Defining type classes and instances ................. 75 3.4 Functors in Haskell............................... 79 3.4.1 The Functor type class......................... 79 3.4.2 First examples of functors in Haskell................. 81 3.4.3 Bifunctors................................ 83 3.4.4 A first glance at profunctors...................... 86 3.5 Natural transformations ............................ 88 3.5.1 Definition ................................ 88 3.5.2 Natural transformations in Haskell.................. 89 3.6 Bonus: Representable functors and the Yoneda embedding . 92 4 Algebras and recursive data structures 97 4.1 The string before the knot ........................... 98 4.2 What you can do with recursive data types . 100 4.3 Algebras .....................................103 4.4 Initial algebras..................................105 4.4.1 Lambek’s lemma............................107 4.5 Recursive data structures............................108 4.5.1 Returning to expression trees.....................110 4.5.2 The essence of recursion........................112 4.5.3 Algebras, catamorphsims, and folds . 113 4.6 Coalgebras, anamorphsims, and unfolds...................114 iv CONTENTS 4.6.1 The type of streams, as a terminal coalgebra . 116 4.6.2 The stream of prime numbers.....................117 4.7 Fixed points in Haskell.............................120 4.7.1 Implementing initial algebras by universal property . 121 4.7.2 Implementing terminal coalgebras by universal property . 123 5 Monads 125 5.1 A teaser......................................125 5.2 Different ways of working with monads...................127 5.2.1 Monads in terms of the “fish”.....................127 5.2.2 Monads in terms of join ........................127 5.2.3 Monads in terms of bind........................130 5.2.4 Monads in terms of the do notation . 131 5.2.5 Monads and effects...........................134 5.3 Examples of monads ..............................134 5.3.1 The exceptions monads ........................134 5.3.2 The list monad and nondeterminism . 135 5.3.3 The writer monads...........................136 5.3.4 The reader monads...........................137 5.3.5 The state monads............................139 5.3.6 The continuation monads.......................140 5.3.7 The IO monad..............................141 6 Monoidal Categories 143 6.1 Lax Monoidal Functors.............................143 6.1.1 Monad as Applicative . 143 6.2 Strength and enrichment............................146 7 Profunctors 149 7.1 Profunctors revisited..............................149 7.2 Ends and Coends................................153 7.3 Profunctors in Haskell .............................156 7.4 Category of profunctors ............................158 7.4.1 Category of profunctors in Haskell..................160 7.5 Day convolution.................................161 7.5.1 Day convolution in Haskell ......................163 7.6 Optics.......................................163 7.6.1 Motivation................................163 7.6.2 Tensorial optics.............................164 7.6.3 Lens ...................................164 7.6.4 Lens in Haskell.............................165 7.6.5 Prism...................................165 CONTENTS v 7.6.6 Prism in Haskell ............................166 7.7 Profunctor optics ................................166 7.7.1 Tambara modules............................166 7.7.2 Profunctor optics in Haskell......................167 Index 169 Preface This book is about how to think using category theory. What does this mean? Category theory is a favorite tool of ours for structuring our thoughts, whether they be about pure math, science, programming, engineering, or society. It’s a formal, rigorous toolkit designed to emphasise notions of relationship, composition, and connection. It’s a mathematical tool, and so is about abstraction, stripping away details and noticing patterns; one power it gains from this is that it is very concise. It’s great for compressing thoughts, and communicating them in short phrases that can be reliably decoded. The flip side of this is that it can feel very unfamiliar at first – a strange, new mode of thought – and also that it often needs to be complemented by more concrete tools to fully realise its practicality. One also needs to practice a certain art, or taste, in knowing when an abstraction is useful for structuring thought, and when it should be broken, or approximated. Programmers know this well, of course: a programming language never fully meets its specification; there are always implementation details that the best must be familiar with. In this book, we’ve chosen programming, in particular functional programming, as the vehicle through which we’ll learn how to think using category theory. This choice is not arbitrary: category theory is older than digital computing itself, and has heavily influenced the design of modern functional programming languages such as Haskell. As we’ll see, it’s also influenced best practice for how to structure code using these languages. Thinking is not just an abstract matter; the best thought has practical consequences. In order to teach you how to think using category theory, we believe that it’s important to give a mechanism for implementation and feedback on how category theory is affecting your thought. So in this book, we’ll complement the abstraction of category theory – lessons on precise definitions of important mathematical structures – with an introduction to programming in Haskell, and lessons on how category theoretic abstractions are approximated to perform practical programming tasks. That said, this book is not intended to be a book about Haskell, and there are many other programming languages that you could use as a world in which to try out these categorical ideas. In fact, we hope you do! Thinking categorically is about using a set vii viii PREFACE of design patterns that emphasise composition, universal constructions, and algebraic structure. Used judiciously, we believe this style of thought can improve the clarity and correctness of code in any language, including those currently popular, and those that will be developed in the years to come. Category theory is a vast toolbox, that is still under active construction. A vibrant community of mathematicians and computer scientists is working hard to find new perspectives, structures, and definitions that lead to compact, insightful ways to reason about the world. We won’t teach all of it. In fact, we’ll teach a very small core, some central ideas all over fifty years old. The first we’ll teach is the namesake: categories. Programming is about composi- tion: it’s about taking programs, some perhaps just single functions, and making them work in sync to construct a larger, usually more
Recommended publications
  • 1. Directed Graphs Or Quivers What Is Category Theory? • Graph Theory on Steroids • Comic Book Mathematics • Abstract Nonsense • the Secret Dictionary
    1. Directed graphs or quivers What is category theory? • Graph theory on steroids • Comic book mathematics • Abstract nonsense • The secret dictionary Sets and classes: For S = fX j X2 = Xg, have S 2 S , S2 = S Directed graph or quiver: C = (C0;C1;@0 : C1 ! C0;@1 : C1 ! C0) Class C0 of objects, vertices, points, . Class C1 of morphisms, (directed) edges, arrows, . For x; y 2 C0, write C(x; y) := ff 2 C1 j @0f = x; @1f = yg f 2C1 tail, domain / @0f / @1f o head, codomain op Opposite or dual graph of C = (C0;C1;@0;@1) is C = (C0;C1;@1;@0) Graph homomorphism F : D ! C has object part F0 : D0 ! C0 and morphism part F1 : D1 ! C1 with @i ◦ F1(f) = F0 ◦ @i(f) for i = 0; 1. Graph isomorphism has bijective object and morphism parts. Poset (X; ≤): set X with reflexive, antisymmetric, transitive order ≤ Hasse diagram of poset (X; ≤): x ! y if y covers x, i.e., x 6= y and [x; y] = fx; yg, so x ≤ z ≤ y ) z = x or z = y. Hasse diagram of (N; ≤) is 0 / 1 / 2 / 3 / ::: Hasse diagram of (f1; 2; 3; 6g; j ) is 3 / 6 O O 1 / 2 1 2 2. Categories Category: Quiver C = (C0;C1;@0 : C1 ! C0;@1 : C1 ! C0) with: • composition: 8 x; y; z 2 C0 ; C(x; y) × C(y; z) ! C(x; z); (f; g) 7! g ◦ f • satisfying associativity: 8 x; y; z; t 2 C0 ; 8 (f; g; h) 2 C(x; y) × C(y; z) × C(z; t) ; h ◦ (g ◦ f) = (h ◦ g) ◦ f y iS qq <SSSS g qq << SSS f qqq h◦g < SSSS qq << SSS qq g◦f < SSS xqq << SS z Vo VV < x VVVV << VVVV < VVVV << h VVVV < h◦(g◦f)=(h◦g)◦f VVVV < VVV+ t • identities: 8 x; y; z 2 C0 ; 9 1y 2 C(y; y) : 8 f 2 C(x; y) ; 1y ◦ f = f and 8 g 2 C(y; z) ; g ◦ 1y = g f y o x MM MM 1y g MM MMM f MMM M& zo g y Example: N0 = fxg ; N1 = N ; 1x = 0 ; 8 m; n 2 N ; n◦m = m+n ; | one object, lots of arrows [monoid of natural numbers under addition] 4 x / x Equation: 3 + 5 = 4 + 4 Commuting diagram: 3 4 x / x 5 ( 1 if m ≤ n; Example: N1 = N ; 8 m; n 2 N ; jN(m; n)j = 0 otherwise | lots of objects, lots of arrows [poset (N; ≤) as a category] These two examples are small categories: have a set of morphisms.
    [Show full text]
  • Compositional Game Theory, Compositionally
    Compositional Game Theory, Compositionally Robert Atkey Bruno Gavranovic´ Neil Ghani Clemens Kupke Jérémy Ledent Fredrik Nordvall Forsberg The MSP Group, University of Strathclyde Glasgow, Écosse Libre We present a new compositional approach to compositional game theory (CGT) based upon Arrows, a concept originally from functional programming, closely related to Tambara modules, and operators to build new Arrows from old. We model equilibria as a module over an Arrow and define an operator to build a new Arrow from such a module over an existing Arrow. We also model strategies as graded Arrows and define an operator which builds a new Arrow by taking the colimit of a graded Arrow. A final operator builds a graded Arrow from a graded bimodule. We use this compositional approach to CGT to show how known and previously unknown variants of open games can be proven to form symmetric monoidal categories. 1 Introduction A new strain of game theory — Compositional Game Theory (CGT) — was introduced recently [9]. At its core, CGT involves a completely new representation of games — open games — with operators for constructing larger and more complex games from smaller, simpler (and hence easier to reason about) ones. Despite recent substantial interest and further development [13, 10, 7, 6, 4, 11, 14], open games remain complex structures, e.g. the simplest form of an open game is an 8-tuple consisting of 4 ports, a set of strategies, play and coplay functions and an equilibrium predicate. More advanced versions [4] require sophisticated structures such as coends. This causes problems: (i) complex definitions lead to complex and even error prone proofs; (ii) proofs are programs and overly complex proofs turn into overly complex programs; (iii) even worse, this complexity deters experimentation and innovation, for instance the authors of [10] were deterred from trying alternative definitions as the work became prohibitive; and (iv) worse still, this complexity suggests we do not fully understand the mathematical structure of open games.
    [Show full text]
  • Notes and Solutions to Exercises for Mac Lane's Categories for The
    Stefan Dawydiak Version 0.3 July 2, 2020 Notes and Exercises from Categories for the Working Mathematician Contents 0 Preface 2 1 Categories, Functors, and Natural Transformations 2 1.1 Functors . .2 1.2 Natural Transformations . .4 1.3 Monics, Epis, and Zeros . .5 2 Constructions on Categories 6 2.1 Products of Categories . .6 2.2 Functor categories . .6 2.2.1 The Interchange Law . .8 2.3 The Category of All Categories . .8 2.4 Comma Categories . 11 2.5 Graphs and Free Categories . 12 2.6 Quotient Categories . 13 3 Universals and Limits 13 3.1 Universal Arrows . 13 3.2 The Yoneda Lemma . 14 3.2.1 Proof of the Yoneda Lemma . 14 3.3 Coproducts and Colimits . 16 3.4 Products and Limits . 18 3.4.1 The p-adic integers . 20 3.5 Categories with Finite Products . 21 3.6 Groups in Categories . 22 4 Adjoints 23 4.1 Adjunctions . 23 4.2 Examples of Adjoints . 24 4.3 Reflective Subcategories . 28 4.4 Equivalence of Categories . 30 4.5 Adjoints for Preorders . 32 4.5.1 Examples of Galois Connections . 32 4.6 Cartesian Closed Categories . 33 5 Limits 33 5.1 Creation of Limits . 33 5.2 Limits by Products and Equalizers . 34 5.3 Preservation of Limits . 35 5.4 Adjoints on Limits . 35 5.5 Freyd's adjoint functor theorem . 36 1 6 Chapter 6 38 7 Chapter 7 38 8 Abelian Categories 38 8.1 Additive Categories . 38 8.2 Abelian Categories . 38 8.3 Diagram Lemmas . 39 9 Special Limits 41 9.1 Interchange of Limits .
    [Show full text]
  • Arithmetical Foundations Recursion.Evaluation.Consistency Ωi 1
    ••• Arithmetical Foundations Recursion.Evaluation.Consistency Ωi 1 f¨ur AN GELA & FRAN CISCUS Michael Pfender version 3.1 December 2, 2018 2 Priv. - Doz. M. Pfender, Technische Universit¨atBerlin With the cooperation of Jan Sablatnig Preprint Institut f¨urMathematik TU Berlin submitted to W. DeGRUYTER Berlin book on demand [email protected] The following students have contributed seminar talks: Sandra An- drasek, Florian Blatt, Nick Bremer, Alistair Cloete, Joseph Helfer, Frank Herrmann, Julia Jonczyk, Sophia Lee, Dariusz Lesniowski, Mr. Matysiak, Gregor Myrach, Chi-Thanh Christopher Nguyen, Thomas Richter, Olivia R¨ohrig,Paul Vater, and J¨orgWleczyk. Keywords: primitive recursion, categorical free-variables Arith- metic, µ-recursion, complexity controlled iteration, map code evaluation, soundness, decidability of p. r. predicates, com- plexity controlled iterative self-consistency, Ackermann dou- ble recursion, inconsistency of quantified arithmetical theo- ries, history. Preface Johannes Zawacki, my high school teacher, told us about G¨odel'ssec- ond theorem, on non-provability of consistency of mathematics within mathematics. Bonmot of Andr´eWeil: Dieu existe parceque la Math´e- matique est consistente, et le diable existe parceque nous ne pouvons pas prouver cela { God exists since Mathematics is consistent, and the devil exists since we cannot prove that. The problem with 19th/20th century mathematical foundations, clearly stated in Skolem 1919, is unbound infinitistic (non-constructive) formal existential quantification. In his 1973
    [Show full text]
  • An Introduction to Category Theory and Categorical Logic
    An Introduction to Category Theory and Categorical Logic Wolfgang Jeltsch Category theory An Introduction to Category Theory basics Products, coproducts, and and Categorical Logic exponentials Categorical logic Functors and Wolfgang Jeltsch natural transformations Monoidal TTU¨ K¨uberneetika Instituut categories and monoidal functors Monads and Teooriaseminar comonads April 19 and 26, 2012 References An Introduction to Category Theory and Categorical Logic Category theory basics Wolfgang Jeltsch Category theory Products, coproducts, and exponentials basics Products, coproducts, and Categorical logic exponentials Categorical logic Functors and Functors and natural transformations natural transformations Monoidal categories and Monoidal categories and monoidal functors monoidal functors Monads and comonads Monads and comonads References References An Introduction to Category Theory and Categorical Logic Category theory basics Wolfgang Jeltsch Category theory Products, coproducts, and exponentials basics Products, coproducts, and Categorical logic exponentials Categorical logic Functors and Functors and natural transformations natural transformations Monoidal categories and Monoidal categories and monoidal functors monoidal functors Monads and Monads and comonads comonads References References An Introduction to From set theory to universal algebra Category Theory and Categorical Logic Wolfgang Jeltsch I classical set theory (for example, Zermelo{Fraenkel): I sets Category theory basics I functions from sets to sets Products, I composition
    [Show full text]
  • NICOLAS WU Department of Computer Science, University of Bristol (E-Mail: [email protected], [email protected])
    Hinze, R., & Wu, N. (2016). Unifying Structured Recursion Schemes. Journal of Functional Programming, 26, [e1]. https://doi.org/10.1017/S0956796815000258 Peer reviewed version Link to published version (if available): 10.1017/S0956796815000258 Link to publication record in Explore Bristol Research PDF-document University of Bristol - Explore Bristol Research General rights This document is made available in accordance with publisher policies. Please cite only the published version using the reference above. Full terms of use are available: http://www.bristol.ac.uk/red/research-policy/pure/user-guides/ebr-terms/ ZU064-05-FPR URS 15 September 2015 9:20 Under consideration for publication in J. Functional Programming 1 Unifying Structured Recursion Schemes An Extended Study RALF HINZE Department of Computer Science, University of Oxford NICOLAS WU Department of Computer Science, University of Bristol (e-mail: [email protected], [email protected]) Abstract Folds and unfolds have been understood as fundamental building blocks for total programming, and have been extended to form an entire zoo of specialised structured recursion schemes. A great number of these schemes were unified by the introduction of adjoint folds, but more exotic beasts such as recursion schemes from comonads proved to be elusive. In this paper, we show how the two canonical derivations of adjunctions from (co)monads yield recursion schemes of significant computational importance: monadic catamorphisms come from the Kleisli construction, and more astonishingly, the elusive recursion schemes from comonads come from the Eilenberg-Moore construction. Thus we demonstrate that adjoint folds are more unifying than previously believed. 1 Introduction Functional programmers have long realised that the full expressive power of recursion is untamable, and so intensive research has been carried out into the identification of an entire zoo of structured recursion schemes that are well-behaved and more amenable to program comprehension and analysis (Meijer et al., 1991).
    [Show full text]
  • Monads and Interpolads in Bicategories
    Theory and Applications of Categories, Vol. 3, No. 8, 1997, pp. 182{212. MONADS AND INTERPOLADS IN BICATEGORIES JURGEN¨ KOSLOWSKI Transmitted by R. J. Wood ABSTRACT. Given a bicategory, Y , with stable local coequalizers, we construct a bicategory of monads Y -mnd by using lax functors from the generic 0-cell, 1-cell and 2-cell, respectively, into Y . Any lax functor into Y factors through Y -mnd and the 1-cells turn out to be the familiar bimodules. The locally ordered bicategory rel and its bicategory of monads both fail to be Cauchy-complete, but have a well-known Cauchy- completion in common. This prompts us to formulate a concept of Cauchy-completeness for bicategories that are not locally ordered and suggests a weakening of the notion of monad. For this purpose, we develop a calculus of general modules between unstruc- tured endo-1-cells. These behave well with respect to composition, but in general fail to have identities. To overcome this problem, we do not need to impose the full struc- ture of a monad on endo-1-cells. We show that associative coequalizing multiplications suffice and call the resulting structures interpolads. Together with structure-preserving i-modules these form a bicategory Y -int that is indeed Cauchy-complete, in our sense, and contains the bicategory of monads as a not necessarily full sub-bicategory. Inter- polads over rel are idempotent relations, over the suspension of set they correspond to interpolative semi-groups, and over spn they lead to a notion of \category without identities" also known as \taxonomy".
    [Show full text]
  • Kleisli Database Instances
    KLEISLI DATABASE INSTANCES DAVID I. SPIVAK Abstract. We use monads to relax the atomicity requirement for data in a database. Depending on the choice of monad, the database fields may contain generalized values such as lists or sets of values, or they may contain excep- tions such as various typesi of nulls. The return operation for monads ensures that any ordinary database instance will count as one of these generalized in- stances, and the bind operation ensures that generalized values behave well under joins of foreign key sequences. Different monads allow for vastly differ- ent types of information to be stored in the database. For example, we show that classical concepts like Markov chains, graphs, and finite state automata are each perfectly captured by a different monad on the same schema. Contents 1. Introduction1 2. Background3 3. Kleisli instances9 4. Examples 12 5. Transformations 20 6. Future work 22 References 22 1. Introduction Monads are category-theoretic constructs with wide-ranging applications in both mathematics and computer science. In [Mog], Moggi showed how to exploit their expressive capacity to incorporate fundamental programming concepts into purely functional languages, thus considerably extending the potency of the functional paradigm. Using monads, concepts that had been elusive to functional program- ming, such as state, input/output, and concurrency, were suddenly made available in that context. In the present paper we describe a parallel use of monads in databases. This approach stems from a similarity between categories and database schemas, as presented in [Sp1]. The rough idea is as follows. A database schema can be modeled as a category C, and an ordinary database instance is a functor δ : C Ñ Set.
    [Show full text]
  • The Petit Topos of Globular Sets
    Journal of Pure and Applied Algebra 154 (2000) 299–315 www.elsevier.com/locate/jpaa View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by Elsevier - Publisher Connector The petit topos of globular sets Ross Street ∗ Macquarie University, N. S. W. 2109, Australia Communicated by M. Tierney Dedicated to Bill Lawvere Abstract There are now several deÿnitions of weak !-category [1,2,5,19]. What is pleasing is that they are not achieved by ad hoc combinatorics. In particular, the theory of higher operads which underlies Michael Batanin’s deÿnition is based on globular sets. The purpose of this paper is to show that many of the concepts of [2] (also see [17]) arise in the natural development of category theory internal to the petit 1 topos Glob of globular sets. For example, higher spans turn out to be internal sets, and, in a sense, trees turn out to be internal natural numbers. c 2000 Elsevier Science B.V. All rights reserved. MSC: 18D05 1. Globular objects and !-categories A globular set is an inÿnite-dimensional graph. To formalize this, let G denote the category whose objects are natural numbers and whose only non-identity arrows are m;m : m → n for all m¡n ∗ Tel.: +61-2-9850-8921; fax: 61-2-9850-8114. E-mail address: [email protected] (R. Street). 1 The distinction between toposes that are “space like” (or petit) and those which are “category-of-space like” (or gros) was investigated by Lawvere [9,10]. The gros topos of re exive globular sets has been studied extensively by Michael Roy [12].
    [Show full text]
  • Geometric Modality and Weak Exponentials
    Geometric Modality and Weak Exponentials Amirhossein Akbar Tabatabai ∗ Institute of Mathematics Academy of Sciences of the Czech Republic [email protected] Abstract The intuitionistic implication and hence the notion of function space in constructive disciplines is both non-geometric and impred- icative. In this paper we try to solve both of these problems by first introducing weak exponential objects as a formalization for predica- tive function spaces and then by proposing modal spaces as a way to introduce a natural family of geometric predicative implications based on the interplay between the concepts of time and space. This combination then leads to a brand new family of modal propositional logics with predicative implications and then to topological semantics for these logics and some weak modal and sub-intuitionistic logics, as well. Finally, we will lift these notions and the corresponding relations to a higher and more structured level of modal topoi and modal type theory. 1 Introduction Intuitionistic logic appears in different many branches of mathematics with arXiv:1711.01736v1 [math.LO] 6 Nov 2017 many different and interesting incarnations. In geometrical world it plays the role of the language of a topological space via topological semantics and in a higher and more structured level, it becomes the internal logic of any elementary topoi. On the other hand and in the theory of computations, the intuitionistic logic shows its computational aspects as a method to describe the behavior of computations using realizability interpretations and in cate- gory theory it becomes the syntax of the very central class of Cartesian closed categories.
    [Show full text]
  • On the Constructive Elementary Theory of the Category of Sets
    On the Constructive Elementary Theory of the Category of Sets Aruchchunan Surendran Ludwig-Maximilians-University Supervision: Dr. I. Petrakis August 14, 2019 1 Contents 1 Introduction 2 2 Elements of basic Category Theory 3 2.1 The category Set ................................3 2.2 Basic definitions . .4 2.3 Basic properties of Set .............................6 2.3.1 Epis and monos . .6 2.3.2 Elements as arrows . .8 2.3.3 Binary relations as monic arrows . .9 2.3.4 Coequalizers as quotient sets . 10 2.4 Membership of elements . 12 2.5 Partial and total arrows . 14 2.6 Cartesian closed categories (CCC) . 16 2.6.1 Products of objects . 16 2.6.2 Application: λ-Calculus . 18 2.6.3 Exponentials . 21 3 Constructive Elementary Theory of the Category of Sets (CETCS) 26 3.1 Constructivism . 26 3.2 Axioms of ETCS . 27 3.3 Axioms of CETCS . 28 3.4 Π-Axiom . 29 3.5 Set-theoretic consequences . 32 3.5.1 Quotient Sets . 32 3.5.2 Induction . 34 3.5.3 Constructing new relations with logical operations . 35 3.6 Correspondence to standard categorical formulations . 42 1 1 Introduction The Elementary Theory of the Category of Sets (ETCS) was first introduced by William Lawvere in [4] in 1964 to give an axiomatization of sets. The goal of this thesis is to describe the Constructive Elementary Theory of the Category of Sets (CETCS), following its presentation by Erik Palmgren in [2]. In chapter 2. we discuss basic elements of Category Theory. Category Theory was first formulated in the year 1945 by Eilenberg and Mac Lane in their paper \General theory of natural equivalences" and is the study of generalized functions, called arrows, in an abstract algebra.
    [Show full text]
  • Free Globularily Generated Double Categories
    Free Globularily Generated Double Categories I Juan Orendain Abstract: This is the first part of a two paper series studying free globular- ily generated double categories. In this first installment we introduce the free globularily generated double category construction. The free globularily generated double category construction canonically associates to every bi- category together with a possible category of vertical morphisms, a double category fixing this set of initial data in a free and minimal way. We use the free globularily generated double category to study length, free prod- ucts, and problems of internalization. We use the free globularily generated double category construction to provide formal functorial extensions of the Haagerup standard form construction and the Connes fusion operation to inclusions of factors of not-necessarily finite Jones index. Contents 1 Introduction 1 2 The free globularily generated double category 11 3 Free globularily generated internalizations 29 4 Length 34 5 Group decorations 38 6 von Neumann algebras 42 1 Introduction arXiv:1610.05145v3 [math.CT] 21 Nov 2019 Double categories were introduced by Ehresmann in [5]. Bicategories were later introduced by Bénabou in [13]. Both double categories and bicategories express the notion of a higher categorical structure of second order, each with its advantages and disadvantages. Double categories and bicategories relate in different ways. Every double category admits an underlying bicategory, its horizontal bicategory. The horizontal bicategory HC of a double category C ’flattens’ C by discarding vertical morphisms and only considering globular squares. 1 There are several structures transferring vertical information on a double category to its horizontal bicategory, e.g.
    [Show full text]