Categorical Logic from a Categorical Point of View
Total Page:16
File Type:pdf, Size:1020Kb
Categorical logic from a categorical point of view Michael Shulman DRAFT for AARMS Summer School 2016 Version of July 28, 2016 2 ii Contents Prefacei 0 Introduction3 0.1 Appetizer: inverses in group objects................3 0.2 On syntax and free objects.....................8 0.3 On type theory and category theory................ 12 0.4 Expectations of the reader...................... 16 1 Unary type theories 19 1.1 Posets................................. 19 1.2 Categories............................... 23 1.2.1 Primitive cuts......................... 24 1.2.2 Cut admissibility....................... 29 1.3 Meet-semilattices........................... 39 1.3.1 Sequent calculus for meet-semilattices........... 40 1.3.2 Natural deduction for meet-semilattices.......... 44 1.4 Categories with products...................... 47 1.5 Categories with coproducts..................... 56 1.6 Universal properties and modularity................ 61 1.7 Presentations and theories...................... 63 1.7.1 Group presentations..................... 64 1.7.2 Category presentations.................... 66 1.7.3 ×-presentations........................ 68 1.7.4 Theories............................ 75 2 Simple type theories 85 2.1 Towards multicategories....................... 85 2.2 Introduction to multicategories................... 89 2.3 Multiposets and monoidal posets.................. 93 2.3.1 Multiposets.......................... 93 2.3.2 Sequent calculus for monoidal posets............ 95 2.3.3 Natural deduction for monoidal posets........... 99 2.4 Multicategories and monoidal categories.............. 100 2.4.1 Multicategories........................ 101 1 2 CONTENTS 2.4.2 Monoidal categories..................... 106 2.5 Adding products and coproducts.................. 110 2.6 Some generalized multicategories.................. 114 2.7 Intuitionistic logic.......................... 120 2.7.1 S-monoidal lattices..................... 120 2.7.2 Heyting algebras....................... 124 2.7.3 Natural deduction and logic................. 127 2.8 Simply typed λ-calculus....................... 135 2.9 Finite-product theories........................ 142 2.10 Symmetric monoidal categories................... 145 3 Classical type theories 153 3.1 Classical logic............................. 153 3.2 Polycategories and linear logic.................... 153 3.3 Props and symmetric monoidal categories............. 153 4 First-order logic 155 4.1 Predicate logic............................ 155 4.1.1 Structural rules and simple rules.............. 156 4.1.2 The universal quantifier................... 159 4.1.3 The existential quantifier.................. 161 4.1.4 Equality............................ 162 4.1.5 First-order theories...................... 164 4.2 First-order hyperdoctrines...................... 170 4.3 Hyperdoctrines of subobjects.................... 181 4.3.1 Horn hyperdoctrines from finite limits........... 181 4.3.2 Regular categories...................... 182 4.3.3 Coherent categories..................... 188 4.3.4 Heyting categories...................... 189 4.4 Finite-limit theories......................... 192 4.5 Indexed monoidal categories..................... 192 5 Higher-order logic 201 6 Dependent type theory 203 A Deductive systems 205 A.1 Trees and free algebras........................ 205 A.2 Indexed trees............................. 207 A.3 Free algebras with axioms...................... 208 A.4 Rules and deductive systems.................... 211 A.5 Terms................................. 212 A.6 Variable binding and α-equivalence................. 216 Chapter 0 Introduction In this optional chapter I will attempt to motivate and describe the discipline of categorical logic for the newcomer, and also locate this book within the ecosystem thereof for the expert. Nothing herein is required for reading the rest of the book; but I hope that it may serve some purpose nevertheless. 0.1 Appetizer: inverses in group objects In this section we consider an extended example. We do not expect the reader to understand it very deeply, but we hope it will give some motivation for what follows, as well as a taste of the power and flexibility of categorical logic as a tool for category theory. Our example will consist of several varations on the following theorem: Theorem 0.1.1. If a monoid has inverses (hence is a group), then those inverses are unique. When \monoid" and \group" have their usual meaning, namely sets equipped with structure, the proof is easy. For any x, if y and z are both two-sided inverse of x, then we have y = y · e = y · (x · z) = (y · x) · z = e · z = z (0.1.2) However, the theorem is true much more generally than this. We consider first the case of monoid/group objects in a category with products. A monoid object is an object A together with maps m : A × A ! A and e : 1 ! A satisfying associativity and unitality axioms: 1×m (1;e) (e;1) A × A × A / A × A A / A × A o A m×1 m m (0.1.3) 1 1 / " | A × A m A A 3 4 CHAPTER 0. INTRODUCTION π A × A 1 / A E 1 1×∆ & (1;e) & A × A × A A × A (i;1) 8 1×1×j m 1×m (i;1;j) ' " A / A × A × A A 7 < L m×1 m i×1×1 & (1;j) A × A × A A × A 8 8 (e;1) ∆×1 A × A / A 1 π2 Figure 1: Uniqueness of inverses by diagram chasing An inverse operator for a monoid object is a map i : A ! A such that the following diagrams commute: i×1 A × A / A × A @ ∆ m ! / e / A 1 @ A (0.1.4) m ∆ A × A / A × A 1×i The internalized claim, then, is that any two inverse operators for a monoid object are equal. A standard category-theoretic proof would be to suppose i and j are both inverse operators and draw a large commutative diagram such as that shown in Figure1. Here the composite around the top is equal to i, the composite around the bottom is equal to j, and all the internal polygons commute either by one of the monoid axioms, the inverse axiom for i or j, or the universal property of products. (We encourage the reader to verify this.) While there is a certain beauty to Figure1, it takes considerable effort to write it down and arrange it in such a pleasing form (as opposed to a horrid mess on scratch paper), let alone typeset it prettily. And this is really a fairly simple fact about monoids; for more complicated theorems, the complexity of the resulting diagrams grows accordingly (see Exercises 0.1.4 and 0.1.5). Nevertheless, there is a sense in which Figure1 is obtained algorithmically from the simple proof (0.1.2). Specifically, each expression in (0.1.2) corresponds to one or more paths through Figure1, and each equality in (0.1.2) corresponds 0.1. APPETIZER: INVERSES IN GROUP OBJECTS 5 to a commuting polygon in Figure1. 1 With experience, one can learn to do such translations without much effort, at least in simple cases. However, if it really is an algorithm, we shouldn't have to re-do it on a case-by-case basis at all; we should be able to prove a single general \meta-theorem" and then appeal to it whenever we want to. This is the goal of categorical logic. Specifically, the type theory for categories with products allows us to replace Figure1 by an argument that looks almost the same as (0.1.2). The morphisms m and e are represented in this logic by the notations x : A; y : A ` x · y : A ` e : A: Don't worry if this notation doesn't make a whole lot of sense yet. The symbol ` (called a \turnstile") is the logic version of a morphism arrow !, and the entire notation is called a sequent or a judgment. The fact that m is a morphism A×A ! A is indicated by the fact that A appears twice to the left of ` and once to the right; the comma \;" in between x : A and y : A represents the product ×, and the variables x; y are there so that we have a good notation \x · y" for the morphism m. In particular, the notation x : A; y : A ` x · y : A should be bracketed as ((x : A); (y : A)) ` ((x · y): A): Similarly, the associativity, unit, and inverse axioms are indicated by the notations x : A; y : A; z : A ` (x · y) · z = x · (y · z): A x : A ` x · e = x : A x : A ` e · x = x : A x : A ` x · i(x) = e : A x : A ` i(x) · x = e : A Now (0.1.2) can be essentially copied in this notation: x : A ` i(x) = i(x) · e = i(x) · (x · j(x)) = (i(x) · x) · j(x) = e · j(x) = j(x): A: The essential point is that the notation looks set-theoretic, with \variables" representing \elements", and yet (as we will see) its formal structure is such that it can be interpreted into any category with products. Therefore, writing the proof in this way yields automatically a proof of the general theorem that any two inverse operators for a monoid object in a category with products are equal. Before leaving this appetizer section, we mention some further generalizations of this result. While type theory allows us to use set-like notation to prove facts about any category with finite products, the allowable notation is fairly limited, essentially restricting us to algebraic calculations with variables. However, if our category has more structure, then we can \internalize" more set-theoretic arguments. 1Not every polygon in Figure1 corresponds to anything in (0.1.2), though: the \universal property" quadrilaterals on the left are \invisible" algebraically. This is why we said each expression corresponds to \one or more" paths: y · (x · z) and (y · x) · z don't care which route we take from A to A × A × A. 6 CHAPTER 0. INTRODUCTION As an example, note that for ordinary monoids in sets, the uniqueness of inverses (0.1.2) is expressed \pointwise" rather than in terms of inverse-assigning operators. In other words, for each element x 2 A, if x has two two-sided inverses y and z, then y = z, regardless of whether any other elements of A have inverses.